fork/training-mode-ce

git clone https://git.julia.blue/fork/training-mode-ce

jamsEggs-ercise ASM to C rewrite (#310)305b2f6

master
29.0 KiB937 linesraw
1    #######################
2    ## Codeset Variables ##
3    #######################
4
5    # Score Types
6    .set KO, 0x0
7    .set Time, 0x1
8    
9    # Utility
10    .set AnalogTriggerThreshold, 43
11    
12    ##################################
13    # This must match the order of the
14    # JumpTableIndex in events.h
15
16    # This macro will change the order of the pages
17    # Only thing this macro doesn't affect is Load CSS + Preload CPU + high scores. Must change this manually.
18    .macro EventJumpTable
19    bl AmsahTech
20    bl AttackOnShield
21    bl ComboTraining
22    bl EscapeSheik
23    bl GrabMashOut
24    bl LedgeStall
25    bl Ledgetech
26    bl LedgetechCounter
27    bl Multishine
28    bl Reaction
29    bl Reversal
30    bl SDITraining
31    bl ShieldDrop
32    bl SlideOff
33    bl WaveshineSDI
34    .long -1
35    .endm
36
37############################
38
39    # Custom Memcard Data Bitfield
40    .set OSDBitfield, 0x1F24
41    .set OSDMaxWindows, 0x1F28
42    .set CurrentEventPage, 0x1F29
43    .set OSDRecommended, 0x1F2A
44    .set LabFrameAdvanceButton, 0x1F2B
45
46    # Custom rtoc offsets
47    .set EventCPUBackup_CharID, -0xDA5                  # byte
48    .set CodesetPointer, -0xDA0                         # word
49    .set CodesetLength, -0xD9C                          # word
50
51    # OSD IDs
52    # These bits must match `osd_memory_bit_position` defined in lab.h in order for the
53    # Lab OSD menu to modify the correct OSD.
54    .set OSD.Wavedash, 0
55    .set OSD.LCancel, 1
56    .set OSD.ActOoS, 3
57    .set OSD.Dashback, 5
58    .set OSD.FighterSpecificTech, 8
59    .set OSD.Powershield, 9
60    .set OSD.SDI, 10
61    .set OSD.LockoutTimers, 12
62    .set OSD.RollAirdodgeInterrupt, 13
63    .set OSD.BoostGrab, 14
64    .set OSD.Miscellaneous, 15
65    .set OSD.ActOoWait, 16
66    .set OSD.ActOoAirborne, 18
67    .set OSD.ActOoJumpSquat, 19
68    .set OSD.Fastfall, 20
69    .set OSD.FrameAdvantage, 21
70    .set OSD.ComboCounter, 22
71    .set OSD.GrabBreakout, 24
72    .set OSD.Ledge, 26
73    .set OSD.ActOoHitstun, 28
74
75    # OSD Alt IDs
76    # Some OSD options contain multiple sub OSDs.
77    # We don't want those OSDs to overwrite each other,
78    # so we have some alt IDs for them to use.
79    .set OSD.FighterSpecificTechAlt, 64
80
81    #####################
82    ## Melee Variables ##
83    #####################
84    # Static Memory Locations
85    .set pdLoadCommonData, 0x803bcde0
86    .set InputStructStart, 0x804c21cc
87    .set InputStruct_HeldButtons, 0x0
88    .set InputStruct_HeldButtonsPrevFrame, 0x4
89    .set InputStruct_InstantButtons, 0x8
90    .set InputStruct_RapidFireButtons, 0xC
91    .set InputStruct_InstantReleasedButtons, 0x10
92    .set InputStruct_RapidFireCounter, 0x14
93    .set InputStruct_LeftAnalogX, 0x18
94    .set InputStruct_LeftAnalogY, 0x19
95    .set InputStruct_RightAnalogX, 0x1A
96    .set InputStruct_RightAnalogY, 0x1B
97    .set InputStruct_LeftTrigger, 0x1C
98    .set InputStruct_RightTrigger, 0x1D
99    .set InputStruct_LeftAnalogXFloat, 0x20
100    .set InputStruct_LeftAnalogYFloat, 0x24
101    .set InputStruct_RightAnalogXFloat, 0x28
102    .set InputStruct_RightAnalogYFloat, 0x2C
103    .set InputStruct_IsPlugged, 0x41
104    .set InputStruct_Length, 68
105    .set HSD_InputStructStart, 0x804c1fac
106    .set PreloadTable, 0x80432078
107    .set Preload_Stage, 0x10
108    .set CSS_CursorPointers, 0x804a0bc0
109    .set HSD_Pad, 0x804c1f78
110    .set CSS_DoorStructs, 0x803f0dfc
111    .set CSSDoor_State, 0xB
112
113    # r13 Offsets
114    .set MemcardData, -0x77C0
115    .set DEBUGLV, -0x6C98
116    .set CSS_Data, -0x49F0
117    .set CSS_UnkGObj, -0x49E4
118    .set CSS_UnkJObj, -0x49E0
119    .set CSS_PointerToDatNodes, -0x49C8                 # these are initialized to at 80266970
120    .set CSS_MainPlayerPort, -0x49B0
121    .set CSS_CPUPlayerPort, -0x49AF
122    .set CSS_StartCountdown, -0x49AE
123    .set CSS_Unk, -0x49AC
124    .set CSS_MaxPlayers, -0x49AB
125    .set CSS_Unk, -0x49AA
126    .set CSS_SinglePlayerPortNumber, -0x4DE0
127    .set HPS_Unk, -0x3F44
128    .set HPS_CurrentSongEntryNum, -0x3F3C
129    .set HPS_Unk, -0x3F14
130    .set GObj_CurrentProc, -0x3E68
131    .set HSDPerf_, 0x0
132    .set Hitbox_DamageLog, -0x5148                      # Num of solid hits dealt by the player this check
133    .set Hitbox_TipLog, -0x5144                         # Num of phantom hits dealt by the player this check
134    .set StageID_External, -0x6CB8
135    .set Stage_LedgeInfo, -0x51E8
136    .set Stage_LineInfo, -0x51EC                        # ctrl f "stage line counts" in melee notes.txt for detailed info
137    .set Stage_PositionHazardCount, -0x5128
138    .set Stage_GrabHazardCount, -0x512C
139    .set Stage_DamageHazardCount, -0x5130
140    .set Audio_NextAreaInSSMHeap, -0x5258
141    .set Audio_UnkConstant, -0x5250
142    .set Audio_TotalSSMMemory, -0x5268
143    .set GObj_Lists, -0x3E74
144
145    .set TM_FrozenToggle, -0x4F8C
146    .set TM_GameFrameCounter, -0x49a8
147
148    .macro TABLE table, base, size=4
149        .set \table, \base
150        .set _current, \base
151        .macro ENTRY name
152            .set \name, _current
153            .set _current, _current + \size
154        .endm
155    .endm
156
157    # TM Function
158    TABLE TM_tmFunction, -(50*4) # offset of rtoc where function pointers are kept, probably temp solution
159    ENTRY TM_EventPages
160    ENTRY TM_GetEventDesc
161    ENTRY TM_GetEventName
162    ENTRY TM_GetEventDescription
163    ENTRY TM_GetPageName
164    ENTRY TM_GetPageEventNum
165    ENTRY TM_GetTMVersShort
166    ENTRY TM_GetTMVersLong
167    ENTRY TM_GetTMCompile
168    ENTRY TM_GetPageNum
169    ENTRY TM_GetCSSType
170    ENTRY TM_GetIsSelectStage
171    ENTRY TM_GetCPUFighter
172    ENTRY TM_GetStage
173    ENTRY TM_GetEventFile
174    ENTRY TM_GetCSSFile
175    ENTRY TM_EventInit
176    ENTRY TM_OnSceneChange
177    ENTRY TM_OnBoot
178    ENTRY TM_OnStartMelee
179    ENTRY TM_OnFileLoad
180    ENTRY TM_MessageDisplay
181    ENTRY TM_GetScoreType
182    ENTRY TM_GetPageEventOffset
183    ENTRY TM_GetJumpTableOffset
184    ENTRY TM_GetEventCharList
185
186    # TmDt Data Pointers
187    .set TM_Data, TM_tmFunction - 0x4
188
189    # Scene Struct
190    .set SceneController, 0x80479D30
191    .set Scene.CurrentMajor, 0x0
192    .set Scene.PendingMajor, 0x1
193    .set Scene.PreviousMajor, 0x2
194    .set Scene.CurrentMinor, 0x3
195    .set Scene.PendingMinor, 0x4
196    .set Scene.PreviousMinor, 0x5
197    # Scene ID's
198    .set Scene.TitleScreen, 0x00
199    .set Scene.MainMenu, 0x01
200    .set Scene.VSMode, 0x02
201    .set Scene.ClassicMode, 0x03
202    .set Scene.AdventureMode, 0x04
203    .set Scene.AllStarMode, 0x05
204    .set Scene.MainDebugMenu, 0x06
205    .set Scene.SoundTestDebugMenu, 0x07
206    .set Scene.HanyuTestCSS, 0x08
207    .set Scene.HanyuTestSSS, 0x09
208    .set Scene.CameraModeMemcardPrompt, 0x0A
209    .set Scene.TrophyGallery, 0x0B
210    .set Scene.TrophyLottery, 0x0C
211    .set Scene.TrophyCollection, 0x0D
212    .set Scene.DebugDiarantou, 0x0E
213    .set Scene.TargetTest, 0x0F
214    .set Scene.SuperSuddenDeath, 0x10
215    .set Scene.InvisibleMelee, 0x11
216    .set Scene.SloMoMelee, 0x12
217    .set Scene.LightningMelee, 0x13
218    .set Scene.ChallengerApproaching, 0x14
219    .set Scene.ClassicModeEnding, 0x15
220    .set Scene.AdventureModeEnding, 0x16
221    .set Scene.AllStarModeEnding, 0x17
222    .set Scene.OpeningMovie, 0x18
223    .set Scene.VisualSceneDebug, 0x19
224    .set Scene.1PEndingDebug, 0x1A
225    .set Scene.TournamentMode, 0x1B
226    .set Scene.TrainingMode, 0x1C
227    .set Scene.TinyMelee, 0x1D
228    .set Scene.GiantMelee, 0x1E
229    .set Scene.StaminaMode, 0x1F
230    .set Scene.HomeRunContest, 0x20
231    .set Scene.10ManMelee, 0x21
232    .set Scene.100ManMelee, 0x22
233    .set Scene.3MinuteMelee, 0x23
234    .set Scene.15MinuteMelee, 0x24
235    .set Scene.EndlessMelee, 0x25
236    .set Scene.CruelMelee, 0x26
237    .set Scene.ProgressiveScanPrompt, 0x27
238    .set Scene.BootUp, 0x28
239    .set Scene.MemcardPropmt, 0x29
240    .set Scene.FixedCamera, 0x2A
241    .set Scene.EventMode, 0x2B
242    .set Scene.SingleButton, 0x2C
243
244####################
245## Function Names ##
246####################
247
248    .set ActionStateChange, 0x800693ac
249    .set OSReport, 0x803456a8
250    .set HSD_Randi, 0x80380580
251    .set HSD_Randf, 0x80380528
252    .set AS_Wait, 0x8008a2bc
253    .set AS_Fall, 0x800cc730
254    .set AS_Catch, 0x800d8c54
255    .set AS_Guard, 0x800939b4
256    .set HSD_MemAlloc, 0x8037f1e4
257    .set HSD_JObjLoadJoint, 0x80370e44
258    .set memcpy, 0x800031f4
259    .set memmove, 0x80323938
260    .set strcpy, 0x80325a50
261    .set ZeroAreaLength, 0x8000c160
262    .set CreateCameraBox, 0x80029020
263    .set FrameSpeedChange, 0x8006f190
264    .set HUD_KOCounter_UpdateKOs, 0x802fa2d0
265    .set Playerblock_StoreTimesR3KilledR4, 0x80034fa8
266    .set Playerblock_LoadTimesR3KilledR4, 0x80034f24
267    .set SFX_PlaySoundAtFullVolume, 0x801c53ec
268    .set SFX_MenuCommonSound, 0x80024030
269    .set AS_Rebirth, 0x800d4ff4
270    .set Stage_GetLeftOfLineCoordinates, 0x80053ecc
271    .set Stage_GetRightOfLineCoordinates, 0x80053da4
272    .set AS_RebirthWait, 0x800d5600
273    .set RebirthPlatform_UpdatePosition, 0x800d54a4
274    .set AS_CliffWait, 0x8009a804
275    .set Air_StoreBool_LoseGroundJump_NoECBfor10Frames, 0x8007d5d4
276    .set DataOffset_ECBBottomUpdateEnable, 0x8007d5bc
277    .set MovePlayerToLedge, 0x80081544
278    .set ApplyIntangibility, 0x8007b760
279    .set ApplyInvincibility, 0x8007b7a4
280    .set GFX_RemoveAll, 0x8007db24
281    .set PlayerBlock_LoadMainCharDataOffset, 0x80034110
282    .set PlayerBlock_SetDamage, 0x80034330
283    .set PlayerBlock_LoadDamage, 0x800342b4
284    .set StageInfo_CameraLimitLeft_Load, 0x80224a54
285    .set StageInfo_CameraLimitRight_Load, 0x80224a68
286    .set StageInfo_CameraLimitTop_Load, 0x80224a80
287    .set StageInfo_CameraLimitBottom_Load, 0x80224a98
288    .set Stage_map_gobj_Load, 0x801c2ba4
289    .set Stage_map_gobj_LoadJObj, 0x801c3fa4
290    .set Stage_Destroy_map_gobj, 0x801c4a08
291    .set EntityItemSpawn, 0x80268b18
292    .set MatchInfo_LoadSeconds, 0x8016aeec
293    .set MatchInfo_LoadSubSeconds, 0x8016aefc
294    .set EventMatch_OnWinCondition, 0x801bc4f4
295    .set Events_GetEventSavedScore, 0x8015cf5c
296    .set Events_SetEventSavedScore, 0x8015cf70
297    .set Textures_DisplayEffectTextures, 0x8005fddc
298    .set AS_GrabOpponent, 0x800d9ce8
299    .set AS_Grabbed, 0x800daadc
300    .set AS_CatchWait, 0x800da1d8
301    .set AS_SquatWait, 0x800d62c4
302    .set AS_Sleep, 0x800d4f24
303    .set SetAsGrounded, 0x8007d7fc
304    .set FrameSpeedChange, 0x8006f190
305    .set EnvironmentCollision_WaitLanding, 0x80084280
306    .set Air_SetAsGrounded, 0x8007d6a4
307    .set CPU_JoystickXAxis_Convert, 0x800a17e4
308    .set CPU_JoystickYAxis_Convert, 0x800a1874
309    .set Joystick_Angle_Retrieve, 0x8007d9d4
310    .set GFX_UpdatePlayerGFX, 0x800c0408
311    .set cos, 0x80326240
312    .set sin, 0x803263d4
313    .set fmod, 0x80364340
314    .set sqrt, 0x8000d5bc
315    .set HSD_Free, 0x8037f1b0
316    .set GObj_Create, 0x803901f0
317    .set GObj_AddUserData, 0x80390b68
318    .set GObj_Destroy, 0x80390228
319    .set GObj_AddProc, 0x8038fd54
320    .set GObj_RemoveProc, 0x8038fed4
321    .set GObj_StorePointerToJObj, 0x80390a70
322    .set GObj_AddGXLink, 0x8039069c
323    .set HSD_JObjSetMtxDirtySub, 0x803732e8
324    .set DevelopMode_FrameAdvanceCheck, 0x801a45e8
325    .set MatchInfo_StockModeCheck, 0x8016b094
326    .set PlayerBlock_LoadStocksLeft, 0x80033bd8
327    .set PlayerBlock_LoadSlotType, 0x8003241c
328    .set Playerblock_LoadStaticBlock, 0x80031724
329    .set Text_CreateTextStruct, 0x803a6754
330    .set Text_InitializeSubtext, 0x803a6b98
331    .set Text_UpdateSubtextSize, 0x803a7548
332    .set Text_UpdateSubtextPosition, 0x803a746c
333    .set Text_UpdateSubtextContents, 0x803a70a0
334    .set Text_ChangeTextColor, 0x803a74f0
335    .set Text_RemoveText, 0x803a5cc4
336    .set strlen, 0x80325b04
337    .set PlayerBlock_LoadExternalCharID, 0x80032330
338    .set PlayerBlock_GotoStaleMoveEntry_0xBC, 0x80036244
339    .set InitializePlayerDataValues, 0x80068354
340    .set Event_GetEventSavedScore, 0x8015cf5c
341    .set Events_CheckIfEventWasPlayedYet, 0x8015cefc
342    .set Events_SetEventAsPlayed, 0x8015ceb4
343    .set Events_StoreEventScore, 0x8015cf70
344    .set Interrupt_AerialJumpGoTo, 0x800cb870
345    .set PlayerBlock_UpdateXYCoords, 0x80032828
346    .set Raycast_GroundLine, 0x8004f008
347    .set Camera_UpdatePlayerCameraBoxPosition, 0x800761c8
348    .set Camera_CorrectPosition, 0x8002f3ac
349    .set ItemCollision_Egg, 0x802895a8
350    .set SFX_StopAllCharacterSFX, 0x80088a50
351    .set SFXManager_StopSFXIfPlaying, 0x80321ce8
352    .set memset, 0x80003100
353    .set Ragdoll_WindDecayThink, 0x800115f4
354    .set Inputs_GetPlayerHeldInputs, 0x801a3680
355    .set Inputs_GetPlayerInstantInputs, 0x801a36a0
356    .set Inputs_GetPlayerRapidInputs, 0x801a36c0
357    .set DevelopText_CreateDataTable, 0x80302834
358    .set DevelopText_Activate, 0x80302810
359    .set DevelopText_AddString, 0x80302be4
360    .set DevelopText_EraseAllText, 0x80302bb0
361    .set DevelopMode_Text_ResetCursorXY, 0x80302a3c
362    .set DevelopText_StoreBGColor, 0x80302b90
363    .set DevelopText_HideBG, 0x80302ae0
364    .set DevelopText_ShowBG, 0x80302ad0
365    .set cvt_sll_flt, 0x80322da0
366    .set cvt_fp2unsigned, 0x803228c0
367    .set sprintf, 0x80323cf4
368    .set PlayerBlock_LoadNameTagSlot, 0x8003556c
369    .set Nametag_LoadNametagSlotText, 0x8023754c
370    .set LoadRulesSettingsPointer1, 0x8015cc34
371    .set CSS_UpdateCSPInfo, 0x8025db34
372    .set Rumble_StoreRumbleFlag, 0x8015ed4c
373
374    # Custom Functions
375    .set TextCreateFunction, 0x80005928
376    .set GetCustomEventPageName, 0x8000552c
377    .set SearchStringTable, 0x80005530
378    .set prim.new, 0x804DD84C
379    .set prim.close, 0x804DD848
380
381    # Character External IDs
382    .set CaptainFalcon.Ext, 0x0
383    .set DK.Ext, 0x1
384    .set Fox.Ext, 0x2
385    .set GaW.Ext, 0x3
386    .set Kirby.Ext, 0x4
387    .set Bowser.Ext, 0x5
388    .set Link.Ext, 0x6
389    .set Luigi.Ext, 0x7
390    .set Mario.Ext, 0x8
391    .set Marth.Ext, 0x9
392    .set Mewtwo.Ext, 0xA
393    .set Ness.Ext, 0xB
394    .set Peach.Ext, 0xC
395    .set Pikachu.Ext, 0xD
396    .set IceClimbers.Ext, 0xE
397    .set Jigglypuff.Ext, 0xF
398    .set Samus.Ext, 0x10
399    .set Yoshi.Ext, 0x11
400    .set Zelda.Ext, 0x12
401    .set Sheik.Ext, 0x13
402    .set Falco.Ext, 0x14
403    .set YLink.Ext, 0x15
404    .set Doc.Ext, 0x16
405    .set Roy.Ext, 0x17
406    .set Pichu.Ext, 0x18
407    .set Ganondorf.Ext, 0x19
408
409    # Character Internal IDs
410    .set Mario.Int, 0x0
411    .set Fox.Int, 0x1
412    .set CaptainFalcon.Int, 0x2
413    .set DK.Int, 0x3
414    .set Kirby.Int, 0x4
415    .set Bowser.Int, 0x5
416    .set Link.Int, 0x6
417    .set Sheik.Int, 0x7
418    .set Ness.Int, 0x8
419    .set Peach.Int, 0x9
420    .set Popo.Int, 0xA
421    .set Nana.Int, 0xB
422    .set Pikachu.Int, 0xC
423    .set Samus.Int, 0xD
424    .set Yoshi.Int, 0xE
425    .set Jigglypuff.Int, 0xF
426    .set Mewtwo.Int, 0x10
427    .set Luigi.Int, 0x11
428    .set Marth.Int, 0x12
429    .set Zelda.Int, 0x13
430    .set YLink.Int, 0x14
431    .set Doc.Int, 0x15
432    .set Falco.Int, 0x16
433    .set Pichu.Int, 0x17
434    .set GaW.Int, 0x18
435    .set Ganondorf.Int, 0x19
436    .set Roy.Int, 0x1A
437
438    # Stage External IDs
439    .set FoD, 0x2
440    .set PokemonStadium, 0x3
441    .set PeachsCastle, 0x4
442    .set KongoJungle, 0x5
443    .set Brinstar, 0x6
444    .set Corneria, 0x7
445    .set YoshiStory, 0x8
446    .set Onett, 0x9
447    .set MuteCity, 0xA
448    .set RainbowCruise, 0xB
449    .set JungleJapes, 0xC
450    .set GreatBay, 0xD
451    .set HyruleTemple, 0xE
452    .set BrinstarDepths, 0xF
453    .set YoshiIsland, 0x10
454    .set GreenGreens, 0x11
455    .set Fourside, 0x12
456    .set MushroomKingdomI, 0x13
457    .set MushroomKingdomII, 0x14
458    .set Akaneia, 0x15
459    .set Venom, 0x16
460    .set PokeFloats, 0x17
461    .set BigBlue, 0x18
462    .set IcicleMountain, 0x19
463    .set IceTop, 0x1A
464    .set FlatZone, 0x1B
465    .set DreamLand, 0x1C
466    .set YoshiIsland64, 0x1D
467    .set KongoJungle64, 0x1E
468    .set Battlefield, 0x1F
469    .set FinalDestination, 0x20
470
471    # Button Definitions
472    .set PAD_BUTTON_LEFT, 0x40000
473    .set PAD_BUTTON_RIGHT, 0x80000
474    .set PAD_BUTTON_DOWN, 0x20000
475    .set PAD_BUTTON_UP, 0x10000
476    .set PAD_BUTTON_DPAD_LEFT, 0x0001
477    .set PAD_BUTTON_DPAD_RIGHT, 0x0002
478    .set PAD_BUTTON_DPAD_DOWN, 0x0004
479    .set PAD_BUTTON_DPAD_UP, 0x0008
480    .set PAD_TRIGGER_Z, 0x0010
481    .set PAD_TRIGGER_R, 0x0020
482    .set PAD_TRIGGER_L, 0x0040
483    .set PAD_BUTTON_A, 0x0100
484    .set PAD_BUTTON_B, 0x0200
485    .set PAD_BUTTON_X, 0x0400
486    .set PAD_BUTTON_Y, 0x0800
487    .set PAD_BUTTON_START, 0x1000
488
489    # SFX Definitions
490    .set SFX_cs_cancel, 0xac
491    .set SFX_cs_decide, 0xad
492    .set SFX_cs_mv, 0xae
493    .set SFX_cs_beep1, 0xaf
494
495#########################
496## Playerblock Offsets ##
497#########################
498
499    # Misc
500    .set ControllerPort, 0x618
501    .set CostumeID, 0x619
502    # Input Data
503    .set HeldButtons, 0x65C
504    .set InstantButtons, 0x668
505    .set AnalogX, 0x620
506    .set AnalogY, 0x624
507    # Animation Data
508    .set CurrentFrame, 0x894
509    # CPU AI Data
510    .set CPU_HeldButtons, 0x1A88
511    .set CPU_AnalogX, 0x1A8C
512    .set CPU_AnalogY, 0x1A8D
513    .set CPU_CStickX, 0x1A8E
514    .set CPU_CStickY, 0x1A8F
515    .set CPU_LAnalog, 0x1A90
516    .set CPU_RAnalog, 0x1A91
517
518    #############################
519    ## Player Action State IDs ##
520    #############################
521    .set ASID_DeadDown, 0x00
522    .set ASID_DeadLeft, 0x01
523    .set ASID_DeadRight, 0x02
524    .set ASID_DeadUp, 0x03
525    .set ASID_DeadUpStar, 0x04
526    .set ASID_DeadUpStarIce, 0x05
527    .set ASID_DeadUpFall, 0x06
528    .set ASID_DeadUpFallHitCamera, 0x07
529    .set ASID_DeadUpFallHitCameraFlat, 0x08
530    .set ASID_DeadUpFallIce, 0x09
531    .set ASID_DeadUpFallHitCameraIce, 0x0A
532    .set ASID_Sleep, 0x0B
533    .set ASID_Rebirth, 0x0C
534    .set ASID_RebirthWait, 0x0D
535    .set ASID_Wait, 0x0E
536    .set ASID_WalkSlow, 0x0F
537    .set ASID_WalkMiddle, 0x10
538    .set ASID_WalkFast, 0x11
539    .set ASID_Turn, 0x12
540    .set ASID_TurnRun, 0x13
541    .set ASID_Dash, 0x14
542    .set ASID_Run, 0x15
543    .set ASID_RunDirect, 0x16
544    .set ASID_RunBrake, 0x17
545    .set ASID_KneeBend, 0x18
546    .set ASID_JumpF, 0x19
547    .set ASID_JumpB, 0x1A
548    .set ASID_JumpAerialF, 0x1B
549    .set ASID_JumpAerialB, 0x1C
550    .set ASID_Fall, 0x1D
551    .set ASID_FallF, 0x1E
552    .set ASID_FallB, 0x1F
553    .set ASID_FallAerial, 0x20
554    .set ASID_FallAerialF, 0x21
555    .set ASID_FallAerialB, 0x22
556    .set ASID_FallSpecial, 0x23
557    .set ASID_FallSpecialF, 0x24
558    .set ASID_FallSpecialB, 0x25
559    .set ASID_DamageFall, 0x26
560    .set ASID_Squat, 0x27
561    .set ASID_SquatWait, 0x28
562    .set ASID_SquatRv, 0x29
563    .set ASID_Landing, 0x2A
564    .set ASID_LandingFallSpecial, 0x2B
565    .set ASID_Attack11, 0x2C
566    .set ASID_Attack12, 0x2D
567    .set ASID_Attack13, 0x2E
568    .set ASID_Attack100Start, 0x2F
569    .set ASID_Attack100Loop, 0x30
570    .set ASID_Attack100End, 0x31
571    .set ASID_AttackDash, 0x32
572    .set ASID_AttackS3Hi, 0x33
573    .set ASID_AttackS3HiS, 0x34
574    .set ASID_AttackS3S, 0x35
575    .set ASID_AttackS3LwS, 0x36
576    .set ASID_AttackS3Lw, 0x37
577    .set ASID_AttackHi3, 0x38
578    .set ASID_AttackLw3, 0x39
579    .set ASID_AttackS4Hi, 0x3A
580    .set ASID_AttackS4HiS, 0x3B
581    .set ASID_AttackS4S, 0x3C
582    .set ASID_AttackS4LwS, 0x3D
583    .set ASID_AttackS4Lw, 0x3E
584    .set ASID_AttackHi4, 0x3F
585    .set ASID_AttackLw4, 0x40
586    .set ASID_AttackAirN, 0x41
587    .set ASID_AttackAirF, 0x42
588    .set ASID_AttackAirB, 0x43
589    .set ASID_AttackAirHi, 0x44
590    .set ASID_AttackAirLw, 0x45
591    .set ASID_LandingAirN, 0x46
592    .set ASID_LandingAirF, 0x47
593    .set ASID_LandingAirB, 0x48
594    .set ASID_LandingAirHi, 0x49
595    .set ASID_LandingAirLw, 0x4A
596    .set ASID_DamageHi1, 0x4B
597    .set ASID_DamageHi2, 0x4C
598    .set ASID_DamageHi3, 0x4D
599    .set ASID_DamageN1, 0x4E
600    .set ASID_DamageN2, 0x4F
601    .set ASID_DamageN3, 0x50
602    .set ASID_DamageLw1, 0x51
603    .set ASID_DamageLw2, 0x52
604    .set ASID_DamageLw3, 0x53
605    .set ASID_DamageAir1, 0x54
606    .set ASID_DamageAir2, 0x55
607    .set ASID_DamageAir3, 0x56
608    .set ASID_DamageFlyHi, 0x57
609    .set ASID_DamageFlyN, 0x58
610    .set ASID_DamageFlyLw, 0x59
611    .set ASID_DamageFlyTop, 0x5A
612    .set ASID_DamageFlyRoll, 0x5B
613    .set ASID_LightGet, 0x5C
614    .set ASID_HeavyGet, 0x5D
615    .set ASID_LightThrowF, 0x5E
616    .set ASID_LightThrowB, 0x5F
617    .set ASID_LightThrowHi, 0x60
618    .set ASID_LightThrowLw, 0x61
619    .set ASID_LightThrowDash, 0x62
620    .set ASID_LightThrowDrop, 0x63
621    .set ASID_LightThrowAirF, 0x64
622    .set ASID_LightThrowAirB, 0x65
623    .set ASID_LightThrowAirHi, 0x66
624    .set ASID_LightThrowAirLw, 0x67
625    .set ASID_HeavyThrowF, 0x68
626    .set ASID_HeavyThrowB, 0x69
627    .set ASID_HeavyThrowHi, 0x6A
628    .set ASID_HeavyThrowLw, 0x6B
629    .set ASID_LightThrowF4, 0x6C
630    .set ASID_LightThrowB4, 0x6D
631    .set ASID_LightThrowHi4, 0x6E
632    .set ASID_LightThrowLw4, 0x6F
633    .set ASID_LightThrowAirF4, 0x70
634    .set ASID_LightThrowAirB4, 0x71
635    .set ASID_LightThrowAirHi4, 0x72
636    .set ASID_LightThrowAirLw4, 0x73
637    .set ASID_HeavyThrowF4, 0x74
638    .set ASID_HeavyThrowB4, 0x75
639    .set ASID_HeavyThrowHi4, 0x76
640    .set ASID_HeavyThrowLw4, 0x77
641    .set ASID_SwordSwing1, 0x78
642    .set ASID_SwordSwing3, 0x79
643    .set ASID_SwordSwing4, 0x7A
644    .set ASID_SwordSwingDash, 0x7B
645    .set ASID_BatSwing1, 0x7C
646    .set ASID_BatSwing3, 0x7D
647    .set ASID_BatSwing4, 0x7E
648    .set ASID_BatSwingDash, 0x7F
649    .set ASID_ParasolSwing1, 0x80
650    .set ASID_ParasolSwing3, 0x81
651    .set ASID_ParasolSwing4, 0x82
652    .set ASID_ParasolSwingDash, 0x83
653    .set ASID_HarisenSwing1, 0x84
654    .set ASID_HarisenSwing3, 0x85
655    .set ASID_HarisenSwing4, 0x86
656    .set ASID_HarisenSwingDash, 0x87
657    .set ASID_StarRodSwing1, 0x88
658    .set ASID_StarRodSwing3, 0x89
659    .set ASID_StarRodSwing4, 0x8A
660    .set ASID_StarRodSwingDash, 0x8B
661    .set ASID_LipStickSwing1, 0x8C
662    .set ASID_LipStickSwing3, 0x8D
663    .set ASID_LipStickSwing4, 0x8E
664    .set ASID_LipStickSwingDash, 0x8F
665    .set ASID_ItemParasolOpen, 0x90
666    .set ASID_ItemParasolFall, 0x91
667    .set ASID_ItemParasolFallSpecial, 0x92
668    .set ASID_ItemParasolDamageFall, 0x93
669    .set ASID_LGunShoot, 0x94
670    .set ASID_LGunShootAir, 0x95
671    .set ASID_LGunShootEmpty, 0x96
672    .set ASID_LGunShootAirEmpty, 0x97
673    .set ASID_FireFlowerShoot, 0x98
674    .set ASID_FireFlowerShootAir, 0x99
675    .set ASID_ItemScrew, 0x9A
676    .set ASID_ItemScrewAir, 0x9B
677    .set ASID_DamageScrew, 0x9C
678    .set ASID_DamageScrewAir, 0x9D
679    .set ASID_ItemScopeStart, 0x9E
680    .set ASID_ItemScopeRapid, 0x9F
681    .set ASID_ItemScopeFire, 0xA0
682    .set ASID_ItemScopeEnd, 0xA1
683    .set ASID_ItemScopeAirStart, 0xA2
684    .set ASID_ItemScopeAirRapid, 0xA3
685    .set ASID_ItemScopeAirFire, 0xA4
686    .set ASID_ItemScopeAirEnd, 0xA5
687    .set ASID_ItemScopeStartEmpty, 0xA6
688    .set ASID_ItemScopeRapidEmpty, 0xA7
689    .set ASID_ItemScopeFireEmpty, 0xA8
690    .set ASID_ItemScopeEndEmpty, 0xA9
691    .set ASID_ItemScopeAirStartEmpty, 0xAA
692    .set ASID_ItemScopeAirRapidEmpty, 0xAB
693    .set ASID_ItemScopeAirFireEmpty, 0xAC
694    .set ASID_ItemScopeAirEndEmpty, 0xAD
695    .set ASID_LiftWait, 0xAE
696    .set ASID_LiftWalk1, 0xAF
697    .set ASID_LiftWalk2, 0xB0
698    .set ASID_LiftTurn, 0xB1
699    .set ASID_GuardOn, 0xB2
700    .set ASID_Guard, 0xB3
701    .set ASID_GuardOff, 0xB4
702    .set ASID_GuardSetOff, 0xB5
703    .set ASID_GuardReflect, 0xB6
704    .set ASID_DownBoundU, 0xB7
705    .set ASID_DownWaitU, 0xB8
706    .set ASID_DownDamageU, 0xB9
707    .set ASID_DownStandU, 0xBA
708    .set ASID_DownAttackU, 0xBB
709    .set ASID_DownFowardU, 0xBC
710    .set ASID_DownBackU, 0xBD
711    .set ASID_DownSpotU, 0xBE
712    .set ASID_DownBoundD, 0xBF
713    .set ASID_DownWaitD, 0xC0
714    .set ASID_DownDamageD, 0xC1
715    .set ASID_DownStandD, 0xC2
716    .set ASID_DownAttackD, 0xC3
717    .set ASID_DownFowardD, 0xC4
718    .set ASID_DownBackD, 0xC5
719    .set ASID_DownSpotD, 0xC6
720    .set ASID_Passive, 0xC7
721    .set ASID_PassiveStandF, 0xC8
722    .set ASID_PassiveStandB, 0xC9
723    .set ASID_PassiveWall, 0xCA
724    .set ASID_PassiveWallJump, 0xCB
725    .set ASID_PassiveCeil, 0xCC
726    .set ASID_ShieldBreakFly, 0xCD
727    .set ASID_ShieldBreakFall, 0xCE
728    .set ASID_ShieldBreakDownU, 0xCF
729    .set ASID_ShieldBreakDownD, 0xD0
730    .set ASID_ShieldBreakStandU, 0xD1
731    .set ASID_ShieldBreakStandD, 0xD2
732    .set ASID_FuraFura, 0xD3
733    .set ASID_Catch, 0xD4
734    .set ASID_CatchPull, 0xD5
735    .set ASID_CatchDash, 0xD6
736    .set ASID_CatchDashPull, 0xD7
737    .set ASID_CatchWait, 0xD8
738    .set ASID_CatchAttack, 0xD9
739    .set ASID_CatchCut, 0xDA
740    .set ASID_ThrowF, 0xDB
741    .set ASID_ThrowB, 0xDC
742    .set ASID_ThrowHi, 0xDD
743    .set ASID_ThrowLw, 0xDE
744    .set ASID_CapturePulledHi, 0xDF
745    .set ASID_CaptureWaitHi, 0xE0
746    .set ASID_CaptureDamageHi, 0xE1
747    .set ASID_CapturePulledLw, 0xE2
748    .set ASID_CaptureWaitLw, 0xE3
749    .set ASID_CaptureDamageLw, 0xE4
750    .set ASID_CaptureCut, 0xE5
751    .set ASID_CaptureJump, 0xE6
752    .set ASID_CaptureNeck, 0xE7
753    .set ASID_CaptureFoot, 0xE8
754    .set ASID_EscapeF, 0xE9
755    .set ASID_EscapeB, 0xEA
756    .set ASID_Escape, 0xEB
757    .set ASID_EscapeAir, 0xEC
758    .set ASID_ReboundStop, 0xED
759    .set ASID_Rebound, 0xEE
760    .set ASID_ThrownF, 0xEF
761    .set ASID_ThrownB, 0xF0
762    .set ASID_ThrownHi, 0xF1
763    .set ASID_ThrownLw, 0xF2
764    .set ASID_ThrownLwWomen, 0xF3
765    .set ASID_Pass, 0xF4
766    .set ASID_Ottotto, 0xF5
767    .set ASID_OttottoWait, 0xF6
768    .set ASID_FlyReflectWall, 0xF7
769    .set ASID_FlyReflectCeil, 0xF8
770    .set ASID_StopWall, 0xF9
771    .set ASID_StopCeil, 0xFA
772    .set ASID_MissFoot, 0xFB
773    .set ASID_CliffCatch, 0xFC
774    .set ASID_CliffWait, 0xFD
775    .set ASID_CliffClimbSlow, 0xFE
776    .set ASID_CliffClimbQuick, 0xFF
777    .set ASID_CliffAttackSlow, 0x100
778    .set ASID_CliffAttackQuick, 0x101
779    .set ASID_CliffEscapeSlow, 0x102
780    .set ASID_CliffEscapeQuick, 0x103
781    .set ASID_CliffJumpSlow1, 0x104
782    .set ASID_CliffJumpSlow2, 0x105
783    .set ASID_CliffJumpQuick1, 0x106
784    .set ASID_CliffJumpQuick2, 0x107
785    .set ASID_AppealR, 0x108
786    .set ASID_AppealL, 0x109
787    .set ASID_ShoulderedWait, 0x10A
788    .set ASID_ShoulderedWalkSlow, 0x10B
789    .set ASID_ShoulderedWalkMiddle, 0x10C
790    .set ASID_ShoulderedWalkFast, 0x10D
791    .set ASID_ShoulderedTurn, 0x10E
792    .set ASID_ThrownFF, 0x10F
793    .set ASID_ThrownFB, 0x110
794    .set ASID_ThrownFHi, 0x111
795    .set ASID_ThrownFLw, 0x112
796    .set ASID_CaptureCaptain, 0x113
797    .set ASID_CaptureYoshi, 0x114
798    .set ASID_YoshiEgg, 0x115
799    .set ASID_CaptureKoopa, 0x116
800    .set ASID_CaptureDamageKoopa, 0x117
801    .set ASID_CaptureWaitKoopa, 0x118
802    .set ASID_ThrownKoopaF, 0x119
803    .set ASID_ThrownKoopaB, 0x11A
804    .set ASID_CaptureKoopaAir, 0x11B
805    .set ASID_CaptureDamageKoopaAir, 0x11C
806    .set ASID_CaptureWaitKoopaAir, 0x11D
807    .set ASID_ThrownKoopaAirF, 0x11E
808    .set ASID_ThrownKoopaAirB, 0x11F
809    .set ASID_CaptureKirby, 0x120
810    .set ASID_CaptureWaitKirby, 0x121
811    .set ASID_ThrownKirbyStar, 0x122
812    .set ASID_ThrownCopyStar, 0x123
813    .set ASID_ThrownKirby, 0x124
814    .set ASID_BarrelWait, 0x125
815    .set ASID_Bury, 0x126
816    .set ASID_BuryWait, 0x127
817    .set ASID_BuryJump, 0x128
818    .set ASID_DamageSong, 0x129
819    .set ASID_DamageSongWait, 0x12A
820    .set ASID_DamageSongRv, 0x12B
821    .set ASID_DamageBind, 0x12C
822    .set ASID_CaptureMewtwo, 0x12D
823    .set ASID_CaptureMewtwoAir, 0x12E
824    .set ASID_ThrownMewtwo, 0x12F
825    .set ASID_ThrownMewtwoAir, 0x130
826    .set ASID_WarpStarJump, 0x131
827    .set ASID_WarpStarFall, 0x132
828    .set ASID_HammerWait, 0x133
829    .set ASID_HammerWalk, 0x134
830    .set ASID_HammerTurn, 0x135
831    .set ASID_HammerKneeBend, 0x136
832    .set ASID_HammerFall, 0x137
833    .set ASID_HammerJump, 0x138
834    .set ASID_HammerLanding, 0x139
835    .set ASID_KinokoGiantStart, 0x13A
836    .set ASID_KinokoGiantStartAir, 0x13B
837    .set ASID_KinokoGiantEnd, 0x13C
838    .set ASID_KinokoGiantEndAir, 0x13D
839    .set ASID_KinokoSmallStart, 0x13E
840    .set ASID_KinokoSmallStartAir, 0x13F
841    .set ASID_KinokoSmallEnd, 0x140
842    .set ASID_KinokoSmallEndAir, 0x141
843    .set ASID_Entry, 0x142
844    .set ASID_EntryStart, 0x143
845    .set ASID_EntryEnd, 0x144
846    .set ASID_DamageIce, 0x145
847    .set ASID_DamageIceJump, 0x146
848    .set ASID_CaptureMasterhand, 0x147
849    .set ASID_CapturedamageMasterhand, 0x148
850    .set ASID_CapturewaitMasterhand, 0x149
851    .set ASID_ThrownMasterhand, 0x14A
852    .set ASID_CaptureKirbyYoshi, 0x14B
853    .set ASID_KirbyYoshiEgg, 0x14C
854    .set ASID_CaptureLeadead, 0x14D
855    .set ASID_CaptureLikelike, 0x14E
856    .set ASID_DownReflect, 0x14F
857    .set ASID_CaptureCrazyhand, 0x150
858    .set ASID_CapturedamageCrazyhand, 0x151
859    .set ASID_CapturewaitCrazyhand, 0x152
860    .set ASID_ThrownCrazyhand, 0x153
861    .set ASID_BarrelCannonWait, 0x154
862
863    .macro branchl reg, address
864    lis \reg, \address @h
865    ori \reg, \reg, \address @l
866    mtctr \reg
867    bctrl
868    .endm
869
870    .macro rtocbl reg, offset
871    lwz \reg, \offset(rtoc)
872    mtctr \reg
873    bctrl
874    .endm
875
876    .macro branch reg, address
877    lis \reg, \address @h
878    ori \reg, \reg, \address @l
879    mtctr \reg
880    bctr
881    .endm
882
883    .macro load reg, address
884    lis \reg, \address @h
885    ori \reg, \reg, \address @l
886    .endm
887
888    .macro backup
889    mflr r0
890    stw r0, 0x4(r1)
891    stwu r1, -0x100(r1)                                 # make space for 12 registers
892    stmw r20, 0x8(r1)
893    .endm
894
895    .macro restore
896    lmw r20, 0x8(r1)
897    lwz r0, 0x104(r1)
898    addi r1, r1, 0x100                                  # release the space
899    mtlr r0
900    .endm
901
902    .macro backupall
903    mflr r0
904    stw r0, 0x4(r1)
905    stwu r1, -0x100(r1)                                 # make space for 12 registers
906    stmw r3, 0x8(r1)
907    .endm
908
909    .macro restoreall
910    lmw r3, 0x8(r1)
911    lwz r0, 0x104(r1)
912    addi r1, r1, 0x100                                  # release the space
913    mtlr r0
914    .endm
915
916    # bp call sets r3 to 0!! Only put before a write to r3!!
917    .macro SetBreakpoint
918    branchl r3, 0x8021b2d8
919    .endm
920
921    .set EventVars_Ptr, 0x803d7054
922    .set EventVars_EventGobj, (2 * 4)
923    .set EventVars_RNGControl, (4 * 4)
924    .set EventVars_MessageDisplay, (8 * 4)
925
926    # Message Display
927    .macro Message_Display
928    crset 6
929    rtocbl r12, TM_MessageDisplay
930    .endm
931
932    .set MsgData_Text, 0x0
933
934    .set MSGCOLOR_WHITE, 0
935    .set MSGCOLOR_GREEN, 1
936    .set MSGCOLOR_RED, 2
937    .set MSGCOLOR_YELLOW, 3