I had somebody give me a chunk of code that works with the 8250 based SVI-805 serial card for the SVI-3x8 systems:
Code: Select all
TTDATA equ 28h ; Data port of WD8250
TTIER equ TTDATA+1 ; Interrupt enable register
TTIDENT equ TTDATA+2 ; Interrupt ident register
TTLCR equ TTDATA+3 ; Line control register
TTMCR equ TTDATA+4 ; Modem control register
TTSTAT equ TTDATA+5 ; Line status register
TTMODST equ TTDATA+6 ; Modem status register
DLL equ TTDATA ; Divisor latch low
DLH equ TTDATA+1 ; Divisor latch high
;
NIT232:
xor a ; Burp 8250
out (TTSTAT), a
ld a, 0fh ; Activate all modem control lines
out (TTMCR), a
xor a ; Disable all interrupts
out (TTIER), a
ld a, 83h ; Enable divisor latch
out (TTLCR), a
ld hl,(UPARMS+7) ; Get baud rate
ld a, l ; Send low first
out (DLL), a
ld a, h ; And then high
out (DLH), a
ld a, 3 ; Select 8 data bits, 1 stop bit, no parity
out (TTLCR), a
xor a ; Burp it again
out (TTSTAT), a
TTYSTI:
in a, (TTSTAT) ; get status byte
and 1 ; is RxRdy set?
ret z ; nope, exit
xor a ; yes, set FF and exit
dec a
ret
;
TTYIN:
call TTYSTI ; get status
jr z, TTYIN ; if not there yet
in a, (TTDATA) ; else get data
and 7fh ; mask parity
ret ; and return
;
TTYSTO:
in a, (TTSTAT) ; get status byte
and 20h ; is TxRdy set?
ret z ; nope, exit
ld a, (UPARMS+9) ; is H/W H/S enabled?
or a
jr z, SETRDY ; nope, go signal ready state
in a, (TTMODST) ; else get modem status
and 10h ; look at CTS pin
ret z ; exit if not ready
SETRDY:
xor a ; else set FF and exit
dec a
ret
;
TTYOUT:
call TTYSTO ; get status
jr z, TTYOUT ; if not ready yet
ld a, c ; get character to send
out (TTDATA), a ; send it out
ret ; and exit
Code: Select all
TTYSTI - Get status
TTYIN - get byte
TTYSTO - for flow control
TTYOUT - send byte