.include "macros.inc"
.section .text, "ax"
.global TRKHandleRequestEvent
TRKHandleRequestEvent:
mflr r0
stw r0, 4(r1)
stwu r1, -8(r1)
lwz r3, 8(r3)
bl TRKGetBuffer
bl TRKDispatchMessage
addi r1, r1, 8
lwz r0, 4(r1)
mtlr r0
blr
.global TRKHandleSupportEvent
TRKHandleSupportEvent:
mflr r0
stw r0, 4(r1)
stwu r1, -8(r1)
bl TRKTargetSupportRequest
addi r1, r1, 8
lwz r0, 4(r1)
mtlr r0
blr
.global TRKIdle
TRKIdle:
mflr r0
stw r0, 4(r1)
stwu r1, -8(r1)
bl TRKTargetStopped
cmpwi r3, 0
bne lbl_80087B64
bl TRKTargetContinue
lbl_80087B64:
addi r1, r1, 8
lwz r0, 4(r1)
mtlr r0
blr
.global TRKNubMainLoop
TRKNubMainLoop:
mflr r0
lis r3, gTRKInputPendingPtr@ha
stw r0, 4(r1)
stwu r1, -0x20(r1)
stw r31, 0x1c(r1)
addi r31, r3, gTRKInputPendingPtr@l
stw r30, 0x18(r1)
li r30, 0
stw r29, 0x14(r1)
li r29, 0
b lbl_80087C44
lbl_80087BA0:
addi r3, r1, 8
bl TRKGetNextEvent
cmpwi r3, 0
beq lbl_80087C18
lbz r0, 8(r1)
li r29, 0
cmpwi r0, 2
beq lbl_80087BE4
bge lbl_80087BD4
cmpwi r0, 0
beq lbl_80087C0C
bge lbl_80087BF0
b lbl_80087C0C
lbl_80087BD4:
cmpwi r0, 5
beq lbl_80087C04
bge lbl_80087C0C
b lbl_80087BF8
lbl_80087BE4:
addi r3, r1, 8
bl TRKHandleRequestEvent
b lbl_80087C0C
lbl_80087BF0:
li r30, 1
b lbl_80087C0C
lbl_80087BF8:
addi r3, r1, 8
bl TRKTargetInterrupt
b lbl_80087C0C
lbl_80087C04:
addi r3, r1, 8
bl TRKHandleSupportEvent
lbl_80087C0C:
addi r3, r1, 8
bl TRKDestructEvent
b lbl_80087C44
lbl_80087C18:
cmpwi r29, 0
beq lbl_80087C30
lwz r3, 0(r31)
lbz r0, 0(r3)
cmplwi r0, 0
beq lbl_80087C3C
lbl_80087C30:
li r29, 1
bl TRKGetInput
b lbl_80087C44
lbl_80087C3C:
bl TRKIdle
li r29, 0
lbl_80087C44:
cmpwi r30, 0
beq lbl_80087BA0
lwz r31, 0x1c(r1)
lwz r30, 0x18(r1)
lwz r29, 0x14(r1)
addi r1, r1, 0x20
lwz r0, 4(r1)
mtlr r0
blr