diff --git a/docs/bugs.md b/docs/bugs.md index 3f5679e50..06626d7db 100644 --- a/docs/bugs.md +++ b/docs/bugs.md @@ -687,3 +687,46 @@ ClearWRAM:: ; 25a ``` **Fix:** Change `jr nc, .bank_loop` to `jr c, .bank_loop`. + + +## `GetForestTreeFrame` works, but it's still bad + +[tilesets/animations.asm](tilesets/animations.asm): + +``` +GetForestTreeFrame: ; fc54c +; Return 0 if a is even, or 2 if odd. + and a + jr z, .even + cp 1 + jr z, .odd + cp 2 + jr z, .even + cp 3 + jr z, .odd + cp 4 + jr z, .even + cp 5 + jr z, .odd + cp 6 + jr z, .even +.odd + ld a, 2 + scf + ret +.even + xor a + ret +; fc56d +``` + +**Fix:** + +``` +GetForestTreeFrame: ; fc54c +; Return 0 if a is even, or 2 if odd. + and 1 + add a + ret +; fc56d +```