summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi@gmail.com>2018-05-28 11:25:55 -0400
committerRangi <remy.oukaour+rangi@gmail.com>2018-05-28 11:25:55 -0400
commit5e4a6aea518e73798ea13c4e4a90f3afd9b24cce (patch)
tree3ea0ab7ce4eba106c36a389137ae375a4f49e84b
parent21abc06448e3929c7f40063cffe7f1ee8be3ad5a (diff)
Use the maskbits macro from pokecrystal PR 514
-rw-r--r--macros/code.asm8
1 files changed, 7 insertions, 1 deletions
diff --git a/macros/code.asm b/macros/code.asm
index 1fb651f..09b1525 100644
--- a/macros/code.asm
+++ b/macros/code.asm
@@ -36,8 +36,10 @@ jumptable: MACRO
ENDM
maskbits: MACRO
-; masks just enough bits to cover the argument
+; masks just enough bits to cover the first argument
+; the second argument is an optional shift amount
; e.g. "maskbits 26" becomes "and %00011111" (since 26 - 1 = %00011001)
+; and "maskbits 3, 2" becomes "and %00001100" (since "maskbits 3" becomes %00000011)
; example usage in rejection sampling:
; .loop
; call Random
@@ -50,7 +52,11 @@ if x + 1 < (\1)
x = x << 1 | 1
endc
endr
+if _NARG == 2
+ and x << (\2)
+else
and x
+endc
ENDM
calc_sine_wave: MACRO