}
MEMORY {
# for size of ZP see runtime/zeropage.s and c1p/extzp.s
- ZP: file = "", define = yes, start = $0002, size = $001A + $0006;
+ ZP: file = "", define = yes, start = $0002, size = $001A + $0005;
RAM: file = %O, define = yes, start = %S, size = __HIMEM__ - __STACKSIZE__ - %S;
}
SEGMENTS {
.export screensize
.include "extzp.inc"
+ .include "osic1p.inc"
.proc screensize
-
- ldx SCR_LINELEN
- inx ; Variable is one less
- ldy #25
+ ldx #(SCR_LINELEN + 1)
+ ldy #(SCR_HEIGHT + 1)
rts
-
.endproc
; Advance cursor position
advance:
- cpy SCR_LINELEN ; xsize-1
+ cpy #SCR_LINELEN ; xsize-1
bne L3
jsr newline ; new line
ldy #$FF ; + cr
newline:
inc CURS_Y
lda CURS_Y
- cmp #24 ; screen height 25 lines hardcoded
+ cmp #SCR_HEIGHT ; screen height
bne plot
lda #0 ; wrap around to line 0
sta CURS_Y
txs
cld ; Clear decimal mode
-; ---------------------------------------------------------------------------
-; Initialize screen width
-; TODO: Can initialization be done in a more idiomatic way?
-; TODO: Create function for changing screen width
- lda #$18
- sta SCR_LINELEN
-
; ---------------------------------------------------------------------------
; Set cc65 argument stack pointer
; ------------------------------------------------------------------------
- .globalzp CURS_X, CURS_Y, CURS_SAV, SCR_LINELEN, SCREEN_PTR
+ .globalzp CURS_X, CURS_Y, CURS_SAV, SCREEN_PTR
CURS_X: .byte 0
CURS_Y: .byte 0
CURS_SAV: .byte 0
-SCR_LINELEN: .byte 24
SCREEN_PTR: .res 2
-; size 6
+; size 5
; Adjust size of this segment in osic1p.cfg if the size changes
\r
; Other definitions\r
VIDEORAMSIZE = $0400 ; Size of C1P video RAM (1 kB)\r
+SCR_LINELEN = $18 ; screen width - 1\r
+SCR_HEIGHT = $18 ; screen height - 1\r