page 1/2 logic was wrong. also update the text pointers when y changes.

This commit is contained in:
Kelvin Sherlock 2021-04-04 22:50:13 -04:00
parent 02acf18c04
commit 147694ca66

45
vt52.S
View File

@ -17,7 +17,7 @@ SETALTCHAR equ $c00f
TXTSET equ $c051 TXTSET equ $c051
ent init,main ent init,main,vt52
dum 0 dum 0
@ -37,12 +37,28 @@ cursor_state dw 0
dend dend
mx %11
main main
clc clc
xce xce
cli cli
jsr init jsr init
mx %00
loop
sep #$30
lda $c000
bmi :key
bra loop
:key
lda $c010
ldx $c025 ; keymod
and #$7f
jsr vt52
bra loop
:loop wai :loop wai
bra :loop bra :loop
@ -101,13 +117,13 @@ clear_eol
lda #" " lda #" "
bcc :even bcc :even
sta [text01],y sta (text00),y
iny iny
:even :even
cpy #80/2 cpy #80/2
bcs :rts bcs :rts
sta (text00),y
sta [text01],y sta [text01],y
sta (text00),y
iny iny
cpy #40 cpy #40
bra :even bra :even
@ -236,21 +252,21 @@ draw_char
; a = char to draw ; a = char to draw
ora #$80 ora #$80
tax tax
lda y lda x
lsr lsr
tay tay
txa txa
bcs :x1 bcs :odd
sep #$20 sep #$20
sta (text00),y sta [text01],y
rep #$20 rep #$20
inc x inc x
jmp update_cursor jmp update_cursor
:x1 :odd
sep #$20 sep #$20
sta [text01],y sta (text00),y
rep #$20 rep #$20
lda x lda x
cmp #79 cmp #79
@ -294,13 +310,17 @@ text
vt52 vt52
mx %11
and #$7f
cmp #' ' cmp #' '
bcs :normal bcs :normal
asl asl
tax tax
rep #$30
jmp (ctrl_table,x) jmp (ctrl_table,x)
:normal :normal
ldx state ldx state
rep #$30
jmp (st_table,x) jmp (st_table,x)
st_table st_table
@ -480,7 +500,7 @@ ctrl_0a ; line feed - cursor down w/ scroll
jmp scroll_down jmp scroll_down
:simple :simple
iny inc y
jmp update_cursor jmp update_cursor
ctrl_0d ; carriage return - cursor to column 0. ctrl_0d ; carriage return - cursor to column 0.
@ -592,6 +612,13 @@ esc_lt ; vt100 - enter ANSI mode (exit vt52 mode).
update_cursor update_cursor
* todo - cursor stuff.
lda y
asl
tay
lda text,y
sta text00
sta text01
rts rts