* This file was written with virtually no knowledge of HPIL. The function * works well enough with devices that do not power down. I would be most * grateful for assistance in improving it so that the 71 does not lock up * when one of the devices in the loop is capable of power down. * Jack Elhay, 9/494-498 Mitcham Rd.,Mitcham, Victoria,3132,AUSTRALIA. LEX 'IOTEST' * A function to test the continuity of the HPIL loop ID #EC * J.Elhay, 10/12/87, with acknowledgements to HP MSG 0 * and Mike Markov for JUMPER and Jean-Franµois Garnier POLL 0 * for SIDY from PPOLL LEX file (JPC 37) ENTRY SIDY * SIDY sends IDY 0 around the loop CHAR #F * a function KEY 'IOQ' * Syntax: S=IOQ, no parameters; returns 1 when loop TOKEN 55 * is complete, 0 when loop is broken ENDTXT * Allows a routine to test loop and set up accordingly FNRTN1 EQU #0F216 * exit for parameterless numeric functions GETLPs EQU #01D15 * get mailbox(mb), check loop status PUTC EQU #06B1C * put command in mb GET EQU #06751 * read mb message ERRORX EQU #0342C * unsupported entry point for error exit 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 D1C=R3 EQU #03047 * recover D1,D0 from R3 R3=D10 EQU #03526 * save D1,D0 in R3 NIBHEX 00 * a function with no parameters SIDY GOSBVL R3=D10 * save the pointers GOSUB JUMPER * access the HPIL routine CON(5) GETLPs * to find the mailbox, check loop status GOC Err * carry set on error, err# in P,C(0) LC(4) #1E00 * load a message to be sent GOSUB JUMPER * send it CON(5) PUTC * with PUTC GOC Err * carry set on error GOSUB JUMPER * receive a message from mb CON(5) GET * carry clear=OK, message in C(7,0) etc. P= 0 * on error, error # in P GOSBVL D1C=R3 * restore pointers D0=C C=0 W * clear C(W) to ready for O/P GOC ZERO * carry set=loop broken, a 0 will be output P= 1 * carry clear=loop OK, output a 1 CPEX 14 * with a little trick swap ZERO CLRST * ST(3:0) need to be cleared GOVLNG FNRTN1 * exit with result Err GOSUB JUMPER * the error routine in the IL CON(5) ERRORX * an unsupported entry point, valid for * versions A and B only. * The code below is taken directly from the TEXT file JUMPER on swapdisc 3 * from Mike Markov. The table of equates has been moved to join with the * those equates needed by the rest of the file. * JUMPER: a routine for accessing the HPIL ROM * * * 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