__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 {
; char cgetc (void);\r
;\r
.export _cgetc\r
+ .import cursor\r
+\r
.include "c1p.inc"\r
+ .include "extzp.inc"\r
\r
-; Direct use of input routine from 65V PROM MONITOR\r
-_cgetc = INPUTC\r
+; Input routine from 65V PROM MONITOR, show cursor if enabled\r
+_cgetc:\r
+ lda cursor ; show cursor?\r
+ beq nocursor\r
+ ldy CURS_X\r
+ lda (SCREEN_PTR),y ; fetch current character\r
+ sta CURS_SAV ; save it\r
+ lda #$A1 ; full white square\r
+ sta (SCREEN_PTR),y ; store at cursor position\r
+nocursor:\r
+ jsr INPUTC\r
+ pha ; save retrieved character\r
+ lda cursor ; was cursor on?\r
+ beq nocursor2\r
+ lda CURS_SAV ; fetch saved character\r
+ ldy CURS_X\r
+ sta (SCREEN_PTR),y ; store at cursor position\r
+nocursor2:\r
+ pla ; restore retrieved character\r
+ rts\r
; ------------------------------------------------------------------------
- .globalzp CURS_X, CURS_Y, SCR_LINELEN, SCREEN_PTR
+ .globalzp CURS_X, CURS_Y, CURS_SAV, SCR_LINELEN, SCREEN_PTR
.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