mirror of
https://github.com/ksherlock/itty-bitty-vtty.git
synced 2024-12-21 16:29:16 +00:00
at 2.6mhz, 9600baud, I was experiencing lost characters during line scroll or screen clear. To compensate, replace modem polling with asynchronous/interrupt-based code. Up to 256 bytes of modem data can be buffered.
Also, enable modem, vt100 as default Also, erase screen before switching to 80-column mode to prevent unsightly flashes.
This commit is contained in:
parent
5a1f0f6ffc
commit
77ec62a091
@ -31,7 +31,11 @@ SGADDRH equ $c03f ; Sound GLU address reg high
|
||||
|
||||
* interrupt vectors. JMP ABSLONG.
|
||||
IRQ1SEC equ $e10054
|
||||
IRQMOUSE equ $e10034
|
||||
IRQQTR equ $e10038
|
||||
IRQVBL equ $e10030
|
||||
IRQSND equ $e1002c
|
||||
IRQSCAN equ $e10028
|
||||
IRQSERIAL equ $e10024
|
||||
IRQATALK equ $e10020
|
||||
|
||||
|
24
vt100.main.S
24
vt100.main.S
@ -11,9 +11,10 @@
|
||||
|
||||
ext scroll_down
|
||||
ext recalc_cursor,recalc_cursor_x,recalc_cursor_y
|
||||
ext write_modem,read_modem,init_modem,keypress
|
||||
ext write_modem,read_modem,init_modem,modem_vector
|
||||
ext keypress
|
||||
ext disable_cursor,enable_cursor,cursor_vector
|
||||
ext erase_screen
|
||||
ext erase_screen,fill_screen
|
||||
ext init_tabs
|
||||
ext init_audio
|
||||
ext init_cda
|
||||
@ -49,6 +50,10 @@ loop
|
||||
bra loop
|
||||
|
||||
init
|
||||
mx %11
|
||||
lda #" "
|
||||
jsr fill_screen ; erase first to prevent flash if going 40->80 columns.
|
||||
|
||||
sta TXTSET
|
||||
sta SET80VID
|
||||
sta SETALTCHAR
|
||||
@ -72,11 +77,18 @@ init
|
||||
|
||||
lda #$0080
|
||||
sta cursor_state
|
||||
|
||||
sei
|
||||
lda cursor_vector
|
||||
stal IRQ1SEC
|
||||
lda cursor_vector+2
|
||||
stal IRQ1SEC+2
|
||||
|
||||
lda modem_vector
|
||||
stal IRQSERIAL
|
||||
lda modem_vector+2
|
||||
stal IRQSERIAL+2
|
||||
|
||||
cli
|
||||
|
||||
lda #0 ; clear high byte
|
||||
@ -90,12 +102,14 @@ init
|
||||
lda #23
|
||||
sta DECBM
|
||||
lda #$80
|
||||
sta LOCAL
|
||||
* sta LOCAL
|
||||
sta DECANM
|
||||
|
||||
lda #st_vt52
|
||||
* lda #st_vt52
|
||||
lda #st_vt100
|
||||
sta state
|
||||
|
||||
jsr erase_screen
|
||||
* jsr erase_screen
|
||||
jsr init_modem
|
||||
jsr init_tabs
|
||||
jsr init_audio
|
||||
|
119
vt100.modem.S
119
vt100.modem.S
@ -14,6 +14,8 @@ SCCBDATA equ $c03a
|
||||
SCCADATA equ $c03b
|
||||
|
||||
|
||||
SerFlag equ $e10104 ;
|
||||
|
||||
*
|
||||
* scc speed:
|
||||
*
|
||||
@ -23,10 +25,17 @@ SCCADATA equ $c03b
|
||||
* clock mode = 1x, 16x, 32x, or 64x (selected via write register 4 bits 6/7)
|
||||
* clock = 3.6864 MHz crystal (scc runs at 14.31818 / 4 = ~ 3.58 Mhz)
|
||||
* time constant = write register 12 (low) + 13 (high)
|
||||
|
||||
*
|
||||
*
|
||||
* see IIgs TN #18 - Do-It-Yourself SCC Access
|
||||
|
||||
init_modem ent
|
||||
* sep #$30
|
||||
|
||||
|
||||
stz q_head
|
||||
stz q_tail
|
||||
|
||||
* reset channel B (modem port)
|
||||
ldx #9
|
||||
lda #%01_0_1_0_0_0_1
|
||||
@ -114,9 +123,10 @@ init_modem ent
|
||||
stx SCCBREG
|
||||
sta SCCBREG
|
||||
|
||||
* disable interrupts
|
||||
* enable interrupts
|
||||
ldx #1
|
||||
lda #0
|
||||
* lda #0
|
||||
lda #%0_0_0_10_0_0_0 ; inr on rx or special condition.
|
||||
stx SCCBREG
|
||||
sta SCCBREG
|
||||
|
||||
@ -124,15 +134,20 @@ init_modem ent
|
||||
lda SCCBREG
|
||||
|
||||
|
||||
* status, visible, master interrupts disabled
|
||||
* no vector, master interrupts enabled
|
||||
ldx #9
|
||||
lda #%00_0_1_0_0_0_1
|
||||
lda #%00_0_0_1_0_1_0
|
||||
stx SCCBREG
|
||||
sta SCCBREG
|
||||
nop
|
||||
nop
|
||||
|
||||
|
||||
* adjust SerFlag so serial IRQs will be handled.
|
||||
lda >SerFlag
|
||||
ora #%00_000_111 ; channel B interrupts.
|
||||
sta >SerFlag
|
||||
|
||||
rts
|
||||
|
||||
write_modem ent
|
||||
@ -151,7 +166,7 @@ write_modem ent
|
||||
sty SCCBDATA
|
||||
rts
|
||||
|
||||
read_modem ent
|
||||
read_modem_sync ent
|
||||
* c set if data read
|
||||
* v set if overrun
|
||||
mx %11
|
||||
@ -168,6 +183,9 @@ read_modem ent
|
||||
lda SCCBREG
|
||||
and #%0010_0000
|
||||
beq :ok
|
||||
* indicate overrun...
|
||||
lda #"x"
|
||||
sta |$07d0+20
|
||||
* clear the overrun
|
||||
lda #$30 ; reg0, error reset.
|
||||
sta SCCBREG
|
||||
@ -178,8 +196,97 @@ read_modem ent
|
||||
* sta SCCBREG
|
||||
* lda SCCBREG
|
||||
lda SCCBDATA
|
||||
|
||||
* debugging...
|
||||
ldx :debug
|
||||
sta $1e00,x
|
||||
inc :debug
|
||||
|
||||
sec
|
||||
:rts rts
|
||||
|
||||
|
||||
:debug ds 2
|
||||
|
||||
buffer equ $1d00
|
||||
|
||||
modem_vector ent
|
||||
jml modem_int
|
||||
modem_int
|
||||
*
|
||||
* called in 8-bit native mode, interrupts disabled.
|
||||
* d = unknown
|
||||
* a/x/y don't need to be preserved.
|
||||
* return carry clear if handled, carry set if not.
|
||||
|
||||
|
||||
* check/clear overrun?
|
||||
mx %11
|
||||
|
||||
phb
|
||||
phk
|
||||
plb
|
||||
|
||||
stz SCCBREG
|
||||
lda SCCBREG
|
||||
and #%0000_0001 ; rx ready.
|
||||
beq :nope
|
||||
|
||||
:read
|
||||
lda SCCBDATA
|
||||
ldx q_tail
|
||||
sta buffer,x
|
||||
inc q_tail
|
||||
|
||||
* more?
|
||||
stz SCCBREG
|
||||
lda SCCBREG
|
||||
and #%0000_0001 ; rx ready.
|
||||
bne :read
|
||||
clc
|
||||
bra :finish
|
||||
|
||||
:nope
|
||||
|
||||
sec
|
||||
:finish
|
||||
* reset errors.
|
||||
lda #%00_110_000
|
||||
stz SCCBREG
|
||||
sta SCCBREG
|
||||
|
||||
* reset highest ius
|
||||
lda #%00_111_000
|
||||
stz SCCBREG
|
||||
sta SCCBREG
|
||||
|
||||
plb
|
||||
rtl
|
||||
|
||||
read_modem ent
|
||||
read_modem_async ent
|
||||
|
||||
mx %11
|
||||
|
||||
php
|
||||
sei
|
||||
ldx q_head
|
||||
cpx q_tail
|
||||
beq :nope
|
||||
|
||||
lda buffer,x
|
||||
inc q_head
|
||||
plp
|
||||
sec
|
||||
rts
|
||||
|
||||
:nope
|
||||
plp
|
||||
clc
|
||||
rts
|
||||
|
||||
q_head ds 2
|
||||
q_tail ds 2
|
||||
*buffer ds 256
|
||||
|
||||
sav vt100.modem.L
|
||||
|
@ -82,6 +82,7 @@ esc_lt
|
||||
* (which we don't support anyhow.)
|
||||
lda #$80
|
||||
sta DECANM
|
||||
* stz MOUSETEXT
|
||||
lda #st_vt100
|
||||
sta state
|
||||
rts
|
||||
@ -176,10 +177,13 @@ esc_H ; cursor home
|
||||
esc_F ; enter graphics mode
|
||||
* lda #%0010
|
||||
* tsb mode
|
||||
lda #$80
|
||||
* tsb MOUSETEXT
|
||||
rts
|
||||
esc_G ; exit graphics mode
|
||||
* lda #%0010
|
||||
* trb mode
|
||||
* stz MOUSETEXT
|
||||
rts
|
||||
|
||||
esc_Y ; direct cursor address
|
||||
|
Loading…
Reference in New Issue
Block a user