;---------------------------------------------------------------- ; This is a module in the ASMLIB library. ; ; CP/M I/O Drivers ; ; This is the I/O driver module of ASMLIB and has ALL the I/O routines ; for the system (EXCEPT from line input). The routines are. ; ; COE Send accumulator to console. ; CIE Get console into accumulator. No echo. ; CST Get console status, 00 = no character there. ; LOE Send accumulator to list device. ; LST Get list device status. ; IONUM Get the number of the I/O driver, for later identification. ; ; Written R.C.H. 22/10/83 ; Last Update R.C.H. 23/02/84 ; ;---------------------------------------------------------------- name 'CPMIO' ; public coe,cie,cst,loe,lst,ionum ; maclib z80 ; bdos equ 5 num equ 01 ; 01 = CPMIO i/o driver module in$off equ 6 ; Bios table offset from entry 00 ot$off equ 9 st$off equ 3 ; ionum: mvi l,num ret ; The i/o identification number ; ;**************************************************************** ; CP/M I/O drivers. * ; Send the accumulator to the screen * ;**************************************************************** ; coe: push h push b push d ; save all registers push psw ; Save the character that is sent mov c,a ; Load the character to be sent lxi d,ot$off ; input offset lxi h,retadr1 jr get$con$com ; ;---------------------------------------------------------------- ; Send the accumulator character to the list device ;---------------------------------------------------------------- ; loe: push psw push h push b push d mov e,a ; load the character to print mvi c,5 ; print list function call bdos pop d pop b pop h pop psw ret ; ;---------------------------------------------------------------- ; Get a character from the console ;---------------------------------------------------------------- ; cie: push h push b push d ; save all registers lxi d,in$off ; input offset lxi h,retadr2 ; get$con$com: push h ; Load a return address lhld 1 ; get the warm boot vector dad d ; Now hl = bios table address to use pchl ; do the routine ; ; Return here to restore all registers retadr1: pop psw ; To skip PSW, return here retadr2: pop d pop b pop h ora a ; Set flags, clear carry ret ; ;---------------------------------------------------------------- ; Get the console status. 00 = no character all else = read. ;---------------------------------------------------------------- ; cst: ; Get the status push h push b push d ; save all registers lxi d,st$off ; input offset lxi h,retadr2 ; load the required return address jr get$con$com ; read the console common code ; ;---------------------------------------------------------------- ; Get the list output status. If = 00 then no character may be ; sent to the device. ;---------------------------------------------------------------- ; lst: mvi a,0ffh ; Not supported yet ret ; return the device as ready ; end