]> git.sur5r.net Git - cc65/blobdiff - libsrc/atari/xlmemchk.inc
more atarixl linker cfg file cleanups; adapt atarixl-overlay.cfg
[cc65] / libsrc / atari / xlmemchk.inc
index 9cc6b612c354b77dfa0c53e967be0cd6cd94dd01..d2a0795579b9cb6181303acc55af9c4d25b3c998 100644 (file)
@@ -9,7 +9,7 @@
 ; by the screen memory afterwards.
 ; 
 ; inputs:
-;      __SAVEAREA_LOAD__       -       load address of the program
+;      __STARTADDRESS__        -       load address of the program
 ; outputs:
 ;      lodadr                  -       (high byte only) value to
 ;                                      write into RAMTOP
@@ -61,18 +61,24 @@ scrmemtst:
        cmp     tmp
        beq     scrmemok
 
+; if lodadr is at an exact 4K boundary, it's still ok
+
+       lda     lodadr+1
+       and     #$0f
+       beq     scrmemok
+
 ; 4K boundary will be crossed, use this 4K boundary address as lodadr
 
 al4k:  lda     lodadr+1
        and     #$f0
-       tax
-       dex
-       stx     lodadr+1
+       sta     lodadr+1
        bne     scrmemtst
 ; not reached
 
-
-lodadr:        .word   __SAVEAREA_LOAD__ & $FF00               ; our program's load address, rounded down to page boundary
+.ifdef DEBUG
+.byte "XLMEMCHK:>"
+.endif
+lodadr:        .word   __STARTADDRESS__ & $FF00                ; our program's load address, rounded down to page boundary
 tstadr:        .res    2
 lowadr:        .res    2
 tmp:   .res    1
@@ -89,6 +95,7 @@ scrmemok:
        sbc     #>DLSZ
        sta     lowadr+1
 
+.if 0  ; this cannot happen
 ; check if a 1K boundary is crossed
 
        lda     tstadr+1
@@ -98,6 +105,7 @@ scrmemok:
        and     #$fc
        cmp     tmp
        bne     al4k            ; 1K boundary will be crossed, decrease lodadr
+.endif
 
 ; address of display list is ok
 ; decrease lowadr by two