þþ. #X;"T:" DEVICE HANDLER FOR "CHEEPX; TALK" BY ANTHONY A. NOGAS#X;Copyright 1985 by ANALOG CORP.X;2X;<X;SYSTEM EQUATESF†DOSINI ;;DOS INIT VECTORP…LOMEM€;;LO MEM POINTERZ…CLOCK;;SOFTWARE TIMER 1d†RUNVECà;;RUN VECTORn…MEMLOç;;O.S. LO MEM PNTRx†HATABS;;HANDLER TABLE‚„IOCB@;;I/O CNTRL BLOCKSŒ…DOSST@;;DOS INIT–…PORTAÓ;;JOYSTICK PORTS …PACTLÓ;;PORT CONTROLLERª…WSYNC Ô;;WAIT HORIZ SYNC´X;¾X;ERROR CODES RETURNEDȆINVCOM„;;INVALID COMMANDÒ†TIMOUTŠ;;DEVICE TIMEOUT܆NOTIMP’;;NO FUNCTION IMPæX;ð$X;"T:" DEVICE HANDLER STARTS HEREúü†VECTAB „OPEN …CLOSE †NOFUNC;;GET NOT IMP" ƒPUT, †STATUS6 †NOFUNC@ !„INITJX;TX;OPEN ROUTINE STARTS HERE^!„OPENQ„IOCB 9;;GET CMND CODEhR>;;OUTPUT ONLY?rF…OPEN2;;YES,PERFORM OPEN| …CLOSE;;NO,ABORT OPEN†%>†INVCOM;;SIGNAL INVALID:;;RETURN ERRORš"…OPEN2Q…PACTL;;GET PORT CONTROL¤M>û;;SETUP TO PROGRAM©;DATA LINES® P…PACTL¸Q> P…PORTAÌ †PIADLY;;GIVE PIA TIMEÑ;TO RESPONDÖQ…PACTL;;RESTORE PORTÛ;CONTROL REGISTERàL>êP…PACTL;;PORTA RESTOREDô †PIADLY;;GIVE PIA TIMEþ †DEVCHK;;CHECK RESPONSE?;;RETURN STATUS:X;&X;CLOSE ROUTINE STARTS HERE0…CLOSEQ>;;SIGNAL SILENCE: ƒPUTD †SETCLK;;SET TIMEOUT CNTRN!†CLLOOPQ…PACTL;;GET PORT CNTRLXM>û;;DATA LINESb P…PACTLlQ>;;SET FOR INPUTv P…PORTA€ †PIADLY;;GIVE PIA TIMEŠ Q…PACTL”L>;;RESET PORT CNTRLžP…PACTL;;PORTA RESTORED¨ †PIADLY;;GIVE PIA TIME² Q…PORTA¼I…CLSAT;;CLOSE SUCCESSFULÆ …CKCLK;;CHECK IF TIMEOUTÐE†CLLOOP;;NOT CLOSEDÚ%>†TIMOUT;;ERROR TIMEOUTä:;:RETURN ERRORî…CLSAT%>;;FLAG SUCCESSø:;;RETURN STATUSX; !X;GET AND SPECIAL ROUTINES NOT$X;IMPLIMENTED-ROUTINE STARTS HERE†NOFUNCQ> %>†NOTIMP;;NO FUNCTION*:;;RETURN ERROR4X;>X;PUT ROUTINE STARTS HEREHƒPUT5;;SAVE OUTPUT DATAR †SETCLK;;SET TIMEOUT\„PUT2Q…PORTA;;DEVICE READY?fIƒOUT;;BRANCH IF READYp …CKCLK;;CHECK IF TIMEOUTzE„PUT2;;CONTINUE„7;;CLEAR STACKŽQ>†TIMOUT;;SET ERROR CODE˜G†SETSTA;;SET ERROR CODE¢ƒOUT †SETCLK;;SET TIMER¬7;;GET DATA¶R>›;;IS IT EOL?ÀH„OUT2;;NO, SEND DATAÊQ>;;YES, SO SILENCEÔ„OUT2M>?;;CONVERT TO 6-BITÞ „SEND;;SEND DATAè …DCHK3;;CHECK RESPONSEò"†SETSTAP„IOCB9;;STORE STATUSü?:X;X;STATUS ROUTINE STARTS HERE$ †STATUS%„IOCB9;;GET STATUS);OF LAST OPERATION.:;;RETURN STATUS8X;B#X;SEND SUB-ROUTINE BELOW USED BYGX;OPEN,CLOSE,PUT AND DEVICEHX;CHECKING ROUTINESL„SEND5;;SAVE OUTPUT DATAVL>@;;SET SEND FLAG` P…PORTAj †PIADLY;;GIVE TIMEt7;;CLEAR SEND FLAG~ P…PORTAˆ:’X;œ$X;DEVICE CHECKING ROUTINE-USED BY¡X; OPEN AND PUT ROUTINES¦†DEVCHK †SETCLK;;SET TIMEOUT°…DCHK1Q…PORTA;;DEVICE READY?ºI…DCHK2;;BRANCH IF READYÄ …CKCLK;;CHECK IF TIMEOUTÎE…DCHK1;;CONTINUEØ„FAILQ>†TIMOUT;;SET ERRORâ:;;RETURN ERRORì…DCHK2 †SETCLK;;SET TIMEOUTöQ>;;SEND SILENCE „SEND  …DCHK3Q…PORTA;;CHECK RESPONSEI‚OK;;RESPONSE, BRANCH …CKCLK;;CHECK IF TIMEOUT(E…DCHK3;;CONTINUE2D„FAIL;;SIGNAL ERROR<‚OKQ>;;FLAG SUCCESSF„XDEV:;;RETURN STATUSPX;ZX;TIME DELAY ROUTINESd†PIADLYP…WSYNC;;WAITn P…WSYNCx:‚X;Œ†SETCLKQ>¨;;2/3 SECOND–P…CLOCK;;RESET TIMER :ªX;´…CKCLK,;;2/3 SEC TIMEOUT¾Q…CLOCK;;GET TIMERÈO>€Ò:Ü"X;CKCLK RETURNS WITH CARRY FLAGáX;CLEARED UPON TIMEOUTæX;ð X;PLACE "T:" IN HANDLER TABLEú…SETUP$>;;OFFSET IN TABLE%> ;;MAX ENTRIES†SULOOPQ†HATABS9;;GET DEVICER>T;;IS IT ASCII T?"FƒMEM;;YES, BRANCH,R>;;ENTRY OCCUPIED?6F…ENTRY;;IF NO, ADD "T:"@2;;YES, NEXT ENTRYJ2T2^1;;UPDATE NUMBERc;UPDATE NUMBERhH†SULOOP;;SPACE REMAINSr:;;NO SPACE "T:"|…ENTRYQ>T;;"T:" DEVICE†P†HATABS9;;PLACE DEVICEQ>†VECTABÿšP†HATABS9¤Q>†VECTAB®P†HATABS9¸X;ÂQ>„INITÿ;;STEAL DOS INITÌ P†DOSINIÖQ>„INITàP†DOSINIêX;ô!ƒMEMQ>†FINISHÿ;;RESET LO MEMþ P…LOMEM P…MEMLOQ>†FINISH P…LOMEM& P…MEMLO0 †XSETUP::X;D X;INITIALIZATION ROUTINE HEREN„INIT …SETUP;;INITILIZE "T:"X!…DOSST;;INITIALIZE DOSb †FINISH lX;vX;RUN ADDRESS FOR PROGRAM€ †RUNVECŠ …SETUP”