xlmemchk.inc: Fix wrong calculation if load address is at an exact 4K border.

This commit is contained in:
Christian Groessler
2013-08-27 22:45:23 +02:00
parent e12fbe35a8
commit ae9ab59549

View File

@@ -61,13 +61,17 @@ scrmemtst:
cmp tmp cmp tmp
beq scrmemok 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 ; 4K boundary will be crossed, use this 4K boundary address as lodadr
al4k: lda lodadr+1 al4k: lda lodadr+1
and #$f0 and #$f0
tax sta lodadr+1
dex
stx lodadr+1
bne scrmemtst bne scrmemtst
; not reached ; not reached
@@ -89,6 +93,7 @@ scrmemok:
sbc #>DLSZ sbc #>DLSZ
sta lowadr+1 sta lowadr+1
.if 0 ; this cannot happen
; check if a 1K boundary is crossed ; check if a 1K boundary is crossed
lda tstadr+1 lda tstadr+1
@@ -98,6 +103,7 @@ scrmemok:
and #$fc and #$fc
cmp tmp cmp tmp
bne al4k ; 1K boundary will be crossed, decrease lodadr bne al4k ; 1K boundary will be crossed, decrease lodadr
.endif
; address of display list is ok ; address of display list is ok
; decrease lowadr by two ; decrease lowadr by two