summaryrefslogtreecommitdiff
path: root/asm/TRK_MINNOW_DOLPHIN/serpoll.s
blob: 9025e260fc143a503cb6e38a47e1bc91dec5e8a7 (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
.include "macros.inc"

.section .text, "ax"  # 0x80005600 - 0x8036FBA0
.global TRKTestForPacket
TRKTestForPacket:
/* 800888C8 00085808  7C 08 02 A6 */	mflr r0
/* 800888CC 0008580C  90 01 00 04 */	stw r0, 4(r1)
/* 800888D0 00085810  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 800888D4 00085814  93 E1 00 14 */	stw r31, 0x14(r1)
/* 800888D8 00085818  93 C1 00 10 */	stw r30, 0x10(r1)
/* 800888DC 0008581C  48 00 39 55 */	bl TRKPollUART
/* 800888E0 00085820  7C 7E 1B 79 */	or. r30, r3, r3
/* 800888E4 00085824  40 81 00 88 */	ble lbl_8008896C
/* 800888E8 00085828  38 61 00 08 */	addi r3, r1, 8
/* 800888EC 0008582C  38 81 00 0C */	addi r4, r1, 0xc
/* 800888F0 00085830  4B FF F8 11 */	bl TRKGetFreeBuffer
/* 800888F4 00085834  2C 1E 08 80 */	cmpwi r30, 0x880
/* 800888F8 00085838  40 81 00 4C */	ble lbl_80088944
/* 800888FC 0008583C  48 00 00 2C */	b lbl_80088928
lbl_80088900:
/* 80088900 00085840  2C 1E 08 80 */	cmpwi r30, 0x880
/* 80088904 00085844  40 81 00 0C */	ble lbl_80088910
/* 80088908 00085848  3B E0 08 80 */	li r31, 0x880
/* 8008890C 0008584C  48 00 00 08 */	b lbl_80088914
lbl_80088910:
/* 80088910 00085850  7F DF F3 78 */	mr r31, r30
lbl_80088914:
/* 80088914 00085854  80 61 00 0C */	lwz r3, 0xc(r1)
/* 80088918 00085858  38 9F 00 00 */	addi r4, r31, 0
/* 8008891C 0008585C  38 63 00 10 */	addi r3, r3, 0x10
/* 80088920 00085860  48 00 39 41 */	bl TRKReadUARTN
/* 80088924 00085864  7F DF F0 50 */	subf r30, r31, r30
lbl_80088928:
/* 80088928 00085868  2C 1E 00 00 */	cmpwi r30, 0
/* 8008892C 0008586C  41 81 FF D4 */	bgt lbl_80088900
/* 80088930 00085870  80 61 00 0C */	lwz r3, 0xc(r1)
/* 80088934 00085874  38 80 00 FF */	li r4, 0xff
/* 80088938 00085878  38 A0 00 06 */	li r5, 6
/* 8008893C 0008587C  48 00 02 D9 */	bl TRKStandardACK
/* 80088940 00085880  48 00 00 2C */	b lbl_8008896C
lbl_80088944:
/* 80088944 00085884  80 61 00 0C */	lwz r3, 0xc(r1)
/* 80088948 00085888  38 9E 00 00 */	addi r4, r30, 0
/* 8008894C 0008588C  38 63 00 10 */	addi r3, r3, 0x10
/* 80088950 00085890  48 00 39 11 */	bl TRKReadUARTN
/* 80088954 00085894  2C 03 00 00 */	cmpwi r3, 0
/* 80088958 00085898  40 82 00 14 */	bne lbl_8008896C
/* 8008895C 0008589C  80 61 00 0C */	lwz r3, 0xc(r1)
/* 80088960 000858A0  93 C3 00 08 */	stw r30, 8(r3)
/* 80088964 000858A4  80 61 00 08 */	lwz r3, 8(r1)
/* 80088968 000858A8  48 00 00 18 */	b lbl_80088980
lbl_8008896C:
/* 8008896C 000858AC  80 61 00 08 */	lwz r3, 8(r1)
/* 80088970 000858B0  2C 03 FF FF */	cmpwi r3, -1
/* 80088974 000858B4  41 82 00 08 */	beq lbl_8008897C
/* 80088978 000858B8  4B FF F8 51 */	bl TRKReleaseBuffer
lbl_8008897C:
/* 8008897C 000858BC  38 60 FF FF */	li r3, -1
lbl_80088980:
/* 80088980 000858C0  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 80088984 000858C4  83 C1 00 10 */	lwz r30, 0x10(r1)
/* 80088988 000858C8  38 21 00 18 */	addi r1, r1, 0x18
/* 8008898C 000858CC  80 01 00 04 */	lwz r0, 4(r1)
/* 80088990 000858D0  7C 08 03 A6 */	mtlr r0
/* 80088994 000858D4  4E 80 00 20 */	blr 

.global TRKGetInput
TRKGetInput:
/* 80088998 000858D8  7C 08 02 A6 */	mflr r0
/* 8008899C 000858DC  90 01 00 04 */	stw r0, 4(r1)
/* 800889A0 000858E0  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 800889A4 000858E4  93 E1 00 14 */	stw r31, 0x14(r1)
/* 800889A8 000858E8  93 C1 00 10 */	stw r30, 0x10(r1)
/* 800889AC 000858EC  4B FF FF 1D */	bl TRKTestForPacket
/* 800889B0 000858F0  3B C3 00 00 */	addi r30, r3, 0
/* 800889B4 000858F4  2C 1E FF FF */	cmpwi r30, -1
/* 800889B8 000858F8  41 82 00 44 */	beq lbl_800889FC
/* 800889BC 000858FC  7F C3 F3 78 */	mr r3, r30
/* 800889C0 00085900  4B FF F7 DD */	bl TRKGetBuffer
/* 800889C4 00085904  3B E3 00 00 */	addi r31, r3, 0
/* 800889C8 00085908  38 80 00 00 */	li r4, 0
/* 800889CC 0008590C  4B FF F8 A5 */	bl TRKSetBufferPosition
/* 800889D0 00085910  38 7F 00 00 */	addi r3, r31, 0
/* 800889D4 00085914  38 81 00 08 */	addi r4, r1, 8
/* 800889D8 00085918  4B FF FC 1D */	bl TRKReadBuffer1_ui8
/* 800889DC 0008591C  88 01 00 08 */	lbz r0, 8(r1)
/* 800889E0 00085920  28 00 00 80 */	cmplwi r0, 0x80
/* 800889E4 00085924  40 80 00 10 */	bge lbl_800889F4
/* 800889E8 00085928  7F C3 F3 78 */	mr r3, r30
/* 800889EC 0008592C  48 00 00 29 */	bl TRKProcessInput
/* 800889F0 00085930  48 00 00 0C */	b lbl_800889FC
lbl_800889F4:
/* 800889F4 00085934  7F C3 F3 78 */	mr r3, r30
/* 800889F8 00085938  4B FF F7 D1 */	bl TRKReleaseBuffer
lbl_800889FC:
/* 800889FC 0008593C  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 80088A00 00085940  83 C1 00 10 */	lwz r30, 0x10(r1)
/* 80088A04 00085944  38 21 00 18 */	addi r1, r1, 0x18
/* 80088A08 00085948  80 01 00 04 */	lwz r0, 4(r1)
/* 80088A0C 0008594C  7C 08 03 A6 */	mtlr r0
/* 80088A10 00085950  4E 80 00 20 */	blr 

.global TRKProcessInput
TRKProcessInput:
/* 80088A14 00085954  7C 08 02 A6 */	mflr r0
/* 80088A18 00085958  38 80 00 02 */	li r4, 2
/* 80088A1C 0008595C  90 01 00 04 */	stw r0, 4(r1)
/* 80088A20 00085960  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 80088A24 00085964  93 E1 00 14 */	stw r31, 0x14(r1)
/* 80088A28 00085968  3B E3 00 00 */	addi r31, r3, 0
/* 80088A2C 0008596C  38 61 00 08 */	addi r3, r1, 8
/* 80088A30 00085970  4B FF F4 59 */	bl TRKConstructEvent
/* 80088A34 00085974  3C 60 80 3F */	lis r3, gTRKFramingState@ha
/* 80088A38 00085978  93 E1 00 10 */	stw r31, 0x10(r1)
/* 80088A3C 0008597C  38 83 AA C0 */	addi r4, r3, gTRKFramingState@l
/* 80088A40 00085980  38 61 00 08 */	addi r3, r1, 8
/* 80088A44 00085984  38 00 FF FF */	li r0, -1
/* 80088A48 00085988  90 04 00 00 */	stw r0, 0(r4)
/* 80088A4C 0008598C  4B FF F3 5D */	bl TRKPostEvent
/* 80088A50 00085990  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 80088A54 00085994  38 21 00 18 */	addi r1, r1, 0x18
/* 80088A58 00085998  80 01 00 04 */	lwz r0, 4(r1)
/* 80088A5C 0008599C  7C 08 03 A6 */	mtlr r0
/* 80088A60 000859A0  4E 80 00 20 */	blr 

.global TRKInitializeSerialHandler
TRKInitializeSerialHandler:
/* 80088A64 000859A4  3C 60 80 3F */	lis r3, gTRKFramingState@ha
/* 80088A68 000859A8  38 83 AA C0 */	addi r4, r3, gTRKFramingState@l
/* 80088A6C 000859AC  38 00 FF FF */	li r0, -1
/* 80088A70 000859B0  90 04 00 00 */	stw r0, 0(r4)
/* 80088A74 000859B4  38 00 00 00 */	li r0, 0
/* 80088A78 000859B8  38 60 00 00 */	li r3, 0
/* 80088A7C 000859BC  98 04 00 08 */	stb r0, 8(r4)
/* 80088A80 000859C0  90 04 00 0C */	stw r0, 0xc(r4)
/* 80088A84 000859C4  4E 80 00 20 */	blr 

.global TRKTerminateSerialHandler
TRKTerminateSerialHandler:
/* 80088A88 000859C8  38 60 00 00 */	li r3, 0
/* 80088A8C 000859CC  4E 80 00 20 */	blr 

.section .bss, "wa"  # 0x803E6000 - 0x80408AC0
.global gTRKFramingState
gTRKFramingState:
	.skip 0x14
.global gTRKInputPendingPtr
gTRKInputPendingPtr:
	.skip 0x4