cursor WIP

This commit is contained in:
Kelvin Sherlock 2021-04-06 23:44:25 -04:00
parent bbadb81a73
commit f458f27860
1 changed files with 30 additions and 13 deletions

43
vt52.S
View File

@ -75,6 +75,8 @@ main
cli cli
jsr init jsr init
jsr cursor_on
mx %00 mx %00
lda #0 lda #0
loop loop
@ -136,6 +138,7 @@ keypress
bne :send bne :send
lda #$08 lda #$08
:send jsr vt52 :send jsr vt52
jsr cursor_on
bra loop bra loop
@ -173,6 +176,10 @@ init
sta text01+2 sta text01+2
sta cursor_ptr+2 sta cursor_ptr+2
lda #" "
sta cursor_saved_char
stz cursor_state
jmp clear_all jmp clear_all
@ -412,6 +419,9 @@ text
vt52 vt52
mx %11 mx %11
tay ; save
jsr cursor_off
tya
and #$7f and #$7f
cmp #' ' cmp #' '
@ -597,6 +607,9 @@ ctrl_0a ; line feed - cursor down w/ scroll
lda y lda y
cmp #23 cmp #23
blt :simple blt :simple
lda #" "
sta cursor_saved_char
jmp scroll_down jmp scroll_down
:simple :simple
@ -618,8 +631,7 @@ esc_A ; cursor up w/o scroll
esc_B ; cursor down w/o scroll esc_B ; cursor down w/o scroll
lda y lda y
inc cmp #23
cmp #24
bcs :rts bcs :rts
inc y inc y
jmp update_cursor jmp update_cursor
@ -628,7 +640,6 @@ esc_B ; cursor down w/o scroll
esc_C ; cursor right w/o wrap esc_C ; cursor right w/o wrap
lda x lda x
inc
cmp #79 cmp #79
bcs :rts bcs :rts
inc x inc x
@ -664,6 +675,8 @@ esc_I ; reverse line feed - cursor up w/ scroll
lda y lda y
bne :simple bne :simple
lda #" "
sta cursor_saved_char
jmp scroll_up jmp scroll_up
:simple :simple
dec y dec y
@ -712,7 +725,6 @@ esc_lt ; vt100 - enter ANSI mode (exit vt52 mode).
update_cursor update_cursor
* todo - cursor stuff.
mx %11 mx %11
php php
rep #$30 rep #$30
@ -724,12 +736,22 @@ update_cursor
sta text00 sta text00
sta text01 sta text01
sta cursor_ptr sta cursor_ptr
lda x
and #1
eor #1
sta cursor_ptr+2
lda x lda x
lsr lsr
clc clc
adc cursor_ptr adc cursor_ptr
sta cursor_ptr sta cursor_ptr
lda [cursor_ptr]
and #$00ff
sta cursor_saved_char
plp plp
rts rts
@ -744,15 +766,7 @@ cursor_off
lsr lsr
bcc :simple bcc :simple
lda x
lsr
lda cursor_saved_char lda cursor_saved_char
bcc :even
sta (cursor_ptr)
bra :simple
:even
sta [cursor_ptr] sta [cursor_ptr]
:simple :simple
@ -771,7 +785,10 @@ cursor_on
lda cursor_state lda cursor_state
bpl :rts bpl :rts
stz cursor_state lda #1
sta cursor_state
lda #"_"
sta [cursor_ptr]
:rts plp :rts plp
rts rts