LEX 'HPILLEX' file name * * the above pseudo-op LEX, constructs the HP71 file head ******************************** * now let's put our name on each page (arrogant of us) TITLE HPILLEX, parallel polls John R Baker * *********************************************************** * this constructs all fields using SASM pseudo-ops * as opposed to the FORTH/Assembler pseudo-ops * CON(2) #5E LEX ID number * CON(2) 76 lowest Token number contained * CON(2) 76 highest Token number contained * CON(5) 0 multiple LEX file link * NIBHEX F no speed table * REL(4) 1+(TxTbSt) start of the TEXT table * CON(4) 0 no Message table in this file * CON(5) 0 no Poll handler in this file * *********************************************************** * This Keyword allows the HP71 to implement parallel polls * * It is a BASIC numeric function, taking no parameters * which sends the IDY 0 HPIL Remote Message (frame) * and returns the received frames' data bits to BASIC as * the value 0-255 (decimal) * * for further information see HPIL IDS * Volume 1, Chapter 5 for mailbox opcodes * Volume 1, Chapter 7 for JUMPER use and routines info * Volume 2, for source code of same * *********************************************************** * * **** MAIN TABLE **** * CON(3) (TxEn01)-(TxTbSt) offset to TEXT entry REL(5) PPOLL offset to execution code NIBHEX F char= F, a Function * *********************************************************** * * **** TEXT TABLE **** * TxTbSt TxEn01 CON(1) 9 length in (nibs-1) of following ASCII NIBASC 'PPOLL' ASCII of Keyword which invokes CON(2) 76 Token number 76 (dec) associates ******************** NIBHEX 1FF marks the end of the TEXT table * *********************************************************** * EQUate Table * GETMBX EQU #03B62 set pointer D0 to current mailbox address PUTE EQU #06AC0 put message in C 5:0 to mailbox GET EQU #06751 get message, data in C(B), control in XS HDFLT EQU #1B31B convert hex in A(A) to 12 form in A(W) FNRTN1 EQU #0F216 push 12 form in C(W) to stack and return * *********************************************************** * NIBHEX 00 no parameters going in * start of execution code PPOLL AD0EX get D0 (BASIC interpreter pointer) R0=A save in scratch R0 * GOSUB JUMPER jump to HPIL ROM routine CON(5) GETMBX load D0 with address of HPIL mailbox * C=0 W preclear for opcode write P= 4 send IDY 0 frame, set to save returned LCHEX #1E ... frame for 71 CPU GOSUB JUMPER jump to HPIL ROM CON(5) PUTE put message to mailbox,write handshake GOC Serror goto send error if trouble * GOSUB JUMPER jump to HPIL ROM routine CON(5) GET get received frame, put in C(X) GOC Rerror error if receive trouble * A=0 A else, preclear A(A) for conversion A=C B copy value of data bits, poll data GOSBVL HDFLT convert to decimal 12 form SETHEX restore HEX mode after HDFLT use C=A W put resultant 12 form (0-255) in C(W) A=R0 get back saved D0 value, BASIC pc D0=A restore D0 so Function returns ok GOVLNG FNRTN1 return to BASIC interpreter * ************************ * error exits * Serror P= 0 send error LC(4) #FF24 msg 36, Message Error GOVLNG BSERR take BASIC error route to mainloop * Rerror P= 0 receive error LC(4) #FF27 msg 39, Unexpected Message GOVLNG BSERR again, error to basic ************************ * * JUMPER: a routine for accessing the HPIL ROM * SNAPBF EQU #2F7F0 the snapshot buffer bLEX EQU #00BFC the LEX buffer ID # I/OFND EQU #118BA finds an I/O buffer given the ID # LEXPIL EQU #000FF the HPIL ROM ID # eXWORD EQU #00023 mainframe error # for XWORD BSERR EQU #0939A the BASIC error reporting routine * * this routine is transparent to the CPU except for SB * * (assembly code) * (setup CPU for call) * GOSUB JUMPER * CON(5) (target routine offset) * (resume assembly code) * *********************************************************** * JUMPER RSTK=C CD1EX D1=(5) SNAPBF DAT1=C A write D1 @ SNAPBF D1=(2) (SNAPBF)+5 C=RSTK DAT1=C W write C(W) @ SNAPBF + 5 D1=(4) (SNAPBF)+21 DAT1=A W write A(W) @ SNAPBF + 21 D1=(2) (SNAPBF)+37 C=B A CPEX 5 save P @ SNAPBF + 42 P= 6 C=0 P GONC JUMP05 C:6='0' means carry clear C=C-1 P C:6#'0' means carry set JUMP05 P= 7 C=0 P C=C-1 P C:7='9' means decimal mode DAT1=C 8 write B(A),P,Carry,mode @ SNAPBF + 37 SETHEX set hex mode for I/OFND ************ * now A(W), B(A), C(W), and D1 are available for use * P= 0 LC(3) bLEX find the LEX buffer GOSBVL I/OFND GONC JUMP90 if not there, error exit ************ * LEX buffer found; D1 points to it * search the LEX buffer for the HPIL ROM entry * LC(2) LEXPIL C(B)=HPIL ROM ID # B=C A A=0 A A=A+1 A A(B)=Token # within HPIL ROM JUMP10 C=DAT1 6 ?C=0 B is this the end of the LEX buffer ? GOYES JUMP90 yes, then error exit ?B#C B is this the right ID ? GOYES JUMP20 no, try the next one ************ * LEX ID matches; see if token # is in range * CSR W CSR A C 3:0 is now the token range ?A