hook up the modem i/o.

This commit is contained in:
Kelvin Sherlock 2021-04-15 23:02:43 -04:00
parent 3eff019871
commit 0285afc299

93
vt52.S
View File

@ -95,12 +95,28 @@ main
jsr cursor_on jsr cursor_on
loop loop
sep #$30 * sep #$30
:again lda $c000
bmi keypress jsr keypress
bra :again bit mode ; local ?
bmi loop
pea loop-1
jmp modem
modem
jsr read_modem
bcc :rts
jmp vt52
:rts rts
keypress keypress
mx %11
lda $c000
bmi :key
rts
:key
and #$7f and #$7f
sta key sta key
sta KEYSTROBE sta KEYSTROBE
@ -110,7 +126,7 @@ keypress
bne :command bne :command
bit #kmKeypad bit #kmKeypad
bne :keypad bne keypad
bit #kmControl bit #kmControl
bne :ctrl bne :ctrl
@ -135,7 +151,7 @@ keypress
lda :arrowtable+1,x lda :arrowtable+1,x
sta key sta key
lda #$1b lda #$1b
jsr vt52 jsr dispatch
bra :ctrl bra :ctrl
:arrowtable :arrowtable
@ -152,19 +168,51 @@ keypress
cmp #$7f ; delete is a special case. cmp #$7f ; delete is a special case.
bne :send bne :send
lda #$08 lda #$08
:send jsr vt52 :send jsr dispatch
jsr cursor_on jsr cursor_on
bra loop rts
:command :command
* or option * or option
bra loop rts
:keypad keypad
* * 0-9, Enter, . PF1-3 are the only valid keypad keys
bra loop
lda mode
bit #mAltKeyPad
beq :normal
lda key
cmp #'0'
bcc :notnum
cmp #'9'+1
bcs :notnum
:qq
* 0-9 sends ESC ? p-y which is num | 0x40
lda #$1b
jsr dispatch
lda #'?'
jsr dispatch
lda key
ora #$40
jmp dispatch
:notnum
cmp #$0d
beq :qq
cmp #'.'
beq :qq
:normal
* todo - PF1/2/3 should send ESC P/Q/R
lda key
jmp dispatch
:table db $1b,'P'
db '=','Q'
db '/','R'
@ -306,6 +354,13 @@ init_modem
rts rts
dispatch
bit mode
bpl :modem
jmp vt52
:modem
write_modem write_modem
mx %11 mx %11
* a: byte to send * a: byte to send
@ -322,12 +377,14 @@ write_modem
sty SCCBDATA sty SCCBDATA
rts rts
read_modem read_modem
* c set if data read * c set if data read
* v set if overrun * v set if overrun
mx %11 mx %11
* ldx #0 * ldx #0
rep #$61 ; C + V rep #$41 ; clear C + V
stz SCCBREG stz SCCBREG
lda SCCBREG lda SCCBREG
and #%0001 and #%0001
@ -343,7 +400,7 @@ read_modem
lda #$30 ; reg0, error reset. lda #$30 ; reg0, error reset.
sta SCCBREG sta SCCBREG
stz SCCBREG stz SCCBREG
sep #$60 ; V sep #$40 ; V
:ok :ok
* lda #8 * lda #8
* sta SCCBREG * sta SCCBREG
@ -874,8 +931,12 @@ esc_Z ; identify terminal.
; return ESC / K ; return ESC / K
bit mode bit mode
bmi :local bmi :local
* todo... lda #$1b
rts jsr write_modem
lda #'/'
jsr write_modem
lda #'K'
jmp write_modem
:local :local
lda #'K' lda #'K'