hide cursor when drawing, minor other fixes

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-19 23:40:51 +09:30
1 parent c46a4aa1dd
commit 415d5a94bb
3 files changed
+58 -3

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
;; We have the following variables:
;; cursor_blink_disable
;; cursor_blink_countdown
;; cursor_saved_character
;; cursor_is_visible
;; colour_under_cursor
blink_cursor:
;; Is the cursor enabled?
bit cursor_blink_disable
bne no_blink_cursor
;; Do we need to redraw things?
dec cursor_blink_countdown
bpl no_blink_cursor
;; XXX - Save character colour also!
;; Check if cursor was visible or not, and toggle
lda cursor_is_visible
bne undraw_cursor
draw_cursor:
ldy current_screen_x
lda (current_screen_line_ptr),y
sta cursor_saved_character
eor #$80
sta (current_screen_line_ptr),y
lda #1
sta cursor_is_visible
jmp reset_blink_timer
undraw_cursor:
lda cursor_saved_character
ldy current_screen_x
sta (current_screen_line_ptr),y
lda #0
sta cursor_is_visible
;; Fall through
reset_blink_timer:
;; Rest blink counter
;; (Compute's Mapping the 64, p39-40)
lda #20
sta cursor_blink_countdown
no_blink_cursor:
rts
hide_cursor_if_visible:
bit cursor_is_visible
bne undraw_cursor
rts
+3 -1
View File
@@ -11,10 +11,12 @@ chrout:
pha
tya
pha
jsr hide_cursor_if_visible
lda last_printed_character_ascii
tax
;; Check for special characters
;; Linefeed (simply ignored)
+4 -2
View File
@@ -21,8 +21,10 @@ irq_handler:
;; (but only if initialised)
lda $0314
ora $0315
beq no_handler_installed
beq default_irq_handler
jmp ($0314)
no_handler_installed:
default_irq_handler:
jsr blink_cursor
jmp return_from_interrupt