summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
Diffstat (limited to 'macros')
-rw-r--r--macros/map.asm26
-rw-r--r--macros/mobile.asm2
-rw-r--r--macros/predef.asm21
-rw-r--r--macros/rst.asm17
-rw-r--r--macros/sound.asm32
-rw-r--r--macros/text.asm33
6 files changed, 124 insertions, 7 deletions
diff --git a/macros/map.asm b/macros/map.asm
index 297646a79..ef62f386f 100644
--- a/macros/map.asm
+++ b/macros/map.asm
@@ -1,3 +1,29 @@
+map: MACRO
+; This is a silly hack to get around an rgbds bug.
+
+; Ideally:
+; db GROUP_\1, MAP_\1
+
+\1\@ EQUS "GROUP_\1"
+\1\@2 EQUS "MAP_\1"
+ db \1\@, \1\@2
+ENDM
+
+roam_map: MACRO
+; A map and an arbitrary number of some more maps.
+
+ map \1
+ db \2
+
+ rept \2
+ map \3
+ shift
+ endr
+
+ db 0
+ENDM
+
+
person_event: macro
db \1 ; sprite
db \2 ; y
diff --git a/macros/mobile.asm b/macros/mobile.asm
new file mode 100644
index 000000000..06b40d694
--- /dev/null
+++ b/macros/mobile.asm
@@ -0,0 +1,2 @@
+; Many mobile functions were dummied out in localization.
+mobile EQUS "ret"
diff --git a/macros/predef.asm b/macros/predef.asm
new file mode 100644
index 000000000..d6c0344e6
--- /dev/null
+++ b/macros/predef.asm
@@ -0,0 +1,21 @@
+add_predef: MACRO
+\1Predef::
+ dw \1
+ db BANK(\1)
+ENDM
+
+predef_id: MACRO
+; Some functions load the predef id
+; without immediately calling Predef.
+ ld a, (\1Predef - PredefPointers) / 3
+ENDM
+
+predef: MACRO
+ predef_id \1
+ call Predef
+ENDM
+
+predef_jump: MACRO
+ predef_id \1
+ jp Predef
+ENDM
diff --git a/macros/rst.asm b/macros/rst.asm
new file mode 100644
index 000000000..50259c968
--- /dev/null
+++ b/macros/rst.asm
@@ -0,0 +1,17 @@
+FarCall EQU $08
+Bankswitch EQU $10
+JumpTable EQU $28
+
+farcall: MACRO ; bank, address
+ ld a, BANK(\1)
+ ld hl, \1
+ rst FarCall
+ ENDM
+
+callba EQUS "farcall"
+
+callab: MACRO ; address, bank
+ ld hl, \1
+ ld a, BANK(\1)
+ rst FarCall
+ ENDM
diff --git a/macros/sound.asm b/macros/sound.asm
index 38c72f1cf..8b8de34b2 100644
--- a/macros/sound.asm
+++ b/macros/sound.asm
@@ -1,3 +1,35 @@
+note: MACRO
+ dn (\1), (\2) - 1
+ ENDM
+
+sound: macro
+ db \1 ; duration
+ db \2 ; intensity
+ dw \3 ; frequency
+ endm
+
+noise: macro
+ db \1 ; duration
+ db \2 ; intensity
+ db \3 ; frequency
+ endm
+
+; pitch
+__ EQU 0
+C_ EQU 1
+C# EQU 2
+D_ EQU 3
+D# EQU 4
+E_ EQU 5
+F_ EQU 6
+F# EQU 7
+G_ EQU 8
+G# EQU 9
+A_ EQU 10
+A# EQU 11
+B_ EQU 12
+
+
octave: macro
db $d8 - (\1)
endm
diff --git a/macros/text.asm b/macros/text.asm
index ae49d8fbb..8174c5200 100644
--- a/macros/text.asm
+++ b/macros/text.asm
@@ -1,7 +1,30 @@
-text_from_ram: macro
+text EQUS "db $00," ; Start writing text.
+next EQUS "db $4e," ; Move a line down.
+line EQUS "db $4f," ; Start writing at the bottom line.
+para EQUS "db $51," ; Start a new paragraph.
+cont EQUS "db $55," ; Scroll to the next line.
+done EQUS "db $57" ; End a text box.
+prompt EQUS "db $58" ; Prompt the player to end a text box (initiating some other event).
+
+; Pokedex text commands are only used with pokered.
+; They are included for compatibility.
+page EQUS "db $50," ; Start a new Pokedex page.
+dex EQUS "db $e8, $50" ; End a Pokedex entry.
+
+
+TX_RAM: MACRO
db 1
dw \1
- endm
+ ENDM
+
+TX_FAR: MACRO
+ db $16
+ dw \1
+ db BANK(\1)
+ ENDM
+
+
+text_from_ram EQUS "TX_RAM"
text_dunno1: macro
db 5
@@ -58,8 +81,4 @@ current_day: macro
db $15
endm
-text_jump: macro
- db $16
- dw \1
- db BANK(\1)
- endm
+text_jump EQUS "TX_FAR"