use 1-sec interrupt to flash the cursor.

This commit is contained in:
Kelvin Sherlock 2021-04-16 19:00:43 -04:00
parent 0285afc299
commit 4823852c6b

72
vt52.S
View File

@ -30,6 +30,7 @@ KEYMOD equ $c025
KEYSTROBE equ $c010 KEYSTROBE equ $c010
KBD equ $c000 KBD equ $c000
VGCINT equ $c023 VGCINT equ $c023
SCANINT equ $c032
SCCBREG equ $c038 SCCBREG equ $c038
@ -78,9 +79,10 @@ mod dw 0
* cursor * cursor
cursor_ptr adrl 0 cursor_ptr adrl 0
cursor_saved_char dw 0 cursor_saved_char dw 0
cursor_state dw 0 cursor_state dw 0
cursor_char dw 0
dend dend
@ -94,15 +96,22 @@ main
jsr init jsr init
jsr cursor_on jsr cursor_on
lda #4
tsb VGCINT ; enable 1-sec interrupt.
stz SCANINT ; reset 1-sec interrupt
loop loop
* sep #$30 * sep #$30
bit cursor_state
bpl :k
jsr cursor_on
jsr keypress :k jsr keypress
bit mode ; local ? bit mode ; local ?
bmi loop bmi loop
pea loop-1 jsr modem
jmp modem bra loop
modem modem
jsr read_modem jsr read_modem
@ -239,11 +248,27 @@ init
sta text01+2 sta text01+2
sta cursor_ptr+2 sta cursor_ptr+2
lda #"_"
sta cursor_char
lda #" " lda #" "
sta cursor_saved_char sta cursor_saved_char
stz cursor_state stz cursor_state
jsr clear_all jsr clear_all
lda #$0080
sta cursor_state
sei
lda cursor_vector
stal IRQ1SEC
lda cursor_vector+2
stal IRQ1SEC+2
cli
lda #0 ; clear high byte. lda #0 ; clear high byte.
; drop through ; drop through
@ -917,10 +942,12 @@ esc_I ; reverse line feed - cursor up w/ scroll
esc_J ; erase to end of screen esc_J ; erase to end of screen
jmp clear_eos jsr clear_eos
jmp update_cursor
esc_K ; erase to end-of-line esc_K ; erase to end-of-line
jmp clear_eol jsr clear_eol
jmp update_cursor
esc_Y ; direct cursor addressing esc_Y ; direct cursor addressing
lda #4 lda #4
@ -970,6 +997,7 @@ esc_lt ; vt100 - enter ANSI mode (exit vt52 mode).
update_cursor update_cursor
mx %11 mx %11
php php
sei
rep #$30 rep #$30
lda y lda y
@ -1030,15 +1058,16 @@ cursor_on
lda #1 lda #1
sta cursor_state sta cursor_state
lda #"_" lda cursor_char
sta [cursor_ptr] sta [cursor_ptr]
:rts plp :rts plp
rts rts
cursor_vector jml cursor_int
cursor_int cursor_int
* cursor interrupt - swap the char w/ * cursor interrupt - blink the cursor.
mx %11 mx %11
php
lda cursor_state lda cursor_state
bmi :rts bmi :rts
@ -1047,32 +1076,17 @@ cursor_int
lsr lsr
bcc :off bcc :off
:on :on
lda x
lsr
bcc :even_on
lda (cursor_ptr)
sta cursor_saved_char
lda #'_'
sta (cursor_ptr)
bra :rts
:even_on
lda [cursor_ptr] lda [cursor_ptr]
sta cursor_saved_char sta cursor_saved_char
lda #'_' lda cursor_char
sta [cursor_ptr] sta [cursor_ptr]
bra :rts bra :rts
:off :off
lda x
lsr
lda cursor_saved_char lda cursor_saved_char
bcc :even_off
sta (cursor_ptr)
bra :rts
:even_off
sta [cursor_ptr] sta [cursor_ptr]
:rts plp :rts stz SCANINT ; reset 1-sec interrupt
clc clc
rtl rtl