From 7ba7c6f69ac854177f52ab261a1325206b0caf95 Mon Sep 17 00:00:00 2001 From: Karri Kaksonen Date: Thu, 7 Apr 2022 08:17:36 +0300 Subject: [PATCH] Add blinking cursor --- cfg/atari7800.cfg | 2 +- libsrc/atari7800/setcursor.s | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/cfg/atari7800.cfg b/cfg/atari7800.cfg index 04216f3bd..160d1e58e 100644 --- a/cfg/atari7800.cfg +++ b/cfg/atari7800.cfg @@ -10,7 +10,7 @@ SYMBOLS { __ENCRYPT_BOTTOM__: value = $ff7a, type = export; __ENCRYPT_SIZE__: value = $80, type = export; __MEMORY_TOP__: value = __ENCRYPT_BOTTOM__, type = export; - __INIT_SIZE__: value = 139+9, type = export; + __INIT_SIZE__: value = 154, type = export; __MEMORY_INIT__: value = __MEMORY_TOP__ - __INIT_SIZE__, type = export; __MEMORY_BOTTOM__: value = $10000 - __CARTSIZE__, type = weak; __FREE_ROM_SIZE__: value = __MEMORY_INIT__ - __MEMORY_BOTTOM__, type = export; diff --git a/libsrc/atari7800/setcursor.s b/libsrc/atari7800/setcursor.s index 81a89144b..0b49fe097 100644 --- a/libsrc/atari7800/setcursor.s +++ b/libsrc/atari7800/setcursor.s @@ -27,6 +27,7 @@ .export gotoxy, _gotoxy, _gotox, _gotoy, _wherex, _wherey .export CURS_X, CURS_Y .constructor init_cursor + .interruptor blink_cursor .importzp sp .import _zones @@ -47,6 +48,8 @@ CURS_Y: .byte 0 _cursor_visible: .byte 1 +blink_time: + .byte 140 .code @@ -208,7 +211,26 @@ umula0: ; Initialize cursorzone at startup ; Offset to cursor zone 5. ; -; .segment "ONCE" + .proc blink_cursor + inc blink_time + bne @L3 + lda #140 + sta blink_time + ldy #0 + lda (cursorzone),y + bne @L1 + lda #254 + bne @L2 +@L1: lda #0 +@L2: sta (cursorzone),y +@L3: rts + .endproc + +;----------------------------------------------------------------------------- +; Initialize cursorzone at startup +; Offset to cursor zone 5. +; + .segment "ONCE" init_cursor: lda #0 jsr calccursorzone