Event Jump
Jump to navigation
Jump to search
# ROUTINE: Event jump # Handles a jump (forward or backward) in an event. # Parameters: # r4 = (limitByteOffset) Event byte offset to treat as the limit (beginning limit if forward jumping, ending limit if backward jumping) # r5 = (jumpTargetCommandID) ID of the Jump Target command to search for (Backwards jump if this parameter value is 0xd5, BackTarget) # r6 = (secondaryJumpTargetCommandID) Secondary Jump Target command ID to search for (if doing a forward jump) # r7 = (jumpTargetID) Jump Target ID specified for this jump instruction (parameter value) # Parameter list for calls to this routine, based on event command: # (currentEventByteOffset is stored in $fp (r30), and jumpTargetID is stored in $s2 (r18), in the Event Instruction routine that calls this one) # {D0}: (currentEventByteOffset + 2, 0xd2, 0xd4, jumpTargetID) # {D1}: (currentEventByteOffset + 2, 0xd2, -1, jumpTargetID) # {D3}: (currentEventByteOffset, 0xd5, -1, jumpTargetID) 80149d6c: 27bdffe0 addiu r29,r29,-0x0020 80149d70: afbf0018 sw r31,0x0018(r29) 80149d74: 340200d5 ori r2,r0,0x00d5 80149d78: 14a20027 bne r5,r2,0x80149e18 80149d7c: 2409ffff addiu r9,r0,-0x0001 # targetByteOffset = -1 # if (jumpTargetCommandID == 0xd5) { // If searching for BackTarget (0xd5), search from the beginning of the event forward 80149d80: 18800021 blez r4,0x80149e08 80149d84: 00001821 addu r3,r0,r0 # eventByteOffset = 0 # if (limitByteOffset > 0) { 80149d88: 3c068017 lui r6,0x8017 80149d8c: 8cc63ca4 lw r6,0x3ca4(r6) # baseEventPtr 80149d90: 340b00d9 ori r11,r0,0x00d9 80149d94: 340a00d2 ori r10,r0,0x00d2 80149d98: 00c31021 addu r2,r6,r3 # eventCommandPtr = baseEventPtr + eventByteOffset # do { 80149d9c: 90480000 lbu r8,0x0000(r2) # eventCommandByte = *eventCommandPtr 80149da0: 00000000 nop 80149da4: 110b0007 beq r8,r11,0x80149dc4 # if ((eventCommandByte == 0xd9) 80149da8: 00000000 nop 80149dac: 150a0007 bne r8,r10,0x80149dcc # || ((eventCommandByte == 0xd2) 80149db0: 00000000 nop 80149db4: 90420001 lbu r2,0x0001(r2) 80149db8: 00000000 nop 80149dbc: 14470003 bne r2,r7,0x80149dcc # && (*(eventCommandPtr + 1) == jumpTargetID))) 80149dc0: 00000000 nop # { 80149dc4: 0805277a j 0x80149de8 80149dc8: 2409ffff addiu r9,r0,-0x0001 # targetByteOffset = -1 # } else { 80149dcc: 15050006 bne r8,r5,0x80149de8 # if ((eventCommandPtr == jumpTargetCommandID) 80149dd0: 00c31021 addu r2,r6,r3 80149dd4: 90420001 lbu r2,0x0001(r2) 80149dd8: 00000000 nop 80149ddc: 14470002 bne r2,r7,0x80149de8 # && (*(eventCommandPtr + 1) == jumpTargetID)) { 80149de0: 00000000 nop 80149de4: 00604821 addu r9,r3,r0 # targetByteOffset = eventByteOffset # } # } 80149de8: 3c018015 lui r1,0x8015 80149dec: 00280821 addu r1,r1,r8 80149df0: 9022d170 lbu r2,-0x2e90(r1) # eventParamByteLength[commandByte] 80149df4: 24630001 addiu r3,r3,0x0001 # eventByteOffset = eventByteOffset + 1 80149df8: 00621821 addu r3,r3,r2 # eventByteOffset = eventByteOffset + eventParamByteLength[commandByte] 80149dfc: 0064102a slt r2,r3,r4 80149e00: 1440ffe6 bne r2,r0,0x80149d9c 80149e04: 00c31021 addu r2,r6,r3 # eventCommandPtr = baseEventPtr + eventByteOffset # } while (eventByteOffset < limitByteOffset); # } 80149e08: 05200026 bltz r9,0x80149ea4 # if (targetByteOffset < 0) { Stop Current Thread (); return; } 80149e0c: 25220002 addiu r2,r9,0x0002 80149e10: 080527ab j 0x80149eac # return targetByteOffset + 2; 80149e14: 00000000 nop # } 80149e18: 3c098017 lui r9,0x8017 80149e1c: 8d293ca4 lw r9,0x3ca4(r9) # baseEventPtr 80149e20: 00000000 nop # eventByteOffset = limitByteOffset 80149e24: 01241021 addu r2,r9,r4 # eventCommandPtr = baseEventPtr + eventByteOffset 80149e28: 90480000 lbu r8,0x0000(r2) # eventCommandByte = *eventCommandPtr 80149e2c: 340200db ori r2,r0,0x00db 80149e30: 1102001c beq r8,r2,0x80149ea4 # if (eventCommandByte != 0xdb) { // If not EventEnd 80149e34: 240cffff addiu r12,r0,-0x0001 80149e38: 01205021 addu r10,r9,r0 # baseEventPtr 80149e3c: 340b00db ori r11,r0,0x00db # do { 80149e40: 15050005 bne r8,r5,0x80149e58 80149e44: 01241021 addu r2,r9,r4 # eventCommandPtr # if ((eventCommandByte == jumpTargetCommandID) 80149e48: 90420001 lbu r2,0x0001(r2) 80149e4c: 00000000 nop 80149e50: 10470016 beq r2,r7,0x80149eac # && (*(eventCommandPtr + 1) == jumpTargetID)) 80149e54: 24820002 addiu r2,r4,0x0002 # return eventByteOffset + 2; 80149e58: 10cc0007 beq r6,r12,0x80149e78 80149e5c: 24830001 addiu r3,r4,0x0001 # eventByteOffset + 1 # if ((p3 != -1) 80149e60: 15060005 bne r8,r6,0x80149e78 # && (eventCommandByte == p3) 80149e64: 01441021 addu r2,r10,r4 80149e68: 90420001 lbu r2,0x0001(r2) 80149e6c: 00000000 nop 80149e70: 1047000e beq r2,r7,0x80149eac # && (*(eventCommandPtr + 1) == jumpTargetID)) { return eventByteOffset + 2; } 80149e74: 24820002 addiu r2,r4,0x0002 80149e78: 3c018015 lui r1,0x8015 80149e7c: 00280821 addu r1,r1,r8 80149e80: 9022d170 lbu r2,-0x2e90(r1) # eventParamByteLength[commandByte] 80149e84: 3c098017 lui r9,0x8017 80149e88: 8d293ca4 lw r9,0x3ca4(r9) # baseEventPtr 80149e8c: 00622021 addu r4,r3,r2 # eventByteOffset = eventByteOffset + 1 + eventParamByteLength[commandByte] 80149e90: 01241021 addu r2,r9,r4 # eventCommandPtr = baseEventPtr + eventByteOffset 80149e94: 90480000 lbu r8,0x0000(r2) # eventCommandByte = *eventCommandPtr 80149e98: 00000000 nop 80149e9c: 150bffe8 bne r8,r11,0x80149e40 80149ea0: 00000000 nop # } while (eventCommandByte != 0xdb); // While not EventEnd # } 80149ea4: 0c053256 jal 0x8014c958 # Stop Current Thread (); 80149ea8: 00000000 nop 80149eac: 8fbf0018 lw r31,0x0018(r29) 80149eb0: 27bd0020 addiu r29,r29,0x0020 80149eb4: 03e00008 jr r31 80149eb8: 00000000 nop