fix for possible cursor-related scren corruption

This commit is contained in:
FeralChild64 committed 2020-08-23 22:44:22 +02:00
1 parent 0b747ded64
commit 7527c7a220
3 files changed
+48 -10

No files matched your search

+13 -5
View File
@@ -50,6 +50,9 @@ cursor_draw:
bne cursor_blink_timer_reset // branches always
// XXX code below is probably not 100% safe
cursor_disable:
lda #$80
@@ -59,23 +62,27 @@ cursor_disable:
cursor_hide_if_visible:
// Set countdown to high value, to prevent IRQ interference
lda #$FF
sta BLNCT
// If cursor is not visible, nothing to do
lda BLNON
beq cursor_blink_end
beq cursor_blink_timer_reset
// FALLTROUGH
cursor_undraw:
// Prevent interrupts from updating cursor
lda #0
sta BLNON
jsr screen_get_clipped_PNTR
lda GDBLN
sta (PNT),y
lda GDCOL
sta (USER),y
lda #0
sta BLNON
// FALLTROUGH
cursor_blink_timer_reset:
@@ -87,4 +94,5 @@ cursor_blink_timer_reset:
// FALLTROUGH
cursor_blink_end:
rts
+2
View File
@@ -12,6 +12,7 @@
cursor_show_if_enabled:
lda BLNSW
bne cursor_show_end
lda BLNON
@@ -36,4 +37,5 @@ cursor_show:
// FALLTROUGH
cursor_show_end:
rts
+33 -5
View File
@@ -10,10 +10,28 @@
// - GDCOL (colour under cursor)
//
m65_cursor_disable: // XXX utilize this!
// Make sure IRQ won't interfere by increasing the counter XXX reuse in legacy mode
lda #$FF
sta BLNCT
// Disable cursor blinking
lda #$80
sta BLNSW
// FALLTHROUGH
m65_cursor_hide_if_visible:
// Set countdown to high value, to prevent IRQ interference
lda #$FF
sta BLNCT
// If cursor is not visible, nothing to do
lda BLNON
beq m65_cursor_end
beq m65_cursor_blink_timer_reset
// FALLTROUGH
@@ -21,8 +39,10 @@ m65_cursor_undraw:
// XXX provide implementation
lda #$80
sta BLNSW
// Mark cursor as not drawn
lda #0
sta BLNON
rts
@@ -35,6 +55,14 @@ m65_cursor_show_if_enabled:
// FALLTROUGH
m65_cursor_end:
m65_cursor_blink_timer_reset: // XXX reuse code from main KERNAL
rts
// Rest blink counter (Mapping the 64, p39-40)
lda #20
sta BLNCT
// FALLTROUGH
m65_cursor_blink_end:
rts