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 bne cursor_blink_timer_reset // branches always
// XXX code below is probably not 100% safe
cursor_disable: cursor_disable:
lda #$80 lda #$80
@@ -59,23 +62,27 @@ cursor_disable:
cursor_hide_if_visible: 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 lda BLNON
beq cursor_blink_end beq cursor_blink_timer_reset
// FALLTROUGH // FALLTROUGH
cursor_undraw: cursor_undraw:
// Prevent interrupts from updating cursor
lda #0
sta BLNON
jsr screen_get_clipped_PNTR jsr screen_get_clipped_PNTR
lda GDBLN lda GDBLN
sta (PNT),y sta (PNT),y
lda GDCOL lda GDCOL
sta (USER),y sta (USER),y
lda #0
sta BLNON
// FALLTROUGH // FALLTROUGH
cursor_blink_timer_reset: cursor_blink_timer_reset:
@@ -87,4 +94,5 @@ cursor_blink_timer_reset:
// FALLTROUGH // FALLTROUGH
cursor_blink_end: cursor_blink_end:
rts rts
+2
View File
@@ -12,6 +12,7 @@
cursor_show_if_enabled: cursor_show_if_enabled:
lda BLNSW lda BLNSW
bne cursor_show_end bne cursor_show_end
lda BLNON lda BLNON
@@ -36,4 +37,5 @@ cursor_show:
// FALLTROUGH // FALLTROUGH
cursor_show_end: cursor_show_end:
rts rts
+33 -5
View File
@@ -10,10 +10,28 @@
// - GDCOL (colour under cursor) // - 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: 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 lda BLNON
beq m65_cursor_end beq m65_cursor_blink_timer_reset
// FALLTROUGH // FALLTROUGH
@@ -21,8 +39,10 @@ m65_cursor_undraw:
// XXX provide implementation // XXX provide implementation
lda #$80
sta BLNSW // Mark cursor as not drawn
lda #0
sta BLNON
rts rts
@@ -35,6 +55,14 @@ m65_cursor_show_if_enabled:
// FALLTROUGH // 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