summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
Diffstat (limited to 'macros')
-rw-r--r--macros/basestats.asm30
-rw-r--r--macros/charmap.asm338
-rwxr-xr-xmacros/coords.asm52
-rwxr-xr-xmacros/data.asm126
-rwxr-xr-x[-rw-r--r--]macros/enum.asm22
-rwxr-xr-xmacros/gfx.asm24
-rwxr-xr-xmacros/legacy.asm244
-rwxr-xr-x[-rw-r--r--]macros/rst.asm16
-rwxr-xr-xmacros/scripts/gfx_anims.asm53
-rw-r--r--macros/scripts/movement.asm (renamed from macros/movement.asm)0
-rwxr-xr-xmacros/scripts/text.asm145
-rwxr-xr-xmacros/scripts/trade_anims.asm (renamed from macros/trade_anim.asm)0
-rw-r--r--macros/text.asm143
13 files changed, 668 insertions, 525 deletions
diff --git a/macros/basestats.asm b/macros/basestats.asm
deleted file mode 100644
index f2fbbee9..00000000
--- a/macros/basestats.asm
+++ /dev/null
@@ -1,30 +0,0 @@
-define: macro
-if !def(\1)
-\1 equs \2
-endc
-endm
-
-const_value = 0
-
-add_tm: MACRO
-if !def(TM01)
-TM01 = const_value
- enum_start 1
-endc
- define _\@_1, "TM_\1"
- const _\@_1
- enum \1_TMNUM
-ENDM
-
-add_hm: MACRO
-if !def(HM01)
-HM01 = const_value
-endc
- define _\@_1, "HM_\1"
- const _\@_1
- enum \1_TMNUM
-ENDM
-
-add_mt: MACRO
- enum \1_TMNUM
-ENDM
diff --git a/macros/charmap.asm b/macros/charmap.asm
deleted file mode 100644
index 2f0b813b..00000000
--- a/macros/charmap.asm
+++ /dev/null
@@ -1,338 +0,0 @@
-; Control characters
- charmap "<START>", $00
- charmap "<PLAY_G>", $14 ; <PLAYER> + gender
- charmap "<DAY>", $15
- charmap "¯", $1f
- charmap "<LNBRK>", $22
- charmap "<POKE>", $24
- charmap "%", $25
- charmap "<RED>", $38
- charmap "<GREEN>", $39
- charmap "<ENEMY>", $3f
- charmap "<SHINY>", $3f
- charmap "<MOM>", $49
- charmap "<PKMN>", $4a
- charmap "<_CONT>", $4b ; implements "<CONT>"
- charmap "<SCROLL>", $4c
- charmap "<NEXT>", $4e
- charmap "<LINE>", $4f
-
- charmap "@", $50
- charmap "<PARA>", $51
- charmap "<PLAYER>", $52
- charmap "<RIVAL>", $53
- charmap "#", $54
- charmap "<CONT>", $55
- charmap "<……>", $56
- charmap "<DONE>", $57
- charmap "<PROMPT>", $58
- charmap "<TARGET>", $59
- charmap "<USER>", $5a
- charmap "<PC>", $5b
- charmap "<TM>", $5c
- charmap "<TRNER>", $5d
- charmap "<ROCKET>", $5e
- charmap "<DEXEND>", $5f
-
-; Actual characters
- charmap "▲", $61
- charmap "_", $62
- charmap "<COLON>", $6d ; necessary because ":" is already used
- charmap "′", $6e
- charmap "<LV>", $6e
- charmap "″", $6f
-
- charmap "<PO>", $70
- charmap "<KE>", $71
- charmap "◀", $71
- charmap "<``>", $72
- charmap "<''>", $73
- charmap "<ID>", $73
- charmap "№", $74
- charmap "…", $75
-
- charmap "┌", $79
- charmap "─", $7a
- charmap "┐", $7b
- charmap "│", $7c
- charmap "└", $7d
- charmap "┘", $7e
- charmap " ", $7f
-
- charmap "A", $80
- charmap "B", $81
- charmap "C", $82
- charmap "D", $83
- charmap "E", $84
- charmap "F", $85
- charmap "G", $86
- charmap "H", $87
- charmap "I", $88
- charmap "J", $89
- charmap "K", $8a
- charmap "L", $8b
- charmap "M", $8c
- charmap "N", $8d
- charmap "O", $8e
- charmap "P", $8f
- charmap "Q", $90
- charmap "R", $91
- charmap "S", $92
- charmap "T", $93
- charmap "U", $94
- charmap "V", $95
- charmap "W", $96
- charmap "X", $97
- charmap "Y", $98
- charmap "Z", $99
-
- charmap "(", $9a
- charmap ")", $9b
- charmap ":", $9c
- charmap ";", $9d
- charmap "[", $9e
- charmap "]", $9f
-
- charmap "a", $a0
- charmap "b", $a1
- charmap "c", $a2
- charmap "d", $a3
- charmap "e", $a4
- charmap "f", $a5
- charmap "g", $a6
- charmap "h", $a7
- charmap "i", $a8
- charmap "j", $a9
- charmap "k", $aa
- charmap "l", $ab
- charmap "m", $ac
- charmap "n", $ad
- charmap "o", $ae
- charmap "p", $af
- charmap "q", $b0
- charmap "r", $b1
- charmap "s", $b2
- charmap "t", $b3
- charmap "u", $b4
- charmap "v", $b5
- charmap "w", $b6
- charmap "x", $b7
- charmap "y", $b8
- charmap "z", $b9
-
- charmap "Ä", $c0
- charmap "Ö", $c1
- charmap "Ü", $c2
- charmap "ä", $c3
- charmap "ö", $c4
- charmap "ü", $c5
-
- charmap "'d", $d0
- charmap "'l", $d1
- charmap "'m", $d2
- charmap "'r", $d3
- charmap "'s", $d4
- charmap "'t", $d5
- charmap "'v", $d6
-
- charmap "←", $df
- charmap "'", $e0
- charmap "<PK>", $e1
- charmap "<MN>", $e2
- charmap "-", $e3
-
- charmap "?", $e6
- charmap "!", $e7
- charmap ".", $e8
- charmap "&", $e9
-
- charmap "é", $ea
- charmap "→", $eb
- charmap "▷", $ec
- charmap "▶", $ed
- charmap "▼", $ee
- charmap "♂", $ef
- charmap "¥", $f0
- charmap "×", $f1
- charmap "·", $f2
- charmap "/", $f3
- charmap ",", $f4
- charmap "♀", $f5
-
- charmap "0", $f6
- charmap "1", $f7
- charmap "2", $f8
- charmap "3", $f9
- charmap "4", $fa
- charmap "5", $fb
- charmap "6", $fc
- charmap "7", $fd
- charmap "8", $fe
- charmap "9", $ff
-
-; Japanese, for those bits of text that
-; were not translated to English.
-
- charmap "ガ", $5
- charmap "ギ", $6
- charmap "グ", $7
- charmap "ゲ", $8
- charmap "ゴ", $9
- charmap "ザ", $a
- charmap "ジ", $b
- charmap "ズ", $c
- charmap "ゼ", $d
- charmap "ゾ", $e
- charmap "ダ", $f
- charmap "ヂ", $10
- charmap "ヅ", $11
- charmap "デ", $12
- charmap "ド", $13
-
- charmap "バ", $19
- charmap "ビ", $1a
- charmap "ブ", $1b
- charmap "ボ", $1c
-; charmap "ベ", $1d
-
- charmap "が", $26
- charmap "ぎ", $27
- charmap "ぐ", $28
- charmap "げ", $29
- charmap "ご", $2a
- charmap "ざ", $2b
- charmap "じ", $2c
- charmap "ず", $2d
- charmap "ぜ", $2e
- charmap "ぞ", $2f
- charmap "だ", $30
- charmap "ぢ", $31
- charmap "づ", $32
- charmap "で", $33
- charmap "ど", $34
-
- charmap "ば", $3a
- charmap "び", $3b
- charmap "ぶ", $3c
- charmap "べ", $3d
- charmap "ぼ", $3e
-
- charmap "パ", $40
- charmap "ピ", $41
- charmap "プ", $42
- charmap "ポ", $43
- charmap "ぱ", $44
- charmap "ぴ", $45
- charmap "ぷ", $46
- charmap "ぺ", $47
- charmap "ぽ", $48
-
- charmap "ア", $80
- charmap "イ", $81
- charmap "ウ", $82
- charmap "エ", $83
- charmap "ォ", $84
- charmap "カ", $85
- charmap "キ", $86
- charmap "ク", $87
- charmap "ケ", $88
- charmap "コ", $89
- charmap "サ", $8a
- charmap "シ", $8b
- charmap "ス", $8c
- charmap "セ", $8d
- charmap "ソ", $8e
- charmap "タ", $8f
- charmap "チ", $90
- charmap "ツ", $91
- charmap "テ", $92
- charmap "ト", $93
- charmap "ナ", $94
- charmap "ニ", $95
- charmap "ヌ", $96
- charmap "ネ", $97
- charmap "ノ", $98
- charmap "ハ", $99
- charmap "ヒ", $9a
- charmap "フ", $9b
- charmap "ホ", $9c
- charmap "マ", $9d
- charmap "ミ", $9e
- charmap "ム", $9f
- charmap "メ", $a0
- charmap "モ", $a1
- charmap "ヤ", $a2
- charmap "ユ", $a3
- charmap "ヨ", $a4
- charmap "ラ", $a5
- charmap "ル", $a6
- charmap "レ", $a7
- charmap "ロ", $a8
- charmap "ワ", $a9
- charmap "ヲ", $aa
- charmap "ン", $ab
- charmap "ッ", $ac
- charmap "ャ", $ad
- charmap "ュ", $ae
- charmap "ョ", $af
- charmap "ィ", $b0
-
- charmap "あ", $b1
- charmap "い", $b2
- charmap "う", $b3
- charmap "え", $b4
- charmap "お", $b5
-
- charmap "か", $b6
- charmap "き", $b7
- charmap "く", $b8
- charmap "け", $b9
- charmap "こ", $ba
- charmap "さ", $bb
- charmap "し", $bc
- charmap "す", $bd
- charmap "せ", $be
- charmap "そ", $bf
- charmap "た", $c0
- charmap "ち", $c1
- charmap "つ", $c2
- charmap "て", $c3
- charmap "と", $c4
- charmap "な", $c5
- charmap "に", $c6
- charmap "ぬ", $c7
- charmap "ね", $c8
- charmap "の", $c9
- charmap "は", $ca
- charmap "ひ", $cb
- charmap "ふ", $cc
- charmap "へ", $cd
- charmap "ほ", $ce
-
- charmap "ま", $cf
- charmap "み", $d0
- charmap "む", $d1
- charmap "め", $d2
- charmap "も", $d3
- charmap "や", $d4
- charmap "ゆ", $d5
- charmap "よ", $d6
- charmap "ら", $d7
- charmap "り", $d8
- charmap "る", $d9
- charmap "れ", $da
- charmap "ろ", $db
- charmap "わ", $dc
- charmap "を", $dd
- charmap "ん", $de
- charmap "っ", $df
- charmap "ゃ", $e0
- charmap "ゅ", $e1
- charmap "ょ", $e2
-
- charmap "ー", $e3
-
- charmap "゚", $e4
- charmap "゙", $e5
-
- charmap "ァ", $e9
diff --git a/macros/coords.asm b/macros/coords.asm
new file mode 100755
index 00000000..0833c242
--- /dev/null
+++ b/macros/coords.asm
@@ -0,0 +1,52 @@
+hlcoord EQUS "coord hl,"
+bccoord EQUS "coord bc,"
+decoord EQUS "coord de,"
+
+coord: MACRO
+; register, x, y[, origin]
+ if _NARG < 4
+ ld \1, (\3) * SCREEN_WIDTH + (\2) + wTileMap
+ else
+ ld \1, (\3) * SCREEN_WIDTH + (\2) + \4
+ endc
+ENDM
+
+hlbgcoord EQUS "bgcoord hl,"
+bcbgcoord EQUS "bgcoord bc,"
+debgcoord EQUS "bgcoord de,"
+
+bgcoord: MACRO
+; register, x, y[, origin]
+ if _NARG < 4
+ ld \1, (\3) * BG_MAP_WIDTH + (\2) + vBGMap0
+ else
+ ld \1, (\3) * BG_MAP_WIDTH + (\2) + \4
+ endc
+ENDM
+
+dwcoord: MACRO
+; x, y
+rept _NARG / 2
+ dw (\2) * SCREEN_WIDTH + (\1) + wTileMap
+ shift
+ shift
+endr
+ENDM
+
+ldcoord_a: MACRO
+; x, y[, origin]
+ if _NARG < 3
+ ld [(\2) * SCREEN_WIDTH + (\1) + wTileMap], a
+ else
+ ld [(\2) * SCREEN_WIDTH + (\1) + \3], a
+ endc
+ENDM
+
+lda_coord: MACRO
+; x, y[, origin]
+ if _NARG < 3
+ ld a, [(\2) * SCREEN_WIDTH + (\1) + wTileMap]
+ else
+ ld a, [(\2) * SCREEN_WIDTH + (\1) + \3]
+ endc
+ENDM
diff --git a/macros/data.asm b/macros/data.asm
new file mode 100755
index 00000000..32903b0f
--- /dev/null
+++ b/macros/data.asm
@@ -0,0 +1,126 @@
+; Value macros
+
+percent EQUS "* $ff / 100"
+
+; Constant data (db, dw, dl) macros
+
+dwb: MACRO
+ dw \1
+ db \2
+ENDM
+
+dbw: MACRO
+ db \1
+ dw \2
+ENDM
+
+dbbw: MACRO
+ db \1, \2
+ dw \3
+ENDM
+
+dbww: MACRO
+ db \1
+ dw \2, \3
+ENDM
+
+dbwww: MACRO
+ db \1
+ dw \2, \3, \4
+ENDM
+
+dn: MACRO ; nybbles
+rept _NARG / 2
+ db ((\1) << 4) | (\2)
+ shift
+ shift
+endr
+ENDM
+
+dc: MACRO ; "crumbs"
+rept _NARG / 4
+ db ((\1) << 6) | ((\2) << 4) | ((\3) << 2) | (\4)
+ shift
+ shift
+ shift
+ shift
+endr
+ENDM
+
+dx: MACRO
+x = 8 * ((\1) - 1)
+rept \1
+ db ((\2) >> x) & $ff
+x = x + -8
+endr
+ENDM
+
+dt: MACRO ; three-byte (big-endian)
+ dx 3, \1
+ENDM
+
+dd: MACRO ; four-byte (big-endian)
+ dx 4, \1
+ENDM
+
+bigdw: MACRO ; big-endian word
+ dx 2, \1 ; db HIGH(\1), LOW(\1)
+ENDM
+
+dba: MACRO ; dbw bank, address
+rept _NARG
+ dbw BANK(\1), \1
+ shift
+endr
+ENDM
+
+dab: MACRO ; dwb address, bank
+rept _NARG
+ dwb \1, BANK(\1)
+ shift
+endr
+ENDM
+
+dba_pic: MACRO ; dbw bank, address
+ db BANK(\1) - PICS_FIX
+ dw \1
+ENDM
+
+dbpixel: MACRO
+if _NARG >= 4
+; x tile, x pxl, y tile, y pxl
+ db \1 * 8 + \3, \2 * 8 + \4
+else
+; x, y
+ db \1 * 8, \2 * 8
+endc
+ENDM
+
+dsprite: MACRO
+; y tile, y pxl, x tile, x pxl, vtile offset, attributes
+ db (\1 * 8) % $100 + \2, (\3 * 8) % $100 + \4, \5, \6
+ENDM
+
+menu_coords: MACRO
+; x1, y1, x2, y2
+ db \2, \1 ; start coords
+ db \4, \3 ; end coords
+ENDM
+
+bcd: MACRO
+rept _NARG
+ dn ((\1) % 100) / 10, (\1) % 10
+ shift
+endr
+ENDM
+
+sine_table: MACRO
+; \1: amplitude
+
+x = 0
+ rept $20
+ ; Round up.
+ dw (sin(x) + (sin(x) & $ff)) >> 8
+x = x + (\1) * $40000
+ endr
+ENDM
diff --git a/macros/enum.asm b/macros/enum.asm
index 4830c339..003445be 100644..100755
--- a/macros/enum.asm
+++ b/macros/enum.asm
@@ -1,6 +1,6 @@
; Enumerate variables
-enum_start: macro
+enum_start: MACRO
if _NARG >= 1
__enum__ = \1
else
@@ -11,16 +11,16 @@ __enumdir__ = \2
else
__enumdir__ = +1
endc
-endm
+ENDM
-enum: macro
-\1 = __enum__
+enum: MACRO
+\1 EQU __enum__
__enum__ = __enum__ + __enumdir__
-endm
+ENDM
-enum_set: macro
+enum_set: MACRO
__enum__ = \1
-endm
+ENDM
; Enumerate constants
@@ -41,3 +41,11 @@ shift_const: MACRO
\1 EQU (1 << const_value)
const_value = const_value + 1
ENDM
+
+; Enumerate strings
+
+define: MACRO
+if !DEF(\1)
+\1 EQUS \2
+endc
+ENDM
diff --git a/macros/gfx.asm b/macros/gfx.asm
new file mode 100755
index 00000000..2753373e
--- /dev/null
+++ b/macros/gfx.asm
@@ -0,0 +1,24 @@
+RGB: MACRO
+rept _NARG / 3
+ dw palred (\1) + palgreen (\2) + palblue (\3)
+ shift
+ shift
+ shift
+endr
+ENDM
+
+palred EQUS "(1 << 0) *"
+palgreen EQUS "(1 << 5) *"
+palblue EQUS "(1 << 10) *"
+
+palettes EQUS "* PALETTE_SIZE"
+palette EQUS "+ PALETTE_SIZE *"
+color EQUS "+ PAL_COLOR_SIZE *"
+
+tiles EQUS "* LEN_2BPP_TILE"
+tile EQUS "+ LEN_2BPP_TILE *"
+
+; extracts the middle two colors from a 2bpp binary palette
+; example usage:
+; INCBIN "foo.gbcpal", middle_colors
+middle_colors EQUS "PAL_COLOR_SIZE, PAL_COLOR_SIZE * 2"
diff --git a/macros/legacy.asm b/macros/legacy.asm
new file mode 100755
index 00000000..7192195f
--- /dev/null
+++ b/macros/legacy.asm
@@ -0,0 +1,244 @@
+; Legacy support for old pokecrystal.
+; Allows porting scripts with as few edits as possible.
+; Legacy support not in this file can be found by looking for the keyword: "LEGACY"
+
+; macros/rst.asm
+callba EQUS "farcall"
+callab EQUS "callfar"
+
+; macros/scripts/audio.asm
+unknownmusic0xde EQUS "sound_duty"
+
+; macros/scripts/events.asm
+
+checkmorn EQUS "checktime MORN"
+checkday EQUS "checktime DAY"
+checknite EQUS "checktime NITE"
+
+jump EQUS "sjump"
+farjump EQUS "farsjump"
+priorityjump EQUS "prioritysjump"
+ptcall EQUS "memcall"
+ptjump EQUS "memjump"
+ptpriorityjump EQUS "stopandsjump"
+ptcallasm EQUS "memcallasm"
+
+if_equal EQUS "ifequal"
+if_not_equal EQUS "ifnotequal"
+if_greater_than EQUS "ifgreater"
+if_less_than EQUS "ifless"
+end_all EQUS "endall"
+
+checkmaptriggers EQUS "checkmapscene"
+domaptrigger EQUS "setmapscene"
+checktriggers EQUS "checkscene"
+dotrigger EQUS "setscene"
+
+faceperson EQUS "faceobject"
+moveperson EQUS "moveobject"
+writepersonxy EQUS "writeobjectxy"
+spriteface EQUS "turnobject"
+objectface EQUS "turnobject"
+applymovement2 EQUS "applymovementlasttalked"
+
+writebyte EQUS "setval"
+addvar EQUS "addval"
+copybytetovar EQUS "readmem"
+copyvartobyte EQUS "writemem"
+checkcode EQUS "readvar"
+writevarcode EQUS "writevar"
+writecode EQUS "loadvar"
+
+MEM_BUFFER_0 EQUS "STRING_BUFFER_3"
+MEM_BUFFER_1 EQUS "STRING_BUFFER_4"
+MEM_BUFFER_2 EQUS "STRING_BUFFER_5"
+
+vartomem EQUS "getnum"
+mapnametotext EQUS "getcurlandmarkname"
+readcoins EQUS "getcoins"
+
+pokenamemem: MACRO
+ getmonname \2, \1
+ENDM
+
+itemtotext: MACRO
+ getitemname \2, \1
+ENDM
+
+landmarktotext: MACRO
+ getlandmarkname \2, \1
+ENDM
+
+trainertotext: MACRO
+ gettrainername \3, \1, \2
+ENDM
+
+trainerclassname: MACRO
+ gettrainerclassname \2, \1
+ENDM
+
+name: MACRO
+ getname \3, \1, \2
+ENDM
+
+stringtotext: MACRO
+ getstring \2, \1
+ENDM
+
+readmoney: MACRO
+ getmoney \2, \1
+ENDM
+
+RAM2MEM EQUS "getnum"
+loadfont EQUS "opentext"
+loadmenudata EQUS "loadmenu"
+loadmenuheader EQUS "loadmenu"
+writebackup EQUS "closewindow"
+interpretmenu EQUS "_2dmenu"
+interpretmenu2 EQUS "verticalmenu"
+buttonsound EQUS "promptbutton"
+battlecheck EQUS "randomwildmon"
+loadtrainerdata EQUS "loadtemptrainer"
+loadpokedata EQUS "loadwildmon"
+returnafterbattle EQUS "reloadmapafterbattle"
+trainerstatus EQUS "trainerflagaction"
+talkaftercancel EQUS "endifjustbattled"
+talkaftercheck EQUS "checkjustbattled"
+playrammusic EQUS "encountermusic"
+reloadmapmusic EQUS "dontrestartmapmusic"
+resetfuncs EQUS "endall"
+storetext EQUS "battletowertext"
+displaylocation EQUS "landmarktotext"
+givepokeitem EQUS "givepokemail"
+checkpokeitem EQUS "checkpokemail"
+passtoengine EQUS "autoinput"
+verbosegiveitem2 EQUS "verbosegiveitemvar"
+loadbytec2cf EQUS "writeunusedbytebuffer"
+
+; macros/scripts/maps.asm
+
+mapconst: MACRO
+ map_const \1, \3, \2
+ENDM
+
+maptrigger EQUS "scene_script"
+
+warp_def: MACRO
+ warp_event \2, \1, \4, \3
+ENDM
+
+xy_trigger: MACRO
+ coord_event \3, \2, \1, \5
+ENDM
+
+signpost: MACRO
+ bg_event \2, \1, \3, \4
+ENDM
+
+person_event: MACRO
+; object_event \3, \2, \1, \4, \5, \6, \7, \8, \9, \10, \11, \12, \13
+ db \1, \2 + 4, \3 + 4, \4
+ dn \6, \5
+ db \7, \8
+ shift
+ dn \8, \9
+ shift
+ db \9
+ shift
+ dw \9
+ shift
+ dw \9
+ENDM
+
+PERSONTYPE_SCRIPT EQUS "OBJECTTYPE_SCRIPT"
+PERSONTYPE_ITEMBALL EQUS "OBJECTTYPE_ITEMBALL"
+PERSONTYPE_TRAINER EQUS "OBJECTTYPE_TRAINER"
+
+; macros/scripts/movement.asm
+
+show_person EQUS "show_object"
+hide_person EQUS "hide_object"
+remove_person EQUS "remove_object"
+
+turn_head_down EQUS "turn_head DOWN"
+turn_head_up EQUS "turn_head UP"
+turn_head_left EQUS "turn_head LEFT"
+turn_head_right EQUS "turn_head RIGHT"
+turn_step_down EQUS "turn_step DOWN"
+turn_step_up EQUS "turn_step UP"
+turn_step_left EQUS "turn_step LEFT"
+turn_step_right EQUS "turn_step RIGHT"
+slow_step_down EQUS "slow_step DOWN"
+slow_step_up EQUS "slow_step UP"
+slow_step_left EQUS "slow_step LEFT"
+slow_step_right EQUS "slow_step RIGHT"
+step_down EQUS "step DOWN"
+step_up EQUS "step UP"
+step_left EQUS "step LEFT"
+step_right EQUS "step RIGHT"
+big_step_down EQUS "big_step DOWN"
+big_step_up EQUS "big_step UP"
+big_step_left EQUS "big_step LEFT"
+big_step_right EQUS "big_step RIGHT"
+slow_slide_step_down EQUS "slow_slide_step DOWN"
+slow_slide_step_up EQUS "slow_slide_step UP"
+slow_slide_step_left EQUS "slow_slide_step LEFT"
+slow_slide_step_right EQUS "slow_slide_step RIGHT"
+slide_step_down EQUS "slide_step DOWN"
+slide_step_up EQUS "slide_step UP"
+slide_step_left EQUS "slide_step LEFT"
+slide_step_right EQUS "slide_step RIGHT"
+fast_slide_step_down EQUS "fast_slide_step DOWN"
+fast_slide_step_up EQUS "fast_slide_step UP"
+fast_slide_step_left EQUS "fast_slide_step LEFT"
+fast_slide_step_right EQUS "fast_slide_step RIGHT"
+turn_away_down EQUS "turn_away DOWN"
+turn_away_up EQUS "turn_away UP"
+turn_away_left EQUS "turn_away LEFT"
+turn_away_right EQUS "turn_away RIGHT"
+turn_in_down EQUS "turn_in DOWN"
+turn_in_up EQUS "turn_in UP"
+turn_in_left EQUS "turn_in LEFT"
+turn_in_right EQUS "turn_in RIGHT"
+turn_waterfall_down EQUS "turn_waterfall DOWN"
+turn_waterfall_up EQUS "turn_waterfall UP"
+turn_waterfall_left EQUS "turn_waterfall LEFT"
+turn_waterfall_right EQUS "turn_waterfall RIGHT"
+slow_jump_step_down EQUS "slow_jump_step DOWN"
+slow_jump_step_up EQUS "slow_jump_step UP"
+slow_jump_step_left EQUS "slow_jump_step LEFT"
+slow_jump_step_right EQUS "slow_jump_step RIGHT"
+jump_step_down EQUS "jump_step DOWN"
+jump_step_up EQUS "jump_step UP"
+jump_step_left EQUS "jump_step LEFT"
+jump_step_right EQUS "jump_step RIGHT"
+fast_jump_step_down EQUS "fast_jump_step DOWN"
+fast_jump_step_up EQUS "fast_jump_step UP"
+fast_jump_step_left EQUS "fast_jump_step LEFT"
+fast_jump_step_right EQUS "fast_jump_step RIGHT"
+
+step_sleep_1 EQUS "step_sleep 1"
+step_sleep_2 EQUS "step_sleep 2"
+step_sleep_3 EQUS "step_sleep 3"
+step_sleep_4 EQUS "step_sleep 4"
+step_sleep_5 EQUS "step_sleep 5"
+step_sleep_6 EQUS "step_sleep 6"
+step_sleep_7 EQUS "step_sleep 7"
+step_sleep_8 EQUS "step_sleep 8"
+
+; macros/scripts/text.asm
+text_from_ram EQUS "text_ram"
+start_asm EQUS "text_asm"
+deciram EQUS "text_decimal"
+interpret_data EQUS "text_pause"
+limited_interpret_data EQUS "text_dots"
+text_waitbutton EQUS "text_promptbutton"
+link_wait_button EQUS "text_linkpromptbutton"
+text_linkwaitbutton EQUS "text_linkpromptbutton"
+current_day EQUS "text_today"
+text_jump EQUS "text_far"
+
+; macros/scripts/battle_anims.asm
+anim_enemyfeetobj EQUS "anim_battlergfx_2row"
+anim_playerheadobj EQUS "anim_battlergfx_1row"
+anim_clearsprites EQUS "anim_keepsprites"
diff --git a/macros/rst.asm b/macros/rst.asm
index 23c821d9..773a5c60 100644..100755
--- a/macros/rst.asm
+++ b/macros/rst.asm
@@ -6,7 +6,7 @@ farcall: MACRO ; bank, address
ld a, BANK(\1)
ld hl, \1
rst FarCall
- ENDM
+ENDM
callfar: MACRO ; address, bank
ld hl, \1
@@ -14,10 +14,12 @@ callfar: MACRO ; address, bank
rst FarCall
ENDM
-callba EQUS "farcall"
-
-callab: MACRO ; address, bank
- ld hl, \1
+homecall: MACRO
+ ldh a, [hROMBank]
+ push af
ld a, BANK(\1)
- rst FarCall
- ENDM
+ rst Bankswitch
+ call \1
+ pop af
+ rst Bankswitch
+ENDM
diff --git a/macros/scripts/gfx_anims.asm b/macros/scripts/gfx_anims.asm
new file mode 100755
index 00000000..3756481d
--- /dev/null
+++ b/macros/scripts/gfx_anims.asm
@@ -0,0 +1,53 @@
+; pic + oam animations
+
+frame: MACRO
+ db \1
+x = \2
+if _NARG > 2
+rept _NARG + -2
+x = x | (1 << (\3 + 1))
+ shift
+endr
+endc
+ db x
+ENDM
+
+ enum_start $fc
+
+ enum delanim_command ; $fc
+delanim: MACRO
+; Removes the object from the screen, as opposed to `endanim` which just stops all motion
+ db delanim_command
+ENDM
+
+ enum dowait_command ; $fd
+dowait: MACRO
+ db dowait_command
+ db \1 ; frames
+ENDM
+
+ enum dorestart_command ; $fe
+dorestart: MACRO
+ db dorestart_command
+ENDM
+
+ enum endanim_command ; $ff
+endanim: MACRO
+ db endanim_command
+ENDM
+
+
+; Used for pic animations
+__enum__ = $fd
+
+ enum dorepeat_command ; $fd
+dorepeat: MACRO
+ db dorepeat_command
+ db \1 ; command offset to jump to
+ENDM
+
+ enum setrepeat_command ; $fe
+setrepeat: MACRO
+ db setrepeat_command
+ db \1 ; amount of times to repeat
+ENDM
diff --git a/macros/movement.asm b/macros/scripts/movement.asm
index 49d95f82..49d95f82 100644
--- a/macros/movement.asm
+++ b/macros/scripts/movement.asm
diff --git a/macros/scripts/text.asm b/macros/scripts/text.asm
new file mode 100755
index 00000000..bb1701f8
--- /dev/null
+++ b/macros/scripts/text.asm
@@ -0,0 +1,145 @@
+text EQUS "db TX_START," ; Start writing text.
+next EQUS "db \"<NEXT>\"," ; Move a line down.
+line EQUS "db \"<LINE>\"," ; Start writing at the bottom line.
+page EQUS "db \"@\"," ; Start a new Pokédex page.
+para EQUS "db \"<PARA>\"," ; Start a new paragraph.
+cont EQUS "db \"<CONT>\"," ; Scroll to the next line.
+done EQUS "db \"<DONE>\"" ; End a text box.
+prompt EQUS "db \"<PROMPT>\"" ; Prompt the player to end a text box (initiating some other event).
+
+; TextCommands indexes (see home/text.asm)
+ enum_start
+
+ enum TX_START ; $00
+text_start: MACRO
+ db TX_START
+ENDM
+
+ enum TX_RAM ; $01
+text_ram: MACRO
+ db TX_RAM
+ dw \1
+ENDM
+
+ enum TX_BCD ; $02
+text_bcd: MACRO
+ db TX_BCD
+ dw \1
+ db \2
+ENDM
+
+ enum TX_MOVE ; $03
+text_move: MACRO
+ db TX_MOVE
+ dw \1
+ENDM
+
+ enum TX_BOX ; $04
+text_box: MACRO
+ db TX_BOX
+ dw \1
+ db \2, \3
+ENDM
+
+ enum TX_LOW ; $05
+text_low: MACRO
+ db TX_LOW
+ENDM
+
+ enum TX_PROMPT_BUTTON ; $06
+text_promptbutton: MACRO
+ db TX_PROMPT_BUTTON
+ENDM
+
+ enum TX_SCROLL ; $07
+text_scroll: MACRO
+ db TX_SCROLL
+ENDM
+
+ enum TX_START_ASM ; $08
+text_asm: MACRO
+ db TX_START_ASM
+ENDM
+
+ enum TX_NUM ; $09
+text_decimal: MACRO
+ db TX_NUM
+ dw \1 ; address
+ dn \2, \3 ; bytes, digits
+ENDM
+
+ enum TX_PAUSE ; $0a
+text_pause: MACRO
+ db TX_PAUSE
+ENDM
+
+ enum TX_SOUND_DEX_FANFARE_50_79 ; $0b
+sound_dex_fanfare_50_79: MACRO
+ db TX_SOUND_DEX_FANFARE_50_79
+ENDM
+
+ enum TX_DOTS ; $0c
+text_dots: MACRO
+ db TX_DOTS
+ db \1
+ENDM
+
+ enum TX_LINK_PROMPT_BUTTON ; $0d
+text_linkpromptbutton: MACRO
+ db TX_LINK_PROMPT_BUTTON
+ENDM
+
+ enum TX_SOUND_DEX_FANFARE_20_49 ; $0e
+sound_dex_fanfare_20_49: MACRO
+ db TX_SOUND_DEX_FANFARE_20_49
+ENDM
+
+ enum TX_SOUND_ITEM ; $0f
+sound_item: MACRO
+ db TX_SOUND_ITEM
+ENDM
+
+ enum TX_SOUND_CAUGHT_MON ; $10
+sound_caught_mon: MACRO
+ db TX_SOUND_CAUGHT_MON
+ENDM
+
+ enum TX_SOUND_DEX_FANFARE_80_109 ; $11
+sound_dex_fanfare_80_109: MACRO
+ db TX_SOUND_DEX_FANFARE_80_109
+ENDM
+
+ enum TX_SOUND_FANFARE ; $12
+sound_fanfare: MACRO
+ db TX_SOUND_FANFARE
+ENDM
+
+ enum TX_SOUND_SLOT_MACHINE_START ; $13
+sound_slot_machine_start: MACRO
+ db TX_SOUND_SLOT_MACHINE_START
+ENDM
+
+ enum TX_STRINGBUFFER ; $14
+text_buffer: MACRO
+ db TX_STRINGBUFFER
+ db \1
+ENDM
+
+ enum TX_DAY ; $15
+text_today: MACRO
+ db TX_DAY
+ENDM
+
+ enum TX_FAR ; $16
+text_far: MACRO
+ db TX_FAR
+ dw \1
+ db BANK(\1)
+ENDM
+
+ enum_set $50
+
+ enum TX_END ; $50
+text_end: MACRO
+ db TX_END
+ENDM
diff --git a/macros/trade_anim.asm b/macros/scripts/trade_anims.asm
index c590cb62..c590cb62 100755
--- a/macros/trade_anim.asm
+++ b/macros/scripts/trade_anims.asm
diff --git a/macros/text.asm b/macros/text.asm
deleted file mode 100644
index 8cda714a..00000000
--- a/macros/text.asm
+++ /dev/null
@@ -1,143 +0,0 @@
-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 EQU $01
-; TX_FAR EQU $16
- enum_start
-
- enum TX_START
-text_start: MACRO ; 00
- db TX_START
-ENDM
-
- enum TX_RAM
-text_from_ram: MACRO ; 01
- db TX_RAM
- dw \1
- ENDM
-
- enum TX_BCD
-text_bcd: macro ; 02
- db TX_BCD
- dw \1
- db \2
- ENDM
-
- enum TX_MOVE
-text_move: macro ; 03
- db TX_MOVE
- dw \1
- ENDM
-
- enum TX_BOX
-text_box: macro ; 04
- db TX_BOX
- dw \1
- db \2, \3
- ENDM
-
- enum TX_LOW
-text_low: macro ; 05
- db TX_LOW
- endm
-
- enum WAIT_BUTTON
-text_waitbutton: macro ; 06
- db WAIT_BUTTON
- endm
-
- enum TX_SCROLL
-text_scroll: macro ; 07
- db TX_SCROLL
- endm
-
- enum START_ASM
-start_asm: macro ; 08
- db START_ASM
- endm
-
- enum TX_NUM
-deciram: macro ; 09
- db TX_NUM
- dw \1 ; address
- dn \2, \3 ; bytes, digits
- endm
-
- enum TX_EXIT
-interpret_data: macro ; 0a
- db TX_EXIT
- endm
-
- enum TX_SOUND_0B
-sound_dex_fanfare_50_79: macro ; 0b
- db TX_SOUND_0B
- endm
-
- enum TX_DOTS
-limited_interpret_data: macro ; 0c
- db TX_DOTS
- db \1
- endm
-
- enum TX_LINK_WAIT_BUTTON
-link_wait_button: macro ; 0d
- db TX_LINK_WAIT_BUTTON
- endm
-
- enum TX_SOUND_0E
-sound_dex_fanfare_20_49: macro ; 0e
- db TX_SOUND_0E
- endm
-
- enum TX_SOUND_0F
-sound_item: macro ; 0f
- db TX_SOUND_0F
- endm
-
- enum TX_SOUND_10
-sound_caught_mon: macro ; 10
- db TX_SOUND_10
- endm
-
- enum TX_SOUND_11
-sound_dex_fanfare_80_109: macro ; 11
- db TX_SOUND_11
- endm
-
- enum TX_SOUND_12
-sound_fanfare: macro ; 12
- db TX_SOUND_12
- endm
-
- enum TX_SOUND_13
-sound_slot_machine_start: macro ; 13
- db TX_SOUND_13
- endm
-
- enum TX_STRINGBUFFER
-text_buffer: macro ; 14
- db TX_STRINGBUFFER
- db \1
- endm
-
- enum TX_DAY
-current_day: macro ; 15
- db TX_DAY
- endm
-
- enum TX_FAR
-text_jump: MACRO ; 16
- db TX_FAR
- dw \1
- db BANK(\1)
- ENDM