summaryrefslogtreecommitdiff
path: root/macros.asm
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2016-08-11 15:55:32 -0400
committerGitHub <noreply@github.com>2016-08-11 15:55:32 -0400
commit700321a7fb2d6c852ffc91cc0b8867526cb76813 (patch)
tree1a81b2ef5a4d7a2e5a9433e990ea178f5083acbf /macros.asm
parentc33ba049a5a993fc678fd1698645039ce4974022 (diff)
parent050a0162b89c645c4a2a3ed311c4da791fb3de6c (diff)
Merge pull request #342 from PikalaxALT/master
More label interpretations
Diffstat (limited to 'macros.asm')
-rw-r--r--macros.asm50
1 files changed, 47 insertions, 3 deletions
diff --git a/macros.asm b/macros.asm
index 6656ca038..c4fd73b3e 100644
--- a/macros.asm
+++ b/macros.asm
@@ -140,7 +140,14 @@ lda_coord: MACRO
; pic animations
frame: MACRO
db \1
- db \2
+x = \2
+IF _NARG > 2
+rept _NARG +- 2
+x = x | (1 << (\3 + 1))
+ shift
+endr
+endc
+ db x
ENDM
setrepeat: MACRO
db $fe
@@ -155,6 +162,12 @@ endanim: MACRO
ENDM
+delanim: MACRO
+ db $fc
+ ENDM
+dorestart: MACRO
+ db $fe
+ ENDM
sine_wave: MACRO
; \1: amplitude
@@ -244,9 +257,9 @@ debgcoord EQUS "bgcoord de,"
bcbgcoord EQUS "bgcoord bc,"
bgrows EQUS "* $20"
-palred EQUS "$0400 *"
+palred EQUS "$0001 *"
palgreen EQUS "$0020 *"
-palblue EQUS "$0001 *"
+palblue EQUS "$0400 *"
dsprite: MACRO
; conditional segment is there because not every instance of
@@ -270,3 +283,34 @@ jumptable: MACRO
ld l, a
jp [hl]
endm
+
+maskbits: macro
+; returns to x
+; usage in rejection sampling
+; .loop
+; call Random
+; maskbits 30
+; and x
+; cp 30
+; jr nc, .loop
+
+x = 1
+rept 8
+IF \1 > x
+x = (x + 1) * 2 +- 1
+ENDC
+endr
+endm
+
+homecall: MACRO
+ ld a, [hROMBank]
+ push af
+ ld a, BANK(\1)
+ rst Bankswitch
+
+ call \1
+
+ pop af
+ rst Bankswitch
+ENDM
+