summaryrefslogtreecommitdiff
path: root/docs/bugs.md
diff options
context:
space:
mode:
authorRemy Oukaour <remy.oukaour@gmail.com>2017-12-12 21:16:15 -0500
committerRemy Oukaour <remy.oukaour@gmail.com>2017-12-12 21:16:15 -0500
commit7748b20c271d1802afce53ad6dc87d5d0e1c14b8 (patch)
tree1d94bb03366c05c48b3cd86747762eb31b0c0d59 /docs/bugs.md
parent370839cad72da50d6ef4024d9e9ad601755fb0b3 (diff)
GetForestTreeFrame is not technically a bug or glitch, but it's exceptional
Diffstat (limited to 'docs/bugs.md')
-rw-r--r--docs/bugs.md43
1 files changed, 43 insertions, 0 deletions
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
+```