; ; Subroutine GIO ; ; Purpose - To allow direct I/O access to general purpose ; communications port. ; ; Calling sequence - CALL GIO (BUFFER, N_BYTES) ; ; Where : ; ; BUFFER - Is the address of the start of the data buffer. ; Comes in in H & L regs. ; ; N_BYTES - Is the address of the number of bytes to be transferred. ; Comes in in D & E regs. ; entry gio .radix 16 ; ; Conditional assembly parameters. ; true equ -1 false equ not true gport equ false ; Standard VT-180 General Purpose port. ; Does not exist on VT-180 with ; Selanar graphics pport equ false ; Standard VT-180 PTP: port. ; Communications port. tport equ true ; Standard VT-180 LST: port. G.P. port on ; VT-180 with Selanar graphics. lport equ false ; Generic CP/M LST: port ; ; I/O equates. ; qpbaud equ 90 ; Baud rate gen addr. (Printer & G.P.) gp300 equ 12 ; 300 baud gp1200 equ 22 ; 1200 baud gp4800 equ 36 ; 4800 baud gp9600 equ 3F ; 9600 baud baud equ gp9600 ; Adjust baud rate here as req'd ucout equ 0F738 ; UC1: output s/r t@uc1cb equ 0F53E ; UC1: I/O control block ppout equ 0F754 ; PTP: output s/r t@ptrcb equ 0F536 ; PTP: I/O control block ttout equ 0F6E0 ; TTY: output s/r t@ttycb equ 0F4E8 ; TTY: I/O control block bdos equ 5 ; CP/M bdos entry lfunc equ 5 ; LST: function code ; ; Main routine starts here. ; ; Set up the ports. ; gio: if not lport lda init ; Check to see if baud init req'd ora a jnz noinit inr a ; Clear init flag sta init mvi a, baud ; Set baud rate out qpbaud xra a ; Set for XON/XOFF endif if gport sta t@uc1cb+1 ; UC1: port endif if pport sta t@ptrcb+1 ; PTP: port endif if tport sta t@ttycb+1 ; TTY: port endif ; ; Send the string out. ; noinit: xchg ; Get number of bytes from D & E mov a, m ; xchg ; Restore buffer addr. to H & L loop: if gport or pport or tport mov c, m ; Get a character endif if lport mov e, m ; Get a character endif push psw ; Save context push h if gport call ucout ; Send it out UC1: port. endif if pport call ppout ; Send it out PTP: port. endif if tport call ttout ; Send it out TTY: port. endif if lport mvi c, lfunc ; Send it out LST: port. call bdos endif pop h pop psw inx h ; Bump buffer addr dcr a ; Bump char count jnz loop ; Loop til buffer empty ret if not lport init: db 0 ; Initialization flag endif end