diff options
author | yenatch <yenatch@gmail.com> | 2018-01-22 01:06:48 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-22 01:06:48 -0500 |
commit | c60f1331fef22b886adf3472d2b4f348832cfaf7 (patch) | |
tree | 5a471fad61e406f5b3ca1aba67ced0186de01c52 /macros/code.asm | |
parent | f27f79488a460f0a89670f3611e1e9e175baf5d6 (diff) | |
parent | 7fba864883732ccecb1221ae7ff97492d112362a (diff) |
Merge pull request #456 from Rangi42/master
OAM data documentation; move more content into data/; move palettes into gfx/; more code+script constants; consistent map naming
Diffstat (limited to 'macros/code.asm')
-rw-r--r-- | macros/code.asm | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/macros/code.asm b/macros/code.asm index 5ec214d50..799c27d45 100644 --- a/macros/code.asm +++ b/macros/code.asm @@ -35,10 +35,9 @@ jumptable: MACRO jp hl ENDM -; Many mobile functions were dummied out in localization. -mobile EQUS "ret" - maskbits: MACRO +; masks just enough bits to cover the argument +; e.g. "maskbits 26" becomes "and %00011111" (since 26 - 1 = %00011001) ; example usage in rejection sampling: ; .loop ; call Random @@ -47,8 +46,8 @@ maskbits: MACRO ; jr nc, .loop x = 1 rept 8 -if \1 > x -x = (x + 1) * 2 +- 1 +if x + 1 < (\1) +x = x << 1 | 1 endc endr and x |