summaryrefslogtreecommitdiff
path: root/include/asm/macros
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm/macros')
-rw-r--r--include/asm/macros/function.inc29
-rw-r--r--include/asm/macros/m4a.inc13
-rw-r--r--include/asm/macros/music_voice.inc140
-rw-r--r--include/asm/macros/script.inc415
4 files changed, 597 insertions, 0 deletions
diff --git a/include/asm/macros/function.inc b/include/asm/macros/function.inc
new file mode 100644
index 0000000..67fb373
--- /dev/null
+++ b/include/asm/macros/function.inc
@@ -0,0 +1,29 @@
+ .macro arm_func_start name
+ .align 2, 0
+ .global \name
+ .arm
+ .type \name, function
+ .endm
+
+ .macro arm_func_end name
+ .size \name, .-\name
+ .endm
+
+ .macro thumb_func_start name
+ .align 2, 0
+ .global \name
+ .thumb
+ .thumb_func
+ .type \name, function
+ .endm
+
+ .macro non_word_aligned_thumb_func_start name
+ .global \name
+ .thumb
+ .thumb_func
+ .type \name, function
+ .endm
+
+ .macro thumb_func_end name
+ .size \name, .-\name
+ .endm
diff --git a/include/asm/macros/m4a.inc b/include/asm/macros/m4a.inc
new file mode 100644
index 0000000..6c5abc0
--- /dev/null
+++ b/include/asm/macros/m4a.inc
@@ -0,0 +1,13 @@
+ .macro song label, music_player, unknown
+ .4byte \label
+ .2byte \music_player
+ .2byte \unknown
+ .endm
+
+ .macro music_player info_struct, track_struct, unknown_1, unknown_2
+ .4byte \info_struct
+ .4byte \track_struct
+ .byte \unknown_1
+ .space 1
+ .2byte \unknown_2
+ .endm
diff --git a/include/asm/macros/music_voice.inc b/include/asm/macros/music_voice.inc
new file mode 100644
index 0000000..7dd6c74
--- /dev/null
+++ b/include/asm/macros/music_voice.inc
@@ -0,0 +1,140 @@
+ .macro voice_directsound base_midi_key:req, pan:req, sample_data_pointer:req, attack:req, decay:req, sustain:req, release:req
+ .byte 0
+ _voice_directsound \base_midi_key, \pan, \sample_data_pointer, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro voice_directsound_no_resample base_midi_key:req, pan:req, sample_data_pointer:req, attack:req, decay:req, sustain:req, release:req
+ .byte 8
+ _voice_directsound \base_midi_key, \pan, \sample_data_pointer, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro voice_directsound_alt base_midi_key:req, pan:req, sample_data_pointer:req, attack:req, decay:req, sustain:req, release:req
+ .byte 16
+ _voice_directsound \base_midi_key, \pan, \sample_data_pointer, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro _voice_directsound base_midi_key:req, pan:req, sample_data_pointer:req, attack:req, decay:req, sustain:req, release:req
+ .byte \base_midi_key
+ .byte 0
+ .if \pan != 0
+ .byte (0x80 | \pan)
+ .else
+ .byte 0
+ .endif
+ .4byte \sample_data_pointer
+ .byte \attack
+ .byte \decay
+ .byte \sustain
+ .byte \release
+ .endm
+
+ .macro voice_square_1 base_midi_key:req, pan:req, sweep:req, duty_cycle:req, attack:req, decay:req, sustain:req, release:req
+ _voice_square_1 1, \base_midi_key, \pan, \sweep, \duty_cycle, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro voice_square_1_alt base_midi_key:req, pan:req, sweep:req, duty_cycle:req, attack:req, decay:req, sustain:req, release:req
+ _voice_square_1 9, \base_midi_key, \pan, \sweep, \duty_cycle, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro _voice_square_1 type:req, base_midi_key:req, pan:req, sweep:req, duty_cycle:req, attack:req, decay:req, sustain:req, release:req
+ .byte \type
+ .byte \base_midi_key
+ .if \pan != 0
+ .byte (0x80 | \pan)
+ .else
+ .byte 0
+ .endif
+ .byte \sweep
+ .byte (\duty_cycle & 0x3)
+ .byte 0, 0, 0
+ .byte (\attack & 0x7)
+ .byte (\decay & 0x7)
+ .byte (\sustain & 0xF)
+ .byte (\release & 0x7)
+ .endm
+
+ .macro voice_square_2 base_midi_key:req, pan:req, duty_cycle:req, attack:req, decay:req, sustain:req, release:req
+ _voice_square_2 2, \base_midi_key, \pan, \duty_cycle, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro voice_square_2_alt base_midi_key:req, pan:req, duty_cycle:req, attack:req, decay:req, sustain:req, release:req
+ _voice_square_2 10, \base_midi_key, \pan, \duty_cycle, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro _voice_square_2 type:req, base_midi_key:req, pan:req, duty_cycle:req, attack:req, decay:req, sustain:req, release:req
+ .byte \type
+ .byte \base_midi_key
+ .if \pan != 0
+ .byte (0x80 | \pan)
+ .else
+ .byte 0
+ .endif
+ .byte 0
+ .byte (\duty_cycle & 0x3)
+ .byte 0, 0, 0
+ .byte (\attack & 0x7)
+ .byte (\decay & 0x7)
+ .byte (\sustain & 0xF)
+ .byte (\release & 0x7)
+ .endm
+
+ .macro voice_programmable_wave base_midi_key:req, pan:req, wave_samples_pointer:req, attack:req, decay:req, sustain:req, release:req
+ _voice_programmable_wave 3, \base_midi_key, \pan, \wave_samples_pointer, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro voice_programmable_wave_alt base_midi_key:req, pan:req, wave_samples_pointer:req, attack:req, decay:req, sustain:req, release:req
+ _voice_programmable_wave 11, \base_midi_key, \pan, \wave_samples_pointer, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro _voice_programmable_wave type:req, base_midi_key:req, pan:req, wave_samples_pointer:req, attack:req, decay:req, sustain:req, release:req
+ .byte \type
+ .byte \base_midi_key
+ .if \pan != 0
+ .byte (0x80 | \pan)
+ .else
+ .byte 0
+ .endif
+ .byte 0
+ .4byte \wave_samples_pointer
+ .byte (\attack & 0x7)
+ .byte (\decay & 0x7)
+ .byte (\sustain & 0xF)
+ .byte (\release & 0x7)
+ .endm
+
+ .macro voice_noise base_midi_key:req, pan:req, period:req, attack:req, decay:req, sustain:req, release:req
+ _voice_noise 4, \base_midi_key, \pan, \period, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro voice_noise_alt base_midi_key:req, pan:req, period:req, attack:req, decay:req, sustain:req, release:req
+ _voice_noise 12, \base_midi_key, \pan, \period, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro _voice_noise type:req, base_midi_key:req, pan:req, period:req, attack:req, decay:req, sustain:req, release:req
+ .byte \type
+ .byte \base_midi_key
+ .if \pan != 0
+ .byte (0x80 | \pan)
+ .else
+ .byte 0
+ .endif
+ .byte 0
+ .byte (\period & 0x1)
+ .byte 0, 0, 0
+ .byte (\attack & 0x7)
+ .byte (\decay & 0x7)
+ .byte (\sustain & 0xF)
+ .byte (\release & 0x7)
+ .endm
+
+ .macro voice_keysplit voice_group_pointer:req, keysplit_table_pointer:req
+ .byte 0x40, 0, 0, 0
+ .4byte \voice_group_pointer
+ .4byte \keysplit_table_pointer
+ .endm
+
+ .macro voice_keysplit_all voice_group_pointer:req
+ .byte 0x80, 0, 0, 0
+ .4byte \voice_group_pointer
+ .4byte 0
+ .endm
diff --git a/include/asm/macros/script.inc b/include/asm/macros/script.inc
new file mode 100644
index 0000000..8ef4bd8
--- /dev/null
+++ b/include/asm/macros/script.inc
@@ -0,0 +1,415 @@
+.macro warpLocation id:req
+ .byte 0x01
+ .byte 0x00
+ .2byte \id
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro warpDungeon id:req
+ .byte 0x02
+ .byte 0x00
+ .2byte \id
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro warpFriendArea time:req
+ .byte 0x02
+ .byte 0x00
+ .2byte \time
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro ConfirmDungeonRules
+ .byte 0x05
+ .4byte 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00
+.endm
+
+.macro changeTileset id:req
+ .byte 0x08, 0x00, 0x00, 0x00
+ .2byte \id
+ .4byte 0x00, 0x00
+ .2byte 0x00
+.endm
+
+@ Start Scene? Run Call?
+.macro StartSceneRunCall id:req
+ .byte 0x0C
+ .byte \id
+ .byte 0xFF, 0xFF
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro RunCall id:req
+ .byte 0x0D
+ .byte \id
+ .byte 0xFF, 0xFF
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro triggerCutscene id:req
+ .byte 0x1B
+ .byte 0x00
+ .2byte \id
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro fadeOut arg0:req time:req arg2:req
+ .byte 0x23
+ .byte \arg0
+ .2byte \time
+ .4byte \arg2
+ .4byte 0x00, 0x00
+.endm
+
+.macro fadeColorOut arg0:req arg1:req time:req color:req
+ .byte 0x27
+ .byte \arg0
+ .2byte \arg1
+ .4byte \time
+ .4byte \color
+ .4byte 0x00
+.endm
+
+.macro fadeColorIn arg0:req arg1:req time:req color:req
+ .byte 0x28
+ .byte \arg0
+ .2byte \arg1
+ .4byte \time
+ .4byte \color
+ .4byte 0x00
+.endm
+
+.macro loadData type:req charac:req source:req
+ .byte 0x2D
+ .byte \type
+ .2byte \charac
+ .2byte \source
+ .4byte 0x00, 0x00
+ .2byte 0x00
+.endm
+
+@ Face Locations
+.set bottomL, 0x2
+.set bottomR, 0x3
+.set insetTopL, 0xE
+.set insetTopR, 0xF
+
+.set previousLoc, 0x15
+
+.macro selectFace loc:req charac:req face:req
+ .byte 0x2E
+ .byte \loc
+ .2byte \charac
+ .4byte \face
+ .4byte 0x00, 0x00
+.endm
+
+.macro closeTextBox
+ .byte 0x30
+ .4byte 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00
+.endm
+
+.macro scrollTextBox character:req textPtr:req
+ .byte 0x33, 0x00
+ .2byte \character
+ .4byte 0x00, 0x00
+ .4byte \textPtr
+.endm
+
+.macro PicNameTextBox character:req textPtr:req
+ .byte 0x34, 0x00
+ .2byte \character
+ .4byte 0x00, 0x00
+ .4byte \textPtr
+.endm
+
+.macro quickCloseTextBox character:req textPtr:req
+ .byte 0x36, 0x00
+ .2byte \character
+ .4byte 0x00, 0x00
+ .4byte \textPtr
+.endm
+
+@ Is it always 0xff, 0xff?
+.macro floatingText textPtr:req
+ .byte 0x37, 0x00
+ .byte 0xff, 0xff
+ .4byte 0x00, 0x00
+ .4byte \textPtr
+.endm
+
+.macro fadeFloatingText time:req textPtr:req
+ .byte 0x39, 0x00
+ .2byte \time
+ .4byte 0x00, 0x00
+ .4byte \textPtr
+.endm
+
+.macro YesNoTextBox eventID:req character:req textPtr:req
+ .byte 0x3A, 0x00
+ .2byte \eventID
+ .2byte \character
+ .2byte 0x00
+ .4byte 0x00
+ .4byte \textPtr
+.endm
+
+.macro showName arg0:req
+ .byte 0x3B
+ .byte \arg0
+ .2byte 0x00
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+@ TODO: 0x3C has a lot of different cases...
+
+.macro renamePoke id:req
+ .byte 0x3D, 0x00, 0x00, 0x00
+ .byte \id, 0x00, 0x00, 0x00
+ .4byte 0x00, 0x00
+.endm
+
+.macro renameTeam
+ .byte 0x3D, 0x00, 0x00, 0x00
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro abruptStopMusic
+ .byte 0x42
+ .4byte 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00
+.endm
+
+.macro fadeMusic time:req
+ .byte 0x43
+ .byte 0x00
+ .2byte \time
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro PlayMusic id:req
+ .byte 0x44
+ .byte 0x00
+ .2byte 0x0
+ .2byte \id
+ .2byte 0x00
+ .4byte 0x00, 0x00
+.endm
+
+.macro fadeInMusic id:req time:req
+ .byte 0x45, 0x00
+ .2byte \id
+ .2byte \time
+ .4byte 0x00, 0x00
+ .2byte 0x00
+.endm
+
+@ Also seen referred to as StopSng
+.macro pushR14
+ .byte 0x47
+ .4byte 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00
+.endm
+
+.macro fadeMusicOut time:req
+ .byte 0x48
+ .byte 0x00
+ .2byte \time
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro playSound id:req
+ .byte 0x4C
+ .byte 0x00, 0x00, 0x00
+ .2byte \id
+ .4byte 0x00, 0x00
+ .2byte 0x00
+.endm
+
+.macro stopSound id:req
+ .byte 0x4D
+ .byte 0x00, 0x00, 0x00
+ .2byte \id
+ .4byte 0x00, 0x00
+ .2byte 0x00
+.endm
+
+.macro setAnimation anim:req
+ .byte 0x54
+ .byte 0x00
+ .2byte \anim
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro warpToLoc id:req
+ .byte 0x5B, 0x00
+ .2byte 0x00
+ .byte \id
+ .byte 0x00, 0x00, 0x00
+ .4byte 0x00, 0x00
+.endm
+
+@ move to prefined location along grid
+.macro gridMoveTo speed:req id:req
+ .byte 0x6B, 0x00
+ .2byte \speed
+ .byte \id
+ .4byte 0x00, 0x00
+ .byte 0x00, 0x00, 0x00
+.endm
+
+.macro changeSpriteZ speed:req targetHeight:req
+ .byte 0x70, 0x00
+ .byte \speed
+ .3byte \targetHeight
+ .4byte 0x00, 0x00
+ .2byte 0x00
+.endm
+
+@ Rotation Directions
+.set CW, 1
+.set CCW, 2
+.set shortestDir, 0xA
+
+@ Cardinal Directions / Facing Directions
+.set south, 0
+.set southeast, 1
+.set east, 2
+.set northeast, 3
+.set north, 4
+.set northwest, 5
+.set west, 6
+.set southwest, 7
+
+.macro setFaceDir delay:req faceDir:req
+ .byte 0x8B
+ .byte \delay
+ .byte \faceDir
+ .byte 0x00
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro rotate time:req rotDir:req faceDir:req
+ .byte 0x91
+ .byte \time
+ .byte \rotDir
+ .byte 0x00
+ .byte \faceDir
+ .byte 0x00
+ .4byte 0x00, 0x00
+ .2byte 0x00
+.endm
+
+.macro initVariableTextBox arg0:req arg1:req speaker:req
+ .byte 0xCF
+ .byte \arg0
+ .byte \arg1
+ .byte 0x00
+ .4byte \speaker
+ .4byte 0x00, 0x00
+.endm
+
+.macro variableTextBox version:req textPtr:req
+ .byte 0xD0, 0x00
+ .2byte \version
+ .4byte 0x00, 0x00
+ .4byte \textPtr
+.endm
+
+.macro elseTextBox textPtr:req
+ .byte 0xD1, 0x00
+ .4byte 0x00, 0x00
+ .byte 0x00, 0x00
+ .4byte \textPtr
+.endm
+
+.macro pause time:req
+ .byte 0xDB
+ .byte 0x00
+ .2byte \time
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+@ Wait for sound to finish playing?
+.macro waitSound id:req
+ .byte 0xE2
+ .byte 0x00
+ .2byte \id
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro waitFlag flagnum:req
+ .byte 0xE3
+ .byte 0x00
+ .2byte \flagnum
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro setFlag flagnum:req
+ .byte 0xE4
+ .byte 0x00
+ .2byte \flagnum
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro goTo id:req
+ .byte 0xE5
+ .byte 0x00
+ .byte \id
+ .byte 0x00
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+@ Loop at label until end of scene
+.macro loopLabel id:req
+ .byte 0xE7, 0x00
+ .byte \id, 0x00
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro executeScript scriptNum:req
+ .byte 0xE8
+ .byte 0x00
+ .2byte \scriptNum
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro MsgEnd arg0:req
+ .byte 0xE9
+ .byte 0x00
+ .2byte \arg0
+ .4byte 0x00, 0x00, 0x00
+.endm
+
+.macro endFuncContinueScript
+ .byte 0xEE
+ .4byte 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00
+.endm
+
+.macro endFuncandScript
+ .byte 0xEF
+ .4byte 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00
+.endm
+
+.macro closeThread
+ .byte 0xF0
+ .4byte 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00
+.endm
+
+.macro closeThreadRemoveObject
+ .byte 0xF1
+ .4byte 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00
+.endm
+
+@ Set label for loop
+.macro label id:req
+ .byte 0xF4, 0x00
+ .byte \id, 0x00
+ .4byte 0x00, 0x00, 0x00
+.endm