;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ; ; 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. ; ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ; ; Dave Cook ; Ball Aerospace Systems Division ; This Version : 26-Sep-83 ; ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ; ; Notes : ; ; This version has a special initialization for the printer ; port for standard VT-180 CP/M. In the standard ; version of CP/M, the printer port is set for 7 ; data bits with the 8th bit set to a mark. This ; is not compatible with most 8 bit devices, including ; odd-ball plotters and printers. The initialization ; fixes this problem only for the duration of the ; program, since a warm boot occurs upon termination. ; ; Note that there is a patched version of CP/M ; which we use here at BASD. It is identified by ; BASD after the CP/M version level message on the ; cold boot banner. In this version of CP/M, we ; have patched the printer port initialization to ; be 8 bits. Therefore, the bit-fix may not always ; be required in initialization. ; ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= entry gio .z80 .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 bitfix equ false ; Flag to indicate printer port fix ; ; I/O equates. ; qpbaud equ 90 ; Baud rate gen addr. (Printer & G.P.) gp300 equ 12 ; 300 baud gp1200 equ 22 ; 1200 baud gp9600 equ 3F ; 9600 baud ; ; Adjust baud rate for PTP and TTY ports here. ; baud equ gp9600 ; Adjust baud rate here as req'd ; ; UART control. ; b8s1m16 equ 4E ; Uart ctl. 8 bit, 1 stop, X16 ureset equ 55 ; Uart reset command ttyuart equ 49 ; TTY: Uart address crtuart equ 41 ; CRT: Uart address uc1uart equ 51 ; UC1: Uart address ptruart equ 59 ; PTP: Uart address p232int equ 0F3DC ; Init RS-232 s/r ; ; Physical I/O subroutine entry points. ; 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 page ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ; ; Main routine starts here. ; ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ; ; Set up the ports. ; gio: if not lport ; No init check req'd for generic version. ld a, (init) ; Check to see if baud init req'd or a jp nz, noinit inc a ; Clear init flag ld (init), a ; ; Initialization is needed. ; ld a, baud ; Set baud rate out (qpbaud), a xor a ; Set for XON/XOFF endif if gport ; UC1: port ld (t@uc1cb+1), a ; Set for XON/XOFF endif if pport ; PTP: port ld (t@ptrcb+1), a ; Set for XON/XOFF endif if tport ; TTY: port ld (t@ttycb+1), a ; Enable XON/XOFF endif ; ; Special initialization is required for standard VT-180 CP/M ; here since the default UART set-up is 7 bits with marking ; parity which is not compatible with almost everybody ; else in the world. ; if tport and bitfix push hl ; Save argument addresses. push de ; "" di ; Don't let interrupts interfere ld a, ureset ; Reset Uart out (ttyuart), a ; "" ld ix, t@ttycb ; Set for 8 bits, 1 stop, x16 clock ld a, b8s1m16 ; "" call p232int ; "" ei ; Re-enable interrupts now pop de ; Restore argument addresses. pop hl ; "" endif page ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ; ; Send the string out. ; ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= noinit: ex de, hl ; Get number of bytes from D & E ld a, (hl) ; ex de, hl ; Restore buffer addr. to H & L loop: if gport or pport or tport ld c, (hl) ; Get a character endif if lport ld e, (hl) ; Get a character endif push af ; Save context push hl if gport ; Send it out UC1: port. call ucout endif if pport ; Send it out PTP: port. call ppout endif if tport ; Send it out TTY: port. call ttout endif if lport ; Send it out LST: port. ld c, lfunc call bdos endif pop hl pop af inc hl ; Bump buffer addr dec a ; Bump char count jp nz, loop ; Loop til buffer empty ret ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ; ; Data area. ; ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= if not lport init: db 0 ; Initialization flag endif end