summaryrefslogtreecommitdiff
path: root/macros/code.asm
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2018-05-23 12:48:14 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2018-05-23 12:48:14 -0400
commit32b92ca51c73f1ad9be169bef476b9c93687e2a4 (patch)
tree310cbf0ee30c832941a1afc0da5ff35e1089c292 /macros/code.asm
parent4e776d4fa6bb0510fa06416ad7a6dd9ffe0ff724 (diff)
Start improving sprite movement engine (to do: identify bit flags)
Introduce maskbits N[, S]: optionally shift the bitmask
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