summaryrefslogtreecommitdiff
path: root/asm/TRK_MINNOW_DOLPHIN/mainloop.s
blob: 8265cf9b448e104b99dee9832cc7cc0768a6d4ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
.include "macros.inc"

.section .text, "ax"  # 0x80005600 - 0x8036FBA0
.global TRKHandleRequestEvent
TRKHandleRequestEvent:
/* 80087B00 00084A40  7C 08 02 A6 */	mflr r0
/* 80087B04 00084A44  90 01 00 04 */	stw r0, 4(r1)
/* 80087B08 00084A48  94 21 FF F8 */	stwu r1, -8(r1)
/* 80087B0C 00084A4C  80 63 00 08 */	lwz r3, 8(r3)
/* 80087B10 00084A50  48 00 06 8D */	bl TRKGetBuffer
/* 80087B14 00084A54  48 00 0F 95 */	bl TRKDispatchMessage
/* 80087B18 00084A58  38 21 00 08 */	addi r1, r1, 8
/* 80087B1C 00084A5C  80 01 00 04 */	lwz r0, 4(r1)
/* 80087B20 00084A60  7C 08 03 A6 */	mtlr r0
/* 80087B24 00084A64  4E 80 00 20 */	blr 

.global TRKHandleSupportEvent
TRKHandleSupportEvent:
/* 80087B28 00084A68  7C 08 02 A6 */	mflr r0
/* 80087B2C 00084A6C  90 01 00 04 */	stw r0, 4(r1)
/* 80087B30 00084A70  94 21 FF F8 */	stwu r1, -8(r1)
/* 80087B34 00084A74  48 00 3A 4D */	bl TRKTargetSupportRequest
/* 80087B38 00084A78  38 21 00 08 */	addi r1, r1, 8
/* 80087B3C 00084A7C  80 01 00 04 */	lwz r0, 4(r1)
/* 80087B40 00084A80  7C 08 03 A6 */	mtlr r0
/* 80087B44 00084A84  4E 80 00 20 */	blr 

.global TRKIdle
TRKIdle:
/* 80087B48 00084A88  7C 08 02 A6 */	mflr r0
/* 80087B4C 00084A8C  90 01 00 04 */	stw r0, 4(r1)
/* 80087B50 00084A90  94 21 FF F8 */	stwu r1, -8(r1)
/* 80087B54 00084A94  48 00 3B 59 */	bl TRKTargetStopped
/* 80087B58 00084A98  2C 03 00 00 */	cmpwi r3, 0
/* 80087B5C 00084A9C  40 82 00 08 */	bne lbl_80087B64
/* 80087B60 00084AA0  48 00 48 0D */	bl TRKTargetContinue
lbl_80087B64:
/* 80087B64 00084AA4  38 21 00 08 */	addi r1, r1, 8
/* 80087B68 00084AA8  80 01 00 04 */	lwz r0, 4(r1)
/* 80087B6C 00084AAC  7C 08 03 A6 */	mtlr r0
/* 80087B70 00084AB0  4E 80 00 20 */	blr 

.global TRKNubMainLoop
TRKNubMainLoop:
/* 80087B74 00084AB4  7C 08 02 A6 */	mflr r0
/* 80087B78 00084AB8  3C 60 80 3F */	lis r3, gTRKInputPendingPtr@ha
/* 80087B7C 00084ABC  90 01 00 04 */	stw r0, 4(r1)
/* 80087B80 00084AC0  94 21 FF E0 */	stwu r1, -0x20(r1)
/* 80087B84 00084AC4  93 E1 00 1C */	stw r31, 0x1c(r1)
/* 80087B88 00084AC8  3B E3 AA D4 */	addi r31, r3, gTRKInputPendingPtr@l
/* 80087B8C 00084ACC  93 C1 00 18 */	stw r30, 0x18(r1)
/* 80087B90 00084AD0  3B C0 00 00 */	li r30, 0
/* 80087B94 00084AD4  93 A1 00 14 */	stw r29, 0x14(r1)
/* 80087B98 00084AD8  3B A0 00 00 */	li r29, 0
/* 80087B9C 00084ADC  48 00 00 A8 */	b lbl_80087C44
lbl_80087BA0:
/* 80087BA0 00084AE0  38 61 00 08 */	addi r3, r1, 8
/* 80087BA4 00084AE4  48 00 01 45 */	bl TRKGetNextEvent
/* 80087BA8 00084AE8  2C 03 00 00 */	cmpwi r3, 0
/* 80087BAC 00084AEC  41 82 00 6C */	beq lbl_80087C18
/* 80087BB0 00084AF0  88 01 00 08 */	lbz r0, 8(r1)
/* 80087BB4 00084AF4  3B A0 00 00 */	li r29, 0
/* 80087BB8 00084AF8  2C 00 00 02 */	cmpwi r0, 2
/* 80087BBC 00084AFC  41 82 00 28 */	beq lbl_80087BE4
/* 80087BC0 00084B00  40 80 00 14 */	bge lbl_80087BD4
/* 80087BC4 00084B04  2C 00 00 00 */	cmpwi r0, 0
/* 80087BC8 00084B08  41 82 00 44 */	beq lbl_80087C0C
/* 80087BCC 00084B0C  40 80 00 24 */	bge lbl_80087BF0
/* 80087BD0 00084B10  48 00 00 3C */	b lbl_80087C0C
lbl_80087BD4:
/* 80087BD4 00084B14  2C 00 00 05 */	cmpwi r0, 5
/* 80087BD8 00084B18  41 82 00 2C */	beq lbl_80087C04
/* 80087BDC 00084B1C  40 80 00 30 */	bge lbl_80087C0C
/* 80087BE0 00084B20  48 00 00 18 */	b lbl_80087BF8
lbl_80087BE4:
/* 80087BE4 00084B24  38 61 00 08 */	addi r3, r1, 8
/* 80087BE8 00084B28  4B FF FF 19 */	bl TRKHandleRequestEvent
/* 80087BEC 00084B2C  48 00 00 20 */	b lbl_80087C0C
lbl_80087BF0:
/* 80087BF0 00084B30  3B C0 00 01 */	li r30, 1
/* 80087BF4 00084B34  48 00 00 18 */	b lbl_80087C0C
lbl_80087BF8:
/* 80087BF8 00084B38  38 61 00 08 */	addi r3, r1, 8
/* 80087BFC 00084B3C  48 00 35 D5 */	bl TRKTargetInterrupt
/* 80087C00 00084B40  48 00 00 0C */	b lbl_80087C0C
lbl_80087C04:
/* 80087C04 00084B44  38 61 00 08 */	addi r3, r1, 8
/* 80087C08 00084B48  4B FF FF 21 */	bl TRKHandleSupportEvent
lbl_80087C0C:
/* 80087C0C 00084B4C  38 61 00 08 */	addi r3, r1, 8
/* 80087C10 00084B50  48 00 02 91 */	bl TRKDestructEvent
/* 80087C14 00084B54  48 00 00 30 */	b lbl_80087C44
lbl_80087C18:
/* 80087C18 00084B58  2C 1D 00 00 */	cmpwi r29, 0
/* 80087C1C 00084B5C  41 82 00 14 */	beq lbl_80087C30
/* 80087C20 00084B60  80 7F 00 00 */	lwz r3, 0(r31)
/* 80087C24 00084B64  88 03 00 00 */	lbz r0, 0(r3)
/* 80087C28 00084B68  28 00 00 00 */	cmplwi r0, 0
/* 80087C2C 00084B6C  41 82 00 10 */	beq lbl_80087C3C
lbl_80087C30:
/* 80087C30 00084B70  3B A0 00 01 */	li r29, 1
/* 80087C34 00084B74  48 00 0D 65 */	bl TRKGetInput
/* 80087C38 00084B78  48 00 00 0C */	b lbl_80087C44
lbl_80087C3C:
/* 80087C3C 00084B7C  4B FF FF 0D */	bl TRKIdle
/* 80087C40 00084B80  3B A0 00 00 */	li r29, 0
lbl_80087C44:
/* 80087C44 00084B84  2C 1E 00 00 */	cmpwi r30, 0
/* 80087C48 00084B88  41 82 FF 58 */	beq lbl_80087BA0
/* 80087C4C 00084B8C  83 E1 00 1C */	lwz r31, 0x1c(r1)
/* 80087C50 00084B90  83 C1 00 18 */	lwz r30, 0x18(r1)
/* 80087C54 00084B94  83 A1 00 14 */	lwz r29, 0x14(r1)
/* 80087C58 00084B98  38 21 00 20 */	addi r1, r1, 0x20
/* 80087C5C 00084B9C  80 01 00 04 */	lwz r0, 4(r1)
/* 80087C60 00084BA0  7C 08 03 A6 */	mtlr r0
/* 80087C64 00084BA4  4E 80 00 20 */	blr