mirror of
https://github.com/ksherlock/itty-bitty-vtty.git
synced 2024-06-14 06:29:29 +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.
|
* interrupt vectors. JMP ABSLONG.
|
||||||
IRQ1SEC equ $e10054
|
IRQ1SEC equ $e10054
|
||||||
|
IRQMOUSE equ $e10034
|
||||||
IRQQTR equ $e10038
|
IRQQTR equ $e10038
|
||||||
IRQVBL equ $e10030
|
IRQVBL equ $e10030
|
||||||
IRQSND equ $e1002c
|
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 scroll_down
|
||||||
ext recalc_cursor,recalc_cursor_x,recalc_cursor_y
|
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 disable_cursor,enable_cursor,cursor_vector
|
||||||
ext erase_screen
|
ext erase_screen,fill_screen
|
||||||
ext init_tabs
|
ext init_tabs
|
||||||
ext init_audio
|
ext init_audio
|
||||||
ext init_cda
|
ext init_cda
|
||||||
|
@ -49,6 +50,10 @@ loop
|
||||||
bra loop
|
bra loop
|
||||||
|
|
||||||
init
|
init
|
||||||
|
mx %11
|
||||||
|
lda #" "
|
||||||
|
jsr fill_screen ; erase first to prevent flash if going 40->80 columns.
|
||||||
|
|
||||||
sta TXTSET
|
sta TXTSET
|
||||||
sta SET80VID
|
sta SET80VID
|
||||||
sta SETALTCHAR
|
sta SETALTCHAR
|
||||||
|
@ -72,11 +77,18 @@ init
|
||||||
|
|
||||||
lda #$0080
|
lda #$0080
|
||||||
sta cursor_state
|
sta cursor_state
|
||||||
|
|
||||||
sei
|
sei
|
||||||
lda cursor_vector
|
lda cursor_vector
|
||||||
stal IRQ1SEC
|
stal IRQ1SEC
|
||||||
lda cursor_vector+2
|
lda cursor_vector+2
|
||||||
stal IRQ1SEC+2
|
stal IRQ1SEC+2
|
||||||
|
|
||||||
|
lda modem_vector
|
||||||
|
stal IRQSERIAL
|
||||||
|
lda modem_vector+2
|
||||||
|
stal IRQSERIAL+2
|
||||||
|
|
||||||
cli
|
cli
|
||||||
|
|
||||||
lda #0 ; clear high byte
|
lda #0 ; clear high byte
|
||||||
|
@ -90,12 +102,14 @@ init
|
||||||
lda #23
|
lda #23
|
||||||
sta DECBM
|
sta DECBM
|
||||||
lda #$80
|
lda #$80
|
||||||
sta LOCAL
|
* sta LOCAL
|
||||||
|
sta DECANM
|
||||||
|
|
||||||
lda #st_vt52
|
* lda #st_vt52
|
||||||
|
lda #st_vt100
|
||||||
sta state
|
sta state
|
||||||
|
|
||||||
jsr erase_screen
|
* jsr erase_screen
|
||||||
jsr init_modem
|
jsr init_modem
|
||||||
jsr init_tabs
|
jsr init_tabs
|
||||||
jsr init_audio
|
jsr init_audio
|
||||||
|
|
119
vt100.modem.S
119
vt100.modem.S
|
@ -14,6 +14,8 @@ SCCBDATA equ $c03a
|
||||||
SCCADATA equ $c03b
|
SCCADATA equ $c03b
|
||||||
|
|
||||||
|
|
||||||
|
SerFlag equ $e10104 ;
|
||||||
|
|
||||||
*
|
*
|
||||||
* scc speed:
|
* 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 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)
|
* clock = 3.6864 MHz crystal (scc runs at 14.31818 / 4 = ~ 3.58 Mhz)
|
||||||
* time constant = write register 12 (low) + 13 (high)
|
* time constant = write register 12 (low) + 13 (high)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* see IIgs TN #18 - Do-It-Yourself SCC Access
|
||||||
|
|
||||||
init_modem ent
|
init_modem ent
|
||||||
* sep #$30
|
* sep #$30
|
||||||
|
|
||||||
|
|
||||||
|
stz q_head
|
||||||
|
stz q_tail
|
||||||
|
|
||||||
* reset channel B (modem port)
|
* reset channel B (modem port)
|
||||||
ldx #9
|
ldx #9
|
||||||
lda #%01_0_1_0_0_0_1
|
lda #%01_0_1_0_0_0_1
|
||||||
|
@ -114,9 +123,10 @@ init_modem ent
|
||||||
stx SCCBREG
|
stx SCCBREG
|
||||||
sta SCCBREG
|
sta SCCBREG
|
||||||
|
|
||||||
* disable interrupts
|
* enable interrupts
|
||||||
ldx #1
|
ldx #1
|
||||||
lda #0
|
* lda #0
|
||||||
|
lda #%0_0_0_10_0_0_0 ; inr on rx or special condition.
|
||||||
stx SCCBREG
|
stx SCCBREG
|
||||||
sta SCCBREG
|
sta SCCBREG
|
||||||
|
|
||||||
|
@ -124,15 +134,20 @@ init_modem ent
|
||||||
lda SCCBREG
|
lda SCCBREG
|
||||||
|
|
||||||
|
|
||||||
* status, visible, master interrupts disabled
|
* no vector, master interrupts enabled
|
||||||
ldx #9
|
ldx #9
|
||||||
lda #%00_0_1_0_0_0_1
|
lda #%00_0_0_1_0_1_0
|
||||||
stx SCCBREG
|
stx SCCBREG
|
||||||
sta SCCBREG
|
sta SCCBREG
|
||||||
nop
|
nop
|
||||||
nop
|
nop
|
||||||
|
|
||||||
|
|
||||||
|
* adjust SerFlag so serial IRQs will be handled.
|
||||||
|
lda >SerFlag
|
||||||
|
ora #%00_000_111 ; channel B interrupts.
|
||||||
|
sta >SerFlag
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
write_modem ent
|
write_modem ent
|
||||||
|
@ -151,7 +166,7 @@ write_modem ent
|
||||||
sty SCCBDATA
|
sty SCCBDATA
|
||||||
rts
|
rts
|
||||||
|
|
||||||
read_modem ent
|
read_modem_sync ent
|
||||||
* c set if data read
|
* c set if data read
|
||||||
* v set if overrun
|
* v set if overrun
|
||||||
mx %11
|
mx %11
|
||||||
|
@ -168,6 +183,9 @@ read_modem ent
|
||||||
lda SCCBREG
|
lda SCCBREG
|
||||||
and #%0010_0000
|
and #%0010_0000
|
||||||
beq :ok
|
beq :ok
|
||||||
|
* indicate overrun...
|
||||||
|
lda #"x"
|
||||||
|
sta |$07d0+20
|
||||||
* clear the overrun
|
* clear the overrun
|
||||||
lda #$30 ; reg0, error reset.
|
lda #$30 ; reg0, error reset.
|
||||||
sta SCCBREG
|
sta SCCBREG
|
||||||
|
@ -178,8 +196,97 @@ read_modem ent
|
||||||
* sta SCCBREG
|
* sta SCCBREG
|
||||||
* lda SCCBREG
|
* lda SCCBREG
|
||||||
lda SCCBDATA
|
lda SCCBDATA
|
||||||
|
|
||||||
|
* debugging...
|
||||||
|
ldx :debug
|
||||||
|
sta $1e00,x
|
||||||
|
inc :debug
|
||||||
|
|
||||||
sec
|
sec
|
||||||
:rts rts
|
: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
|
sav vt100.modem.L
|
||||||
|
|
|
@ -82,6 +82,7 @@ esc_lt
|
||||||
* (which we don't support anyhow.)
|
* (which we don't support anyhow.)
|
||||||
lda #$80
|
lda #$80
|
||||||
sta DECANM
|
sta DECANM
|
||||||
|
* stz MOUSETEXT
|
||||||
lda #st_vt100
|
lda #st_vt100
|
||||||
sta state
|
sta state
|
||||||
rts
|
rts
|
||||||
|
@ -176,10 +177,13 @@ esc_H ; cursor home
|
||||||
esc_F ; enter graphics mode
|
esc_F ; enter graphics mode
|
||||||
* lda #%0010
|
* lda #%0010
|
||||||
* tsb mode
|
* tsb mode
|
||||||
|
lda #$80
|
||||||
|
* tsb MOUSETEXT
|
||||||
rts
|
rts
|
||||||
esc_G ; exit graphics mode
|
esc_G ; exit graphics mode
|
||||||
* lda #%0010
|
* lda #%0010
|
||||||
* trb mode
|
* trb mode
|
||||||
|
* stz MOUSETEXT
|
||||||
rts
|
rts
|
||||||
|
|
||||||
esc_Y ; direct cursor address
|
esc_Y ; direct cursor address
|
||||||
|
|
Loading…
Reference in New Issue
Block a user