arrows, screen erasing, region fixes

This commit is contained in:
Kelvin Sherlock 2021-09-25 21:27:48 -04:00
parent 7fbd54e791
commit 45aea0293f

View File

@ -14,6 +14,9 @@
ext reset_tab,reset_all_tabs ext reset_tab,reset_all_tabs
ext recalc_cursor,recalc_cursor_x,recalc_cursor_y ext recalc_cursor,recalc_cursor_x,recalc_cursor_y
ext erase_line_0,erase_line_1,erase_line_2
ext erase_screen_0,erase_screen_1,erase_screen_2
vt100_csi ent vt100_csi ent
debug vt100_csi debug vt100_csi
@ -489,15 +492,19 @@ p1 mac
lda parms lda parms
bne ok bne ok
lda #1 lda #1
ok sta r0 ok sta parms
<<< <<<
* cursor movement. * cursor movement.
* if private mode, no effect.
csi_A csi_A
* up * up
* if cursor is outside the scrolling region, it is not locked to the scrolling region. * if cursor is outside the scrolling region, it is not locked to the scrolling region.
bit pmod
bmi :rts
p1 p1
lda y lda y
@ -506,9 +513,9 @@ csi_A
bcc :simple bcc :simple
sec sec
sbc r0 sbc parms
bcc :top bcc :top
cmp #DECTM cmp DECTM
* bcc :top * bcc :top
* bra :sta * bra :sta
bcs :sta bcs :sta
@ -521,7 +528,7 @@ csi_A
:simple :simple
* lda y * lda y
sec sec
sbc r0 sbc parms
* bcc :0 ; clear indicate underflow. * bcc :0 ; clear indicate underflow.
bcc :sta bcc :sta
:0 lda #0 :0 lda #0
@ -530,6 +537,10 @@ csi_A
csi_B csi_B
* down * down
bit pmod
bmi :rts
p1 p1
lda y lda y
@ -538,9 +549,9 @@ csi_B
bge :simple bge :simple
clc clc
adc r0 adc parms
bcs :bottom ; overflow bcs :bottom ; overflow
cmp #DECBM cmp DECBM
bcc :sta bcc :sta
:bottom lda DECBM :bottom lda DECBM
@ -549,7 +560,7 @@ csi_B
:simple :simple
clc clc
adc r0 adc parms
bcs :23 ; overflow bcs :23 ; overflow
cmp #24 cmp #24
bcc :sta bcc :sta
@ -560,14 +571,21 @@ csi_B
csi_C csi_C
* right * right
* TODO - what happens in column 80 w/ DECAWM? * in column 80, no effect.
bit pmod
bmi :rts
lda x
cmp #79
bcs :rts
p1 p1
lda x lda x
and #$7f * and #$7f
clc clc
adc r0 adc parms
bcs :79 ; overflow bcs :79 ; overflow
cmp #80 cmp #80
bcc :sta bcc :sta
@ -575,23 +593,27 @@ csi_C
:79 lda #79 :79 lda #79
:sta sta x :sta sta x
jmp recalc_cursor_x jmp recalc_cursor_x
:rts rts
csi_D csi_D
* left * left
bit pmod
bmi :rts
p1 p1
lda x lda x
and #$7f and #$7f
sec sec
sbc r0 sbc parms
* bcc :0 ; underflow * bcc :0 ; underflow
bcs :sta bcs :sta
:0 lda #0 :0 lda #0
:sta sta x :sta sta x
jmp recalc_cursor_x jmp recalc_cursor_x
:rts rts
csi_f csi_f
@ -649,6 +671,8 @@ csi_r ; scrolling region
* 24 is assumed value for second parameter * 24 is assumed value for second parameter
* invalid parameters exit without updating * invalid parameters exit without updating
* based on testing, row parameters are not affected by DECOM.
lda parms lda parms
beq :p1 beq :p1
dec parms dec parms
@ -680,20 +704,51 @@ csi_r ; scrolling region
beq :rts beq :rts
bmi :rts bmi :rts
* move cursor to origin.
lda parms lda parms
sta DECTM sta DECTM
sta y sta y
lda parms+1 lda parms+1
sta DECBM sta DECBM
stz x stz x
jmp recalc_cursor bit DECOM
bmi :j
stz y
:j jmp recalc_cursor
:rts rts :rts rts
csi_J ; erase csi_J ; erase screen
rts
csi_K ; erase lda parms
rts cmp #2+1
bcs :rts
asl
tax
jmp (:table,x)
:rts rts
:table
dw erase_screen_0
dw erase_screen_1
dw erase_screen_2
csi_K ; erase line
lda parms
cmp #2+1
bcs :rts
asl
tax
jmp (:table,x)
:rts rts
:table
dw erase_line_0
dw erase_line_1
dw erase_line_2
csi_q ; LEDs csi_q ; LEDs
rts rts