]> git.sur5r.net Git - cc65/commitdiff
xlmemchk.inc: Fix wrong calculation if load address is at an exact 4K border.
authorChristian Groessler <chris@groessler.org>
Tue, 27 Aug 2013 20:45:23 +0000 (22:45 +0200)
committerChristian Groessler <chris@groessler.org>
Tue, 27 Aug 2013 20:45:23 +0000 (22:45 +0200)
libsrc/atari/xlmemchk.inc

index 9cc6b612c354b77dfa0c53e967be0cd6cd94dd01..81e09ba9040c18329f247b70fd1e2daf89f2c058 100644 (file)
@@ -61,13 +61,17 @@ 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
 
@@ -89,6 +93,7 @@ scrmemok:
        sbc     #>DLSZ
        sta     lowadr+1
 
+.if 0  ; this cannot happen
 ; check if a 1K boundary is crossed
 
        lda     tstadr+1
@@ -98,6 +103,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