From 00591676dcf5228d2389b118414ff8a1a9b2c77b Mon Sep 17 00:00:00 2001 From: Paul Gardner-Stephen Date: Sat, 20 Apr 2019 23:43:12 +0930 Subject: [PATCH] make cursor visible immediately after printing a character, but for only 1 frame, to match C64 KERNAL behaviour --- c64/kernal/blink_cursor.s | 13 +++++++++++++ c64/kernal/chrout.s | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/c64/kernal/blink_cursor.s b/c64/kernal/blink_cursor.s index 09aa3cc3..4dd8e55c 100644 --- a/c64/kernal/blink_cursor.s +++ b/c64/kernal/blink_cursor.s @@ -4,6 +4,19 @@ ;; cursor_saved_character ;; cursor_is_visible ;; colour_under_cursor + +show_cursor: + ;; Set cursor as though it had just finished the off phase, + ;; so that the call to blink_cursor paints it + lda #$00 + sta cursor_blink_countdown + sta cursor_is_visible + jsr blink_cursor + ;; Then set the timeout to 1 frame, so that the cursor + ;; blinks under key repeat conditions, like on the original KERNAL + lda #$01 + sta cursor_blink_countdown + rts blink_cursor: ;; Is the cursor enabled? diff --git a/c64/kernal/chrout.s b/c64/kernal/chrout.s index 479234b9..ff871bfe 100644 --- a/c64/kernal/chrout.s +++ b/c64/kernal/chrout.s @@ -136,7 +136,10 @@ chrout_l1: bcc no_screen_advance_to_next_line jmp screen_advance_to_next_line no_screen_advance_to_next_line: -chrout_done: +chrout_done: + ;; Make cursor immediately visible + jsr show_cursor + ;; Restore X and Y, set carry to mark success on exit pla tay