From ac88639f4a9bdcb40388d6afd04dae032f74b951 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stephan=20M=C3=BChlstrasser?= Date: Sat, 29 Nov 2014 20:07:30 +0100 Subject: [PATCH] Implemented cursor functionality. --- cfg/c1p.cfg | 3 ++- libsrc/c1p/cgetc.s | 25 +++++++++++++++++++++++-- libsrc/c1p/extzp.inc | 2 +- libsrc/c1p/extzp.s | 8 +++----- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/cfg/c1p.cfg b/cfg/c1p.cfg index 46015017b..2f48dd084 100644 --- a/cfg/c1p.cfg +++ b/cfg/c1p.cfg @@ -14,7 +14,8 @@ SYMBOLS { __HIMEM__: type = weak, value = $2000; # Presumed RAM end } MEMORY { - ZP: file = "", define = yes, start = $0002, size = $001A + $0005; + # for size of ZP see runtime/zeropage.s and c1p/extzp.s + ZP: file = "", define = yes, start = $0002, size = $001A + $0006; RAM: file = %O, define = yes, start = %S, size = __HIMEM__ - __STACKSIZE__ - %S; } SEGMENTS { diff --git a/libsrc/c1p/cgetc.s b/libsrc/c1p/cgetc.s index a73866a56..b17e76572 100644 --- a/libsrc/c1p/cgetc.s +++ b/libsrc/c1p/cgetc.s @@ -2,7 +2,28 @@ ; char cgetc (void); ; .export _cgetc + .import cursor + .include "c1p.inc" + .include "extzp.inc" -; Direct use of input routine from 65V PROM MONITOR -_cgetc = INPUTC +; Input routine from 65V PROM MONITOR, show cursor if enabled +_cgetc: + lda cursor ; show cursor? + beq nocursor + ldy CURS_X + lda (SCREEN_PTR),y ; fetch current character + sta CURS_SAV ; save it + lda #$A1 ; full white square + sta (SCREEN_PTR),y ; store at cursor position +nocursor: + jsr INPUTC + pha ; save retrieved character + lda cursor ; was cursor on? + beq nocursor2 + lda CURS_SAV ; fetch saved character + ldy CURS_X + sta (SCREEN_PTR),y ; store at cursor position +nocursor2: + pla ; restore retrieved character + rts diff --git a/libsrc/c1p/extzp.inc b/libsrc/c1p/extzp.inc index 0f9632df2..c5bb2b585 100644 --- a/libsrc/c1p/extzp.inc +++ b/libsrc/c1p/extzp.inc @@ -4,4 +4,4 @@ ; ------------------------------------------------------------------------ - .globalzp CURS_X, CURS_Y, SCR_LINELEN, SCREEN_PTR + .globalzp CURS_X, CURS_Y, CURS_SAV, SCR_LINELEN, SCREEN_PTR diff --git a/libsrc/c1p/extzp.s b/libsrc/c1p/extzp.s index 139feffde..c55156f82 100644 --- a/libsrc/c1p/extzp.s +++ b/libsrc/c1p/extzp.s @@ -11,13 +11,11 @@ .segment "EXTZP" : zeropage -; The following values get initialized from a table in the startup code. -; While this sounds crazy, it has reasons that have to do with modules (and -; we have the space anyway). So when changing anything, be sure to adjust the -; initializer table CURS_X: .byte 0 CURS_Y: .byte 0 +CURS_SAV: .byte 0 SCR_LINELEN: .byte 24 SCREEN_PTR: .res 2 -; size 5 +; size 6 +; Adjust size of this segment in c1p.cfg if the size changes -- 2.39.5