summaryrefslogtreecommitdiff
path: root/macros/code.asm
diff options
context:
space:
mode:
authormid-kid <esteve.varela@gmail.com>2018-06-04 11:05:53 +0200
committermid-kid <esteve.varela@gmail.com>2018-06-04 11:05:53 +0200
commit5e9c785b3f5c4638e61a0e58a11b79566a054636 (patch)
tree681ea4c043ed2c4d001ced844303151e66e3dcbf /macros/code.asm
parent17087489c6b2466b1d4b2d22d7760604d3e755f8 (diff)
parentd596a0c83bfbb97bff5cdb5b3bba925d3f798fa1 (diff)
Merge branch 'master' of https://github.com/pret/pokecrystal
Diffstat (limited to 'macros/code.asm')
-rw-r--r--macros/code.asm8
1 files changed, 7 insertions, 1 deletions
diff --git a/macros/code.asm b/macros/code.asm
index 1fb651f30..09b15255e 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