.include "SM64Functions.txt" // Custom loop function 0x802CB1C0, 0x2C bytes (11 instructions) left. .org 0x861C0 ADDIU SP, SP, 0xFFE8 SW RA, 0x14 (SP) LUI T0, 0x8034 LW T2, 0xB17C(T0) // T2 = current action LUI T1, 0x0C00 ORI T1, T1, 0x0203 // T1 = 0x0C000203, Sleeping BNE T2, T1, 802CB1C0_end // Branch to end if Mario is not sleeping. NOP LW T3, 0xB1D0(T0) // Load word at 0x8033B1D0 (For this example it's a timer) ORI T4, R0, 0x20 BNE T3, T4, 802CB1C0_incrementTimer NOP LUI A0, 0x8036 LW A0, 0x1158(A0) // A0 = Pointer to Mario object. LUI A2, 0x1300 ORI A2, A2, 0x40EC // A2 = 0x130040EC, 1-UP behavior. JAL @SpawnObj // 0x8029EDCC ORI A1, R0, 0xD4 // 1-UP Model ID. // V0 = pointer to newly spawned 1-UP object. LUI T4, 0x41A0 // 0x41A00000 = (float) 20.0 MTC1 T4, F0 // Move value at T4 to float register F0 LWC1 F2, 0xA4(V0) // Get Y position of 1-UP ADD.S F2, F2, F0 // Add 20.0 to Y position SWC1 F2, 0xA4(V0) // Store new Y position 802CB1C0_incrementTimer: ADDIU T3, T3, 0x01 LUI T0, 0x8034 SW T3, 0xB1D0(T0) 802CB1C0_end: LW RA, 0x14 (SP) JR RA ADDIU SP, SP, 0x18