1
0
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:
Stephan Mühlstrasser 2015-02-12 20:54:47 +01:00
parent 5063e0ecca
commit 679f5aa675
7 changed files with 10 additions and 18 deletions

View File

@ -7,7 +7,7 @@ SYMBOLS {
} }
MEMORY { MEMORY {
# for size of ZP see runtime/zeropage.s and c1p/extzp.s # 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; RAM: file = %O, define = yes, start = %S, size = __HIMEM__ - __STACKSIZE__ - %S;
} }
SEGMENTS { SEGMENTS {

View File

@ -10,12 +10,10 @@
.export screensize .export screensize
.include "extzp.inc" .include "extzp.inc"
.include "osic1p.inc"
.proc screensize .proc screensize
ldx #(SCR_LINELEN + 1)
ldx SCR_LINELEN ldy #(SCR_HEIGHT + 1)
inx ; Variable is one less
ldy #25
rts rts
.endproc .endproc

View File

@ -35,7 +35,7 @@ cputdirect:
; Advance cursor position ; Advance cursor position
advance: advance:
cpy SCR_LINELEN ; xsize-1 cpy #SCR_LINELEN ; xsize-1
bne L3 bne L3
jsr newline ; new line jsr newline ; new line
ldy #$FF ; + cr ldy #$FF ; + cr
@ -46,7 +46,7 @@ L3: iny
newline: newline:
inc CURS_Y inc CURS_Y
lda CURS_Y lda CURS_Y
cmp #24 ; screen height 25 lines hardcoded cmp #SCR_HEIGHT ; screen height
bne plot bne plot
lda #0 ; wrap around to line 0 lda #0 ; wrap around to line 0
sta CURS_Y sta CURS_Y

View File

@ -28,13 +28,6 @@ _init: ldx #$FF ; Initialize stack pointer to $01FF
txs txs
cld ; Clear decimal mode 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 ; Set cc65 argument stack pointer

View File

@ -4,4 +4,4 @@
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
.globalzp CURS_X, CURS_Y, CURS_SAV, SCR_LINELEN, SCREEN_PTR .globalzp CURS_X, CURS_Y, CURS_SAV, SCREEN_PTR

View File

@ -14,8 +14,7 @@
CURS_X: .byte 0 CURS_X: .byte 0
CURS_Y: .byte 0 CURS_Y: .byte 0
CURS_SAV: .byte 0 CURS_SAV: .byte 0
SCR_LINELEN: .byte 24
SCREEN_PTR: .res 2 SCREEN_PTR: .res 2
; size 6 ; size 5
; Adjust size of this segment in osic1p.cfg if the size changes ; Adjust size of this segment in osic1p.cfg if the size changes

View File

@ -5,3 +5,5 @@ RESET := $FF00 ; Reset address, show boot prompt
; Other definitions ; Other definitions
VIDEORAMSIZE = $0400 ; Size of C1P video RAM (1 kB) VIDEORAMSIZE = $0400 ; Size of C1P video RAM (1 kB)
SCR_LINELEN = $18 ; screen width - 1
SCR_HEIGHT = $18 ; screen height - 1