Clean up bugs commented in the source code (#912)

Co-authored-by: Rangi <remy.oukaour+rangi42@gmail.com>
This commit is contained in:
vulcandth
2022-07-09 16:12:02 -05:00
committed by GitHub
parent bd27c0d8dc
commit ef9b9bb437
49 changed files with 267 additions and 324 deletions

View File

@@ -186,6 +186,7 @@ ClearVRAM::
ClearWRAM::
; Wipe swappable WRAM banks (1-7)
; Assumes CGB or AGB
; BUG: ClearWRAM only clears WRAM bank 1 (see docs/bugs_and_glitches.md)
ld a, 1
.bank_loop
@@ -198,7 +199,7 @@ ClearWRAM::
pop af
inc a
cp 8
jr nc, .bank_loop ; Should be jr c
jr nc, .bank_loop
ret
ClearsScratch::

View File

@@ -146,12 +146,10 @@ LoadMetatiles::
ld e, l
ld d, h
; Set hl to the address of the current metatile data ([wTilesetBlocksAddress] + (a) tiles).
; This is buggy; it wraps around past 128 blocks.
; To fix, uncomment the line below.
add a ; Comment or delete this line to fix the above bug.
; BUG: LoadMetatiles wraps around past 128 blocks (see docs/bugs_and_glitches.md)
add a
ld l, a
ld h, 0
; add hl, hl
add hl, hl
add hl, hl
add hl, hl
@@ -584,18 +582,16 @@ ReadObjectEvents::
call CopyMapObjectEvents
; get NUM_OBJECTS - [wCurMapObjectEventCount]
; BUG: ReadObjectEvents overflows into wObjectMasks (see docs/bugs_and_glitches.md)
ld a, [wCurMapObjectEventCount]
ld c, a
ld a, NUM_OBJECTS ; - 1
ld a, NUM_OBJECTS
sub c
jr z, .skip
; jr c, .skip
; could have done "inc hl" instead
ld bc, 1
add hl, bc
; Fill the remaining sprite IDs and y coords with 0 and -1, respectively.
; Bleeds into wObjectMasks due to a bug. Uncomment the above code to fix.
ld bc, MAPOBJECT_LENGTH
.loop
ld [hl], 0