mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
Use constants for screen width and height.
This commit is contained in:
parent
5063e0ecca
commit
679f5aa675
@ -7,7 +7,7 @@ SYMBOLS {
|
||||
}
|
||||
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 {
|
||||
|
@ -10,12 +10,10 @@
|
||||
.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
|
||||
|
@ -35,7 +35,7 @@ cputdirect:
|
||||
; Advance cursor position
|
||||
|
||||
advance:
|
||||
cpy SCR_LINELEN ; xsize-1
|
||||
cpy #SCR_LINELEN ; xsize-1
|
||||
bne L3
|
||||
jsr newline ; new line
|
||||
ldy #$FF ; + cr
|
||||
@ -46,7 +46,7 @@ L3: iny
|
||||
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
|
||||
|
@ -28,13 +28,6 @@ _init: ldx #$FF ; Initialize stack pointer to $01FF
|
||||
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
|
||||
|
||||
|
@ -4,4 +4,4 @@
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.globalzp CURS_X, CURS_Y, CURS_SAV, SCR_LINELEN, SCREEN_PTR
|
||||
.globalzp CURS_X, CURS_Y, CURS_SAV, SCREEN_PTR
|
||||
|
@ -14,8 +14,7 @@
|
||||
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
|
||||
|
@ -5,3 +5,5 @@ RESET := $FF00 ; Reset address, show boot prompt
|
||||
|
||||
; Other definitions
|
||||
VIDEORAMSIZE = $0400 ; Size of C1P video RAM (1 kB)
|
||||
SCR_LINELEN = $18 ; screen width - 1
|
||||
SCR_HEIGHT = $18 ; screen height - 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user