diff options
Diffstat (limited to 'macros')
-rw-r--r-- | macros/code.asm | 13 | ||||
-rw-r--r-- | macros/data.asm | 5 | ||||
-rw-r--r-- | macros/enum.asm | 2 | ||||
-rw-r--r-- | macros/legacy.asm | 3 | ||||
-rw-r--r-- | macros/scripts/battle_anims.asm | 2 | ||||
-rw-r--r-- | macros/scripts/maps.asm | 2 | ||||
-rw-r--r-- | macros/scripts/text.asm | 8 | ||||
-rw-r--r-- | macros/scripts/trade_anims.asm | 1 | ||||
-rw-r--r-- | macros/wram.asm | 30 |
9 files changed, 27 insertions, 39 deletions
diff --git a/macros/code.asm b/macros/code.asm index 1fb651f30..9429884ca 100644 --- a/macros/code.asm +++ b/macros/code.asm @@ -1,11 +1,11 @@ ; Syntactic sugar macros lb: MACRO ; r, hi, lo - ld \1, (((\2) & $ff) << 8) | (((\3) & $ff)) + ld \1, ((\2) & $ff) << 8 | ((\3) & $ff) ENDM ln: MACRO ; r, hi, lo - ld \1, (((\2) & $f) << 4) | (((\3) & $f)) + ld \1, ((\2) & $f) << 4 | ((\3) & $f) ENDM ldpixel: MACRO @@ -19,7 +19,6 @@ ENDM depixel EQUS "ldpixel de," bcpixel EQUS "ldpixel bc," - ; Design patterns jumptable: MACRO @@ -36,8 +35,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 +51,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 diff --git a/macros/data.asm b/macros/data.asm index ad2d9b8ef..08a23ad29 100644 --- a/macros/data.asm +++ b/macros/data.asm @@ -2,7 +2,6 @@ percent EQUS "* $ff / 100" - ; Constant data (db, dw, dl) macros dwb: MACRO @@ -87,7 +86,6 @@ dba_pic: MACRO ; dbw bank, address dw \1 ENDM - dbpixel: MACRO if _NARG >= 4 ; x tile, x pxl, y tile, y pxl @@ -103,14 +101,12 @@ dsprite: MACRO 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 @@ -118,7 +114,6 @@ rept _NARG endr ENDM - sine_table: MACRO ; \1 samples of sin(x) from x=0 to x<32768 (pi radians) x = 0 diff --git a/macros/enum.asm b/macros/enum.asm index 385aee6f8..009400743 100644 --- a/macros/enum.asm +++ b/macros/enum.asm @@ -22,7 +22,6 @@ enum_set: MACRO __enum__ = \1 ENDM - ; Enumerate constants const_def: MACRO @@ -43,7 +42,6 @@ shift_const: MACRO const_value = const_value + 1 ENDM - ; Enumerate strings define: MACRO diff --git a/macros/legacy.asm b/macros/legacy.asm index 9e452da28..35e6e9ccb 100644 --- a/macros/legacy.asm +++ b/macros/legacy.asm @@ -8,7 +8,6 @@ callab EQUS "callfar" ; macros/scripts/audio.asm unknownmusic0xde EQUS "sound_duty" - ; macros/scripts/events.asm checkmorn EQUS "checktime MORN" @@ -54,7 +53,6 @@ displaylocation EQUS "landmarktotext" givepokeitem EQUS "givepokemail" checkpokeitem EQUS "checkpokemail" - ; macros/scripts/maps.asm mapconst: MACRO @@ -94,7 +92,6 @@ PERSONTYPE_SCRIPT EQUS "OBJECTTYPE_SCRIPT" PERSONTYPE_ITEMBALL EQUS "OBJECTTYPE_ITEMBALL" PERSONTYPE_TRAINER EQUS "OBJECTTYPE_TRAINER" - ; macros/scripts/movement.asm show_person EQUS "show_object" diff --git a/macros/scripts/battle_anims.asm b/macros/scripts/battle_anims.asm index 76300e78f..f25b6da22 100644 --- a/macros/scripts/battle_anims.asm +++ b/macros/scripts/battle_anims.asm @@ -295,7 +295,7 @@ anim_call: MACRO dw \1 ; address ENDM - enum anim_ret_command ; $ff +anim_ret_command EQU -1 ; $ff anim_ret: MACRO db anim_ret_command ENDM diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index d5f5b00e1..7f5947a55 100644 --- a/macros/scripts/maps.asm +++ b/macros/scripts/maps.asm @@ -3,7 +3,6 @@ map_id: MACRO db GROUP_\1, MAP_\1 ENDM - scene_script: MACRO ;\1: script pointer dw \1 @@ -75,7 +74,6 @@ object_event: MACRO dw \9 ENDM - trainer: MACRO ;\1: trainer group ;\2: trainer id diff --git a/macros/scripts/text.asm b/macros/scripts/text.asm index bff18c7ea..d1fec35db 100644 --- a/macros/scripts/text.asm +++ b/macros/scripts/text.asm @@ -46,9 +46,9 @@ text_low: MACRO db TX_LOW ENDM - enum WAIT_BUTTON ; $06 + enum TX_WAIT_BUTTON ; $06 text_waitbutton: MACRO - db WAIT_BUTTON + db TX_WAIT_BUTTON ENDM enum TX_SCROLL ; $07 @@ -56,9 +56,9 @@ text_scroll: MACRO db TX_SCROLL ENDM - enum START_ASM ; $08 + enum TX_START_ASM ; $08 start_asm: MACRO - db START_ASM + db TX_START_ASM ENDM enum TX_NUM ; $09 diff --git a/macros/scripts/trade_anims.asm b/macros/scripts/trade_anims.asm index 633047b82..6227f2022 100644 --- a/macros/scripts/trade_anims.asm +++ b/macros/scripts/trade_anims.asm @@ -166,7 +166,6 @@ tradeanim_wait_180_if_ot_egg: MACRO db tradeanim_wait_180_if_ot_egg_command ENDM - ; Mobile enum_start $01 diff --git a/macros/wram.asm b/macros/wram.asm index 469cc1022..eec839b7d 100644 --- a/macros/wram.asm +++ b/macros/wram.asm @@ -76,7 +76,6 @@ red_party_struct: MACRO \1Special:: dw ENDM - battle_struct: MACRO \1Species:: db \1Item:: db @@ -114,7 +113,6 @@ box: MACRO \1End:: ds 2 ; padding ENDM - map_connection_struct: MACRO \1ConnectedMapGroup:: db \1ConnectedMapNumber:: db @@ -131,7 +129,7 @@ channel_struct: MACRO ; Addreses are wChannel1 (c101). \1MusicID:: dw \1MusicBank:: db -\1Flags:: db ; 0:on/off 1:subroutine 3:sfx 4:noise 5:rest +\1Flags1:: db ; 0:on/off 1:subroutine 3:sfx 4:noise 5:rest \1Flags2:: db ; 0:vibrato on/off 2:duty 4:cry pitch \1Flags3:: db ; 0:vibrato up/down \1MusicAddress:: dw @@ -141,37 +139,35 @@ channel_struct: MACRO \1Condition:: db ; conditional jumps \1DutyCycle:: db ; bits 6-7 (0:12.5% 1:25% 2:50% 3:75%) \1Intensity:: db ; hi:pressure lo:velocity -\1Frequency:: ; 11 bits -\1FrequencyLo:: db -\1FrequencyHi:: db +\1Frequency:: dw ; 11 bits \1Pitch:: db ; 0:rest 1-c:note \1Octave:: db ; 7-0 (0 is highest) \1PitchOffset:: db ; raises existing octaves (to repeat phrases) \1NoteDuration:: db ; frames remaining for the current note -\1Field16:: ds 1 ; c117 - ds 1 ; c118 +\1Field16:: ds 1 + ds 1 \1LoopCount:: db \1Tempo:: dw \1Tracks:: db ; hi:left lo:right -\1SFXDutyLoop:: db ; c11d +\1SFXDutyLoop:: db \1VibratoDelayCount:: db ; initialized by \1VibratoDelay \1VibratoDelay:: db ; number of frames a note plays until vibrato starts \1VibratoExtent:: db \1VibratoRate:: db ; hi:frames for each alt lo:frames to the next alt \1PitchWheelTarget:: dw ; frequency endpoint for pitch wheel -\1PitchWheelAmount:: db ; c124 -\1PitchWheelAmountFraction:: db ; c125 -\1Field25:: db ; c126 - ds 1 ; c127 +\1PitchWheelAmount:: db +\1PitchWheelAmountFraction:: db +\1Field25:: db + ds 1 \1CryPitch:: dw \1Field29:: ds 1 \1Field2a:: ds 2 \1Field2c:: ds 1 \1NoteLength:: db ; frames per 16th note -\1Field2e:: ds 1 ; c12f -\1Field2f:: ds 1 ; c130 -\1Field30:: ds 1 ; c131 - ds 1 ; c132 +\1Field2e:: ds 1 +\1Field2f:: ds 1 +\1Field30:: ds 1 + ds 1 ENDM battle_tower_struct: MACRO |