TITLE TURBODOS NULL CONSOLE DRIVER + MODEM DRIVER ; ; dualio.mac ; ; DUALIO, in existence mostly thanks to Steve Rasmussen of ; Intercontinental Microsystems with many mods by ESKAY ; ; For use with ICM's SPICPS module. For SPDCPS, see note in TSTDCD:. ; For other systems, see note at S0DCDE. ; .Z80 ; zilog mnemonics ; NAME ('dualio') ; module id ; PUBLIC CONBR ; set conbr to public PUBLIC MODBR ; set modbr to public ; DSEG ; locate in data segment ; FFCHR:: DB 0 ; form feed character (not used) INITC: DB 0 ; initialization complete flag tomc:: db 0 ; COMMON /?INIT?/ ; place into common segment ; consnit:DEC (HL) ; set init complete flag PUSH DE ; save function number PUSH BC ; save chan number/character ; ; set console baud rate ; LD C,8FH ; baud rate code to c-reg 19.2 kbaud CONBR EQU $-1 ; pointer back to baud rate byte LD E,3 ; set function number = 3 CALL SERIAL## ; set channel 1 baud rate ; ;set modem baud rate ; LD B,0 ; set to modem channel number LD C,07H ; baud rate code to c-reg 1200 baud MODBR EQU $-1 ; pointer back to baud rate byte LD E,3 ; set function number = 3 CALL SERIAL## ; set channel 0 baud rate wtlp: call tstdcd ; make sure no carrier while initing jr nz,wtlp POP BC ; restore channel number/character POP DE ; restore function number RET ; CSEG ; locate in program area ; CONDR@::LD HL,INITC ; get initialization complete flag LD A,(HL) OR A ; initialization complete flag set ? call z,consnit ; LD A,E ; get function number SUB 10 ; function number = 10? JP Z,CONS10 ; if so, return error code since ; modem checking code to complex ; for fnction 10, detour through ; other functions ; INC A ; function number = 9? JP Z,CONS9 ; if so enter routine INC A ; function number = 8? JP Z,CONS8 ; if so enter routine LD A,E ; get function number CP 2 ; function number = 2? JP Z,CONS2 ; if so enter rutine CP 1 ; function number = 1? JP Z,CONS1 ; if so enter rutine or a jp nz,serial## ; status check function 0 CALL SERIAL## ; test console status OR A ; set flags RET NZ ; return if char avail call tstdcd ;carrier? ret z ;no - return LD B,0 ; modem channel LD E,0 ; request status CALL SERIAL## ; test modem status OR A ; set flags RET ; CONS10: XOR A ; zero a RET ; always return error code ; CONS9: CALL DMS## ; begin lolite DB 10,13,80H,0,0,0,0,0,0,0,0,0,0 RET ; CONS8: CALL DMS## ; end lolite DB 10,13,80H,0,0,0,0,0,0,0,0,0,0 RET ; ; console and possible modem character output ; CONS2: CALL TSTDCD ; test for dcd4 - 0 if false JP Z,SERIAL## ; if not, enter serial routine PUSH BC ; save channel number PUSH DE ; save function number LD B,0 ; modem channel number LD E,2 ; send character to modem CALL SERIAL## POP DE ; restore function number POP BC ; restore channel number JP SERIAL## ; output char to console ; ; ; console or possible modem character input ; CONS1: CALL TSTDCD ; test for dcd4 - 0 if false JP Z,SERIAL## ; if not, enter serial routine ; DSPACH: LD B,1 ; console channel number LD E,0 ; test for character avail CALL SERIAL## ; -1 = true, 0 = false OR A ; set flags JR NZ,CONSOLE ; if char avail, get from console ; test modem for char LD B,0 ; modem channel number LD E,0 ; test for character avail CALL SERIAL## ; -1 = true, 0 = false OR A ; set flags JR NZ,MODEM ; if char avail, get from modem ld c,2 ld de,0 call xtntry## ; courtesy dispatch JR DSPACH ; loop till char available ; MODEM: LD B,0 ; load modem channel number LD E,1 ; get character xor a dec a ld (tomc),a CALL SERIAL## ; return to os and 7fh ld (tomc),a ret ; CONSOLE:LD B,1 ; load console channel number LD E,1 ; get character JP SERIAL## ; return to os ; ; test for data carrier detect ; TSTDCD: ld a,(remoff##) or a ret z PUSH BC ; save channel number PUSH DE ; save function number LD B,0 ; modem channel number LD E,6 ; request modem status CALL SERIAL## POP DE ; restore function number POP BC ; restore channel number ; xor 20h ; only for ICM's SPDCPS module! AND 20H ; set a to zero if no dcd ret ; ; this routine called from SPICPS at every carrier transition. ; when carrier goes away, wait 3 seconds for carrier to return. ; If carrier not back within 3 secs, then crash to reboot. ; non-ICM systems must emulate this call! ; s0dcde:: or a ; carrier loss? ret nz ld a,(remoff##) or a ret z di halt ; END ; end of dualio.mac