]> git.sur5r.net Git - cc65/commitdiff
Use constants for screen width and height.
authorStephan Mühlstrasser <stephan.muehlstrasser@web.de>
Thu, 12 Feb 2015 19:54:47 +0000 (20:54 +0100)
committerStephan Mühlstrasser <stephan.muehlstrasser@web.de>
Thu, 12 Feb 2015 19:54:47 +0000 (20:54 +0100)
cfg/osic1p.cfg
libsrc/osic1p/_scrsize.s
libsrc/osic1p/cputc.s
libsrc/osic1p/crt0.s
libsrc/osic1p/extzp.inc
libsrc/osic1p/extzp.s
libsrc/osic1p/osic1p.inc

index 59fdd34d8b0baa422988cbd01452818a677f8050..4771639a63e00ce29862c2c1575629d8d68b684c 100644 (file)
@@ -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 {
index 3b0d71c2f6d6ec72f80378dcb803e64aef1f707d..337fe1ee780f0920b67cca25d2a6ba14964acb19 100644 (file)
         .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
index 9cea787891c2261f13fe0ceb27eb12d302ef5a11..f6f285301b05b192fb3dd70a4f02eec154b0763c 100644 (file)
@@ -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
index 447b65c562a2ef300c934f1bbd4464ceacafecce..0db447bb0312d72a3f3db4f74f4d3a24c36ddfbe 100644 (file)
@@ -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
 
index c5bb2b5851dc32490487df163ab4cc64cd3db651..4aab34ff9aa5a2c4077c9699e6e451e55fb1379d 100644 (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
index dfa84a61c3d19f59bc040825dbf901bb1ffa5159..95f9394dcfc0a3220460cbe44b8668da952c6e33 100644 (file)
@@ -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
index e364277e0d34281c7d80ef80f3ab8a471ce858f5..58d63632f88a51f8fd923367249c3c88deef0208 100644 (file)
@@ -5,3 +5,5 @@ RESET           := $FF00    ; Reset address, show boot prompt
 \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