diff --git a/asm/Dolphin/si/SIBios.s b/asm/Dolphin/si/SIBios.s
deleted file mode 100644
index df6d2fc88..000000000
--- a/asm/Dolphin/si/SIBios.s
+++ /dev/null
@@ -1,1862 +0,0 @@
-.include "macros.inc"
-.section .data, "wa" # 0x8049E220 - 0x804EFC20
-.balign 8
-.obj lbl_804A9EB8, local
- .asciz "<< Dolphin SDK - SI\trelease build: Apr 17 2003 12:33:19 (0x2301) >>"
-.endobj lbl_804A9EB8
-.obj Si, local
- .4byte 0xFFFFFFFF
- .4byte 0x00000000
- .4byte 0x00000000
- .4byte 0x00000000
- .4byte 0x00000000
-.endobj Si
-.obj Type, local
- .4byte 0x00000008
- .4byte 0x00000008
- .4byte 0x00000008
- .4byte 0x00000008
-.endobj Type
-.balign 4
-.obj lbl_804A9F20, local
- .asciz "No response"
-.endobj lbl_804A9F20
-.balign 4
-.obj lbl_804A9F2C, local
- .asciz "N64 controller"
-.endobj lbl_804A9F2C
-.balign 4
-.obj lbl_804A9F3C, local
- .asciz "N64 microphone"
-.endobj lbl_804A9F3C
-.balign 4
-.obj lbl_804A9F4C, local
- .asciz "N64 keyboard"
-.endobj lbl_804A9F4C
-.balign 4
-.obj lbl_804A9F5C, local
- .asciz "N64 mouse"
-.endobj lbl_804A9F5C
-.balign 4
-.obj lbl_804A9F68, local
- .asciz "GameBoy Advance"
-.endobj lbl_804A9F68
-.balign 4
-.obj lbl_804A9F78, local
- .asciz "Standard controller"
-.endobj lbl_804A9F78
-.balign 4
-.obj lbl_804A9F8C, local
- .asciz "Wireless receiver"
-.endobj lbl_804A9F8C
-.balign 4
-.obj lbl_804A9FA0, local
- .asciz "WaveBird controller"
-.endobj lbl_804A9FA0
-.balign 4
-.obj lbl_804A9FB4, local
- .asciz "Keyboard"
-.endobj lbl_804A9FB4
-.balign 4
-.obj lbl_804A9FC0, local
- .asciz "Steering"
-.endobj lbl_804A9FC0
-
-.section .bss # 0x804EFC20 - 0x8051467C
-.balign 8
-.obj Packet, local
- .skip 0x80
-.endobj Packet
-.balign 8
-.obj Alarm, local
- .skip 0xA0
-.endobj Alarm
-.balign 8
-.obj TypeTime, local
- .skip 0x20
-.endobj TypeTime
-.balign 8
-.obj XferTime, local
- .skip 0x20
-.endobj XferTime
-.obj TypeCallback, local
- .skip 0x40
-.endobj TypeCallback
-.obj RDSTHandler, local
- .skip 0x10
-.endobj RDSTHandler
-.obj InputBufferValid, local
- .skip 0x10
-.endobj InputBufferValid
-.obj InputBuffer, local
- .skip 0x20
-.endobj InputBuffer
-.obj InputBufferVcount, local
- .skip 0x10
-.endobj InputBufferVcount
-.obj cmdFixDevice$327, local
- .skip 0x10
-.endobj cmdFixDevice$327
-
-.section .sdata, "wa" # 0x80514680 - 0x80514D80
-.balign 8
-.obj __SIVersion, global
- .4byte lbl_804A9EB8
-.endobj __SIVersion
-
-.section .sbss # 0x80514D80 - 0x80516360
-.balign 8
-.obj cmdTypeAndStatus$78, local
- .skip 4
-.endobj cmdTypeAndStatus$78
-.obj cmdTypeAndStatus$372, local
- .skip 4
-.endobj cmdTypeAndStatus$372
-.obj __PADFixBits, global
- .skip 4
-.endobj __PADFixBits
-
-.section .text, "ax" # 0x800056C0 - 0x80472F00
-.fn SIBusy, global
-/* 800F4EFC 000F1E3C 3C 60 80 4B */ lis r3, Si@ha
-/* 800F4F00 000F1E40 80 03 9E FC */ lwz r0, Si@l(r3)
-/* 800F4F04 000F1E44 2C 00 FF FF */ cmpwi r0, -1
-/* 800F4F08 000F1E48 41 82 00 0C */ beq .L_800F4F14
-/* 800F4F0C 000F1E4C 38 60 00 01 */ li r3, 1
-/* 800F4F10 000F1E50 4E 80 00 20 */ blr
-.L_800F4F14:
-/* 800F4F14 000F1E54 38 60 00 00 */ li r3, 0
-/* 800F4F18 000F1E58 4E 80 00 20 */ blr
-.endfn SIBusy
-
-.fn SIIsChanBusy, global
-/* 800F4F1C 000F1E5C 3C 80 80 4F */ lis r4, Packet@ha
-/* 800F4F20 000F1E60 54 65 28 34 */ slwi r5, r3, 5
-/* 800F4F24 000F1E64 38 04 71 80 */ addi r0, r4, Packet@l
-/* 800F4F28 000F1E68 7C 80 2A 14 */ add r4, r0, r5
-/* 800F4F2C 000F1E6C 80 04 00 00 */ lwz r0, 0(r4)
-/* 800F4F30 000F1E70 38 A0 00 01 */ li r5, 1
-/* 800F4F34 000F1E74 2C 00 FF FF */ cmpwi r0, -1
-/* 800F4F38 000F1E78 40 82 00 18 */ bne .L_800F4F50
-/* 800F4F3C 000F1E7C 3C 80 80 4B */ lis r4, Si@ha
-/* 800F4F40 000F1E80 80 04 9E FC */ lwz r0, Si@l(r4)
-/* 800F4F44 000F1E84 7C 00 18 00 */ cmpw r0, r3
-/* 800F4F48 000F1E88 41 82 00 08 */ beq .L_800F4F50
-/* 800F4F4C 000F1E8C 38 A0 00 00 */ li r5, 0
-.L_800F4F50:
-/* 800F4F50 000F1E90 7C A3 2B 78 */ mr r3, r5
-/* 800F4F54 000F1E94 4E 80 00 20 */ blr
-.endfn SIIsChanBusy
-
-.fn CompleteTransfer, local
-/* 800F4F58 000F1E98 7C 08 02 A6 */ mflr r0
-/* 800F4F5C 000F1E9C 3C 60 CC 00 */ lis r3, 0xCC006400@ha
-/* 800F4F60 000F1EA0 90 01 00 04 */ stw r0, 4(r1)
-/* 800F4F64 000F1EA4 94 21 FF E0 */ stwu r1, -0x20(r1)
-/* 800F4F68 000F1EA8 93 E1 00 1C */ stw r31, 0x1c(r1)
-/* 800F4F6C 000F1EAC 93 C1 00 18 */ stw r30, 0x18(r1)
-/* 800F4F70 000F1EB0 3B C3 64 00 */ addi r30, r3, 0xCC006400@l
-/* 800F4F74 000F1EB4 93 A1 00 14 */ stw r29, 0x14(r1)
-/* 800F4F78 000F1EB8 3B BE 00 34 */ addi r29, r30, 0x34
-/* 800F4F7C 000F1EBC 93 81 00 10 */ stw r28, 0x10(r1)
-/* 800F4F80 000F1EC0 80 03 64 34 */ lwz r0, 0x6434(r3)
-/* 800F4F84 000F1EC4 83 83 64 38 */ lwz r28, 0x6438(r3)
-/* 800F4F88 000F1EC8 3C 60 80 4B */ lis r3, lbl_804A9EB8@ha
-/* 800F4F8C 000F1ECC 64 00 80 00 */ oris r0, r0, 0x8000
-/* 800F4F90 000F1ED0 54 00 00 3C */ rlwinm r0, r0, 0, 0, 0x1e
-/* 800F4F94 000F1ED4 90 1E 00 34 */ stw r0, 0x34(r30)
-/* 800F4F98 000F1ED8 3B E3 9E B8 */ addi r31, r3, lbl_804A9EB8@l
-/* 800F4F9C 000F1EDC 80 1F 00 44 */ lwz r0, 0x44(r31)
-/* 800F4FA0 000F1EE0 2C 00 FF FF */ cmpwi r0, -1
-/* 800F4FA4 000F1EE4 41 82 02 74 */ beq .L_800F5218
-/* 800F4FA8 000F1EE8 4B FF DC 09 */ bl __OSGetSystemTime
-/* 800F4FAC 000F1EEC 80 DF 00 44 */ lwz r6, 0x44(r31)
-/* 800F4FB0 000F1EF0 3C A0 80 4F */ lis r5, XferTime@ha
-/* 800F4FB4 000F1EF4 38 05 72 C0 */ addi r0, r5, XferTime@l
-/* 800F4FB8 000F1EF8 54 C5 18 38 */ slwi r5, r6, 3
-/* 800F4FBC 000F1EFC 7C A0 2A 14 */ add r5, r0, r5
-/* 800F4FC0 000F1F00 90 85 00 04 */ stw r4, 4(r5)
-/* 800F4FC4 000F1F04 38 DF 00 4C */ addi r6, r31, 0x4c
-/* 800F4FC8 000F1F08 38 80 00 00 */ li r4, 0
-/* 800F4FCC 000F1F0C 90 65 00 00 */ stw r3, 0(r5)
-/* 800F4FD0 000F1F10 80 1F 00 4C */ lwz r0, 0x4c(r31)
-/* 800F4FD4 000F1F14 80 BF 00 50 */ lwz r5, 0x50(r31)
-/* 800F4FD8 000F1F18 54 07 F0 BE */ srwi r7, r0, 2
-/* 800F4FDC 000F1F1C 28 07 00 00 */ cmplwi r7, 0
-/* 800F4FE0 000F1F20 40 81 00 A0 */ ble .L_800F5080
-/* 800F4FE4 000F1F24 28 07 00 08 */ cmplwi r7, 8
-/* 800F4FE8 000F1F28 38 67 FF F8 */ addi r3, r7, -8
-/* 800F4FEC 000F1F2C 40 81 02 34 */ ble .L_800F5220
-/* 800F4FF0 000F1F30 38 03 00 07 */ addi r0, r3, 7
-/* 800F4FF4 000F1F34 54 00 E8 FE */ srwi r0, r0, 3
-/* 800F4FF8 000F1F38 28 03 00 00 */ cmplwi r3, 0
-/* 800F4FFC 000F1F3C 7C 09 03 A6 */ mtctr r0
-/* 800F5000 000F1F40 40 81 02 20 */ ble .L_800F5220
-.L_800F5004:
-/* 800F5004 000F1F44 80 1E 00 80 */ lwz r0, 0x80(r30)
-/* 800F5008 000F1F48 38 84 00 08 */ addi r4, r4, 8
-/* 800F500C 000F1F4C 90 05 00 00 */ stw r0, 0(r5)
-/* 800F5010 000F1F50 80 1E 00 84 */ lwz r0, 0x84(r30)
-/* 800F5014 000F1F54 90 05 00 04 */ stw r0, 4(r5)
-/* 800F5018 000F1F58 80 1E 00 88 */ lwz r0, 0x88(r30)
-/* 800F501C 000F1F5C 90 05 00 08 */ stw r0, 8(r5)
-/* 800F5020 000F1F60 80 1E 00 8C */ lwz r0, 0x8c(r30)
-/* 800F5024 000F1F64 90 05 00 0C */ stw r0, 0xc(r5)
-/* 800F5028 000F1F68 80 1E 00 90 */ lwz r0, 0x90(r30)
-/* 800F502C 000F1F6C 90 05 00 10 */ stw r0, 0x10(r5)
-/* 800F5030 000F1F70 80 1E 00 94 */ lwz r0, 0x94(r30)
-/* 800F5034 000F1F74 90 05 00 14 */ stw r0, 0x14(r5)
-/* 800F5038 000F1F78 80 1E 00 98 */ lwz r0, 0x98(r30)
-/* 800F503C 000F1F7C 90 05 00 18 */ stw r0, 0x18(r5)
-/* 800F5040 000F1F80 80 1E 00 9C */ lwz r0, 0x9c(r30)
-/* 800F5044 000F1F84 3B DE 00 20 */ addi r30, r30, 0x20
-/* 800F5048 000F1F88 90 05 00 1C */ stw r0, 0x1c(r5)
-/* 800F504C 000F1F8C 38 A5 00 20 */ addi r5, r5, 0x20
-/* 800F5050 000F1F90 42 00 FF B4 */ bdnz .L_800F5004
-/* 800F5054 000F1F94 48 00 01 CC */ b .L_800F5220
-.L_800F5058:
-/* 800F5058 000F1F98 7C 04 38 50 */ subf r0, r4, r7
-/* 800F505C 000F1F9C 7C 04 38 40 */ cmplw r4, r7
-/* 800F5060 000F1FA0 7C 09 03 A6 */ mtctr r0
-/* 800F5064 000F1FA4 40 80 00 1C */ bge .L_800F5080
-.L_800F5068:
-/* 800F5068 000F1FA8 80 03 00 80 */ lwz r0, 0x80(r3)
-/* 800F506C 000F1FAC 38 63 00 04 */ addi r3, r3, 4
-/* 800F5070 000F1FB0 38 84 00 01 */ addi r4, r4, 1
-/* 800F5074 000F1FB4 90 05 00 00 */ stw r0, 0(r5)
-/* 800F5078 000F1FB8 38 A5 00 04 */ addi r5, r5, 4
-/* 800F507C 000F1FBC 42 00 FF EC */ bdnz .L_800F5068
-.L_800F5080:
-/* 800F5080 000F1FC0 80 06 00 00 */ lwz r0, 0(r6)
-/* 800F5084 000F1FC4 54 03 07 BF */ clrlwi. r3, r0, 0x1e
-/* 800F5088 000F1FC8 41 82 01 10 */ beq .L_800F5198
-/* 800F508C 000F1FCC 3C C0 CC 00 */ lis r6, 0xCC006400@ha
-/* 800F5090 000F1FD0 38 C6 64 00 */ addi r6, r6, 0xCC006400@l
-/* 800F5094 000F1FD4 54 80 10 3A */ slwi r0, r4, 2
-/* 800F5098 000F1FD8 7C 86 02 14 */ add r4, r6, r0
-/* 800F509C 000F1FDC 80 C4 00 80 */ lwz r6, 0x80(r4)
-/* 800F50A0 000F1FE0 38 80 00 00 */ li r4, 0
-/* 800F50A4 000F1FE4 40 81 00 F4 */ ble .L_800F5198
-/* 800F50A8 000F1FE8 28 03 00 08 */ cmplwi r3, 8
-/* 800F50AC 000F1FEC 38 E3 FF F8 */ addi r7, r3, -8
-/* 800F50B0 000F1FF0 40 81 00 BC */ ble .L_800F516C
-/* 800F50B4 000F1FF4 38 07 00 07 */ addi r0, r7, 7
-/* 800F50B8 000F1FF8 54 00 E8 FE */ srwi r0, r0, 3
-/* 800F50BC 000F1FFC 28 07 00 00 */ cmplwi r7, 0
-/* 800F50C0 000F2000 7C 09 03 A6 */ mtctr r0
-/* 800F50C4 000F2004 40 81 00 A8 */ ble .L_800F516C
-.L_800F50C8:
-/* 800F50C8 000F2008 20 04 00 03 */ subfic r0, r4, 3
-/* 800F50CC 000F200C 54 07 18 38 */ slwi r7, r0, 3
-/* 800F50D0 000F2010 38 04 00 01 */ addi r0, r4, 1
-/* 800F50D4 000F2014 7C C7 3C 30 */ srw r7, r6, r7
-/* 800F50D8 000F2018 20 00 00 03 */ subfic r0, r0, 3
-/* 800F50DC 000F201C 98 E5 00 00 */ stb r7, 0(r5)
-/* 800F50E0 000F2020 54 00 18 38 */ slwi r0, r0, 3
-/* 800F50E4 000F2024 38 E4 00 02 */ addi r7, r4, 2
-/* 800F50E8 000F2028 7C C0 04 30 */ srw r0, r6, r0
-/* 800F50EC 000F202C 20 E7 00 03 */ subfic r7, r7, 3
-/* 800F50F0 000F2030 98 05 00 01 */ stb r0, 1(r5)
-/* 800F50F4 000F2034 54 E7 18 38 */ slwi r7, r7, 3
-/* 800F50F8 000F2038 7C CC 3C 30 */ srw r12, r6, r7
-/* 800F50FC 000F203C 7C E4 00 D0 */ neg r7, r4
-/* 800F5100 000F2040 99 85 00 02 */ stb r12, 2(r5)
-/* 800F5104 000F2044 54 E8 18 38 */ slwi r8, r7, 3
-/* 800F5108 000F2048 38 E4 00 04 */ addi r7, r4, 4
-/* 800F510C 000F204C 7C CB 44 30 */ srw r11, r6, r8
-/* 800F5110 000F2050 20 E7 00 03 */ subfic r7, r7, 3
-/* 800F5114 000F2054 99 65 00 03 */ stb r11, 3(r5)
-/* 800F5118 000F2058 54 E8 18 38 */ slwi r8, r7, 3
-/* 800F511C 000F205C 38 E4 00 05 */ addi r7, r4, 5
-/* 800F5120 000F2060 7C CA 44 30 */ srw r10, r6, r8
-/* 800F5124 000F2064 20 E7 00 03 */ subfic r7, r7, 3
-/* 800F5128 000F2068 99 45 00 04 */ stb r10, 4(r5)
-/* 800F512C 000F206C 54 E8 18 38 */ slwi r8, r7, 3
-/* 800F5130 000F2070 7C C9 44 30 */ srw r9, r6, r8
-/* 800F5134 000F2074 38 E4 00 06 */ addi r7, r4, 6
-/* 800F5138 000F2078 99 25 00 05 */ stb r9, 5(r5)
-/* 800F513C 000F207C 21 07 00 03 */ subfic r8, r7, 3
-/* 800F5140 000F2080 38 E4 00 07 */ addi r7, r4, 7
-/* 800F5144 000F2084 55 08 18 38 */ slwi r8, r8, 3
-/* 800F5148 000F2088 7C C8 44 30 */ srw r8, r6, r8
-/* 800F514C 000F208C 20 E7 00 03 */ subfic r7, r7, 3
-/* 800F5150 000F2090 99 05 00 06 */ stb r8, 6(r5)
-/* 800F5154 000F2094 54 E7 18 38 */ slwi r7, r7, 3
-/* 800F5158 000F2098 7C C7 3C 30 */ srw r7, r6, r7
-/* 800F515C 000F209C 98 E5 00 07 */ stb r7, 7(r5)
-/* 800F5160 000F20A0 38 A5 00 08 */ addi r5, r5, 8
-/* 800F5164 000F20A4 38 84 00 08 */ addi r4, r4, 8
-/* 800F5168 000F20A8 42 00 FF 60 */ bdnz .L_800F50C8
-.L_800F516C:
-/* 800F516C 000F20AC 7C 04 18 50 */ subf r0, r4, r3
-/* 800F5170 000F20B0 7C 04 18 40 */ cmplw r4, r3
-/* 800F5174 000F20B4 7C 09 03 A6 */ mtctr r0
-/* 800F5178 000F20B8 40 80 00 20 */ bge .L_800F5198
-.L_800F517C:
-/* 800F517C 000F20BC 20 04 00 03 */ subfic r0, r4, 3
-/* 800F5180 000F20C0 54 00 18 38 */ slwi r0, r0, 3
-/* 800F5184 000F20C4 7C C0 04 30 */ srw r0, r6, r0
-/* 800F5188 000F20C8 98 05 00 00 */ stb r0, 0(r5)
-/* 800F518C 000F20CC 38 A5 00 01 */ addi r5, r5, 1
-/* 800F5190 000F20D0 38 84 00 01 */ addi r4, r4, 1
-/* 800F5194 000F20D4 42 00 FF E8 */ bdnz .L_800F517C
-.L_800F5198:
-/* 800F5198 000F20D8 80 1D 00 00 */ lwz r0, 0(r29)
-/* 800F519C 000F20DC 54 00 00 85 */ rlwinm. r0, r0, 0, 2, 2
-/* 800F51A0 000F20E0 41 82 00 4C */ beq .L_800F51EC
-/* 800F51A4 000F20E4 80 7F 00 44 */ lwz r3, 0x44(r31)
-/* 800F51A8 000F20E8 20 03 00 03 */ subfic r0, r3, 3
-/* 800F51AC 000F20EC 54 00 18 38 */ slwi r0, r0, 3
-/* 800F51B0 000F20F0 7F 9C 04 30 */ srw r28, r28, r0
-/* 800F51B4 000F20F4 57 9C 07 3E */ clrlwi r28, r28, 0x1c
-/* 800F51B8 000F20F8 57 80 07 39 */ rlwinm. r0, r28, 0, 0x1c, 0x1c
-/* 800F51BC 000F20FC 41 82 00 20 */ beq .L_800F51DC
-/* 800F51C0 000F2100 54 60 10 3A */ slwi r0, r3, 2
-/* 800F51C4 000F2104 7C 7F 02 14 */ add r3, r31, r0
-/* 800F51C8 000F2108 84 03 00 58 */ lwzu r0, 0x58(r3)
-/* 800F51CC 000F210C 54 00 06 31 */ rlwinm. r0, r0, 0, 0x18, 0x18
-/* 800F51D0 000F2110 40 82 00 0C */ bne .L_800F51DC
-/* 800F51D4 000F2114 38 00 00 08 */ li r0, 8
-/* 800F51D8 000F2118 90 03 00 00 */ stw r0, 0(r3)
-.L_800F51DC:
-/* 800F51DC 000F211C 28 1C 00 00 */ cmplwi r28, 0
-/* 800F51E0 000F2120 40 82 00 30 */ bne .L_800F5210
-/* 800F51E4 000F2124 3B 80 00 04 */ li r28, 4
-/* 800F51E8 000F2128 48 00 00 28 */ b .L_800F5210
-.L_800F51EC:
-/* 800F51EC 000F212C 4B FF D9 C5 */ bl __OSGetSystemTime
-/* 800F51F0 000F2130 80 DF 00 44 */ lwz r6, 0x44(r31)
-/* 800F51F4 000F2134 3C A0 80 4F */ lis r5, TypeTime@ha
-/* 800F51F8 000F2138 38 05 72 A0 */ addi r0, r5, TypeTime@l
-/* 800F51FC 000F213C 54 C5 18 38 */ slwi r5, r6, 3
-/* 800F5200 000F2140 7C A0 2A 14 */ add r5, r0, r5
-/* 800F5204 000F2144 90 85 00 04 */ stw r4, 4(r5)
-/* 800F5208 000F2148 3B 80 00 00 */ li r28, 0
-/* 800F520C 000F214C 90 65 00 00 */ stw r3, 0(r5)
-.L_800F5210:
-/* 800F5210 000F2150 38 00 FF FF */ li r0, -1
-/* 800F5214 000F2154 90 1F 00 44 */ stw r0, 0x44(r31)
-.L_800F5218:
-/* 800F5218 000F2158 7F 83 E3 78 */ mr r3, r28
-/* 800F521C 000F215C 48 00 00 18 */ b .L_800F5234
-.L_800F5220:
-/* 800F5220 000F2160 3C 60 CC 00 */ lis r3, 0xCC006400@ha
-/* 800F5224 000F2164 54 80 10 3A */ slwi r0, r4, 2
-/* 800F5228 000F2168 38 63 64 00 */ addi r3, r3, 0xCC006400@l
-/* 800F522C 000F216C 7C 63 02 14 */ add r3, r3, r0
-/* 800F5230 000F2170 4B FF FE 28 */ b .L_800F5058
-.L_800F5234:
-/* 800F5234 000F2174 80 01 00 24 */ lwz r0, 0x24(r1)
-/* 800F5238 000F2178 83 E1 00 1C */ lwz r31, 0x1c(r1)
-/* 800F523C 000F217C 83 C1 00 18 */ lwz r30, 0x18(r1)
-/* 800F5240 000F2180 83 A1 00 14 */ lwz r29, 0x14(r1)
-/* 800F5244 000F2184 83 81 00 10 */ lwz r28, 0x10(r1)
-/* 800F5248 000F2188 38 21 00 20 */ addi r1, r1, 0x20
-/* 800F524C 000F218C 7C 08 03 A6 */ mtlr r0
-/* 800F5250 000F2190 4E 80 00 20 */ blr
-.endfn CompleteTransfer
-
-.fn SIInterruptHandler, local
-/* 800F5254 000F2194 7C 08 02 A6 */ mflr r0
-/* 800F5258 000F2198 3C A0 CC 00 */ lis r5, 0xCC006434@ha
-/* 800F525C 000F219C 90 01 00 04 */ stw r0, 4(r1)
-/* 800F5260 000F21A0 3C E0 80 4F */ lis r7, Packet@ha
-/* 800F5264 000F21A4 3C C0 80 4B */ lis r6, lbl_804A9EB8@ha
-/* 800F5268 000F21A8 94 21 FF B8 */ stwu r1, -0x48(r1)
-/* 800F526C 000F21AC BE A1 00 1C */ stmw r21, 0x1c(r1)
-/* 800F5270 000F21B0 3B C3 00 00 */ addi r30, r3, 0
-/* 800F5274 000F21B4 3B E4 00 00 */ addi r31, r4, 0
-/* 800F5278 000F21B8 3B 87 71 80 */ addi r28, r7, Packet@l
-/* 800F527C 000F21BC 3B A6 9E B8 */ addi r29, r6, lbl_804A9EB8@l
-/* 800F5280 000F21C0 83 05 64 34 */ lwz r24, 0xCC006434@l(r5)
-/* 800F5284 000F21C4 57 05 00 02 */ rlwinm r5, r24, 0, 0, 1
-/* 800F5288 000F21C8 3C 05 40 00 */ addis r0, r5, 0x4000
-/* 800F528C 000F21CC 28 00 00 00 */ cmplwi r0, 0
-/* 800F5290 000F21D0 40 82 01 84 */ bne .L_800F5414
-/* 800F5294 000F21D4 82 FD 00 44 */ lwz r23, 0x44(r29)
-/* 800F5298 000F21D8 4B FF FC C1 */ bl CompleteTransfer
-/* 800F529C 000F21DC 82 BD 00 54 */ lwz r21, 0x54(r29)
-/* 800F52A0 000F21E0 3B 60 00 00 */ li r27, 0
-/* 800F52A4 000F21E4 3A C3 00 00 */ addi r22, r3, 0
-/* 800F52A8 000F21E8 93 7D 00 54 */ stw r27, 0x54(r29)
-/* 800F52AC 000F21EC 3B 57 00 00 */ addi r26, r23, 0
-.L_800F52B0:
-/* 800F52B0 000F21F0 3B 5A 00 01 */ addi r26, r26, 1
-/* 800F52B4 000F21F4 7F 40 16 70 */ srawi r0, r26, 2
-/* 800F52B8 000F21F8 7C 00 01 94 */ addze r0, r0
-/* 800F52BC 000F21FC 54 00 10 3A */ slwi r0, r0, 2
-/* 800F52C0 000F2200 7C 00 D0 10 */ subfc r0, r0, r26
-/* 800F52C4 000F2204 7C 1A 03 78 */ mr r26, r0
-/* 800F52C8 000F2208 54 00 28 34 */ slwi r0, r0, 5
-/* 800F52CC 000F220C 7F 3C 02 14 */ add r25, r28, r0
-/* 800F52D0 000F2210 80 19 00 00 */ lwz r0, 0(r25)
-/* 800F52D4 000F2214 2C 00 FF FF */ cmpwi r0, -1
-/* 800F52D8 000F2218 41 82 00 6C */ beq .L_800F5344
-/* 800F52DC 000F221C 4B FF D8 D5 */ bl __OSGetSystemTime
-/* 800F52E0 000F2220 80 19 00 18 */ lwz r0, 0x18(r25)
-/* 800F52E4 000F2224 6C 65 80 00 */ xoris r5, r3, 0x8000
-/* 800F52E8 000F2228 80 D9 00 1C */ lwz r6, 0x1c(r25)
-/* 800F52EC 000F222C 6C 03 80 00 */ xoris r3, r0, 0x8000
-/* 800F52F0 000F2230 7C 06 20 10 */ subfc r0, r6, r4
-/* 800F52F4 000F2234 7C 63 29 10 */ subfe r3, r3, r5
-/* 800F52F8 000F2238 7C 65 29 10 */ subfe r3, r5, r5
-/* 800F52FC 000F223C 7C 63 00 D1 */ neg. r3, r3
-/* 800F5300 000F2240 40 82 00 44 */ bne .L_800F5344
-/* 800F5304 000F2244 80 79 00 00 */ lwz r3, 0(r25)
-/* 800F5308 000F2248 80 99 00 04 */ lwz r4, 4(r25)
-/* 800F530C 000F224C 80 B9 00 08 */ lwz r5, 8(r25)
-/* 800F5310 000F2250 80 D9 00 0C */ lwz r6, 0xc(r25)
-/* 800F5314 000F2254 80 F9 00 10 */ lwz r7, 0x10(r25)
-/* 800F5318 000F2258 81 19 00 14 */ lwz r8, 0x14(r25)
-/* 800F531C 000F225C 48 00 05 89 */ bl __SITransfer
-/* 800F5320 000F2260 2C 03 00 00 */ cmpwi r3, 0
-/* 800F5324 000F2264 41 82 00 2C */ beq .L_800F5350
-/* 800F5328 000F2268 1C 1A 00 28 */ mulli r0, r26, 0x28
-/* 800F532C 000F226C 7C 7C 02 14 */ add r3, r28, r0
-/* 800F5330 000F2270 38 63 00 80 */ addi r3, r3, 0x80
-/* 800F5334 000F2274 4B FF 6A A1 */ bl OSCancelAlarm
-/* 800F5338 000F2278 38 00 FF FF */ li r0, -1
-/* 800F533C 000F227C 90 19 00 00 */ stw r0, 0(r25)
-/* 800F5340 000F2280 48 00 00 10 */ b .L_800F5350
-.L_800F5344:
-/* 800F5344 000F2284 3B 7B 00 01 */ addi r27, r27, 1
-/* 800F5348 000F2288 2C 1B 00 04 */ cmpwi r27, 4
-/* 800F534C 000F228C 41 80 FF 64 */ blt .L_800F52B0
-.L_800F5350:
-/* 800F5350 000F2290 28 15 00 00 */ cmplwi r21, 0
-/* 800F5354 000F2294 41 82 00 1C */ beq .L_800F5370
-/* 800F5358 000F2298 39 95 00 00 */ addi r12, r21, 0
-/* 800F535C 000F229C 7D 88 03 A6 */ mtlr r12
-/* 800F5360 000F22A0 38 77 00 00 */ addi r3, r23, 0
-/* 800F5364 000F22A4 38 96 00 00 */ addi r4, r22, 0
-/* 800F5368 000F22A8 38 BF 00 00 */ addi r5, r31, 0
-/* 800F536C 000F22AC 4E 80 00 21 */ blrl
-.L_800F5370:
-/* 800F5370 000F22B0 3C 60 CC 00 */ lis r3, 0xCC006400@ha
-/* 800F5374 000F22B4 38 83 64 00 */ addi r4, r3, 0xCC006400@l
-/* 800F5378 000F22B8 80 A3 64 38 */ lwz r5, 0x6438(r3)
-/* 800F537C 000F22BC 56 E0 18 38 */ slwi r0, r23, 3
-/* 800F5380 000F22C0 3C 60 0F 00 */ lis r3, 0xf00
-/* 800F5384 000F22C4 7C 60 06 30 */ sraw r0, r3, r0
-/* 800F5388 000F22C8 7C A5 00 38 */ and r5, r5, r0
-/* 800F538C 000F22CC 56 E0 10 3A */ slwi r0, r23, 2
-/* 800F5390 000F22D0 90 A4 00 38 */ stw r5, 0x38(r4)
-/* 800F5394 000F22D4 7C DD 02 14 */ add r6, r29, r0
-/* 800F5398 000F22D8 84 06 00 58 */ lwzu r0, 0x58(r6)
-/* 800F539C 000F22DC 28 00 00 80 */ cmplwi r0, 0x80
-/* 800F53A0 000F22E0 40 82 00 74 */ bne .L_800F5414
-/* 800F53A4 000F22E4 56 E0 28 34 */ slwi r0, r23, 5
-/* 800F53A8 000F22E8 7C 1C 00 2E */ lwzx r0, r28, r0
-/* 800F53AC 000F22EC 38 60 00 01 */ li r3, 1
-/* 800F53B0 000F22F0 2C 00 FF FF */ cmpwi r0, -1
-/* 800F53B4 000F22F4 40 82 00 14 */ bne .L_800F53C8
-/* 800F53B8 000F22F8 80 1D 00 44 */ lwz r0, 0x44(r29)
-/* 800F53BC 000F22FC 7C 00 B8 00 */ cmpw r0, r23
-/* 800F53C0 000F2300 41 82 00 08 */ beq .L_800F53C8
-/* 800F53C4 000F2304 38 60 00 00 */ li r3, 0
-.L_800F53C8:
-/* 800F53C8 000F2308 2C 03 00 00 */ cmpwi r3, 0
-/* 800F53CC 000F230C 40 82 00 48 */ bne .L_800F5414
-/* 800F53D0 000F2310 3C 60 80 00 */ lis r3, 0x800000F8@ha
-/* 800F53D4 000F2314 80 03 00 F8 */ lwz r0, 0x800000F8@l(r3)
-/* 800F53D8 000F2318 3C 60 43 1C */ lis r3, 0x431BDE83@ha
-/* 800F53DC 000F231C 3C 80 80 0F */ lis r4, GetTypeCallback@ha
-/* 800F53E0 000F2320 54 00 F0 BE */ srwi r0, r0, 2
-/* 800F53E4 000F2324 38 63 DE 83 */ addi r3, r3, 0x431BDE83@l
-/* 800F53E8 000F2328 7C 03 00 16 */ mulhwu r0, r3, r0
-/* 800F53EC 000F232C 54 00 8B FE */ srwi r0, r0, 0xf
-/* 800F53F0 000F2330 1C 00 00 41 */ mulli r0, r0, 0x41
-/* 800F53F4 000F2334 39 04 60 54 */ addi r8, r4, GetTypeCallback@l
-/* 800F53F8 000F2338 54 0A E8 FE */ srwi r10, r0, 3
-/* 800F53FC 000F233C 38 77 00 00 */ addi r3, r23, 0
-/* 800F5400 000F2340 38 8D 90 20 */ addi r4, r13, cmdTypeAndStatus$78@sda21
-/* 800F5404 000F2344 38 A0 00 01 */ li r5, 1
-/* 800F5408 000F2348 38 E0 00 03 */ li r7, 3
-/* 800F540C 000F234C 39 20 00 00 */ li r9, 0
-/* 800F5410 000F2350 48 00 0A D9 */ bl SITransfer
-.L_800F5414:
-/* 800F5414 000F2354 57 03 00 C8 */ rlwinm r3, r24, 0, 3, 4
-/* 800F5418 000F2358 3C 03 E8 00 */ addis r0, r3, 0xe800
-/* 800F541C 000F235C 28 00 00 00 */ cmplwi r0, 0
-/* 800F5420 000F2360 40 82 01 64 */ bne .L_800F5584
-/* 800F5424 000F2364 4B FD CE 69 */ bl VIGetCurrentLine
-/* 800F5428 000F2368 80 1D 00 48 */ lwz r0, 0x48(r29)
-/* 800F542C 000F236C 3A FC 01 E0 */ addi r23, r28, 0x1e0
-/* 800F5430 000F2370 3B 1D 00 48 */ addi r24, r29, 0x48
-/* 800F5434 000F2374 3A D7 00 00 */ addi r22, r23, 0
-/* 800F5438 000F2378 3A A3 00 01 */ addi r21, r3, 1
-/* 800F543C 000F237C 54 1A 85 BE */ rlwinm r26, r0, 0x10, 0x16, 0x1f
-/* 800F5440 000F2380 3B 20 00 00 */ li r25, 0
-.L_800F5444:
-/* 800F5444 000F2384 7F 23 CB 78 */ mr r3, r25
-/* 800F5448 000F2388 48 00 08 7D */ bl SIGetResponseRaw
-/* 800F544C 000F238C 2C 03 00 00 */ cmpwi r3, 0
-/* 800F5450 000F2390 41 82 00 08 */ beq .L_800F5458
-/* 800F5454 000F2394 92 B6 00 00 */ stw r21, 0(r22)
-.L_800F5458:
-/* 800F5458 000F2398 3B 39 00 01 */ addi r25, r25, 1
-/* 800F545C 000F239C 2C 19 00 04 */ cmpwi r25, 4
-/* 800F5460 000F23A0 3A D6 00 04 */ addi r22, r22, 4
-/* 800F5464 000F23A4 41 80 FF E0 */ blt .L_800F5444
-/* 800F5468 000F23A8 80 B8 00 00 */ lwz r5, 0(r24)
-/* 800F546C 000F23AC 3C 60 80 00 */ lis r3, 0x8000
-/* 800F5470 000F23B0 38 00 00 18 */ li r0, 0x18
-/* 800F5474 000F23B4 7C 60 04 30 */ srw r0, r3, r0
-/* 800F5478 000F23B8 7C A0 00 39 */ and. r0, r5, r0
-/* 800F547C 000F23BC 57 46 F8 7E */ srwi r6, r26, 1
-/* 800F5480 000F23C0 41 82 00 24 */ beq .L_800F54A4
-/* 800F5484 000F23C4 80 17 00 00 */ lwz r0, 0(r23)
-/* 800F5488 000F23C8 28 00 00 00 */ cmplwi r0, 0
-/* 800F548C 000F23CC 41 82 00 F8 */ beq .L_800F5584
-/* 800F5490 000F23D0 80 17 00 00 */ lwz r0, 0(r23)
-/* 800F5494 000F23D4 7C 06 02 14 */ add r0, r6, r0
-/* 800F5498 000F23D8 7C 00 A8 40 */ cmplw r0, r21
-/* 800F549C 000F23DC 40 80 00 08 */ bge .L_800F54A4
-/* 800F54A0 000F23E0 48 00 00 E4 */ b .L_800F5584
-.L_800F54A4:
-/* 800F54A4 000F23E4 38 00 00 19 */ li r0, 0x19
-/* 800F54A8 000F23E8 7C 60 04 30 */ srw r0, r3, r0
-/* 800F54AC 000F23EC 7C A0 00 39 */ and. r0, r5, r0
-/* 800F54B0 000F23F0 38 97 00 04 */ addi r4, r23, 4
-/* 800F54B4 000F23F4 41 82 00 24 */ beq .L_800F54D8
-/* 800F54B8 000F23F8 80 04 00 00 */ lwz r0, 0(r4)
-/* 800F54BC 000F23FC 28 00 00 00 */ cmplwi r0, 0
-/* 800F54C0 000F2400 41 82 00 C4 */ beq .L_800F5584
-/* 800F54C4 000F2404 80 04 00 00 */ lwz r0, 0(r4)
-/* 800F54C8 000F2408 7C 06 02 14 */ add r0, r6, r0
-/* 800F54CC 000F240C 7C 00 A8 40 */ cmplw r0, r21
-/* 800F54D0 000F2410 40 80 00 08 */ bge .L_800F54D8
-/* 800F54D4 000F2414 48 00 00 B0 */ b .L_800F5584
-.L_800F54D8:
-/* 800F54D8 000F2418 38 00 00 1A */ li r0, 0x1a
-/* 800F54DC 000F241C 7C 60 04 30 */ srw r0, r3, r0
-/* 800F54E0 000F2420 7C A0 00 39 */ and. r0, r5, r0
-/* 800F54E4 000F2424 38 84 00 04 */ addi r4, r4, 4
-/* 800F54E8 000F2428 41 82 00 24 */ beq .L_800F550C
-/* 800F54EC 000F242C 80 04 00 00 */ lwz r0, 0(r4)
-/* 800F54F0 000F2430 28 00 00 00 */ cmplwi r0, 0
-/* 800F54F4 000F2434 41 82 00 90 */ beq .L_800F5584
-/* 800F54F8 000F2438 80 04 00 00 */ lwz r0, 0(r4)
-/* 800F54FC 000F243C 7C 06 02 14 */ add r0, r6, r0
-/* 800F5500 000F2440 7C 00 A8 40 */ cmplw r0, r21
-/* 800F5504 000F2444 40 80 00 08 */ bge .L_800F550C
-/* 800F5508 000F2448 48 00 00 7C */ b .L_800F5584
-.L_800F550C:
-/* 800F550C 000F244C 38 00 00 1B */ li r0, 0x1b
-/* 800F5510 000F2450 7C 60 04 30 */ srw r0, r3, r0
-/* 800F5514 000F2454 7C A0 00 39 */ and. r0, r5, r0
-/* 800F5518 000F2458 38 84 00 04 */ addi r4, r4, 4
-/* 800F551C 000F245C 41 82 00 24 */ beq .L_800F5540
-/* 800F5520 000F2460 80 04 00 00 */ lwz r0, 0(r4)
-/* 800F5524 000F2464 28 00 00 00 */ cmplwi r0, 0
-/* 800F5528 000F2468 41 82 00 5C */ beq .L_800F5584
-/* 800F552C 000F246C 80 04 00 00 */ lwz r0, 0(r4)
-/* 800F5530 000F2470 7C 06 02 14 */ add r0, r6, r0
-/* 800F5534 000F2474 7C 00 A8 40 */ cmplw r0, r21
-/* 800F5538 000F2478 40 80 00 08 */ bge .L_800F5540
-/* 800F553C 000F247C 48 00 00 48 */ b .L_800F5584
-.L_800F5540:
-/* 800F5540 000F2480 3A C0 00 00 */ li r22, 0
-/* 800F5544 000F2484 92 D7 00 00 */ stw r22, 0(r23)
-/* 800F5548 000F2488 3A BC 01 A0 */ addi r21, r28, 0x1a0
-/* 800F554C 000F248C 92 DC 01 E4 */ stw r22, 0x1e4(r28)
-/* 800F5550 000F2490 92 DC 01 E8 */ stw r22, 0x1e8(r28)
-/* 800F5554 000F2494 92 DC 01 EC */ stw r22, 0x1ec(r28)
-.L_800F5558:
-/* 800F5558 000F2498 81 95 00 00 */ lwz r12, 0(r21)
-/* 800F555C 000F249C 28 0C 00 00 */ cmplwi r12, 0
-/* 800F5560 000F24A0 41 82 00 14 */ beq .L_800F5574
-/* 800F5564 000F24A4 7D 88 03 A6 */ mtlr r12
-/* 800F5568 000F24A8 38 7E 00 00 */ addi r3, r30, 0
-/* 800F556C 000F24AC 38 9F 00 00 */ addi r4, r31, 0
-/* 800F5570 000F24B0 4E 80 00 21 */ blrl
-.L_800F5574:
-/* 800F5574 000F24B4 3A D6 00 01 */ addi r22, r22, 1
-/* 800F5578 000F24B8 2C 16 00 04 */ cmpwi r22, 4
-/* 800F557C 000F24BC 3A B5 00 04 */ addi r21, r21, 4
-/* 800F5580 000F24C0 41 80 FF D8 */ blt .L_800F5558
-.L_800F5584:
-/* 800F5584 000F24C4 BA A1 00 1C */ lmw r21, 0x1c(r1)
-/* 800F5588 000F24C8 80 01 00 4C */ lwz r0, 0x4c(r1)
-/* 800F558C 000F24CC 38 21 00 48 */ addi r1, r1, 0x48
-/* 800F5590 000F24D0 7C 08 03 A6 */ mtlr r0
-/* 800F5594 000F24D4 4E 80 00 20 */ blr
-.endfn SIInterruptHandler
-
-.fn SIEnablePollingInterrupt, local
-/* 800F5598 000F24D8 7C 08 02 A6 */ mflr r0
-/* 800F559C 000F24DC 3C 80 80 4F */ lis r4, Packet@ha
-/* 800F55A0 000F24E0 90 01 00 04 */ stw r0, 4(r1)
-/* 800F55A4 000F24E4 94 21 FF D0 */ stwu r1, -0x30(r1)
-/* 800F55A8 000F24E8 93 E1 00 2C */ stw r31, 0x2c(r1)
-/* 800F55AC 000F24EC 3B E4 71 80 */ addi r31, r4, Packet@l
-/* 800F55B0 000F24F0 93 C1 00 28 */ stw r30, 0x28(r1)
-/* 800F55B4 000F24F4 93 A1 00 24 */ stw r29, 0x24(r1)
-/* 800F55B8 000F24F8 3B A3 00 00 */ addi r29, r3, 0
-/* 800F55BC 000F24FC 4B FF 96 7D */ bl OSDisableInterrupts
-/* 800F55C0 000F2500 3C 80 CC 00 */ lis r4, 0xcc00
-/* 800F55C4 000F2504 84 A4 64 34 */ lwzu r5, 0x6434(r4)
-/* 800F55C8 000F2508 54 A0 01 09 */ rlwinm. r0, r5, 0, 4, 4
-/* 800F55CC 000F250C 41 82 00 0C */ beq .L_800F55D8
-/* 800F55D0 000F2510 3B C0 00 01 */ li r30, 1
-/* 800F55D4 000F2514 48 00 00 08 */ b .L_800F55DC
-.L_800F55D8:
-/* 800F55D8 000F2518 3B C0 00 00 */ li r30, 0
-.L_800F55DC:
-/* 800F55DC 000F251C 2C 1D 00 00 */ cmpwi r29, 0
-/* 800F55E0 000F2520 41 82 00 20 */ beq .L_800F5600
-/* 800F55E4 000F2524 38 00 00 00 */ li r0, 0
-/* 800F55E8 000F2528 90 1F 01 E0 */ stw r0, 0x1e0(r31)
-/* 800F55EC 000F252C 64 A5 08 00 */ oris r5, r5, 0x800
-/* 800F55F0 000F2530 90 1F 01 E4 */ stw r0, 0x1e4(r31)
-/* 800F55F4 000F2534 90 1F 01 E8 */ stw r0, 0x1e8(r31)
-/* 800F55F8 000F2538 90 1F 01 EC */ stw r0, 0x1ec(r31)
-/* 800F55FC 000F253C 48 00 00 08 */ b .L_800F5604
-.L_800F5600:
-/* 800F5600 000F2540 54 A5 01 46 */ rlwinm r5, r5, 0, 5, 3
-.L_800F5604:
-/* 800F5604 000F2544 54 A5 00 7C */ rlwinm r5, r5, 0, 1, 0x1e
-/* 800F5608 000F2548 90 A4 00 00 */ stw r5, 0(r4)
-/* 800F560C 000F254C 4B FF 96 55 */ bl OSRestoreInterrupts
-/* 800F5610 000F2550 7F C3 F3 78 */ mr r3, r30
-/* 800F5614 000F2554 80 01 00 34 */ lwz r0, 0x34(r1)
-/* 800F5618 000F2558 83 E1 00 2C */ lwz r31, 0x2c(r1)
-/* 800F561C 000F255C 83 C1 00 28 */ lwz r30, 0x28(r1)
-/* 800F5620 000F2560 83 A1 00 24 */ lwz r29, 0x24(r1)
-/* 800F5624 000F2564 38 21 00 30 */ addi r1, r1, 0x30
-/* 800F5628 000F2568 7C 08 03 A6 */ mtlr r0
-/* 800F562C 000F256C 4E 80 00 20 */ blr
-.endfn SIEnablePollingInterrupt
-
-.fn SIRegisterPollingHandler, global
-/* 800F5630 000F2570 7C 08 02 A6 */ mflr r0
-/* 800F5634 000F2574 90 01 00 04 */ stw r0, 4(r1)
-/* 800F5638 000F2578 94 21 FF E8 */ stwu r1, -0x18(r1)
-/* 800F563C 000F257C 93 E1 00 14 */ stw r31, 0x14(r1)
-/* 800F5640 000F2580 93 C1 00 10 */ stw r30, 0x10(r1)
-/* 800F5644 000F2584 7C 7E 1B 78 */ mr r30, r3
-/* 800F5648 000F2588 4B FF 95 F1 */ bl OSDisableInterrupts
-/* 800F564C 000F258C 3C 80 80 4F */ lis r4, RDSTHandler@ha
-/* 800F5650 000F2590 38 00 00 04 */ li r0, 4
-/* 800F5654 000F2594 38 84 73 20 */ addi r4, r4, RDSTHandler@l
-/* 800F5658 000F2598 7C 09 03 A6 */ mtctr r0
-/* 800F565C 000F259C 3B E3 00 00 */ addi r31, r3, 0
-/* 800F5660 000F25A0 38 64 00 00 */ addi r3, r4, 0
-.L_800F5664:
-/* 800F5664 000F25A4 80 03 00 00 */ lwz r0, 0(r3)
-/* 800F5668 000F25A8 7C 00 F0 40 */ cmplw r0, r30
-/* 800F566C 000F25AC 40 82 00 14 */ bne .L_800F5680
-/* 800F5670 000F25B0 7F E3 FB 78 */ mr r3, r31
-/* 800F5674 000F25B4 4B FF 95 ED */ bl OSRestoreInterrupts
-/* 800F5678 000F25B8 38 60 00 01 */ li r3, 1
-/* 800F567C 000F25BC 48 00 00 68 */ b .L_800F56E4
-.L_800F5680:
-/* 800F5680 000F25C0 38 63 00 04 */ addi r3, r3, 4
-/* 800F5684 000F25C4 42 00 FF E0 */ bdnz .L_800F5664
-/* 800F5688 000F25C8 38 00 00 04 */ li r0, 4
-/* 800F568C 000F25CC 7C 09 03 A6 */ mtctr r0
-/* 800F5690 000F25D0 38 A0 00 00 */ li r5, 0
-.L_800F5694:
-/* 800F5694 000F25D4 80 04 00 00 */ lwz r0, 0(r4)
-/* 800F5698 000F25D8 28 00 00 00 */ cmplwi r0, 0
-/* 800F569C 000F25DC 40 82 00 30 */ bne .L_800F56CC
-/* 800F56A0 000F25E0 3C 60 80 4F */ lis r3, RDSTHandler@ha
-/* 800F56A4 000F25E4 54 A4 10 3A */ slwi r4, r5, 2
-/* 800F56A8 000F25E8 38 03 73 20 */ addi r0, r3, RDSTHandler@l
-/* 800F56AC 000F25EC 7C 60 22 14 */ add r3, r0, r4
-/* 800F56B0 000F25F0 93 C3 00 00 */ stw r30, 0(r3)
-/* 800F56B4 000F25F4 38 60 00 01 */ li r3, 1
-/* 800F56B8 000F25F8 4B FF FE E1 */ bl SIEnablePollingInterrupt
-/* 800F56BC 000F25FC 7F E3 FB 78 */ mr r3, r31
-/* 800F56C0 000F2600 4B FF 95 A1 */ bl OSRestoreInterrupts
-/* 800F56C4 000F2604 38 60 00 01 */ li r3, 1
-/* 800F56C8 000F2608 48 00 00 1C */ b .L_800F56E4
-.L_800F56CC:
-/* 800F56CC 000F260C 38 84 00 04 */ addi r4, r4, 4
-/* 800F56D0 000F2610 38 A5 00 01 */ addi r5, r5, 1
-/* 800F56D4 000F2614 42 00 FF C0 */ bdnz .L_800F5694
-/* 800F56D8 000F2618 7F E3 FB 78 */ mr r3, r31
-/* 800F56DC 000F261C 4B FF 95 85 */ bl OSRestoreInterrupts
-/* 800F56E0 000F2620 38 60 00 00 */ li r3, 0
-.L_800F56E4:
-/* 800F56E4 000F2624 80 01 00 1C */ lwz r0, 0x1c(r1)
-/* 800F56E8 000F2628 83 E1 00 14 */ lwz r31, 0x14(r1)
-/* 800F56EC 000F262C 83 C1 00 10 */ lwz r30, 0x10(r1)
-/* 800F56F0 000F2630 38 21 00 18 */ addi r1, r1, 0x18
-/* 800F56F4 000F2634 7C 08 03 A6 */ mtlr r0
-/* 800F56F8 000F2638 4E 80 00 20 */ blr
-.endfn SIRegisterPollingHandler
-
-.fn SIUnregisterPollingHandler, global
-/* 800F56FC 000F263C 7C 08 02 A6 */ mflr r0
-/* 800F5700 000F2640 90 01 00 04 */ stw r0, 4(r1)
-/* 800F5704 000F2644 94 21 FF E8 */ stwu r1, -0x18(r1)
-/* 800F5708 000F2648 93 E1 00 14 */ stw r31, 0x14(r1)
-/* 800F570C 000F264C 93 C1 00 10 */ stw r30, 0x10(r1)
-/* 800F5710 000F2650 7C 7E 1B 78 */ mr r30, r3
-/* 800F5714 000F2654 4B FF 95 25 */ bl OSDisableInterrupts
-/* 800F5718 000F2658 3C 80 80 4F */ lis r4, RDSTHandler@ha
-/* 800F571C 000F265C 38 00 00 04 */ li r0, 4
-/* 800F5720 000F2660 38 A4 73 20 */ addi r5, r4, RDSTHandler@l
-/* 800F5724 000F2664 7C 09 03 A6 */ mtctr r0
-/* 800F5728 000F2668 3B E3 00 00 */ addi r31, r3, 0
-/* 800F572C 000F266C 38 65 00 00 */ addi r3, r5, 0
-/* 800F5730 000F2670 38 80 00 00 */ li r4, 0
-.L_800F5734:
-/* 800F5734 000F2674 80 03 00 00 */ lwz r0, 0(r3)
-/* 800F5738 000F2678 7C 00 F0 40 */ cmplw r0, r30
-/* 800F573C 000F267C 40 82 00 84 */ bne .L_800F57C0
-/* 800F5740 000F2680 3C 60 80 4F */ lis r3, RDSTHandler@ha
-/* 800F5744 000F2684 54 84 10 3A */ slwi r4, r4, 2
-/* 800F5748 000F2688 38 03 73 20 */ addi r0, r3, RDSTHandler@l
-/* 800F574C 000F268C 7C 60 22 14 */ add r3, r0, r4
-/* 800F5750 000F2690 38 00 00 00 */ li r0, 0
-/* 800F5754 000F2694 90 03 00 00 */ stw r0, 0(r3)
-/* 800F5758 000F2698 38 80 00 00 */ li r4, 0
-/* 800F575C 000F269C 80 05 00 00 */ lwz r0, 0(r5)
-/* 800F5760 000F26A0 28 00 00 00 */ cmplwi r0, 0
-/* 800F5764 000F26A4 40 82 00 3C */ bne .L_800F57A0
-/* 800F5768 000F26A8 38 65 00 04 */ addi r3, r5, 4
-/* 800F576C 000F26AC 80 05 00 04 */ lwz r0, 4(r5)
-/* 800F5770 000F26B0 38 80 00 01 */ li r4, 1
-/* 800F5774 000F26B4 28 00 00 00 */ cmplwi r0, 0
-/* 800F5778 000F26B8 40 82 00 28 */ bne .L_800F57A0
-/* 800F577C 000F26BC 84 03 00 04 */ lwzu r0, 4(r3)
-/* 800F5780 000F26C0 38 80 00 02 */ li r4, 2
-/* 800F5784 000F26C4 28 00 00 00 */ cmplwi r0, 0
-/* 800F5788 000F26C8 40 82 00 18 */ bne .L_800F57A0
-/* 800F578C 000F26CC 80 03 00 04 */ lwz r0, 4(r3)
-/* 800F5790 000F26D0 38 80 00 03 */ li r4, 3
-/* 800F5794 000F26D4 28 00 00 00 */ cmplwi r0, 0
-/* 800F5798 000F26D8 40 82 00 08 */ bne .L_800F57A0
-/* 800F579C 000F26DC 38 80 00 04 */ li r4, 4
-.L_800F57A0:
-/* 800F57A0 000F26E0 2C 04 00 04 */ cmpwi r4, 4
-/* 800F57A4 000F26E4 40 82 00 0C */ bne .L_800F57B0
-/* 800F57A8 000F26E8 38 60 00 00 */ li r3, 0
-/* 800F57AC 000F26EC 4B FF FD ED */ bl SIEnablePollingInterrupt
-.L_800F57B0:
-/* 800F57B0 000F26F0 7F E3 FB 78 */ mr r3, r31
-/* 800F57B4 000F26F4 4B FF 94 AD */ bl OSRestoreInterrupts
-/* 800F57B8 000F26F8 38 60 00 01 */ li r3, 1
-/* 800F57BC 000F26FC 48 00 00 1C */ b .L_800F57D8
-.L_800F57C0:
-/* 800F57C0 000F2700 38 63 00 04 */ addi r3, r3, 4
-/* 800F57C4 000F2704 38 84 00 01 */ addi r4, r4, 1
-/* 800F57C8 000F2708 42 00 FF 6C */ bdnz .L_800F5734
-/* 800F57CC 000F270C 7F E3 FB 78 */ mr r3, r31
-/* 800F57D0 000F2710 4B FF 94 91 */ bl OSRestoreInterrupts
-/* 800F57D4 000F2714 38 60 00 00 */ li r3, 0
-.L_800F57D8:
-/* 800F57D8 000F2718 80 01 00 1C */ lwz r0, 0x1c(r1)
-/* 800F57DC 000F271C 83 E1 00 14 */ lwz r31, 0x14(r1)
-/* 800F57E0 000F2720 83 C1 00 10 */ lwz r30, 0x10(r1)
-/* 800F57E4 000F2724 38 21 00 18 */ addi r1, r1, 0x18
-/* 800F57E8 000F2728 7C 08 03 A6 */ mtlr r0
-/* 800F57EC 000F272C 4E 80 00 20 */ blr
-.endfn SIUnregisterPollingHandler
-
-.fn SIInit, global
-/* 800F57F0 000F2730 7C 08 02 A6 */ mflr r0
-/* 800F57F4 000F2734 3C 80 80 4F */ lis r4, Packet@ha
-/* 800F57F8 000F2738 90 01 00 04 */ stw r0, 4(r1)
-/* 800F57FC 000F273C 94 21 FF F0 */ stwu r1, -0x10(r1)
-/* 800F5800 000F2740 93 E1 00 0C */ stw r31, 0xc(r1)
-/* 800F5804 000F2744 3B E4 71 80 */ addi r31, r4, Packet@l
-/* 800F5808 000F2748 80 6D 83 A0 */ lwz r3, __SIVersion@sda21(r13)
-/* 800F580C 000F274C 4B FF 62 7D */ bl OSRegisterVersion
-/* 800F5810 000F2750 38 A0 FF FF */ li r5, -1
-/* 800F5814 000F2754 90 BF 00 60 */ stw r5, 0x60(r31)
-/* 800F5818 000F2758 3C 60 80 4B */ lis r3, Si@ha
-/* 800F581C 000F275C 38 83 9E FC */ addi r4, r3, Si@l
-/* 800F5820 000F2760 90 BF 00 40 */ stw r5, 0x40(r31)
-/* 800F5824 000F2764 38 00 00 00 */ li r0, 0
-/* 800F5828 000F2768 38 60 00 00 */ li r3, 0
-/* 800F582C 000F276C 90 BF 00 20 */ stw r5, 0x20(r31)
-/* 800F5830 000F2770 90 BF 00 00 */ stw r5, 0(r31)
-/* 800F5834 000F2774 90 04 00 04 */ stw r0, 4(r4)
-/* 800F5838 000F2778 48 00 0F 25 */ bl SISetSamplingRate
-/* 800F583C 000F277C 3C 60 CC 00 */ lis r3, 0xCC006400@ha
-.L_800F5840:
-/* 800F5840 000F2780 38 83 64 00 */ addi r4, r3, 0xCC006400@l
-/* 800F5844 000F2784 84 04 00 34 */ lwzu r0, 0x34(r4)
-/* 800F5848 000F2788 54 00 07 FF */ clrlwi. r0, r0, 0x1f
-/* 800F584C 000F278C 40 82 FF F4 */ bne .L_800F5840
-/* 800F5850 000F2790 3C 00 80 00 */ lis r0, 0x8000
-/* 800F5854 000F2794 3C 60 80 0F */ lis r3, SIInterruptHandler@ha
-/* 800F5858 000F2798 90 04 00 00 */ stw r0, 0(r4)
-/* 800F585C 000F279C 38 83 52 54 */ addi r4, r3, SIInterruptHandler@l
-/* 800F5860 000F27A0 38 60 00 14 */ li r3, 0x14
-/* 800F5864 000F27A4 4B FF 94 21 */ bl __OSSetInterruptHandler
-/* 800F5868 000F27A8 38 60 08 00 */ li r3, 0x800
-/* 800F586C 000F27AC 4B FF 98 1D */ bl __OSUnmaskInterrupts
-/* 800F5870 000F27B0 38 60 00 00 */ li r3, 0
-/* 800F5874 000F27B4 48 00 0A 79 */ bl SIGetType
-/* 800F5878 000F27B8 38 60 00 01 */ li r3, 1
-/* 800F587C 000F27BC 48 00 0A 71 */ bl SIGetType
-/* 800F5880 000F27C0 38 60 00 02 */ li r3, 2
-/* 800F5884 000F27C4 48 00 0A 69 */ bl SIGetType
-/* 800F5888 000F27C8 38 60 00 03 */ li r3, 3
-/* 800F588C 000F27CC 48 00 0A 61 */ bl SIGetType
-/* 800F5890 000F27D0 80 01 00 14 */ lwz r0, 0x14(r1)
-/* 800F5894 000F27D4 83 E1 00 0C */ lwz r31, 0xc(r1)
-/* 800F5898 000F27D8 38 21 00 10 */ addi r1, r1, 0x10
-/* 800F589C 000F27DC 7C 08 03 A6 */ mtlr r0
-/* 800F58A0 000F27E0 4E 80 00 20 */ blr
-.endfn SIInit
-
-.fn __SITransfer, local
-/* 800F58A4 000F27E4 7C 08 02 A6 */ mflr r0
-/* 800F58A8 000F27E8 3D 20 80 4B */ lis r9, lbl_804A9EB8@ha
-/* 800F58AC 000F27EC 90 01 00 04 */ stw r0, 4(r1)
-/* 800F58B0 000F27F0 94 21 FF B8 */ stwu r1, -0x48(r1)
-/* 800F58B4 000F27F4 BF 21 00 2C */ stmw r25, 0x2c(r1)
-/* 800F58B8 000F27F8 3B 43 00 00 */ addi r26, r3, 0
-/* 800F58BC 000F27FC 3B 64 00 00 */ addi r27, r4, 0
-/* 800F58C0 000F2800 3B 85 00 00 */ addi r28, r5, 0
-/* 800F58C4 000F2804 3B A6 00 00 */ addi r29, r6, 0
-/* 800F58C8 000F2808 3B C7 00 00 */ addi r30, r7, 0
-/* 800F58CC 000F280C 3B E8 00 00 */ addi r31, r8, 0
-/* 800F58D0 000F2810 3B 29 9E B8 */ addi r25, r9, lbl_804A9EB8@l
-/* 800F58D4 000F2814 4B FF 93 65 */ bl OSDisableInterrupts
-/* 800F58D8 000F2818 80 19 00 44 */ lwz r0, 0x44(r25)
-/* 800F58DC 000F281C 2C 00 FF FF */ cmpwi r0, -1
-/* 800F58E0 000F2820 41 82 00 10 */ beq .L_800F58F0
-/* 800F58E4 000F2824 4B FF 93 7D */ bl OSRestoreInterrupts
-/* 800F58E8 000F2828 38 60 00 00 */ li r3, 0
-/* 800F58EC 000F282C 48 00 01 B0 */ b .L_800F5A9C
-.L_800F58F0:
-/* 800F58F0 000F2830 3C C0 CC 00 */ lis r6, 0xCC006438@ha
-/* 800F58F4 000F2834 57 40 18 38 */ slwi r0, r26, 3
-/* 800F58F8 000F2838 80 E6 64 38 */ lwz r7, 0xCC006438@l(r6)
-/* 800F58FC 000F283C 3C 80 0F 00 */ lis r4, 0xf00
-/* 800F5900 000F2840 7C 80 06 30 */ sraw r0, r4, r0
-/* 800F5904 000F2844 7C E7 00 38 */ and r7, r7, r0
-/* 800F5908 000F2848 90 E6 64 38 */ stw r7, 0x6438(r6)
-/* 800F590C 000F284C 38 1C 00 03 */ addi r0, r28, 3
-/* 800F5910 000F2850 54 04 F0 BE */ srwi r4, r0, 2
-/* 800F5914 000F2854 93 59 00 44 */ stw r26, 0x44(r25)
-/* 800F5918 000F2858 28 04 00 00 */ cmplwi r4, 0
-/* 800F591C 000F285C 38 A0 00 00 */ li r5, 0
-/* 800F5920 000F2860 93 F9 00 54 */ stw r31, 0x54(r25)
-/* 800F5924 000F2864 93 D9 00 4C */ stw r30, 0x4c(r25)
-/* 800F5928 000F2868 93 B9 00 50 */ stw r29, 0x50(r25)
-/* 800F592C 000F286C 40 81 00 A4 */ ble .L_800F59D0
-/* 800F5930 000F2870 28 04 00 08 */ cmplwi r4, 8
-/* 800F5934 000F2874 38 E4 FF F8 */ addi r7, r4, -8
-/* 800F5938 000F2878 40 81 01 4C */ ble .L_800F5A84
-/* 800F593C 000F287C 38 07 00 07 */ addi r0, r7, 7
-/* 800F5940 000F2880 54 00 E8 FE */ srwi r0, r0, 3
-/* 800F5944 000F2884 28 07 00 00 */ cmplwi r7, 0
-/* 800F5948 000F2888 7C 09 03 A6 */ mtctr r0
-/* 800F594C 000F288C 38 FB 00 00 */ addi r7, r27, 0
-/* 800F5950 000F2890 38 C6 64 00 */ addi r6, r6, 0x6400
-/* 800F5954 000F2894 40 81 01 30 */ ble .L_800F5A84
-.L_800F5958:
-/* 800F5958 000F2898 80 07 00 00 */ lwz r0, 0(r7)
-/* 800F595C 000F289C 38 A5 00 08 */ addi r5, r5, 8
-/* 800F5960 000F28A0 90 06 00 80 */ stw r0, 0x80(r6)
-/* 800F5964 000F28A4 80 07 00 04 */ lwz r0, 4(r7)
-/* 800F5968 000F28A8 90 06 00 84 */ stw r0, 0x84(r6)
-/* 800F596C 000F28AC 80 07 00 08 */ lwz r0, 8(r7)
-/* 800F5970 000F28B0 90 06 00 88 */ stw r0, 0x88(r6)
-/* 800F5974 000F28B4 80 07 00 0C */ lwz r0, 0xc(r7)
-/* 800F5978 000F28B8 90 06 00 8C */ stw r0, 0x8c(r6)
-/* 800F597C 000F28BC 80 07 00 10 */ lwz r0, 0x10(r7)
-/* 800F5980 000F28C0 90 06 00 90 */ stw r0, 0x90(r6)
-/* 800F5984 000F28C4 80 07 00 14 */ lwz r0, 0x14(r7)
-/* 800F5988 000F28C8 90 06 00 94 */ stw r0, 0x94(r6)
-/* 800F598C 000F28CC 80 07 00 18 */ lwz r0, 0x18(r7)
-/* 800F5990 000F28D0 90 06 00 98 */ stw r0, 0x98(r6)
-/* 800F5994 000F28D4 80 07 00 1C */ lwz r0, 0x1c(r7)
-/* 800F5998 000F28D8 38 E7 00 20 */ addi r7, r7, 0x20
-/* 800F599C 000F28DC 90 06 00 9C */ stw r0, 0x9c(r6)
-/* 800F59A0 000F28E0 38 C6 00 20 */ addi r6, r6, 0x20
-/* 800F59A4 000F28E4 42 00 FF B4 */ bdnz .L_800F5958
-/* 800F59A8 000F28E8 48 00 00 DC */ b .L_800F5A84
-.L_800F59AC:
-/* 800F59AC 000F28EC 7C 05 20 50 */ subf r0, r5, r4
-/* 800F59B0 000F28F0 7C 05 20 40 */ cmplw r5, r4
-/* 800F59B4 000F28F4 7C 09 03 A6 */ mtctr r0
-/* 800F59B8 000F28F8 40 80 00 18 */ bge .L_800F59D0
-.L_800F59BC:
-/* 800F59BC 000F28FC 80 06 00 00 */ lwz r0, 0(r6)
-/* 800F59C0 000F2900 38 C6 00 04 */ addi r6, r6, 4
-/* 800F59C4 000F2904 90 07 00 80 */ stw r0, 0x80(r7)
-/* 800F59C8 000F2908 38 E7 00 04 */ addi r7, r7, 4
-/* 800F59CC 000F290C 42 00 FF F0 */ bdnz .L_800F59BC
-.L_800F59D0:
-/* 800F59D0 000F2910 3C 80 CC 00 */ lis r4, 0xCC006400@ha
-/* 800F59D4 000F2914 38 C4 64 00 */ addi r6, r4, 0xCC006400@l
-/* 800F59D8 000F2918 84 06 00 34 */ lwzu r0, 0x34(r6)
-/* 800F59DC 000F291C 38 80 00 01 */ li r4, 1
-/* 800F59E0 000F2920 90 01 00 24 */ stw r0, 0x24(r1)
-/* 800F59E4 000F2924 28 1F 00 00 */ cmplwi r31, 0
-/* 800F59E8 000F2928 88 01 00 24 */ lbz r0, 0x24(r1)
-/* 800F59EC 000F292C 50 80 3E 30 */ rlwimi r0, r4, 7, 0x18, 0x18
-/* 800F59F0 000F2930 98 01 00 24 */ stb r0, 0x24(r1)
-/* 800F59F4 000F2934 41 82 00 08 */ beq .L_800F59FC
-/* 800F59F8 000F2938 48 00 00 08 */ b .L_800F5A00
-.L_800F59FC:
-/* 800F59FC 000F293C 38 80 00 00 */ li r4, 0
-.L_800F5A00:
-/* 800F5A00 000F2940 88 01 00 24 */ lbz r0, 0x24(r1)
-/* 800F5A04 000F2944 50 80 36 72 */ rlwimi r0, r4, 6, 0x19, 0x19
-/* 800F5A08 000F2948 28 1C 00 80 */ cmplwi r28, 0x80
-/* 800F5A0C 000F294C 98 01 00 24 */ stb r0, 0x24(r1)
-/* 800F5A10 000F2950 40 82 00 0C */ bne .L_800F5A1C
-/* 800F5A14 000F2954 38 00 00 00 */ li r0, 0
-/* 800F5A18 000F2958 48 00 00 08 */ b .L_800F5A20
-.L_800F5A1C:
-/* 800F5A1C 000F295C 7F 80 E3 78 */ mr r0, r28
-.L_800F5A20:
-/* 800F5A20 000F2960 54 04 06 3E */ clrlwi r4, r0, 0x18
-/* 800F5A24 000F2964 88 01 00 25 */ lbz r0, 0x25(r1)
-/* 800F5A28 000F2968 50 80 06 7E */ rlwimi r0, r4, 0, 0x19, 0x1f
-/* 800F5A2C 000F296C 28 1E 00 80 */ cmplwi r30, 0x80
-/* 800F5A30 000F2970 98 01 00 25 */ stb r0, 0x25(r1)
-/* 800F5A34 000F2974 40 82 00 0C */ bne .L_800F5A40
-/* 800F5A38 000F2978 38 00 00 00 */ li r0, 0
-/* 800F5A3C 000F297C 48 00 00 08 */ b .L_800F5A44
-.L_800F5A40:
-/* 800F5A40 000F2980 7F C0 F3 78 */ mr r0, r30
-.L_800F5A44:
-/* 800F5A44 000F2984 54 04 06 3E */ clrlwi r4, r0, 0x18
-/* 800F5A48 000F2988 88 01 00 26 */ lbz r0, 0x26(r1)
-/* 800F5A4C 000F298C 50 80 06 7E */ rlwimi r0, r4, 0, 0x19, 0x1f
-/* 800F5A50 000F2990 98 01 00 26 */ stb r0, 0x26(r1)
-/* 800F5A54 000F2994 38 80 00 01 */ li r4, 1
-/* 800F5A58 000F2998 88 01 00 27 */ lbz r0, 0x27(r1)
-/* 800F5A5C 000F299C 53 40 0F 7C */ rlwimi r0, r26, 1, 0x1d, 0x1e
-/* 800F5A60 000F29A0 98 01 00 27 */ stb r0, 0x27(r1)
-/* 800F5A64 000F29A4 88 01 00 27 */ lbz r0, 0x27(r1)
-/* 800F5A68 000F29A8 50 80 07 FE */ rlwimi r0, r4, 0, 0x1f, 0x1f
-/* 800F5A6C 000F29AC 98 01 00 27 */ stb r0, 0x27(r1)
-/* 800F5A70 000F29B0 80 01 00 24 */ lwz r0, 0x24(r1)
-/* 800F5A74 000F29B4 90 06 00 00 */ stw r0, 0(r6)
-/* 800F5A78 000F29B8 4B FF 91 E9 */ bl OSRestoreInterrupts
-/* 800F5A7C 000F29BC 38 60 00 01 */ li r3, 1
-/* 800F5A80 000F29C0 48 00 00 1C */ b .L_800F5A9C
-.L_800F5A84:
-/* 800F5A84 000F29C4 3C C0 CC 00 */ lis r6, 0xCC006400@ha
-/* 800F5A88 000F29C8 54 A0 10 3A */ slwi r0, r5, 2
-/* 800F5A8C 000F29CC 38 E6 64 00 */ addi r7, r6, 0xCC006400@l
-/* 800F5A90 000F29D0 7C DB 02 14 */ add r6, r27, r0
-/* 800F5A94 000F29D4 7C E7 02 14 */ add r7, r7, r0
-/* 800F5A98 000F29D8 4B FF FF 14 */ b .L_800F59AC
-.L_800F5A9C:
-/* 800F5A9C 000F29DC BB 21 00 2C */ lmw r25, 0x2c(r1)
-/* 800F5AA0 000F29E0 80 01 00 4C */ lwz r0, 0x4c(r1)
-/* 800F5AA4 000F29E4 38 21 00 48 */ addi r1, r1, 0x48
-/* 800F5AA8 000F29E8 7C 08 03 A6 */ mtlr r0
-/* 800F5AAC 000F29EC 4E 80 00 20 */ blr
-.endfn __SITransfer
-
-.fn SIGetStatus, global
-/* 800F5AB0 000F29F0 7C 08 02 A6 */ mflr r0
-/* 800F5AB4 000F29F4 90 01 00 04 */ stw r0, 4(r1)
-/* 800F5AB8 000F29F8 94 21 FF E8 */ stwu r1, -0x18(r1)
-/* 800F5ABC 000F29FC 93 E1 00 14 */ stw r31, 0x14(r1)
-/* 800F5AC0 000F2A00 93 C1 00 10 */ stw r30, 0x10(r1)
-/* 800F5AC4 000F2A04 7C 7E 1B 78 */ mr r30, r3
-/* 800F5AC8 000F2A08 4B FF 91 71 */ bl OSDisableInterrupts
-/* 800F5ACC 000F2A0C 3C 80 CC 00 */ lis r4, 0xCC006438@ha
-/* 800F5AD0 000F2A10 20 1E 00 03 */ subfic r0, r30, 3
-/* 800F5AD4 000F2A14 83 E4 64 38 */ lwz r31, 0xCC006438@l(r4)
-/* 800F5AD8 000F2A18 54 00 18 38 */ slwi r0, r0, 3
-/* 800F5ADC 000F2A1C 7F FF 04 30 */ srw r31, r31, r0
-/* 800F5AE0 000F2A20 57 E0 07 39 */ rlwinm. r0, r31, 0, 0x1c, 0x1c
-/* 800F5AE4 000F2A24 41 82 00 28 */ beq .L_800F5B0C
-/* 800F5AE8 000F2A28 3C 80 80 4B */ lis r4, Type@ha
-/* 800F5AEC 000F2A2C 57 C5 10 3A */ slwi r5, r30, 2
-/* 800F5AF0 000F2A30 38 04 9F 10 */ addi r0, r4, Type@l
-/* 800F5AF4 000F2A34 7C 80 2A 14 */ add r4, r0, r5
-/* 800F5AF8 000F2A38 80 04 00 00 */ lwz r0, 0(r4)
-/* 800F5AFC 000F2A3C 54 00 06 31 */ rlwinm. r0, r0, 0, 0x18, 0x18
-/* 800F5B00 000F2A40 40 82 00 0C */ bne .L_800F5B0C
-/* 800F5B04 000F2A44 38 00 00 08 */ li r0, 8
-/* 800F5B08 000F2A48 90 04 00 00 */ stw r0, 0(r4)
-.L_800F5B0C:
-/* 800F5B0C 000F2A4C 4B FF 91 55 */ bl OSRestoreInterrupts
-/* 800F5B10 000F2A50 7F E3 FB 78 */ mr r3, r31
-/* 800F5B14 000F2A54 80 01 00 1C */ lwz r0, 0x1c(r1)
-/* 800F5B18 000F2A58 83 E1 00 14 */ lwz r31, 0x14(r1)
-/* 800F5B1C 000F2A5C 83 C1 00 10 */ lwz r30, 0x10(r1)
-/* 800F5B20 000F2A60 38 21 00 18 */ addi r1, r1, 0x18
-/* 800F5B24 000F2A64 7C 08 03 A6 */ mtlr r0
-/* 800F5B28 000F2A68 4E 80 00 20 */ blr
-.endfn SIGetStatus
-
-.fn SISetCommand, global
-/* 800F5B2C 000F2A6C 1C 03 00 0C */ mulli r0, r3, 0xc
-/* 800F5B30 000F2A70 3C 60 CC 00 */ lis r3, 0xCC006400@ha
-/* 800F5B34 000F2A74 38 63 64 00 */ addi r3, r3, 0xCC006400@l
-/* 800F5B38 000F2A78 7C 83 01 2E */ stwx r4, r3, r0
-/* 800F5B3C 000F2A7C 4E 80 00 20 */ blr
-.endfn SISetCommand
-
-.fn SITransferCommands, global
-/* 800F5B40 000F2A80 3C 60 CC 00 */ lis r3, 0xCC006438@ha
-/* 800F5B44 000F2A84 3C 00 80 00 */ lis r0, 0x8000
-/* 800F5B48 000F2A88 90 03 64 38 */ stw r0, 0xCC006438@l(r3)
-/* 800F5B4C 000F2A8C 4E 80 00 20 */ blr
-.endfn SITransferCommands
-
-.fn SISetXY, global
-/* 800F5B50 000F2A90 7C 08 02 A6 */ mflr r0
-/* 800F5B54 000F2A94 90 01 00 04 */ stw r0, 4(r1)
-/* 800F5B58 000F2A98 54 80 40 2E */ slwi r0, r4, 8
-/* 800F5B5C 000F2A9C 94 21 FF E8 */ stwu r1, -0x18(r1)
-/* 800F5B60 000F2AA0 93 E1 00 14 */ stw r31, 0x14(r1)
-/* 800F5B64 000F2AA4 54 7F 80 1E */ slwi r31, r3, 0x10
-/* 800F5B68 000F2AA8 7F FF 03 78 */ or r31, r31, r0
-/* 800F5B6C 000F2AAC 4B FF 90 CD */ bl OSDisableInterrupts
-/* 800F5B70 000F2AB0 3C 80 80 4B */ lis r4, Si@ha
-/* 800F5B74 000F2AB4 38 84 9E FC */ addi r4, r4, Si@l
-/* 800F5B78 000F2AB8 80 04 00 04 */ lwz r0, 4(r4)
-/* 800F5B7C 000F2ABC 38 A4 00 04 */ addi r5, r4, 4
-/* 800F5B80 000F2AC0 3C 80 CC 00 */ lis r4, 0xCC006430@ha
-/* 800F5B84 000F2AC4 54 00 06 0A */ rlwinm r0, r0, 0, 0x18, 5
-/* 800F5B88 000F2AC8 90 05 00 00 */ stw r0, 0(r5)
-/* 800F5B8C 000F2ACC 80 05 00 00 */ lwz r0, 0(r5)
-/* 800F5B90 000F2AD0 7C 00 FB 78 */ or r0, r0, r31
-/* 800F5B94 000F2AD4 90 05 00 00 */ stw r0, 0(r5)
-/* 800F5B98 000F2AD8 83 E5 00 00 */ lwz r31, 0(r5)
-/* 800F5B9C 000F2ADC 93 E4 64 30 */ stw r31, 0xCC006430@l(r4)
-/* 800F5BA0 000F2AE0 4B FF 90 C1 */ bl OSRestoreInterrupts
-/* 800F5BA4 000F2AE4 7F E3 FB 78 */ mr r3, r31
-/* 800F5BA8 000F2AE8 80 01 00 1C */ lwz r0, 0x1c(r1)
-/* 800F5BAC 000F2AEC 83 E1 00 14 */ lwz r31, 0x14(r1)
-/* 800F5BB0 000F2AF0 38 21 00 18 */ addi r1, r1, 0x18
-/* 800F5BB4 000F2AF4 7C 08 03 A6 */ mtlr r0
-/* 800F5BB8 000F2AF8 4E 80 00 20 */ blr
-.endfn SISetXY
-
-.fn SIEnablePolling, global
-/* 800F5BBC 000F2AFC 7C 08 02 A6 */ mflr r0
-/* 800F5BC0 000F2B00 90 01 00 04 */ stw r0, 4(r1)
-/* 800F5BC4 000F2B04 94 21 FF E8 */ stwu r1, -0x18(r1)
-/* 800F5BC8 000F2B08 93 E1 00 14 */ stw r31, 0x14(r1)
-/* 800F5BCC 000F2B0C 7C 7F 1B 79 */ or. r31, r3, r3
-/* 800F5BD0 000F2B10 40 82 00 14 */ bne .L_800F5BE4
-/* 800F5BD4 000F2B14 3C 60 80 4B */ lis r3, Si@ha
-/* 800F5BD8 000F2B18 38 63 9E FC */ addi r3, r3, Si@l
-/* 800F5BDC 000F2B1C 80 63 00 04 */ lwz r3, 4(r3)
-/* 800F5BE0 000F2B20 48 00 00 64 */ b .L_800F5C44
-.L_800F5BE4:
-/* 800F5BE4 000F2B24 4B FF 90 55 */ bl OSDisableInterrupts
-/* 800F5BE8 000F2B28 3C 80 80 4B */ lis r4, Si@ha
-/* 800F5BEC 000F2B2C 38 84 9E FC */ addi r4, r4, Si@l
-/* 800F5BF0 000F2B30 57 FF 46 3E */ srwi r31, r31, 0x18
-/* 800F5BF4 000F2B34 80 04 00 04 */ lwz r0, 4(r4)
-/* 800F5BF8 000F2B38 38 A4 00 04 */ addi r5, r4, 4
-/* 800F5BFC 000F2B3C 57 E4 E7 3E */ rlwinm r4, r31, 0x1c, 0x1c, 0x1f
-/* 800F5C00 000F2B40 7C 00 20 78 */ andc r0, r0, r4
-/* 800F5C04 000F2B44 90 05 00 00 */ stw r0, 0(r5)
-/* 800F5C08 000F2B48 64 80 03 FF */ oris r0, r4, 0x3ff
-/* 800F5C0C 000F2B4C 60 00 FF F0 */ ori r0, r0, 0xfff0
-/* 800F5C10 000F2B50 7F FF 00 38 */ and r31, r31, r0
-/* 800F5C14 000F2B54 80 05 00 00 */ lwz r0, 0(r5)
-/* 800F5C18 000F2B58 57 FF 06 0A */ rlwinm r31, r31, 0, 0x18, 5
-/* 800F5C1C 000F2B5C 7C 00 FB 78 */ or r0, r0, r31
-/* 800F5C20 000F2B60 90 05 00 00 */ stw r0, 0(r5)
-/* 800F5C24 000F2B64 3C 80 CC 00 */ lis r4, 0xCC006400@ha
-/* 800F5C28 000F2B68 38 84 64 00 */ addi r4, r4, 0xCC006400@l
-/* 800F5C2C 000F2B6C 83 E5 00 00 */ lwz r31, 0(r5)
-/* 800F5C30 000F2B70 3C 00 80 00 */ lis r0, 0x8000
-/* 800F5C34 000F2B74 90 04 00 38 */ stw r0, 0x38(r4)
-/* 800F5C38 000F2B78 93 E4 00 30 */ stw r31, 0x30(r4)
-/* 800F5C3C 000F2B7C 4B FF 90 25 */ bl OSRestoreInterrupts
-/* 800F5C40 000F2B80 7F E3 FB 78 */ mr r3, r31
-.L_800F5C44:
-/* 800F5C44 000F2B84 80 01 00 1C */ lwz r0, 0x1c(r1)
-/* 800F5C48 000F2B88 83 E1 00 14 */ lwz r31, 0x14(r1)
-/* 800F5C4C 000F2B8C 38 21 00 18 */ addi r1, r1, 0x18
-/* 800F5C50 000F2B90 7C 08 03 A6 */ mtlr r0
-/* 800F5C54 000F2B94 4E 80 00 20 */ blr
-.endfn SIEnablePolling
-
-.fn SIDisablePolling, global
-/* 800F5C58 000F2B98 7C 08 02 A6 */ mflr r0
-/* 800F5C5C 000F2B9C 90 01 00 04 */ stw r0, 4(r1)
-/* 800F5C60 000F2BA0 94 21 FF E8 */ stwu r1, -0x18(r1)
-/* 800F5C64 000F2BA4 93 E1 00 14 */ stw r31, 0x14(r1)
-/* 800F5C68 000F2BA8 7C 7F 1B 79 */ or. r31, r3, r3
-/* 800F5C6C 000F2BAC 40 82 00 14 */ bne .L_800F5C80
-/* 800F5C70 000F2BB0 3C 60 80 4B */ lis r3, Si@ha
-/* 800F5C74 000F2BB4 38 63 9E FC */ addi r3, r3, Si@l
-/* 800F5C78 000F2BB8 80 63 00 04 */ lwz r3, 4(r3)
-/* 800F5C7C 000F2BBC 48 00 00 34 */ b .L_800F5CB0
-.L_800F5C80:
-/* 800F5C80 000F2BC0 4B FF 8F B9 */ bl OSDisableInterrupts
-/* 800F5C84 000F2BC4 3C 80 80 4B */ lis r4, Si@ha
-/* 800F5C88 000F2BC8 38 84 9E FC */ addi r4, r4, Si@l
-/* 800F5C8C 000F2BCC 80 04 00 04 */ lwz r0, 4(r4)
-/* 800F5C90 000F2BD0 57 FF 46 36 */ rlwinm r31, r31, 8, 0x18, 0x1b
-/* 800F5C94 000F2BD4 38 A4 00 04 */ addi r5, r4, 4
-/* 800F5C98 000F2BD8 3C 80 CC 00 */ lis r4, 0xCC006430@ha
-/* 800F5C9C 000F2BDC 7C 1F F8 78 */ andc r31, r0, r31
-/* 800F5CA0 000F2BE0 93 E4 64 30 */ stw r31, 0xCC006430@l(r4)
-/* 800F5CA4 000F2BE4 93 E5 00 00 */ stw r31, 0(r5)
-/* 800F5CA8 000F2BE8 4B FF 8F B9 */ bl OSRestoreInterrupts
-/* 800F5CAC 000F2BEC 7F E3 FB 78 */ mr r3, r31
-.L_800F5CB0:
-/* 800F5CB0 000F2BF0 80 01 00 1C */ lwz r0, 0x1c(r1)
-/* 800F5CB4 000F2BF4 83 E1 00 14 */ lwz r31, 0x14(r1)
-/* 800F5CB8 000F2BF8 38 21 00 18 */ addi r1, r1, 0x18
-/* 800F5CBC 000F2BFC 7C 08 03 A6 */ mtlr r0
-/* 800F5CC0 000F2C00 4E 80 00 20 */ blr
-.endfn SIDisablePolling
-
-.fn SIGetResponseRaw, local
-/* 800F5CC4 000F2C04 7C 08 02 A6 */ mflr r0
-/* 800F5CC8 000F2C08 3C 80 80 4F */ lis r4, Packet@ha
-/* 800F5CCC 000F2C0C 90 01 00 04 */ stw r0, 4(r1)
-/* 800F5CD0 000F2C10 94 21 FF D8 */ stwu r1, -0x28(r1)
-/* 800F5CD4 000F2C14 93 E1 00 24 */ stw r31, 0x24(r1)
-/* 800F5CD8 000F2C18 3B E4 71 80 */ addi r31, r4, Packet@l
-/* 800F5CDC 000F2C1C 93 C1 00 20 */ stw r30, 0x20(r1)
-/* 800F5CE0 000F2C20 3B C3 00 00 */ addi r30, r3, 0
-/* 800F5CE4 000F2C24 93 A1 00 1C */ stw r29, 0x1c(r1)
-/* 800F5CE8 000F2C28 4B FF 8F 51 */ bl OSDisableInterrupts
-/* 800F5CEC 000F2C2C 3C 80 CC 00 */ lis r4, 0xCC006438@ha
-/* 800F5CF0 000F2C30 20 1E 00 03 */ subfic r0, r30, 3
-/* 800F5CF4 000F2C34 83 A4 64 38 */ lwz r29, 0xCC006438@l(r4)
-/* 800F5CF8 000F2C38 54 00 18 38 */ slwi r0, r0, 3
-/* 800F5CFC 000F2C3C 7F BD 04 30 */ srw r29, r29, r0
-/* 800F5D00 000F2C40 57 A0 07 39 */ rlwinm. r0, r29, 0, 0x1c, 0x1c
-/* 800F5D04 000F2C44 41 82 00 28 */ beq .L_800F5D2C
-/* 800F5D08 000F2C48 3C 80 80 4B */ lis r4, Type@ha
-/* 800F5D0C 000F2C4C 57 C5 10 3A */ slwi r5, r30, 2
-/* 800F5D10 000F2C50 38 04 9F 10 */ addi r0, r4, Type@l
-/* 800F5D14 000F2C54 7C 80 2A 14 */ add r4, r0, r5
-/* 800F5D18 000F2C58 80 04 00 00 */ lwz r0, 0(r4)
-/* 800F5D1C 000F2C5C 54 00 06 31 */ rlwinm. r0, r0, 0, 0x18, 0x18
-/* 800F5D20 000F2C60 40 82 00 0C */ bne .L_800F5D2C
-/* 800F5D24 000F2C64 38 00 00 08 */ li r0, 8
-/* 800F5D28 000F2C68 90 04 00 00 */ stw r0, 0(r4)
-.L_800F5D2C:
-/* 800F5D2C 000F2C6C 4B FF 8F 35 */ bl OSRestoreInterrupts
-/* 800F5D30 000F2C70 57 A0 06 B5 */ rlwinm. r0, r29, 0, 0x1a, 0x1a
-/* 800F5D34 000F2C74 41 82 00 44 */ beq .L_800F5D78
-/* 800F5D38 000F2C78 1C 9E 00 0C */ mulli r4, r30, 0xc
-/* 800F5D3C 000F2C7C 3C 60 CC 00 */ lis r3, 0xCC006400@ha
-/* 800F5D40 000F2C80 38 03 64 00 */ addi r0, r3, 0xCC006400@l
-/* 800F5D44 000F2C84 7C 60 22 14 */ add r3, r0, r4
-/* 800F5D48 000F2C88 57 C4 18 38 */ slwi r4, r30, 3
-/* 800F5D4C 000F2C8C 80 03 00 04 */ lwz r0, 4(r3)
-/* 800F5D50 000F2C90 7C DF 22 14 */ add r6, r31, r4
-/* 800F5D54 000F2C94 90 06 01 C0 */ stw r0, 0x1c0(r6)
-/* 800F5D58 000F2C98 57 C0 10 3A */ slwi r0, r30, 2
-/* 800F5D5C 000F2C9C 7C 9F 02 14 */ add r4, r31, r0
-/* 800F5D60 000F2CA0 80 A3 00 08 */ lwz r5, 8(r3)
-/* 800F5D64 000F2CA4 38 00 00 01 */ li r0, 1
-/* 800F5D68 000F2CA8 38 60 00 01 */ li r3, 1
-/* 800F5D6C 000F2CAC 90 A6 01 C4 */ stw r5, 0x1c4(r6)
-/* 800F5D70 000F2CB0 90 04 01 B0 */ stw r0, 0x1b0(r4)
-/* 800F5D74 000F2CB4 48 00 00 08 */ b .L_800F5D7C
-.L_800F5D78:
-/* 800F5D78 000F2CB8 38 60 00 00 */ li r3, 0
-.L_800F5D7C:
-/* 800F5D7C 000F2CBC 80 01 00 2C */ lwz r0, 0x2c(r1)
-/* 800F5D80 000F2CC0 83 E1 00 24 */ lwz r31, 0x24(r1)
-/* 800F5D84 000F2CC4 83 C1 00 20 */ lwz r30, 0x20(r1)
-/* 800F5D88 000F2CC8 83 A1 00 1C */ lwz r29, 0x1c(r1)
-/* 800F5D8C 000F2CCC 38 21 00 28 */ addi r1, r1, 0x28
-/* 800F5D90 000F2CD0 7C 08 03 A6 */ mtlr r0
-/* 800F5D94 000F2CD4 4E 80 00 20 */ blr
-.endfn SIGetResponseRaw
-
-.fn SIGetResponse, global
-/* 800F5D98 000F2CD8 7C 08 02 A6 */ mflr r0
-/* 800F5D9C 000F2CDC 3C A0 80 4F */ lis r5, Packet@ha
-/* 800F5DA0 000F2CE0 90 01 00 04 */ stw r0, 4(r1)
-/* 800F5DA4 000F2CE4 94 21 FF D8 */ stwu r1, -0x28(r1)
-/* 800F5DA8 000F2CE8 BF 61 00 14 */ stmw r27, 0x14(r1)
-/* 800F5DAC 000F2CEC 3B A3 00 00 */ addi r29, r3, 0
-/* 800F5DB0 000F2CF0 3B C4 00 00 */ addi r30, r4, 0
-/* 800F5DB4 000F2CF4 3B 85 71 80 */ addi r28, r5, Packet@l
-/* 800F5DB8 000F2CF8 4B FF 8E 81 */ bl OSDisableInterrupts
-/* 800F5DBC 000F2CFC 3B E3 00 00 */ addi r31, r3, 0
-/* 800F5DC0 000F2D00 38 7D 00 00 */ addi r3, r29, 0
-/* 800F5DC4 000F2D04 4B FF FC ED */ bl SIGetStatus
-/* 800F5DC8 000F2D08 54 60 06 B5 */ rlwinm. r0, r3, 0, 0x1a, 0x1a
-/* 800F5DCC 000F2D0C 41 82 00 3C */ beq .L_800F5E08
-/* 800F5DD0 000F2D10 1C 9D 00 0C */ mulli r4, r29, 0xc
-/* 800F5DD4 000F2D14 3C 60 CC 00 */ lis r3, 0xCC006400@ha
-/* 800F5DD8 000F2D18 38 03 64 00 */ addi r0, r3, 0xCC006400@l
-/* 800F5DDC 000F2D1C 7C 80 22 14 */ add r4, r0, r4
-/* 800F5DE0 000F2D20 57 A3 18 38 */ slwi r3, r29, 3
-/* 800F5DE4 000F2D24 80 04 00 04 */ lwz r0, 4(r4)
-/* 800F5DE8 000F2D28 7C BC 1A 14 */ add r5, r28, r3
-/* 800F5DEC 000F2D2C 90 05 01 C0 */ stw r0, 0x1c0(r5)
-/* 800F5DF0 000F2D30 57 A0 10 3A */ slwi r0, r29, 2
-/* 800F5DF4 000F2D34 7C 7C 02 14 */ add r3, r28, r0
-/* 800F5DF8 000F2D38 80 84 00 08 */ lwz r4, 8(r4)
-/* 800F5DFC 000F2D3C 38 00 00 01 */ li r0, 1
-/* 800F5E00 000F2D40 90 85 01 C4 */ stw r4, 0x1c4(r5)
-/* 800F5E04 000F2D44 90 03 01 B0 */ stw r0, 0x1b0(r3)
-.L_800F5E08:
-/* 800F5E08 000F2D48 57 A0 10 3A */ slwi r0, r29, 2
-/* 800F5E0C 000F2D4C 7C 7C 02 14 */ add r3, r28, r0
-/* 800F5E10 000F2D50 83 63 01 B0 */ lwz r27, 0x1b0(r3)
-/* 800F5E14 000F2D54 38 00 00 00 */ li r0, 0
-/* 800F5E18 000F2D58 2C 1B 00 00 */ cmpwi r27, 0
-/* 800F5E1C 000F2D5C 90 03 01 B0 */ stw r0, 0x1b0(r3)
-/* 800F5E20 000F2D60 41 82 00 1C */ beq .L_800F5E3C
-/* 800F5E24 000F2D64 57 A0 18 38 */ slwi r0, r29, 3
-/* 800F5E28 000F2D68 7C 7C 02 14 */ add r3, r28, r0
-/* 800F5E2C 000F2D6C 80 03 01 C0 */ lwz r0, 0x1c0(r3)
-/* 800F5E30 000F2D70 90 1E 00 00 */ stw r0, 0(r30)
-/* 800F5E34 000F2D74 80 03 01 C4 */ lwz r0, 0x1c4(r3)
-/* 800F5E38 000F2D78 90 1E 00 04 */ stw r0, 4(r30)
-.L_800F5E3C:
-/* 800F5E3C 000F2D7C 7F E3 FB 78 */ mr r3, r31
-/* 800F5E40 000F2D80 4B FF 8E 21 */ bl OSRestoreInterrupts
-/* 800F5E44 000F2D84 7F 63 DB 78 */ mr r3, r27
-/* 800F5E48 000F2D88 BB 61 00 14 */ lmw r27, 0x14(r1)
-/* 800F5E4C 000F2D8C 80 01 00 2C */ lwz r0, 0x2c(r1)
-/* 800F5E50 000F2D90 38 21 00 28 */ addi r1, r1, 0x28
-/* 800F5E54 000F2D94 7C 08 03 A6 */ mtlr r0
-/* 800F5E58 000F2D98 4E 80 00 20 */ blr
-.endfn SIGetResponse
-
-.fn AlarmHandler, local
-/* 800F5E5C 000F2D9C 7C 08 02 A6 */ mflr r0
-/* 800F5E60 000F2DA0 3C 80 80 4F */ lis r4, Alarm@ha
-/* 800F5E64 000F2DA4 90 01 00 04 */ stw r0, 4(r1)
-/* 800F5E68 000F2DA8 38 04 72 00 */ addi r0, r4, Alarm@l
-/* 800F5E6C 000F2DAC 3C 80 66 66 */ lis r4, 0x66666667@ha
-/* 800F5E70 000F2DB0 7C 00 18 50 */ subf r0, r0, r3
-/* 800F5E74 000F2DB4 94 21 FF E0 */ stwu r1, -0x20(r1)
-/* 800F5E78 000F2DB8 38 64 66 67 */ addi r3, r4, 0x66666667@l
-/* 800F5E7C 000F2DBC 7C 03 00 96 */ mulhw r0, r3, r0
-/* 800F5E80 000F2DC0 93 E1 00 1C */ stw r31, 0x1c(r1)
-/* 800F5E84 000F2DC4 7C 00 26 70 */ srawi r0, r0, 4
-/* 800F5E88 000F2DC8 54 03 0F FE */ srwi r3, r0, 0x1f
-/* 800F5E8C 000F2DCC 7C 00 1A 14 */ add r0, r0, r3
-/* 800F5E90 000F2DD0 3C 60 80 4F */ lis r3, Packet@ha
-/* 800F5E94 000F2DD4 54 04 28 34 */ slwi r4, r0, 5
-/* 800F5E98 000F2DD8 38 03 71 80 */ addi r0, r3, Packet@l
-/* 800F5E9C 000F2DDC 7F E0 22 14 */ add r31, r0, r4
-/* 800F5EA0 000F2DE0 80 7F 00 00 */ lwz r3, 0(r31)
-/* 800F5EA4 000F2DE4 2C 03 FF FF */ cmpwi r3, -1
-/* 800F5EA8 000F2DE8 41 82 00 2C */ beq .L_800F5ED4
-/* 800F5EAC 000F2DEC 80 9F 00 04 */ lwz r4, 4(r31)
-/* 800F5EB0 000F2DF0 80 BF 00 08 */ lwz r5, 8(r31)
-/* 800F5EB4 000F2DF4 80 DF 00 0C */ lwz r6, 0xc(r31)
-/* 800F5EB8 000F2DF8 80 FF 00 10 */ lwz r7, 0x10(r31)
-/* 800F5EBC 000F2DFC 81 1F 00 14 */ lwz r8, 0x14(r31)
-/* 800F5EC0 000F2E00 4B FF F9 E5 */ bl __SITransfer
-/* 800F5EC4 000F2E04 2C 03 00 00 */ cmpwi r3, 0
-/* 800F5EC8 000F2E08 41 82 00 0C */ beq .L_800F5ED4
-/* 800F5ECC 000F2E0C 38 00 FF FF */ li r0, -1
-/* 800F5ED0 000F2E10 90 1F 00 00 */ stw r0, 0(r31)
-.L_800F5ED4:
-/* 800F5ED4 000F2E14 80 01 00 24 */ lwz r0, 0x24(r1)
-/* 800F5ED8 000F2E18 83 E1 00 1C */ lwz r31, 0x1c(r1)
-/* 800F5EDC 000F2E1C 38 21 00 20 */ addi r1, r1, 0x20
-/* 800F5EE0 000F2E20 7C 08 03 A6 */ mtlr r0
-/* 800F5EE4 000F2E24 4E 80 00 20 */ blr
-.endfn AlarmHandler
-
-.fn SITransfer, global
-/* 800F5EE8 000F2E28 7C 08 02 A6 */ mflr r0
-/* 800F5EEC 000F2E2C 90 01 00 04 */ stw r0, 4(r1)
-/* 800F5EF0 000F2E30 94 21 FF A0 */ stwu r1, -0x60(r1)
-/* 800F5EF4 000F2E34 BE 61 00 2C */ stmw r19, 0x2c(r1)
-/* 800F5EF8 000F2E38 3B 03 00 00 */ addi r24, r3, 0
-/* 800F5EFC 000F2E3C 3C 60 80 4F */ lis r3, Packet@ha
-/* 800F5F00 000F2E40 3A E3 71 80 */ addi r23, r3, Packet@l
-/* 800F5F04 000F2E44 57 00 28 34 */ slwi r0, r24, 5
-/* 800F5F08 000F2E48 3B 24 00 00 */ addi r25, r4, 0
-/* 800F5F0C 000F2E4C 3B 45 00 00 */ addi r26, r5, 0
-/* 800F5F10 000F2E50 3B 66 00 00 */ addi r27, r6, 0
-/* 800F5F14 000F2E54 3B 87 00 00 */ addi r28, r7, 0
-/* 800F5F18 000F2E58 3B A8 00 00 */ addi r29, r8, 0
-/* 800F5F1C 000F2E5C 3B E9 00 00 */ addi r31, r9, 0
-/* 800F5F20 000F2E60 3B CA 00 00 */ addi r30, r10, 0
-/* 800F5F24 000F2E64 7E D7 02 14 */ add r22, r23, r0
-/* 800F5F28 000F2E68 4B FF 8D 11 */ bl OSDisableInterrupts
-/* 800F5F2C 000F2E6C 80 16 00 00 */ lwz r0, 0(r22)
-/* 800F5F30 000F2E70 3A A3 00 00 */ addi r21, r3, 0
-/* 800F5F34 000F2E74 2C 00 FF FF */ cmpwi r0, -1
-/* 800F5F38 000F2E78 40 82 00 14 */ bne .L_800F5F4C
-/* 800F5F3C 000F2E7C 3C 60 80 4B */ lis r3, Si@ha
-/* 800F5F40 000F2E80 80 03 9E FC */ lwz r0, Si@l(r3)
-/* 800F5F44 000F2E84 7C 00 C0 00 */ cmpw r0, r24
-/* 800F5F48 000F2E88 40 82 00 14 */ bne .L_800F5F5C
-.L_800F5F4C:
-/* 800F5F4C 000F2E8C 7E A3 AB 78 */ mr r3, r21
-/* 800F5F50 000F2E90 4B FF 8D 11 */ bl OSRestoreInterrupts
-/* 800F5F54 000F2E94 38 60 00 00 */ li r3, 0
-/* 800F5F58 000F2E98 48 00 00 E8 */ b .L_800F6040
-.L_800F5F5C:
-/* 800F5F5C 000F2E9C 4B FF CC 55 */ bl __OSGetSystemTime
-/* 800F5F60 000F2EA0 38 00 00 00 */ li r0, 0
-/* 800F5F64 000F2EA4 7F C5 02 78 */ xor r5, r30, r0
-/* 800F5F68 000F2EA8 7F E0 02 78 */ xor r0, r31, r0
-/* 800F5F6C 000F2EAC 7C A0 03 79 */ or. r0, r5, r0
-/* 800F5F70 000F2EB0 40 82 00 10 */ bne .L_800F5F80
-/* 800F5F74 000F2EB4 3A 64 00 00 */ addi r19, r4, 0
-/* 800F5F78 000F2EB8 3A 83 00 00 */ addi r20, r3, 0
-/* 800F5F7C 000F2EBC 48 00 00 1C */ b .L_800F5F98
-.L_800F5F80:
-/* 800F5F80 000F2EC0 57 00 18 38 */ slwi r0, r24, 3
-/* 800F5F84 000F2EC4 7C D7 02 14 */ add r6, r23, r0
-/* 800F5F88 000F2EC8 80 A6 01 44 */ lwz r5, 0x144(r6)
-/* 800F5F8C 000F2ECC 80 06 01 40 */ lwz r0, 0x140(r6)
-/* 800F5F90 000F2ED0 7E 7E 28 14 */ addc r19, r30, r5
-/* 800F5F94 000F2ED4 7E 9F 01 14 */ adde r20, r31, r0
-.L_800F5F98:
-/* 800F5F98 000F2ED8 6C 66 80 00 */ xoris r6, r3, 0x8000
-/* 800F5F9C 000F2EDC 6E 85 80 00 */ xoris r5, r20, 0x8000
-/* 800F5FA0 000F2EE0 7C 13 20 10 */ subfc r0, r19, r4
-/* 800F5FA4 000F2EE4 7C A5 31 10 */ subfe r5, r5, r6
-/* 800F5FA8 000F2EE8 7C A6 31 10 */ subfe r5, r6, r6
-/* 800F5FAC 000F2EEC 7C A5 00 D1 */ neg. r5, r5
-/* 800F5FB0 000F2EF0 41 82 00 30 */ beq .L_800F5FE0
-/* 800F5FB4 000F2EF4 1C 18 00 28 */ mulli r0, r24, 0x28
-/* 800F5FB8 000F2EF8 7F C4 98 10 */ subfc r30, r4, r19
-/* 800F5FBC 000F2EFC 7F E3 A1 10 */ subfe r31, r3, r20
-/* 800F5FC0 000F2F00 3C 80 80 0F */ lis r4, AlarmHandler@ha
-/* 800F5FC4 000F2F04 7C 77 02 14 */ add r3, r23, r0
-/* 800F5FC8 000F2F08 38 E4 5E 5C */ addi r7, r4, AlarmHandler@l
-/* 800F5FCC 000F2F0C 38 DE 00 00 */ addi r6, r30, 0
-/* 800F5FD0 000F2F10 38 BF 00 00 */ addi r5, r31, 0
-/* 800F5FD4 000F2F14 38 63 00 80 */ addi r3, r3, 0x80
-/* 800F5FD8 000F2F18 4B FF 5D 95 */ bl OSSetAlarm
-/* 800F5FDC 000F2F1C 48 00 00 38 */ b .L_800F6014
-.L_800F5FE0:
-/* 800F5FE0 000F2F20 38 78 00 00 */ addi r3, r24, 0
-/* 800F5FE4 000F2F24 38 99 00 00 */ addi r4, r25, 0
-/* 800F5FE8 000F2F28 38 BA 00 00 */ addi r5, r26, 0
-/* 800F5FEC 000F2F2C 38 DB 00 00 */ addi r6, r27, 0
-/* 800F5FF0 000F2F30 38 FC 00 00 */ addi r7, r28, 0
-/* 800F5FF4 000F2F34 39 1D 00 00 */ addi r8, r29, 0
-/* 800F5FF8 000F2F38 4B FF F8 AD */ bl __SITransfer
-/* 800F5FFC 000F2F3C 2C 03 00 00 */ cmpwi r3, 0
-/* 800F6000 000F2F40 41 82 00 14 */ beq .L_800F6014
-/* 800F6004 000F2F44 7E A3 AB 78 */ mr r3, r21
-/* 800F6008 000F2F48 4B FF 8C 59 */ bl OSRestoreInterrupts
-/* 800F600C 000F2F4C 38 60 00 01 */ li r3, 1
-/* 800F6010 000F2F50 48 00 00 30 */ b .L_800F6040
-.L_800F6014:
-/* 800F6014 000F2F54 93 16 00 00 */ stw r24, 0(r22)
-/* 800F6018 000F2F58 7E A3 AB 78 */ mr r3, r21
-/* 800F601C 000F2F5C 93 36 00 04 */ stw r25, 4(r22)
-/* 800F6020 000F2F60 93 56 00 08 */ stw r26, 8(r22)
-/* 800F6024 000F2F64 93 76 00 0C */ stw r27, 0xc(r22)
-/* 800F6028 000F2F68 93 96 00 10 */ stw r28, 0x10(r22)
-/* 800F602C 000F2F6C 93 B6 00 14 */ stw r29, 0x14(r22)
-/* 800F6030 000F2F70 92 76 00 1C */ stw r19, 0x1c(r22)
-/* 800F6034 000F2F74 92 96 00 18 */ stw r20, 0x18(r22)
-/* 800F6038 000F2F78 4B FF 8C 29 */ bl OSRestoreInterrupts
-/* 800F603C 000F2F7C 38 60 00 01 */ li r3, 1
-.L_800F6040:
-/* 800F6040 000F2F80 BA 61 00 2C */ lmw r19, 0x2c(r1)
-/* 800F6044 000F2F84 80 01 00 64 */ lwz r0, 0x64(r1)
-/* 800F6048 000F2F88 38 21 00 60 */ addi r1, r1, 0x60
-/* 800F604C 000F2F8C 7C 08 03 A6 */ mtlr r0
-/* 800F6050 000F2F90 4E 80 00 20 */ blr
-.endfn SITransfer
-
-.fn GetTypeCallback, local
-/* 800F6054 000F2F94 7C 08 02 A6 */ mflr r0
-/* 800F6058 000F2F98 90 01 00 04 */ stw r0, 4(r1)
-/* 800F605C 000F2F9C 94 21 FF D0 */ stwu r1, -0x30(r1)
-/* 800F6060 000F2FA0 BF 41 00 18 */ stmw r26, 0x18(r1)
-/* 800F6064 000F2FA4 3B 63 00 00 */ addi r27, r3, 0
-/* 800F6068 000F2FA8 3C 60 80 4B */ lis r3, Type@ha
-/* 800F606C 000F2FAC 38 03 9F 10 */ addi r0, r3, Type@l
-/* 800F6070 000F2FB0 57 7D 10 3A */ slwi r29, r27, 2
-/* 800F6074 000F2FB4 7F C0 EA 14 */ add r30, r0, r29
-/* 800F6078 000F2FB8 3C 60 80 4F */ lis r3, Packet@ha
-/* 800F607C 000F2FBC 3B 44 00 00 */ addi r26, r4, 0
-/* 800F6080 000F2FC0 3B E3 71 80 */ addi r31, r3, Packet@l
-/* 800F6084 000F2FC4 80 1E 00 00 */ lwz r0, 0(r30)
-/* 800F6088 000F2FC8 54 00 06 6E */ rlwinm r0, r0, 0, 0x19, 0x17
-/* 800F608C 000F2FCC 90 1E 00 00 */ stw r0, 0(r30)
-/* 800F6090 000F2FD0 80 1E 00 00 */ lwz r0, 0(r30)
-/* 800F6094 000F2FD4 7C 00 D3 78 */ or r0, r0, r26
-/* 800F6098 000F2FD8 90 1E 00 00 */ stw r0, 0(r30)
-/* 800F609C 000F2FDC 4B FF CB 15 */ bl __OSGetSystemTime
-/* 800F60A0 000F2FE0 57 60 18 38 */ slwi r0, r27, 3
-/* 800F60A4 000F2FE4 7C BF 02 14 */ add r5, r31, r0
-/* 800F60A8 000F2FE8 90 85 01 24 */ stw r4, 0x124(r5)
-/* 800F60AC 000F2FEC 3C 80 80 00 */ lis r4, 0x8000
-/* 800F60B0 000F2FF0 57 40 07 3F */ clrlwi. r0, r26, 0x1c
-/* 800F60B4 000F2FF4 90 65 01 20 */ stw r3, 0x120(r5)
-/* 800F60B8 000F2FF8 7C 84 DC 30 */ srw r4, r4, r27
-/* 800F60BC 000F2FFC 80 6D 90 28 */ lwz r3, __PADFixBits@sda21(r13)
-/* 800F60C0 000F3000 83 9E 00 00 */ lwz r28, 0(r30)
-/* 800F60C4 000F3004 7C 60 20 78 */ andc r0, r3, r4
-/* 800F60C8 000F3008 90 0D 90 28 */ stw r0, __PADFixBits@sda21(r13)
-/* 800F60CC 000F300C 7C 7A 20 38 */ and r26, r3, r4
-/* 800F60D0 000F3010 40 82 00 24 */ bne .L_800F60F4
-/* 800F60D4 000F3014 57 83 00 C8 */ rlwinm r3, r28, 0, 3, 4
-/* 800F60D8 000F3018 3C 03 F8 00 */ addis r0, r3, 0xf800
-/* 800F60DC 000F301C 28 00 00 00 */ cmplwi r0, 0
-/* 800F60E0 000F3020 40 82 00 14 */ bne .L_800F60F4
-/* 800F60E4 000F3024 57 80 00 01 */ rlwinm. r0, r28, 0, 0, 0
-/* 800F60E8 000F3028 41 82 00 0C */ beq .L_800F60F4
-/* 800F60EC 000F302C 57 80 01 4B */ rlwinm. r0, r28, 0, 5, 5
-/* 800F60F0 000F3030 41 82 00 5C */ beq .L_800F614C
-.L_800F60F4:
-/* 800F60F4 000F3034 38 7B 00 00 */ addi r3, r27, 0
-/* 800F60F8 000F3038 38 80 00 00 */ li r4, 0
-/* 800F60FC 000F303C 4B FF B5 05 */ bl OSSetWirelessID
-/* 800F6100 000F3040 57 60 20 36 */ slwi r0, r27, 4
-/* 800F6104 000F3044 83 DE 00 00 */ lwz r30, 0(r30)
-/* 800F6108 000F3048 7F FF 02 14 */ add r31, r31, r0
-/* 800F610C 000F304C 3B A0 00 00 */ li r29, 0
-/* 800F6110 000F3050 3B 9D 00 00 */ addi r28, r29, 0
-/* 800F6114 000F3054 3B FF 01 60 */ addi r31, r31, 0x160
-.L_800F6118:
-/* 800F6118 000F3058 81 9F 00 00 */ lwz r12, 0(r31)
-/* 800F611C 000F305C 28 0C 00 00 */ cmplwi r12, 0
-/* 800F6120 000F3060 41 82 00 18 */ beq .L_800F6138
-/* 800F6124 000F3064 93 9F 00 00 */ stw r28, 0(r31)
-/* 800F6128 000F3068 7D 88 03 A6 */ mtlr r12
-/* 800F612C 000F306C 38 7B 00 00 */ addi r3, r27, 0
-/* 800F6130 000F3070 38 9E 00 00 */ addi r4, r30, 0
-/* 800F6134 000F3074 4E 80 00 21 */ blrl
-.L_800F6138:
-/* 800F6138 000F3078 3B BD 00 01 */ addi r29, r29, 1
-/* 800F613C 000F307C 2C 1D 00 04 */ cmpwi r29, 4
-/* 800F6140 000F3080 3B FF 00 04 */ addi r31, r31, 4
-/* 800F6144 000F3084 41 80 FF D4 */ blt .L_800F6118
-/* 800F6148 000F3088 48 00 01 90 */ b .L_800F62D8
-.L_800F614C:
-/* 800F614C 000F308C 7F 63 DB 78 */ mr r3, r27
-/* 800F6150 000F3090 4B FF B4 2D */ bl OSGetWirelessID
-/* 800F6154 000F3094 2C 1A 00 00 */ cmpwi r26, 0
-/* 800F6158 000F3098 54 7A 42 2E */ rlwinm r26, r3, 8, 8, 0x17
-/* 800F615C 000F309C 41 82 00 54 */ beq .L_800F61B0
-/* 800F6160 000F30A0 57 40 02 D7 */ rlwinm. r0, r26, 0, 0xb, 0xb
-/* 800F6164 000F30A4 41 82 00 4C */ beq .L_800F61B0
-/* 800F6168 000F30A8 3C 60 00 D0 */ lis r3, 0x00CFFF00@ha
-/* 800F616C 000F30AC 38 03 FF 00 */ addi r0, r3, 0x00CFFF00@l
-/* 800F6170 000F30B0 7F 40 00 38 */ and r0, r26, r0
-/* 800F6174 000F30B4 64 00 4E 10 */ oris r0, r0, 0x4e10
-/* 800F6178 000F30B8 7C 9F EA 14 */ add r4, r31, r29
-/* 800F617C 000F30BC 94 04 01 F0 */ stwu r0, 0x1f0(r4)
-/* 800F6180 000F30C0 38 00 00 80 */ li r0, 0x80
-/* 800F6184 000F30C4 3C 60 80 0F */ lis r3, GetTypeCallback@ha
-/* 800F6188 000F30C8 90 1E 00 00 */ stw r0, 0(r30)
-/* 800F618C 000F30CC 39 03 60 54 */ addi r8, r3, GetTypeCallback@l
-/* 800F6190 000F30D0 38 7B 00 00 */ addi r3, r27, 0
-/* 800F6194 000F30D4 38 DE 00 00 */ addi r6, r30, 0
-/* 800F6198 000F30D8 38 A0 00 03 */ li r5, 3
-/* 800F619C 000F30DC 38 E0 00 03 */ li r7, 3
-/* 800F61A0 000F30E0 39 40 00 00 */ li r10, 0
-/* 800F61A4 000F30E4 39 20 00 00 */ li r9, 0
-/* 800F61A8 000F30E8 4B FF FD 41 */ bl SITransfer
-/* 800F61AC 000F30EC 48 00 01 2C */ b .L_800F62D8
-.L_800F61B0:
-/* 800F61B0 000F30F0 57 80 02 D7 */ rlwinm. r0, r28, 0, 0xb, 0xb
-/* 800F61B4 000F30F4 41 82 00 70 */ beq .L_800F6224
-/* 800F61B8 000F30F8 3C 60 00 D0 */ lis r3, 0x00CFFF00@ha
-/* 800F61BC 000F30FC 38 63 FF 00 */ addi r3, r3, 0x00CFFF00@l
-/* 800F61C0 000F3100 7F 40 18 38 */ and r0, r26, r3
-/* 800F61C4 000F3104 7F 83 18 38 */ and r3, r28, r3
-/* 800F61C8 000F3108 7C 00 18 40 */ cmplw r0, r3
-/* 800F61CC 000F310C 41 82 00 C4 */ beq .L_800F6290
-/* 800F61D0 000F3110 57 40 02 D7 */ rlwinm. r0, r26, 0, 0xb, 0xb
-/* 800F61D4 000F3114 40 82 00 14 */ bne .L_800F61E8
-/* 800F61D8 000F3118 64 7A 00 10 */ oris r26, r3, 0x10
-/* 800F61DC 000F311C 38 7B 00 00 */ addi r3, r27, 0
-/* 800F61E0 000F3120 57 44 C4 3E */ rlwinm r4, r26, 0x18, 0x10, 0x1f
-/* 800F61E4 000F3124 4B FF B4 1D */ bl OSSetWirelessID
-.L_800F61E8:
-/* 800F61E8 000F3128 67 40 4E 00 */ oris r0, r26, 0x4e00
-/* 800F61EC 000F312C 7C 9F EA 14 */ add r4, r31, r29
-/* 800F61F0 000F3130 94 04 01 F0 */ stwu r0, 0x1f0(r4)
-/* 800F61F4 000F3134 38 00 00 80 */ li r0, 0x80
-/* 800F61F8 000F3138 3C 60 80 0F */ lis r3, GetTypeCallback@ha
-/* 800F61FC 000F313C 90 1E 00 00 */ stw r0, 0(r30)
-/* 800F6200 000F3140 39 03 60 54 */ addi r8, r3, GetTypeCallback@l
-/* 800F6204 000F3144 38 7B 00 00 */ addi r3, r27, 0
-/* 800F6208 000F3148 38 DE 00 00 */ addi r6, r30, 0
-/* 800F620C 000F314C 38 A0 00 03 */ li r5, 3
-/* 800F6210 000F3150 38 E0 00 03 */ li r7, 3
-/* 800F6214 000F3154 39 40 00 00 */ li r10, 0
-/* 800F6218 000F3158 39 20 00 00 */ li r9, 0
-/* 800F621C 000F315C 4B FF FC CD */ bl SITransfer
-/* 800F6220 000F3160 48 00 00 B8 */ b .L_800F62D8
-.L_800F6224:
-/* 800F6224 000F3164 57 80 00 43 */ rlwinm. r0, r28, 0, 1, 1
-/* 800F6228 000F3168 41 82 00 5C */ beq .L_800F6284
-/* 800F622C 000F316C 3C 60 00 D0 */ lis r3, 0x00CFFF00@ha
-/* 800F6230 000F3170 38 03 FF 00 */ addi r0, r3, 0x00CFFF00@l
-/* 800F6234 000F3174 7F 9C 00 38 */ and r28, r28, r0
-/* 800F6238 000F3178 67 9C 00 10 */ oris r28, r28, 0x10
-/* 800F623C 000F317C 38 7B 00 00 */ addi r3, r27, 0
-/* 800F6240 000F3180 57 84 C4 3E */ rlwinm r4, r28, 0x18, 0x10, 0x1f
-/* 800F6244 000F3184 4B FF B3 BD */ bl OSSetWirelessID
-/* 800F6248 000F3188 67 80 4E 00 */ oris r0, r28, 0x4e00
-/* 800F624C 000F318C 7C 9F EA 14 */ add r4, r31, r29
-/* 800F6250 000F3190 94 04 01 F0 */ stwu r0, 0x1f0(r4)
-/* 800F6254 000F3194 38 00 00 80 */ li r0, 0x80
-/* 800F6258 000F3198 3C 60 80 0F */ lis r3, GetTypeCallback@ha
-/* 800F625C 000F319C 90 1E 00 00 */ stw r0, 0(r30)
-/* 800F6260 000F31A0 39 03 60 54 */ addi r8, r3, GetTypeCallback@l
-/* 800F6264 000F31A4 38 7B 00 00 */ addi r3, r27, 0
-/* 800F6268 000F31A8 38 DE 00 00 */ addi r6, r30, 0
-/* 800F626C 000F31AC 38 A0 00 03 */ li r5, 3
-/* 800F6270 000F31B0 38 E0 00 03 */ li r7, 3
-/* 800F6274 000F31B4 39 40 00 00 */ li r10, 0
-/* 800F6278 000F31B8 39 20 00 00 */ li r9, 0
-/* 800F627C 000F31BC 4B FF FC 6D */ bl SITransfer
-/* 800F6280 000F31C0 48 00 00 58 */ b .L_800F62D8
-.L_800F6284:
-/* 800F6284 000F31C4 38 7B 00 00 */ addi r3, r27, 0
-/* 800F6288 000F31C8 38 80 00 00 */ li r4, 0
-/* 800F628C 000F31CC 4B FF B3 75 */ bl OSSetWirelessID
-.L_800F6290:
-/* 800F6290 000F31D0 57 60 20 36 */ slwi r0, r27, 4
-/* 800F6294 000F31D4 83 DE 00 00 */ lwz r30, 0(r30)
-/* 800F6298 000F31D8 7F FF 02 14 */ add r31, r31, r0
-/* 800F629C 000F31DC 3B A0 00 00 */ li r29, 0
-/* 800F62A0 000F31E0 3B 9D 00 00 */ addi r28, r29, 0
-/* 800F62A4 000F31E4 3B FF 01 60 */ addi r31, r31, 0x160
-.L_800F62A8:
-/* 800F62A8 000F31E8 81 9F 00 00 */ lwz r12, 0(r31)
-/* 800F62AC 000F31EC 28 0C 00 00 */ cmplwi r12, 0
-/* 800F62B0 000F31F0 41 82 00 18 */ beq .L_800F62C8
-/* 800F62B4 000F31F4 93 9F 00 00 */ stw r28, 0(r31)
-/* 800F62B8 000F31F8 7D 88 03 A6 */ mtlr r12
-/* 800F62BC 000F31FC 38 7B 00 00 */ addi r3, r27, 0
-/* 800F62C0 000F3200 38 9E 00 00 */ addi r4, r30, 0
-/* 800F62C4 000F3204 4E 80 00 21 */ blrl
-.L_800F62C8:
-/* 800F62C8 000F3208 3B BD 00 01 */ addi r29, r29, 1
-/* 800F62CC 000F320C 2C 1D 00 04 */ cmpwi r29, 4
-/* 800F62D0 000F3210 3B FF 00 04 */ addi r31, r31, 4
-/* 800F62D4 000F3214 41 80 FF D4 */ blt .L_800F62A8
-.L_800F62D8:
-/* 800F62D8 000F3218 BB 41 00 18 */ lmw r26, 0x18(r1)
-/* 800F62DC 000F321C 80 01 00 34 */ lwz r0, 0x34(r1)
-/* 800F62E0 000F3220 38 21 00 30 */ addi r1, r1, 0x30
-/* 800F62E4 000F3224 7C 08 03 A6 */ mtlr r0
-/* 800F62E8 000F3228 4E 80 00 20 */ blr
-.endfn GetTypeCallback
-
-.fn SIGetType, global
-/* 800F62EC 000F322C 7C 08 02 A6 */ mflr r0
-/* 800F62F0 000F3230 90 01 00 04 */ stw r0, 4(r1)
-/* 800F62F4 000F3234 94 21 FF D8 */ stwu r1, -0x28(r1)
-/* 800F62F8 000F3238 BF 61 00 14 */ stmw r27, 0x14(r1)
-/* 800F62FC 000F323C 7C 7B 1B 78 */ mr r27, r3
-/* 800F6300 000F3240 4B FF 89 39 */ bl OSDisableInterrupts
-/* 800F6304 000F3244 3C 80 80 4B */ lis r4, Type@ha
-/* 800F6308 000F3248 57 65 10 3A */ slwi r5, r27, 2
-/* 800F630C 000F324C 38 04 9F 10 */ addi r0, r4, Type@l
-/* 800F6310 000F3250 7F C0 2A 14 */ add r30, r0, r5
-/* 800F6314 000F3254 83 9E 00 00 */ lwz r28, 0(r30)
-/* 800F6318 000F3258 7C 7D 1B 78 */ mr r29, r3
-/* 800F631C 000F325C 4B FF C8 95 */ bl __OSGetSystemTime
-/* 800F6320 000F3260 3C A0 80 4F */ lis r5, TypeTime@ha
-/* 800F6324 000F3264 57 66 18 38 */ slwi r6, r27, 3
-/* 800F6328 000F3268 38 05 72 A0 */ addi r0, r5, TypeTime@l
-/* 800F632C 000F326C 7F E0 32 14 */ add r31, r0, r6
-/* 800F6330 000F3270 80 DF 00 04 */ lwz r6, 4(r31)
-/* 800F6334 000F3274 3C A0 80 4B */ lis r5, Si@ha
-/* 800F6338 000F3278 38 A5 9E FC */ addi r5, r5, Si@l
-/* 800F633C 000F327C 80 1F 00 00 */ lwz r0, 0(r31)
-/* 800F6340 000F3280 7C 86 20 10 */ subfc r4, r6, r4
-/* 800F6344 000F3284 7C 00 19 10 */ subfe r0, r0, r3
-/* 800F6348 000F3288 80 C5 00 04 */ lwz r6, 4(r5)
-/* 800F634C 000F328C 38 A0 00 80 */ li r5, 0x80
-/* 800F6350 000F3290 7C A3 DE 30 */ sraw r3, r5, r27
-/* 800F6354 000F3294 7C C3 18 39 */ and. r3, r6, r3
-/* 800F6358 000F3298 41 82 00 34 */ beq .L_800F638C
-/* 800F635C 000F329C 28 1C 00 08 */ cmplwi r28, 8
-/* 800F6360 000F32A0 41 82 00 20 */ beq .L_800F6380
-/* 800F6364 000F32A4 4B FF C8 4D */ bl __OSGetSystemTime
-/* 800F6368 000F32A8 90 9F 00 04 */ stw r4, 4(r31)
-/* 800F636C 000F32AC 90 7F 00 00 */ stw r3, 0(r31)
-/* 800F6370 000F32B0 7F A3 EB 78 */ mr r3, r29
-/* 800F6374 000F32B4 4B FF 88 ED */ bl OSRestoreInterrupts
-/* 800F6378 000F32B8 7F 83 E3 78 */ mr r3, r28
-/* 800F637C 000F32BC 48 00 01 20 */ b .L_800F649C
-.L_800F6380:
-/* 800F6380 000F32C0 90 BE 00 00 */ stw r5, 0(r30)
-/* 800F6384 000F32C4 3B 80 00 80 */ li r28, 0x80
-/* 800F6388 000F32C8 48 00 00 B4 */ b .L_800F643C
-.L_800F638C:
-/* 800F638C 000F32CC 3C 60 80 00 */ lis r3, 0x800000F8@ha
-/* 800F6390 000F32D0 80 C3 00 F8 */ lwz r6, 0x800000F8@l(r3)
-/* 800F6394 000F32D4 3C A0 10 62 */ lis r5, 0x10624DD3@ha
-/* 800F6398 000F32D8 38 A5 4D D3 */ addi r5, r5, 0x10624DD3@l
-/* 800F639C 000F32DC 54 C6 F0 BE */ srwi r6, r6, 2
-/* 800F63A0 000F32E0 7C A5 30 16 */ mulhwu r5, r5, r6
-/* 800F63A4 000F32E4 54 A5 D1 BE */ srwi r5, r5, 6
-/* 800F63A8 000F32E8 1C E5 00 32 */ mulli r7, r5, 0x32
-/* 800F63AC 000F32EC 38 60 00 00 */ li r3, 0
-/* 800F63B0 000F32F0 6C 66 80 00 */ xoris r6, r3, 0x8000
-/* 800F63B4 000F32F4 6C 05 80 00 */ xoris r5, r0, 0x8000
-/* 800F63B8 000F32F8 7C 64 38 10 */ subfc r3, r4, r7
-/* 800F63BC 000F32FC 7C A5 31 10 */ subfe r5, r5, r6
-/* 800F63C0 000F3300 7C A6 31 10 */ subfe r5, r6, r6
-/* 800F63C4 000F3304 7C A5 00 D1 */ neg. r5, r5
-/* 800F63C8 000F3308 40 82 00 1C */ bne .L_800F63E4
-/* 800F63CC 000F330C 28 1C 00 08 */ cmplwi r28, 8
-/* 800F63D0 000F3310 41 82 00 14 */ beq .L_800F63E4
-/* 800F63D4 000F3314 7F A3 EB 78 */ mr r3, r29
-/* 800F63D8 000F3318 4B FF 88 89 */ bl OSRestoreInterrupts
-/* 800F63DC 000F331C 7F 83 E3 78 */ mr r3, r28
-/* 800F63E0 000F3320 48 00 00 BC */ b .L_800F649C
-.L_800F63E4:
-/* 800F63E4 000F3324 3C 60 80 00 */ lis r3, 0x800000F8@ha
-/* 800F63E8 000F3328 80 C3 00 F8 */ lwz r6, 0x800000F8@l(r3)
-/* 800F63EC 000F332C 3C A0 10 62 */ lis r5, 0x10624DD3@ha
-/* 800F63F0 000F3330 38 A5 4D D3 */ addi r5, r5, 0x10624DD3@l
-/* 800F63F4 000F3334 54 C6 F0 BE */ srwi r6, r6, 2
-/* 800F63F8 000F3338 7C A5 30 16 */ mulhwu r5, r5, r6
-/* 800F63FC 000F333C 54 A5 D1 BE */ srwi r5, r5, 6
-/* 800F6400 000F3340 1C C5 00 4B */ mulli r6, r5, 0x4b
-/* 800F6404 000F3344 38 60 00 00 */ li r3, 0
-/* 800F6408 000F3348 6C 65 80 00 */ xoris r5, r3, 0x8000
-/* 800F640C 000F334C 6C 03 80 00 */ xoris r3, r0, 0x8000
-/* 800F6410 000F3350 7C 04 30 10 */ subfc r0, r4, r6
-/* 800F6414 000F3354 7C 63 29 10 */ subfe r3, r3, r5
-/* 800F6418 000F3358 7C 65 29 10 */ subfe r3, r5, r5
-/* 800F641C 000F335C 7C 63 00 D1 */ neg. r3, r3
-/* 800F6420 000F3360 40 82 00 10 */ bne .L_800F6430
-/* 800F6424 000F3364 38 00 00 80 */ li r0, 0x80
-/* 800F6428 000F3368 90 1E 00 00 */ stw r0, 0(r30)
-/* 800F642C 000F336C 48 00 00 10 */ b .L_800F643C
-.L_800F6430:
-/* 800F6430 000F3370 38 00 00 80 */ li r0, 0x80
-/* 800F6434 000F3374 90 1E 00 00 */ stw r0, 0(r30)
-/* 800F6438 000F3378 3B 80 00 80 */ li r28, 0x80
-.L_800F643C:
-/* 800F643C 000F337C 4B FF C7 75 */ bl __OSGetSystemTime
-/* 800F6440 000F3380 90 9F 00 04 */ stw r4, 4(r31)
-/* 800F6444 000F3384 3C 80 43 1C */ lis r4, 0x431BDE83@ha
-/* 800F6448 000F3388 3C A0 80 0F */ lis r5, GetTypeCallback@ha
-/* 800F644C 000F338C 90 7F 00 00 */ stw r3, 0(r31)
-/* 800F6450 000F3390 3C 60 80 00 */ lis r3, 0x800000F8@ha
-/* 800F6454 000F3394 39 05 60 54 */ addi r8, r5, GetTypeCallback@l
-/* 800F6458 000F3398 80 03 00 F8 */ lwz r0, 0x800000F8@l(r3)
-/* 800F645C 000F339C 38 84 DE 83 */ addi r4, r4, 0x431BDE83@l
-/* 800F6460 000F33A0 38 7B 00 00 */ addi r3, r27, 0
-/* 800F6464 000F33A4 54 00 F0 BE */ srwi r0, r0, 2
-/* 800F6468 000F33A8 7C 04 00 16 */ mulhwu r0, r4, r0
-/* 800F646C 000F33AC 54 00 8B FE */ srwi r0, r0, 0xf
-/* 800F6470 000F33B0 1C 00 00 41 */ mulli r0, r0, 0x41
-/* 800F6474 000F33B4 54 0A E8 FE */ srwi r10, r0, 3
-/* 800F6478 000F33B8 38 DE 00 00 */ addi r6, r30, 0
-/* 800F647C 000F33BC 38 8D 90 24 */ addi r4, r13, cmdTypeAndStatus$372@sda21
-/* 800F6480 000F33C0 38 A0 00 01 */ li r5, 1
-/* 800F6484 000F33C4 38 E0 00 03 */ li r7, 3
-/* 800F6488 000F33C8 39 20 00 00 */ li r9, 0
-/* 800F648C 000F33CC 4B FF FA 5D */ bl SITransfer
-/* 800F6490 000F33D0 7F A3 EB 78 */ mr r3, r29
-/* 800F6494 000F33D4 4B FF 87 CD */ bl OSRestoreInterrupts
-/* 800F6498 000F33D8 7F 83 E3 78 */ mr r3, r28
-.L_800F649C:
-/* 800F649C 000F33DC BB 61 00 14 */ lmw r27, 0x14(r1)
-/* 800F64A0 000F33E0 80 01 00 2C */ lwz r0, 0x2c(r1)
-/* 800F64A4 000F33E4 38 21 00 28 */ addi r1, r1, 0x28
-/* 800F64A8 000F33E8 7C 08 03 A6 */ mtlr r0
-/* 800F64AC 000F33EC 4E 80 00 20 */ blr
-.endfn SIGetType
-
-.fn SIGetTypeAsync, global
-/* 800F64B0 000F33F0 7C 08 02 A6 */ mflr r0
-/* 800F64B4 000F33F4 90 01 00 04 */ stw r0, 4(r1)
-/* 800F64B8 000F33F8 94 21 FF E0 */ stwu r1, -0x20(r1)
-/* 800F64BC 000F33FC 93 E1 00 1C */ stw r31, 0x1c(r1)
-/* 800F64C0 000F3400 3B E4 00 00 */ addi r31, r4, 0
-/* 800F64C4 000F3404 93 C1 00 18 */ stw r30, 0x18(r1)
-/* 800F64C8 000F3408 93 A1 00 14 */ stw r29, 0x14(r1)
-/* 800F64CC 000F340C 93 81 00 10 */ stw r28, 0x10(r1)
-/* 800F64D0 000F3410 3B 83 00 00 */ addi r28, r3, 0
-/* 800F64D4 000F3414 4B FF 87 65 */ bl OSDisableInterrupts
-/* 800F64D8 000F3418 3B C3 00 00 */ addi r30, r3, 0
-/* 800F64DC 000F341C 38 7C 00 00 */ addi r3, r28, 0
-/* 800F64E0 000F3420 4B FF FE 0D */ bl SIGetType
-/* 800F64E4 000F3424 3C 80 80 4B */ lis r4, Type@ha
-/* 800F64E8 000F3428 57 85 10 3A */ slwi r5, r28, 2
-/* 800F64EC 000F342C 38 04 9F 10 */ addi r0, r4, Type@l
-/* 800F64F0 000F3430 7C 80 2A 14 */ add r4, r0, r5
-/* 800F64F4 000F3434 80 04 00 00 */ lwz r0, 0(r4)
-/* 800F64F8 000F3438 3B A3 00 00 */ addi r29, r3, 0
-/* 800F64FC 000F343C 54 00 06 31 */ rlwinm. r0, r0, 0, 0x18, 0x18
-/* 800F6500 000F3440 41 82 00 AC */ beq .L_800F65AC
-/* 800F6504 000F3444 3C 60 80 4F */ lis r3, TypeCallback@ha
-/* 800F6508 000F3448 57 84 20 36 */ slwi r4, r28, 4
-/* 800F650C 000F344C 38 03 72 E0 */ addi r0, r3, TypeCallback@l
-/* 800F6510 000F3450 7C 80 22 14 */ add r4, r0, r4
-/* 800F6514 000F3454 80 04 00 00 */ lwz r0, 0(r4)
-/* 800F6518 000F3458 38 A0 00 00 */ li r5, 0
-/* 800F651C 000F345C 7C 00 F8 40 */ cmplw r0, r31
-/* 800F6520 000F3460 41 82 00 A0 */ beq .L_800F65C0
-/* 800F6524 000F3464 28 00 00 00 */ cmplwi r0, 0
-/* 800F6528 000F3468 40 82 00 10 */ bne .L_800F6538
-/* 800F652C 000F346C 54 A0 10 3A */ slwi r0, r5, 2
-/* 800F6530 000F3470 7F E4 01 2E */ stwx r31, r4, r0
-/* 800F6534 000F3474 48 00 00 8C */ b .L_800F65C0
-.L_800F6538:
-/* 800F6538 000F3478 38 64 00 04 */ addi r3, r4, 4
-/* 800F653C 000F347C 80 04 00 04 */ lwz r0, 4(r4)
-/* 800F6540 000F3480 38 A0 00 01 */ li r5, 1
-/* 800F6544 000F3484 7C 00 F8 40 */ cmplw r0, r31
-/* 800F6548 000F3488 41 82 00 78 */ beq .L_800F65C0
-/* 800F654C 000F348C 28 00 00 00 */ cmplwi r0, 0
-/* 800F6550 000F3490 40 82 00 10 */ bne .L_800F6560
-/* 800F6554 000F3494 54 A0 10 3A */ slwi r0, r5, 2
-/* 800F6558 000F3498 7F E4 01 2E */ stwx r31, r4, r0
-/* 800F655C 000F349C 48 00 00 64 */ b .L_800F65C0
-.L_800F6560:
-/* 800F6560 000F34A0 84 03 00 04 */ lwzu r0, 4(r3)
-/* 800F6564 000F34A4 38 A0 00 02 */ li r5, 2
-/* 800F6568 000F34A8 7C 00 F8 40 */ cmplw r0, r31
-/* 800F656C 000F34AC 41 82 00 54 */ beq .L_800F65C0
-/* 800F6570 000F34B0 28 00 00 00 */ cmplwi r0, 0
-/* 800F6574 000F34B4 40 82 00 10 */ bne .L_800F6584
-/* 800F6578 000F34B8 54 A0 10 3A */ slwi r0, r5, 2
-/* 800F657C 000F34BC 7F E4 01 2E */ stwx r31, r4, r0
-/* 800F6580 000F34C0 48 00 00 40 */ b .L_800F65C0
-.L_800F6584:
-/* 800F6584 000F34C4 80 03 00 04 */ lwz r0, 4(r3)
-/* 800F6588 000F34C8 38 A0 00 03 */ li r5, 3
-/* 800F658C 000F34CC 7C 00 F8 40 */ cmplw r0, r31
-/* 800F6590 000F34D0 41 82 00 30 */ beq .L_800F65C0
-/* 800F6594 000F34D4 28 00 00 00 */ cmplwi r0, 0
-/* 800F6598 000F34D8 40 82 00 28 */ bne .L_800F65C0
-/* 800F659C 000F34DC 54 A0 10 3A */ slwi r0, r5, 2
-/* 800F65A0 000F34E0 7F E4 01 2E */ stwx r31, r4, r0
-/* 800F65A4 000F34E4 48 00 00 1C */ b .L_800F65C0
-/* 800F65A8 000F34E8 48 00 00 18 */ b .L_800F65C0
-.L_800F65AC:
-/* 800F65AC 000F34EC 39 9F 00 00 */ addi r12, r31, 0
-/* 800F65B0 000F34F0 7D 88 03 A6 */ mtlr r12
-/* 800F65B4 000F34F4 38 7C 00 00 */ addi r3, r28, 0
-/* 800F65B8 000F34F8 38 9D 00 00 */ addi r4, r29, 0
-/* 800F65BC 000F34FC 4E 80 00 21 */ blrl
-.L_800F65C0:
-/* 800F65C0 000F3500 7F C3 F3 78 */ mr r3, r30
-/* 800F65C4 000F3504 4B FF 86 9D */ bl OSRestoreInterrupts
-/* 800F65C8 000F3508 7F A3 EB 78 */ mr r3, r29
-/* 800F65CC 000F350C 80 01 00 24 */ lwz r0, 0x24(r1)
-/* 800F65D0 000F3510 83 E1 00 1C */ lwz r31, 0x1c(r1)
-/* 800F65D4 000F3514 83 C1 00 18 */ lwz r30, 0x18(r1)
-/* 800F65D8 000F3518 83 A1 00 14 */ lwz r29, 0x14(r1)
-/* 800F65DC 000F351C 83 81 00 10 */ lwz r28, 0x10(r1)
-/* 800F65E0 000F3520 38 21 00 20 */ addi r1, r1, 0x20
-/* 800F65E4 000F3524 7C 08 03 A6 */ mtlr r0
-/* 800F65E8 000F3528 4E 80 00 20 */ blr
-.endfn SIGetTypeAsync
-
-.fn SIDecodeType, global
-/* 800F65EC 000F352C 54 60 07 39 */ rlwinm. r0, r3, 0, 0x1c, 0x1c
-/* 800F65F0 000F3530 54 64 06 3E */ clrlwi r4, r3, 0x18
-/* 800F65F4 000F3534 54 65 00 2E */ rlwinm r5, r3, 0, 0, 0x17
-/* 800F65F8 000F3538 41 82 00 0C */ beq .L_800F6604
-/* 800F65FC 000F353C 38 60 00 08 */ li r3, 8
-/* 800F6600 000F3540 4E 80 00 20 */ blr
-.L_800F6604:
-/* 800F6604 000F3544 70 80 00 47 */ andi. r0, r4, 0x47
-/* 800F6608 000F3548 41 82 00 0C */ beq .L_800F6614
-/* 800F660C 000F354C 38 60 00 40 */ li r3, 0x40
-/* 800F6610 000F3550 4E 80 00 20 */ blr
-.L_800F6614:
-/* 800F6614 000F3554 28 04 00 00 */ cmplwi r4, 0
-/* 800F6618 000F3558 41 82 00 0C */ beq .L_800F6624
-/* 800F661C 000F355C 38 60 00 80 */ li r3, 0x80
-/* 800F6620 000F3560 4E 80 00 20 */ blr
-.L_800F6624:
-/* 800F6624 000F3564 54 A3 00 C9 */ rlwinm. r3, r5, 0, 3, 4
-/* 800F6628 000F3568 40 82 00 64 */ bne .L_800F668C
-/* 800F662C 000F356C 54 A3 00 1E */ rlwinm r3, r5, 0, 0, 0xf
-/* 800F6630 000F3570 3C 00 00 04 */ lis r0, 4
-/* 800F6634 000F3574 7C 03 00 00 */ cmpw r3, r0
-/* 800F6638 000F3578 4D 82 00 20 */ beqlr
-/* 800F663C 000F357C 40 80 00 24 */ bge .L_800F6660
-/* 800F6640 000F3580 3C 00 00 02 */ lis r0, 2
-/* 800F6644 000F3584 7C 03 00 00 */ cmpw r3, r0
-/* 800F6648 000F3588 4D 82 00 20 */ beqlr
-/* 800F664C 000F358C 40 80 00 38 */ bge .L_800F6684
-/* 800F6650 000F3590 3C 00 00 01 */ lis r0, 1
-/* 800F6654 000F3594 7C 03 00 00 */ cmpw r3, r0
-/* 800F6658 000F3598 4D 82 00 20 */ beqlr
-/* 800F665C 000F359C 48 00 00 28 */ b .L_800F6684
-.L_800F6660:
-/* 800F6660 000F35A0 3C 00 05 00 */ lis r0, 0x500
-/* 800F6664 000F35A4 7C 03 00 00 */ cmpw r3, r0
-/* 800F6668 000F35A8 4D 82 00 20 */ beqlr
-/* 800F666C 000F35AC 40 80 00 18 */ bge .L_800F6684
-/* 800F6670 000F35B0 3C 00 02 00 */ lis r0, 0x200
-/* 800F6674 000F35B4 7C 03 00 00 */ cmpw r3, r0
-/* 800F6678 000F35B8 4D 82 00 20 */ beqlr
-/* 800F667C 000F35BC 48 00 00 08 */ b .L_800F6684
-/* 800F6680 000F35C0 4E 80 00 20 */ blr
-.L_800F6684:
-/* 800F6684 000F35C4 38 60 00 40 */ li r3, 0x40
-/* 800F6688 000F35C8 4E 80 00 20 */ blr
-.L_800F668C:
-/* 800F668C 000F35CC 3C 03 F8 00 */ addis r0, r3, 0xf800
-/* 800F6690 000F35D0 28 00 00 00 */ cmplwi r0, 0
-/* 800F6694 000F35D4 41 82 00 0C */ beq .L_800F66A0
-/* 800F6698 000F35D8 38 60 00 40 */ li r3, 0x40
-/* 800F669C 000F35DC 4E 80 00 20 */ blr
-.L_800F66A0:
-/* 800F66A0 000F35E0 54 A3 00 1E */ rlwinm r3, r5, 0, 0, 0xf
-/* 800F66A4 000F35E4 3C 00 09 00 */ lis r0, 0x900
-/* 800F66A8 000F35E8 7C 03 00 00 */ cmpw r3, r0
-/* 800F66AC 000F35EC 4D 82 00 20 */ beqlr
-/* 800F66B0 000F35F0 40 80 00 18 */ bge .L_800F66C8
-/* 800F66B4 000F35F4 3C 00 08 00 */ lis r0, 0x800
-/* 800F66B8 000F35F8 7C 03 00 00 */ cmpw r3, r0
-/* 800F66BC 000F35FC 4D 82 00 20 */ beqlr
-/* 800F66C0 000F3600 48 00 00 08 */ b .L_800F66C8
-/* 800F66C4 000F3604 4E 80 00 20 */ blr
-.L_800F66C8:
-/* 800F66C8 000F3608 54 A3 00 14 */ rlwinm r3, r5, 0, 0, 0xa
-/* 800F66CC 000F360C 3C 03 F7 E0 */ addis r0, r3, 0xf7e0
-/* 800F66D0 000F3610 28 00 00 00 */ cmplwi r0, 0
-/* 800F66D4 000F3614 40 82 00 0C */ bne .L_800F66E0
-/* 800F66D8 000F3618 3C 60 08 20 */ lis r3, 0x820
-/* 800F66DC 000F361C 4E 80 00 20 */ blr
-.L_800F66E0:
-/* 800F66E0 000F3620 54 A0 00 01 */ rlwinm. r0, r5, 0, 0, 0
-/* 800F66E4 000F3624 41 82 00 34 */ beq .L_800F6718
-/* 800F66E8 000F3628 54 A0 01 4B */ rlwinm. r0, r5, 0, 5, 5
-/* 800F66EC 000F362C 40 82 00 2C */ bne .L_800F6718
-/* 800F66F0 000F3630 74 A3 8B 10 */ andis. r3, r5, 0x8b10
-/* 800F66F4 000F3634 3C 03 74 F0 */ addis r0, r3, 0x74f0
-/* 800F66F8 000F3638 28 00 00 00 */ cmplwi r0, 0
-/* 800F66FC 000F363C 40 82 00 0C */ bne .L_800F6708
-/* 800F6700 000F3640 3C 60 8B 10 */ lis r3, 0x8b10
-/* 800F6704 000F3644 4E 80 00 20 */ blr
-.L_800F6708:
-/* 800F6708 000F3648 54 A0 01 8D */ rlwinm. r0, r5, 0, 6, 6
-/* 800F670C 000F364C 40 82 00 0C */ bne .L_800F6718
-/* 800F6710 000F3650 3C 60 88 00 */ lis r3, 0x8800
-/* 800F6714 000F3654 4E 80 00 20 */ blr
-.L_800F6718:
-/* 800F6718 000F3658 74 A3 09 00 */ andis. r3, r5, 0x900
-/* 800F671C 000F365C 3C 03 F7 00 */ addis r0, r3, 0xf700
-/* 800F6720 000F3660 28 00 00 00 */ cmplwi r0, 0
-/* 800F6724 000F3664 40 82 00 0C */ bne .L_800F6730
-/* 800F6728 000F3668 3C 60 09 00 */ lis r3, 0x900
-/* 800F672C 000F366C 4E 80 00 20 */ blr
-.L_800F6730:
-/* 800F6730 000F3670 38 60 00 40 */ li r3, 0x40
-/* 800F6734 000F3674 4E 80 00 20 */ blr
-.endfn SIDecodeType
-
-.fn SIProbe, global
-/* 800F6738 000F3678 7C 08 02 A6 */ mflr r0
-/* 800F673C 000F367C 90 01 00 04 */ stw r0, 4(r1)
-/* 800F6740 000F3680 94 21 FF F8 */ stwu r1, -8(r1)
-/* 800F6744 000F3684 4B FF FB A9 */ bl SIGetType
-/* 800F6748 000F3688 4B FF FE A5 */ bl SIDecodeType
-/* 800F674C 000F368C 80 01 00 0C */ lwz r0, 0xc(r1)
-/* 800F6750 000F3690 38 21 00 08 */ addi r1, r1, 8
-/* 800F6754 000F3694 7C 08 03 A6 */ mtlr r0
-/* 800F6758 000F3698 4E 80 00 20 */ blr
-.endfn SIProbe
diff --git a/configure.py b/configure.py
index fde510c8a..c49547e76 100755
--- a/configure.py
+++ b/configure.py
@@ -784,7 +784,7 @@
"cflags": "$cflags_base -str noreadonly",
"host": False,
"objects": [
- "Dolphin/si/SIBios",
+ ["Dolphin/si/SIBios", True],
["Dolphin/si/SISamplingRate", True],
],
},
diff --git a/docs/recommended_todo.md b/docs/recommended_todo.md
index 285357b3b..6bd2a0455 100644
--- a/docs/recommended_todo.md
+++ b/docs/recommended_todo.md
@@ -19,7 +19,7 @@
###
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
-| TRK_MINNOW_DOLPHIN/targsupp.c | 326 | gx/GXDisplayList.c | 582 |
+| TRK_MINNOW_DOLPHIN/targsupp.c | 326 | gx/GXDisplayList.c | 583 |
| Runtime/__init_cpp_exceptions.cpp | 684 | Runtime/global_destructor_chain.c | 965 |
| mtx/mtxvec.c | 3122 | TRK_MINNOW_DOLPHIN/mslsupp.c | 4555 |
| TRK_MINNOW_DOLPHIN/CircleBuffer.c | 4715 | TRK_MINNOW_DOLPHIN/serpoll.c | 4793 |
diff --git a/include/Dolphin/si.h b/include/Dolphin/si.h
index 42b1f98d3..3cfcdf7e3 100644
--- a/include/Dolphin/si.h
+++ b/include/Dolphin/si.h
@@ -33,6 +33,28 @@ typedef struct SIControl {
SICallback callback; // _10
} SIControl;
+// Struct to set and store flags (size 0x4).
+typedef struct SICommFlags {
+ u32 tcint : 1;
+ u32 tcintmsk : 1;
+ u32 comerr : 1;
+ u32 rdstint : 1;
+ u32 rdstintmsk : 1;
+ u32 pad0 : 4;
+ u32 outlngth : 7;
+ u32 pad1 : 1;
+ u32 inlngth : 7;
+ u32 pad2 : 5;
+ u32 channel : 2;
+ u32 tstart : 1;
+} SICommFlags;
+
+// Union to control setting flags or overall word value (size 0x4).
+typedef union SIComm {
+ u32 val;
+ SICommFlags flags;
+} SIComm;
+
////////////////////////////////////////////
/////////////// SI FUNCTIONS ///////////////
diff --git a/src/Dolphin/si/Makefile b/src/Dolphin/si/Makefile
index 72e3351a2..9b627369b 100644
--- a/src/Dolphin/si/Makefile
+++ b/src/Dolphin/si/Makefile
@@ -1,5 +1,5 @@
SI_FILES:=\
- $(BUILD_DIR)/asm/Dolphin/si/SIBios.o\
+ $(BUILD_DIR)/src/Dolphin/si/SIBios.o\
$(BUILD_DIR)/src/Dolphin/si/SISamplingRate.o\
$(SI_FILES): CFLAGS += -common off -str noreadonly
diff --git a/src/Dolphin/si/SIBios.c b/src/Dolphin/si/SIBios.c
index e90a422c9..1c6243dbb 100644
--- a/src/Dolphin/si/SIBios.c
+++ b/src/Dolphin/si/SIBios.c
@@ -1,9 +1,9 @@
#include "Dolphin/si.h"
+#include "Dolphin/hw_regs.h"
char* __SIVersion = "<< Dolphin SDK - SI\trelease build: Apr 17 2003 12:33:19 (0x2301) >>";
static SIControl Si = { -1, 0, 0, nullptr, nullptr };
-
static SIPacket Packet[SI_MAX_CHAN];
static OSAlarm Alarm[SI_MAX_CHAN];
static u32 Type[SI_MAX_CHAN] = {
@@ -12,19 +12,24 @@ static u32 Type[SI_MAX_CHAN] = {
SI_ERROR_NO_RESPONSE,
SI_ERROR_NO_RESPONSE,
};
-
static OSTime TypeTime[SI_MAX_CHAN];
static OSTime XferTime[SI_MAX_CHAN];
-
static SITypeAndStatusCallback TypeCallback[SI_MAX_CHAN][4];
static __OSInterruptHandler RDSTHandler[4];
-
static BOOL InputBufferValid[SI_MAX_CHAN];
static u32 InputBuffer[SI_MAX_CHAN][2];
static vu32 InputBufferVcount[SI_MAX_CHAN];
u32 __PADFixBits;
+// forward-declared static functions.
+static BOOL __SITransfer(int chan, void* output, u32 outputBytes, void* input, u32 inputBytes, SICallback callback);
+static BOOL SIGetResponseRaw(int chan);
+static void GetTypeCallback(int chan, u32 error, OSContext* context);
+
+// useful macros.
+#define ROUND(n, a) (((u32)(n) + (a)-1) & ~((a)-1))
+
/*
* --INFO--
* Address: 800F4EFC
@@ -37,29 +42,7 @@ BOOL SIBusy() { return Si.chan != -1 ? TRUE : FALSE; }
* Address: 800F4F1C
* Size: 00003C
*/
-BOOL SIIsChanBusy(int chan)
-{
- /*
- .loc_0x0:
- lis r4, 0x804F
- rlwinm r5,r3,5,0,26
- addi r0, r4, 0x7180
- add r4, r0, r5
- lwz r0, 0x0(r4)
- li r5, 0x1
- cmpwi r0, -0x1
- bne- .loc_0x34
- lis r4, 0x804B
- lwz r0, -0x6104(r4)
- cmpw r0, r3
- beq- .loc_0x34
- li r5, 0
-
- .loc_0x34:
- mr r3, r5
- blr
- */
-}
+BOOL SIIsChanBusy(int chan) { return Packet[chan].chan != -1 || Si.chan == chan; }
/*
* --INFO--
@@ -68,7 +51,12 @@ BOOL SIIsChanBusy(int chan)
*/
void SIClearTCInterrupt(void)
{
- // UNUSED FUNCTION
+ u32 reg;
+
+ reg = __SIRegs[SI_CC_STAT];
+ reg |= 0x80000000;
+ reg &= ~0x00000001;
+ __SIRegs[SI_CC_STAT] = reg;
}
/*
@@ -76,230 +64,56 @@ void SIClearTCInterrupt(void)
* Address: 800F4F58
* Size: 0002FC
*/
-static void CompleteTransfer(void)
+static u32 CompleteTransfer(void)
{
- /*
- .loc_0x0:
- mflr r0
- lis r3, 0xCC00
- stw r0, 0x4(r1)
- stwu r1, -0x20(r1)
- stw r31, 0x1C(r1)
- stw r30, 0x18(r1)
- addi r30, r3, 0x6400
- stw r29, 0x14(r1)
- addi r29, r30, 0x34
- stw r28, 0x10(r1)
- lwz r0, 0x6434(r3)
- lwz r28, 0x6438(r3)
- lis r3, 0x804B
- oris r0, r0, 0x8000
- rlwinm r0,r0,0,0,30
- stw r0, 0x34(r30)
- subi r31, r3, 0x6148
- lwz r0, 0x44(r31)
- cmpwi r0, -0x1
- beq- .loc_0x2C0
- bl -0x23F8
- lwz r6, 0x44(r31)
- lis r5, 0x804F
- addi r0, r5, 0x72C0
- rlwinm r5,r6,3,0,28
- add r5, r0, r5
- stw r4, 0x4(r5)
- addi r6, r31, 0x4C
- li r4, 0
- stw r3, 0x0(r5)
- lwz r0, 0x4C(r31)
- lwz r5, 0x50(r31)
- rlwinm r7,r0,30,2,31
- cmplwi r7, 0
- ble- .loc_0x128
- cmplwi r7, 0x8
- subi r3, r7, 0x8
- ble- .loc_0x2C8
- addi r0, r3, 0x7
- rlwinm r0,r0,29,3,31
- cmplwi r3, 0
- mtctr r0
- ble- .loc_0x2C8
-
- .loc_0xAC:
- lwz r0, 0x80(r30)
- addi r4, r4, 0x8
- stw r0, 0x0(r5)
- lwz r0, 0x84(r30)
- stw r0, 0x4(r5)
- lwz r0, 0x88(r30)
- stw r0, 0x8(r5)
- lwz r0, 0x8C(r30)
- stw r0, 0xC(r5)
- lwz r0, 0x90(r30)
- stw r0, 0x10(r5)
- lwz r0, 0x94(r30)
- stw r0, 0x14(r5)
- lwz r0, 0x98(r30)
- stw r0, 0x18(r5)
- lwz r0, 0x9C(r30)
- addi r30, r30, 0x20
- stw r0, 0x1C(r5)
- addi r5, r5, 0x20
- bdnz+ .loc_0xAC
- b .loc_0x2C8
-
- .loc_0x100:
- sub r0, r7, r4
- cmplw r4, r7
- mtctr r0
- bge- .loc_0x128
-
- .loc_0x110:
- lwz r0, 0x80(r3)
- addi r3, r3, 0x4
- addi r4, r4, 0x1
- stw r0, 0x0(r5)
- addi r5, r5, 0x4
- bdnz+ .loc_0x110
-
- .loc_0x128:
- lwz r0, 0x0(r6)
- rlwinm. r3,r0,0,30,31
- beq- .loc_0x240
- lis r6, 0xCC00
- addi r6, r6, 0x6400
- rlwinm r0,r4,2,0,29
- add r4, r6, r0
- lwz r6, 0x80(r4)
- li r4, 0
- ble- .loc_0x240
- cmplwi r3, 0x8
- subi r7, r3, 0x8
- ble- .loc_0x214
- addi r0, r7, 0x7
- rlwinm r0,r0,29,3,31
- cmplwi r7, 0
- mtctr r0
- ble- .loc_0x214
-
- .loc_0x170:
- subfic r0, r4, 0x3
- rlwinm r7,r0,3,0,28
- addi r0, r4, 0x1
- srw r7, r6, r7
- subfic r0, r0, 0x3
- stb r7, 0x0(r5)
- rlwinm r0,r0,3,0,28
- addi r7, r4, 0x2
- srw r0, r6, r0
- subfic r7, r7, 0x3
- stb r0, 0x1(r5)
- rlwinm r7,r7,3,0,28
- srw r12, r6, r7
- neg r7, r4
- stb r12, 0x2(r5)
- rlwinm r8,r7,3,0,28
- addi r7, r4, 0x4
- srw r11, r6, r8
- subfic r7, r7, 0x3
- stb r11, 0x3(r5)
- rlwinm r8,r7,3,0,28
- addi r7, r4, 0x5
- srw r10, r6, r8
- subfic r7, r7, 0x3
- stb r10, 0x4(r5)
- rlwinm r8,r7,3,0,28
- srw r9, r6, r8
- addi r7, r4, 0x6
- stb r9, 0x5(r5)
- subfic r8, r7, 0x3
- addi r7, r4, 0x7
- rlwinm r8,r8,3,0,28
- srw r8, r6, r8
- subfic r7, r7, 0x3
- stb r8, 0x6(r5)
- rlwinm r7,r7,3,0,28
- srw r7, r6, r7
- stb r7, 0x7(r5)
- addi r5, r5, 0x8
- addi r4, r4, 0x8
- bdnz+ .loc_0x170
-
- .loc_0x214:
- sub r0, r3, r4
- cmplw r4, r3
- mtctr r0
- bge- .loc_0x240
-
- .loc_0x224:
- subfic r0, r4, 0x3
- rlwinm r0,r0,3,0,28
- srw r0, r6, r0
- stb r0, 0x0(r5)
- addi r5, r5, 0x1
- addi r4, r4, 0x1
- bdnz+ .loc_0x224
-
- .loc_0x240:
- lwz r0, 0x0(r29)
- rlwinm. r0,r0,0,2,2
- beq- .loc_0x294
- lwz r3, 0x44(r31)
- subfic r0, r3, 0x3
- rlwinm r0,r0,3,0,28
- srw r28, r28, r0
- rlwinm r28,r28,0,28,31
- rlwinm. r0,r28,0,28,28
- beq- .loc_0x284
- rlwinm r0,r3,2,0,29
- add r3, r31, r0
- lwzu r0, 0x58(r3)
- rlwinm. r0,r0,0,24,24
- bne- .loc_0x284
- li r0, 0x8
- stw r0, 0x0(r3)
-
- .loc_0x284:
- cmplwi r28, 0
- bne- .loc_0x2B8
- li r28, 0x4
- b .loc_0x2B8
-
- .loc_0x294:
- bl -0x263C
- lwz r6, 0x44(r31)
- lis r5, 0x804F
- addi r0, r5, 0x72A0
- rlwinm r5,r6,3,0,28
- add r5, r0, r5
- stw r4, 0x4(r5)
- li r28, 0
- stw r3, 0x0(r5)
-
- .loc_0x2B8:
- li r0, -0x1
- stw r0, 0x44(r31)
-
- .loc_0x2C0:
- mr r3, r28
- b .loc_0x2DC
-
- .loc_0x2C8:
- lis r3, 0xCC00
- rlwinm r0,r4,2,0,29
- addi r3, r3, 0x6400
- add r3, r3, r0
- b .loc_0x100
-
- .loc_0x2DC:
- lwz r0, 0x24(r1)
- lwz r31, 0x1C(r1)
- lwz r30, 0x18(r1)
- lwz r29, 0x14(r1)
- lwz r28, 0x10(r1)
- addi r1, r1, 0x20
- mtlr r0
- blr
- */
+ u32 sr;
+ u32 i;
+ u32 rLen;
+ u8* input;
+
+ sr = __SIRegs[SI_STAT];
+
+ SIClearTCInterrupt();
+
+ if (Si.chan != -1) {
+ XferTime[Si.chan] = __OSGetSystemTime();
+
+ input = Si.input;
+ rLen = Si.inputBytes / 4;
+
+ for (i = 0; i < rLen; i++) {
+ *(u32*)input = __SIRegs[SI_IO_BUFFER + i];
+ input += 4;
+ }
+
+ rLen = Si.inputBytes & 3;
+ if (rLen) {
+ u32 temp = __SIRegs[SI_IO_BUFFER + i];
+
+ for (i = 0; i < rLen; i++) {
+ *input++ = (u8)((temp >> ((3 - i) * 8)) & 0xff);
+ }
+ }
+
+ if (__SIRegs[SI_CC_STAT] & 0x20000000) {
+ sr >>= 8 * (3 - Si.chan);
+ sr &= 0xf;
+
+ if ((sr & SI_ERROR_NO_RESPONSE) && !(Type[Si.chan] & SI_ERROR_BUSY)) {
+ Type[Si.chan] = SI_ERROR_NO_RESPONSE;
+ }
+
+ if (sr == 0) {
+ sr = SI_ERROR_COLLISION;
+ }
+ } else {
+ TypeTime[Si.chan] = __OSGetSystemTime();
+ sr = 0;
+ }
+
+ Si.chan = -1;
+ }
+ return sr;
}
/*
@@ -307,9 +121,23 @@ static void CompleteTransfer(void)
* Address: ........
* Size: 0000F0
*/
-void SITransferNext(void)
+void SITransferNext(int chan)
{
- // UNUSED FUNCTION
+ int i;
+ SIPacket* packet;
+
+ for (i = 0; i < SI_MAX_CHAN; ++i) {
+ ++chan;
+ chan %= SI_MAX_CHAN;
+ packet = &Packet[chan];
+ if (packet->chan != -1 && packet->fire <= __OSGetSystemTime()) {
+ if (__SITransfer(packet->chan, packet->output, packet->outputBytes, packet->input, packet->inputBytes, packet->callback)) {
+ OSCancelAlarm(&Alarm[chan]);
+ packet->chan = -1;
+ }
+ break;
+ }
+ }
}
/*
@@ -317,250 +145,73 @@ void SITransferNext(void)
* Address: 800F5254
* Size: 000344
*/
-static void SIInterruptHandler(void)
+static void SIInterruptHandler(__OSInterrupt interrupt, OSContext* context)
{
- /*
- .loc_0x0:
- mflr r0
- lis r5, 0xCC00
- stw r0, 0x4(r1)
- lis r7, 0x804F
- lis r6, 0x804B
- stwu r1, -0x48(r1)
- stmw r21, 0x1C(r1)
- addi r30, r3, 0
- addi r31, r4, 0
- addi r28, r7, 0x7180
- subi r29, r6, 0x6148
- lwz r24, 0x6434(r5)
- rlwinm r5,r24,0,0,1
- addis r0, r5, 0x4000
- cmplwi r0, 0
- bne- .loc_0x1C0
- lwz r23, 0x44(r29)
- bl -0x340
- lwz r21, 0x54(r29)
- li r27, 0
- addi r22, r3, 0
- stw r27, 0x54(r29)
- addi r26, r23, 0
-
- .loc_0x5C:
- addi r26, r26, 0x1
- srawi r0, r26, 0x2
- addze r0, r0
- rlwinm r0,r0,2,0,29
- subc r0, r26, r0
- mr r26, r0
- rlwinm r0,r0,5,0,26
- add r25, r28, r0
- lwz r0, 0x0(r25)
- cmpwi r0, -0x1
- beq- .loc_0xF0
- bl -0x272C
- lwz r0, 0x18(r25)
- xoris r5, r3, 0x8000
- lwz r6, 0x1C(r25)
- xoris r3, r0, 0x8000
- subc r0, r4, r6
- subfe r3, r3, r5
- subfe r3, r5, r5
- neg. r3, r3
- bne- .loc_0xF0
- lwz r3, 0x0(r25)
- lwz r4, 0x4(r25)
- lwz r5, 0x8(r25)
- lwz r6, 0xC(r25)
- lwz r7, 0x10(r25)
- lwz r8, 0x14(r25)
- bl 0x588
- cmpwi r3, 0
- beq- .loc_0xFC
- mulli r0, r26, 0x28
- add r3, r28, r0
- addi r3, r3, 0x80
- bl -0x9560
- li r0, -0x1
- stw r0, 0x0(r25)
- b .loc_0xFC
-
- .loc_0xF0:
- addi r27, r27, 0x1
- cmpwi r27, 0x4
- blt+ .loc_0x5C
-
- .loc_0xFC:
- cmplwi r21, 0
- beq- .loc_0x11C
- addi r12, r21, 0
- mtlr r12
- addi r3, r23, 0
- addi r4, r22, 0
- addi r5, r31, 0
- blrl
-
- .loc_0x11C:
- lis r3, 0xCC00
- addi r4, r3, 0x6400
- lwz r5, 0x6438(r3)
- rlwinm r0,r23,3,0,28
- lis r3, 0xF00
- sraw r0, r3, r0
- and r5, r5, r0
- rlwinm r0,r23,2,0,29
- stw r5, 0x38(r4)
- add r6, r29, r0
- lwzu r0, 0x58(r6)
- cmplwi r0, 0x80
- bne- .loc_0x1C0
- rlwinm r0,r23,5,0,26
- lwzx r0, r28, r0
- li r3, 0x1
- cmpwi r0, -0x1
- bne- .loc_0x174
- lwz r0, 0x44(r29)
- cmpw r0, r23
- beq- .loc_0x174
- li r3, 0
-
- .loc_0x174:
- cmpwi r3, 0
- bne- .loc_0x1C0
- lis r3, 0x8000
- lwz r0, 0xF8(r3)
- lis r3, 0x431C
- lis r4, 0x800F
- rlwinm r0,r0,30,2,31
- subi r3, r3, 0x217D
- mulhwu r0, r3, r0
- rlwinm r0,r0,17,15,31
- mulli r0, r0, 0x41
- addi r8, r4, 0x6054
- rlwinm r10,r0,29,3,31
- addi r3, r23, 0
- subi r4, r13, 0x6FE0
- li r5, 0x1
- li r7, 0x3
- li r9, 0
- bl 0xAD8
-
- .loc_0x1C0:
- rlwinm r3,r24,0,3,4
- subis r0, r3, 0x1800
- cmplwi r0, 0
- bne- .loc_0x330
- bl -0x23198
- lwz r0, 0x48(r29)
- addi r23, r28, 0x1E0
- addi r24, r29, 0x48
- addi r22, r23, 0
- addi r21, r3, 0x1
- rlwinm r26,r0,16,22,31
- li r25, 0
-
- .loc_0x1F0:
- mr r3, r25
- bl 0x87C
- cmpwi r3, 0
- beq- .loc_0x204
- stw r21, 0x0(r22)
-
- .loc_0x204:
- addi r25, r25, 0x1
- cmpwi r25, 0x4
- addi r22, r22, 0x4
- blt+ .loc_0x1F0
- lwz r5, 0x0(r24)
- lis r3, 0x8000
- li r0, 0x18
- srw r0, r3, r0
- and. r0, r5, r0
- rlwinm r6,r26,31,1,31
- beq- .loc_0x250
- lwz r0, 0x0(r23)
- cmplwi r0, 0
- beq- .loc_0x330
- lwz r0, 0x0(r23)
- add r0, r6, r0
- cmplw r0, r21
- bge- .loc_0x250
- b .loc_0x330
-
- .loc_0x250:
- li r0, 0x19
- srw r0, r3, r0
- and. r0, r5, r0
- addi r4, r23, 0x4
- beq- .loc_0x284
- lwz r0, 0x0(r4)
- cmplwi r0, 0
- beq- .loc_0x330
- lwz r0, 0x0(r4)
- add r0, r6, r0
- cmplw r0, r21
- bge- .loc_0x284
- b .loc_0x330
-
- .loc_0x284:
- li r0, 0x1A
- srw r0, r3, r0
- and. r0, r5, r0
- addi r4, r4, 0x4
- beq- .loc_0x2B8
- lwz r0, 0x0(r4)
- cmplwi r0, 0
- beq- .loc_0x330
- lwz r0, 0x0(r4)
- add r0, r6, r0
- cmplw r0, r21
- bge- .loc_0x2B8
- b .loc_0x330
-
- .loc_0x2B8:
- li r0, 0x1B
- srw r0, r3, r0
- and. r0, r5, r0
- addi r4, r4, 0x4
- beq- .loc_0x2EC
- lwz r0, 0x0(r4)
- cmplwi r0, 0
- beq- .loc_0x330
- lwz r0, 0x0(r4)
- add r0, r6, r0
- cmplw r0, r21
- bge- .loc_0x2EC
- b .loc_0x330
-
- .loc_0x2EC:
- li r22, 0
- stw r22, 0x0(r23)
- addi r21, r28, 0x1A0
- stw r22, 0x1E4(r28)
- stw r22, 0x1E8(r28)
- stw r22, 0x1EC(r28)
-
- .loc_0x304:
- lwz r12, 0x0(r21)
- cmplwi r12, 0
- beq- .loc_0x320
- mtlr r12
- addi r3, r30, 0
- addi r4, r31, 0
- blrl
-
- .loc_0x320:
- addi r22, r22, 0x1
- cmpwi r22, 0x4
- addi r21, r21, 0x4
- blt+ .loc_0x304
-
- .loc_0x330:
- lmw r21, 0x1C(r1)
- lwz r0, 0x4C(r1)
- addi r1, r1, 0x48
- mtlr r0
- blr
- */
+ u32 reg;
+
+ reg = __SIRegs[SI_CC_STAT];
+
+ if ((reg & 0xc0000000) == 0xc0000000) {
+ s32 chan;
+ u32 sr;
+ SICallback callback;
+
+ chan = Si.chan;
+ sr = CompleteTransfer();
+ callback = Si.callback;
+ Si.callback = 0;
+
+ SITransferNext(chan);
+
+ if (callback) {
+ callback(chan, sr, context);
+ }
+
+ sr = __SIRegs[SI_STAT];
+ sr &= 0xf000000 >> (8 * chan);
+ __SIRegs[SI_STAT] = sr;
+
+ if (Type[chan] == SI_ERROR_BUSY && !SIIsChanBusy(chan)) {
+ static u32 cmdTypeAndStatus = 0 << 24;
+ SITransfer(chan, &cmdTypeAndStatus, 1, &Type[chan], 3, GetTypeCallback, OSMicrosecondsToTicks(65));
+ }
+ }
+
+ if ((reg & 0x18000000) == 0x18000000) {
+
+ int i;
+ u32 vcount;
+ u32 x;
+
+ vcount = VIGetCurrentLine() + 1;
+ x = (Si.poll & 0x03ff0000) >> 16;
+
+ for (i = 0; i < SI_MAX_CHAN; ++i) {
+ if (SIGetResponseRaw(i)) {
+ InputBufferVcount[i] = vcount;
+ }
+ }
+
+ for (i = 0; i < SI_MAX_CHAN; ++i) {
+ if (!(Si.poll & (SI_CHAN0_BIT >> (31 - 7 + i)))) {
+ continue;
+ }
+
+ if (InputBufferVcount[i] == 0 || InputBufferVcount[i] + (x / 2) < vcount) {
+ return;
+ }
+ }
+
+ for (i = 0; i < SI_MAX_CHAN; ++i) {
+ InputBufferVcount[i] = 0;
+ }
+
+ for (i = 0; i < 4; ++i) {
+ if (RDSTHandler[i]) {
+ RDSTHandler[i](interrupt, context);
+ }
+ }
+ }
}
/*
@@ -568,57 +219,32 @@ static void SIInterruptHandler(void)
* Address: 800F5598
* Size: 000098
*/
-static void SIEnablePollingInterrupt(void)
+static BOOL SIEnablePollingInterrupt(BOOL doEnable)
{
- /*
- .loc_0x0:
- mflr r0
- lis r4, 0x804F
- stw r0, 0x4(r1)
- stwu r1, -0x30(r1)
- stw r31, 0x2C(r1)
- addi r31, r4, 0x7180
- stw r30, 0x28(r1)
- stw r29, 0x24(r1)
- addi r29, r3, 0
- bl -0x6984
- lis r4, 0xCC00
- lwzu r5, 0x6434(r4)
- rlwinm. r0,r5,0,4,4
- beq- .loc_0x40
- li r30, 0x1
- b .loc_0x44
-
- .loc_0x40:
- li r30, 0
-
- .loc_0x44:
- cmpwi r29, 0
- beq- .loc_0x68
- li r0, 0
- stw r0, 0x1E0(r31)
- oris r5, r5, 0x800
- stw r0, 0x1E4(r31)
- stw r0, 0x1E8(r31)
- stw r0, 0x1EC(r31)
- b .loc_0x6C
-
- .loc_0x68:
- rlwinm r5,r5,0,5,3
-
- .loc_0x6C:
- rlwinm r5,r5,0,1,30
- stw r5, 0x0(r4)
- bl -0x69AC
- mr r3, r30
- lwz r0, 0x34(r1)
- lwz r31, 0x2C(r1)
- lwz r30, 0x28(r1)
- lwz r29, 0x24(r1)
- addi r1, r1, 0x30
- mtlr r0
- blr
- */
+ BOOL enabled;
+ BOOL rc;
+ u32 reg;
+ int i;
+
+ enabled = OSDisableInterrupts();
+ reg = __SIRegs[SI_CC_STAT];
+ rc = (reg & 0x08000000) ? TRUE : FALSE;
+
+ if (doEnable) {
+ reg |= 0x08000000;
+ for (i = 0; i < SI_MAX_CHAN; ++i) {
+ InputBufferVcount[i] = 0;
+ }
+
+ } else {
+ reg &= ~0x08000000;
+ }
+
+ reg &= ~0x80000001;
+ __SIRegs[SI_CC_STAT] = reg;
+
+ OSRestoreInterrupts(enabled);
+ return rc;
}
/*
@@ -628,70 +254,29 @@ static void SIEnablePollingInterrupt(void)
*/
BOOL SIRegisterPollingHandler(__OSInterruptHandler handler)
{
- /*
- .loc_0x0:
- mflr r0
- stw r0, 0x4(r1)
- stwu r1, -0x18(r1)
- stw r31, 0x14(r1)
- stw r30, 0x10(r1)
- mr r30, r3
- bl -0x6A10
- lis r4, 0x804F
- li r0, 0x4
- addi r4, r4, 0x7320
- mtctr r0
- addi r31, r3, 0
- addi r3, r4, 0
-
- .loc_0x34:
- lwz r0, 0x0(r3)
- cmplw r0, r30
- bne- .loc_0x50
- mr r3, r31
- bl -0x6A14
- li r3, 0x1
- b .loc_0xB4
-
- .loc_0x50:
- addi r3, r3, 0x4
- bdnz+ .loc_0x34
- li r0, 0x4
- mtctr r0
- li r5, 0
-
- .loc_0x64:
- lwz r0, 0x0(r4)
- cmplwi r0, 0
- bne- .loc_0x9C
- lis r3, 0x804F
- rlwinm r4,r5,2,0,29
- addi r0, r3, 0x7320
- add r3, r0, r4
- stw r30, 0x0(r3)
- li r3, 0x1
- bl -0x120
- mr r3, r31
- bl -0x6A60
- li r3, 0x1
- b .loc_0xB4
-
- .loc_0x9C:
- addi r4, r4, 0x4
- addi r5, r5, 0x1
- bdnz+ .loc_0x64
- mr r3, r31
- bl -0x6A7C
- li r3, 0
-
- .loc_0xB4:
- lwz r0, 0x1C(r1)
- lwz r31, 0x14(r1)
- lwz r30, 0x10(r1)
- addi r1, r1, 0x18
- mtlr r0
- blr
- */
+ BOOL enabled;
+ int i;
+
+ enabled = OSDisableInterrupts();
+
+ for (i = 0; i < 4; ++i) {
+ if (RDSTHandler[i] == handler) {
+ OSRestoreInterrupts(enabled);
+ return TRUE;
+ }
+ }
+
+ for (i = 0; i < 4; ++i) {
+ if (RDSTHandler[i] == 0) {
+ RDSTHandler[i] = handler;
+ SIEnablePollingInterrupt(TRUE);
+ OSRestoreInterrupts(enabled);
+ return TRUE;
+ }
+ }
+
+ OSRestoreInterrupts(enabled);
+ return FALSE;
}
/*
@@ -701,80 +286,31 @@ BOOL SIRegisterPollingHandler(__OSInterruptHandler handler)
*/
BOOL SIUnregisterPollingHandler(__OSInterruptHandler handler)
{
- /*
- .loc_0x0:
- mflr r0
- stw r0, 0x4(r1)
- stwu r1, -0x18(r1)
- stw r31, 0x14(r1)
- stw r30, 0x10(r1)
- mr r30, r3
- bl -0x6ADC
- lis r4, 0x804F
- li r0, 0x4
- addi r5, r4, 0x7320
- mtctr r0
- addi r31, r3, 0
- addi r3, r5, 0
- li r4, 0
-
- .loc_0x38:
- lwz r0, 0x0(r3)
- cmplw r0, r30
- bne- .loc_0xC4
- lis r3, 0x804F
- rlwinm r4,r4,2,0,29
- addi r0, r3, 0x7320
- add r3, r0, r4
- li r0, 0
- stw r0, 0x0(r3)
- li r4, 0
- lwz r0, 0x0(r5)
- cmplwi r0, 0
- bne- .loc_0xA4
- addi r3, r5, 0x4
- lwz r0, 0x4(r5)
- li r4, 0x1
- cmplwi r0, 0
- bne- .loc_0xA4
- lwzu r0, 0x4(r3)
- li r4, 0x2
- cmplwi r0, 0
- bne- .loc_0xA4
- lwz r0, 0x4(r3)
- li r4, 0x3
- cmplwi r0, 0
- bne- .loc_0xA4
- li r4, 0x4
-
- .loc_0xA4:
- cmpwi r4, 0x4
- bne- .loc_0xB4
- li r3, 0
- bl -0x214
-
- .loc_0xB4:
- mr r3, r31
- bl -0x6B54
- li r3, 0x1
- b .loc_0xDC
-
- .loc_0xC4:
- addi r3, r3, 0x4
- addi r4, r4, 0x1
- bdnz+ .loc_0x38
- mr r3, r31
- bl -0x6B70
- li r3, 0
-
- .loc_0xDC:
- lwz r0, 0x1C(r1)
- lwz r31, 0x14(r1)
- lwz r30, 0x10(r1)
- addi r1, r1, 0x18
- mtlr r0
- blr
- */
+ BOOL enabled;
+ int i;
+
+ enabled = OSDisableInterrupts();
+
+ for (i = 0; i < 4; ++i) {
+ if (RDSTHandler[i] == handler) {
+ RDSTHandler[i] = 0;
+ for (i = 0; i < 4; ++i) {
+ if (RDSTHandler[i]) {
+ break;
+ }
+ }
+
+ if (i == 4) {
+ SIEnablePollingInterrupt(FALSE);
+ }
+
+ OSRestoreInterrupts(enabled);
+ return TRUE;
+ }
+ }
+
+ OSRestoreInterrupts(enabled);
+ return FALSE;
}
/*
@@ -784,56 +320,26 @@ BOOL SIUnregisterPollingHandler(__OSInterruptHandler handler)
*/
void SIInit(void)
{
- /*
- .loc_0x0:
- mflr r0
- lis r4, 0x804F
- stw r0, 0x4(r1)
- stwu r1, -0x10(r1)
- stw r31, 0xC(r1)
- addi r31, r4, 0x7180
- lwz r3, -0x7C60(r13)
- bl -0x9D84
- li r5, -0x1
- stw r5, 0x60(r31)
- lis r3, 0x804B
- subi r4, r3, 0x6104
- stw r5, 0x40(r31)
- li r0, 0
- li r3, 0
- stw r5, 0x20(r31)
- stw r5, 0x0(r31)
- stw r0, 0x4(r4)
- bl 0xF24
- lis r3, 0xCC00
-
- .loc_0x50:
- addi r4, r3, 0x6400
- lwzu r0, 0x34(r4)
- rlwinm. r0,r0,0,31,31
- bne+ .loc_0x50
- lis r0, 0x8000
- lis r3, 0x800F
- stw r0, 0x0(r4)
- addi r4, r3, 0x5254
- li r3, 0x14
- bl -0x6BE0
- li r3, 0x800
- bl -0x67E4
- li r3, 0
- bl 0xA78
- li r3, 0x1
- bl 0xA70
- li r3, 0x2
- bl 0xA68
- li r3, 0x3
- bl 0xA60
- lwz r0, 0x14(r1)
- lwz r31, 0xC(r1)
- addi r1, r1, 0x10
- mtlr r0
- blr
- */
+ OSRegisterVersion(__SIVersion);
+
+ Packet[0].chan = Packet[1].chan = Packet[2].chan = Packet[3].chan = -1;
+
+ Si.poll = 0;
+ SISetSamplingRate(0);
+
+ while (__SIRegs[SI_CC_STAT] & 1) {
+ ;
+ }
+
+ __SIRegs[SI_CC_STAT] = 0x80000000;
+
+ __OSSetInterruptHandler(__OS_INTERRUPT_PI_SI, SIInterruptHandler);
+ __OSUnmaskInterrupts(OS_INTERRUPTMASK_PI_SI);
+
+ SIGetType(0);
+ SIGetType(1);
+ SIGetType(2);
+ SIGetType(3);
}
/*
@@ -841,168 +347,46 @@ void SIInit(void)
* Address: 800F58A4
* Size: 00020C
*/
-static void __SITransfer(void)
+static BOOL __SITransfer(int chan, void* output, u32 outputBytes, void* input, u32 inputBytes, SICallback callback)
{
- /*
- .loc_0x0:
- mflr r0
- lis r9, 0x804B
- stw r0, 0x4(r1)
- stwu r1, -0x48(r1)
- stmw r25, 0x2C(r1)
- addi r26, r3, 0
- addi r27, r4, 0
- addi r28, r5, 0
- addi r29, r6, 0
- addi r30, r7, 0
- addi r31, r8, 0
- subi r25, r9, 0x6148
- bl -0x6C9C
- lwz r0, 0x44(r25)
- cmpwi r0, -0x1
- beq- .loc_0x4C
- bl -0x6C84
- li r3, 0
- b .loc_0x1F8
-
- .loc_0x4C:
- lis r6, 0xCC00
- rlwinm r0,r26,3,0,28
- lwz r7, 0x6438(r6)
- lis r4, 0xF00
- sraw r0, r4, r0
- and r7, r7, r0
- stw r7, 0x6438(r6)
- addi r0, r28, 0x3
- rlwinm r4,r0,30,2,31
- stw r26, 0x44(r25)
- cmplwi r4, 0
- li r5, 0
- stw r31, 0x54(r25)
- stw r30, 0x4C(r25)
- stw r29, 0x50(r25)
- ble- .loc_0x12C
- cmplwi r4, 0x8
- subi r7, r4, 0x8
- ble- .loc_0x1E0
- addi r0, r7, 0x7
- rlwinm r0,r0,29,3,31
- cmplwi r7, 0
- mtctr r0
- addi r7, r27, 0
- addi r6, r6, 0x6400
- ble- .loc_0x1E0
-
- .loc_0xB4:
- lwz r0, 0x0(r7)
- addi r5, r5, 0x8
- stw r0, 0x80(r6)
- lwz r0, 0x4(r7)
- stw r0, 0x84(r6)
- lwz r0, 0x8(r7)
- stw r0, 0x88(r6)
- lwz r0, 0xC(r7)
- stw r0, 0x8C(r6)
- lwz r0, 0x10(r7)
- stw r0, 0x90(r6)
- lwz r0, 0x14(r7)
- stw r0, 0x94(r6)
- lwz r0, 0x18(r7)
- stw r0, 0x98(r6)
- lwz r0, 0x1C(r7)
- addi r7, r7, 0x20
- stw r0, 0x9C(r6)
- addi r6, r6, 0x20
- bdnz+ .loc_0xB4
- b .loc_0x1E0
-
- .loc_0x108:
- sub r0, r4, r5
- cmplw r5, r4
- mtctr r0
- bge- .loc_0x12C
-
- .loc_0x118:
- lwz r0, 0x0(r6)
- addi r6, r6, 0x4
- stw r0, 0x80(r7)
- addi r7, r7, 0x4
- bdnz+ .loc_0x118
-
- .loc_0x12C:
- lis r4, 0xCC00
- addi r6, r4, 0x6400
- lwzu r0, 0x34(r6)
- li r4, 0x1
- stw r0, 0x24(r1)
- cmplwi r31, 0
- lbz r0, 0x24(r1)
- rlwimi r0,r4,7,24,24
- stb r0, 0x24(r1)
- beq- .loc_0x158
- b .loc_0x15C
-
- .loc_0x158:
- li r4, 0
-
- .loc_0x15C:
- lbz r0, 0x24(r1)
- rlwimi r0,r4,6,25,25
- cmplwi r28, 0x80
- stb r0, 0x24(r1)
- bne- .loc_0x178
- li r0, 0
- b .loc_0x17C
-
- .loc_0x178:
- mr r0, r28
-
- .loc_0x17C:
- rlwinm r4,r0,0,24,31
- lbz r0, 0x25(r1)
- rlwimi r0,r4,0,25,31
- cmplwi r30, 0x80
- stb r0, 0x25(r1)
- bne- .loc_0x19C
- li r0, 0
- b .loc_0x1A0
-
- .loc_0x19C:
- mr r0, r30
-
- .loc_0x1A0:
- rlwinm r4,r0,0,24,31
- lbz r0, 0x26(r1)
- rlwimi r0,r4,0,25,31
- stb r0, 0x26(r1)
- li r4, 0x1
- lbz r0, 0x27(r1)
- rlwimi r0,r26,1,29,30
- stb r0, 0x27(r1)
- lbz r0, 0x27(r1)
- rlwimi r0,r4,0,31,31
- stb r0, 0x27(r1)
- lwz r0, 0x24(r1)
- stw r0, 0x0(r6)
- bl -0x6E18
- li r3, 0x1
- b .loc_0x1F8
-
- .loc_0x1E0:
- lis r6, 0xCC00
- rlwinm r0,r5,2,0,29
- addi r7, r6, 0x6400
- add r6, r27, r0
- add r7, r7, r0
- b .loc_0x108
-
- .loc_0x1F8:
- lmw r25, 0x2C(r1)
- lwz r0, 0x4C(r1)
- addi r1, r1, 0x48
- mtlr r0
- blr
- */
+ BOOL enabled;
+ u32 rLen;
+ u32 i;
+ u32 sr;
+ SIComm comcsr;
+
+ enabled = OSDisableInterrupts();
+ if (Si.chan != -1) {
+ OSRestoreInterrupts(enabled);
+ return FALSE;
+ }
+
+ sr = __SIRegs[SI_STAT];
+ sr &= (0xF000000) >> (8 * chan);
+ __SIRegs[SI_STAT] = sr;
+
+ Si.chan = chan;
+ Si.callback = callback;
+ Si.inputBytes = inputBytes;
+ Si.input = input;
+
+ rLen = ROUND(outputBytes, 4) / 4;
+ for (i = 0; i < rLen; i++) {
+ __SIRegs[SI_IO_BUFFER + i] = ((u32*)output)[i];
+ }
+
+ comcsr.val = __SIRegs[SI_CC_STAT];
+ comcsr.flags.tcint = 1;
+ comcsr.flags.tcintmsk = callback ? 1 : 0;
+ comcsr.flags.outlngth = (outputBytes == SI_MAX_COMCSR_OUTLNGTH) ? 0 : outputBytes;
+ comcsr.flags.inlngth = (inputBytes == SI_MAX_COMCSR_INLNGTH) ? 0 : inputBytes;
+ comcsr.flags.channel = chan;
+ comcsr.flags.tstart = 1;
+ __SIRegs[SI_CC_STAT] = comcsr.val;
+
+ OSRestoreInterrupts(enabled);
+
+ return TRUE;
}
/*
@@ -1010,9 +394,23 @@ static void __SITransfer(void)
* Address: ........
* Size: 000108
*/
-void SISync(void)
+u32 SISync(void)
{
- // UNUSED FUNCTION
+ BOOL enabled;
+ u32 sr;
+
+ while (__SIRegs[SI_CC_STAT] & 1) {
+ ;
+ }
+
+ enabled = OSDisableInterrupts();
+ sr = CompleteTransfer();
+
+ SITransferNext(SI_MAX_CHAN);
+
+ OSRestoreInterrupts(enabled);
+
+ return sr;
}
/*
@@ -1022,42 +420,23 @@ void SISync(void)
*/
u32 SIGetStatus(int chan)
{
- /*
- .loc_0x0:
- mflr r0
- stw r0, 0x4(r1)
- stwu r1, -0x18(r1)
- stw r31, 0x14(r1)
- stw r30, 0x10(r1)
- mr r30, r3
- bl -0x6E90
- lis r4, 0xCC00
- subfic r0, r30, 0x3
- lwz r31, 0x6438(r4)
- rlwinm r0,r0,3,0,28
- srw r31, r31, r0
- rlwinm. r0,r31,0,28,28
- beq- .loc_0x5C
- lis r4, 0x804B
- rlwinm r5,r30,2,0,29
- subi r0, r4, 0x60F0
- add r4, r0, r5
- lwz r0, 0x0(r4)
- rlwinm. r0,r0,0,24,24
- bne- .loc_0x5C
- li r0, 0x8
- stw r0, 0x0(r4)
-
- .loc_0x5C:
- bl -0x6EAC
- mr r3, r31
- lwz r0, 0x1C(r1)
- lwz r31, 0x14(r1)
- lwz r30, 0x10(r1)
- addi r1, r1, 0x18
- mtlr r0
- blr
- */
+ BOOL enabled;
+ u32 sr;
+ int chanShift;
+
+ enabled = OSDisableInterrupts();
+
+ sr = __SIRegs[SI_STAT];
+ chanShift = 8 * (SI_MAX_CHAN - 1 - chan);
+ sr >>= chanShift;
+ if (sr & SI_ERROR_NO_RESPONSE) {
+ if (!(Type[chan] & SI_ERROR_BUSY)) {
+ Type[chan] = SI_ERROR_NO_RESPONSE;
+ }
+ }
+
+ OSRestoreInterrupts(enabled);
+ return sr;
}
/*
@@ -1065,43 +444,21 @@ u32 SIGetStatus(int chan)
* Address: 800F5B2C
* Size: 000014
*/
-void SISetCommand(int chan, u32 command)
-{
- /*
- .loc_0x0:
- mulli r0, r3, 0xC
- lis r3, 0xCC00
- addi r3, r3, 0x6400
- stwx r4, r3, r0
- blr
- */
-}
+void SISetCommand(int chan, u32 command) { __SIRegs[3 * chan] = command; }
/*
* --INFO--
* Address: ........
* Size: 000014
*/
-void SIGetCommand(void)
-{
- // UNUSED FUNCTION
-}
+u32 SIGetCommand(int chan) { return __SIRegs[3 * chan]; }
/*
* --INFO--
* Address: 800F5B40
* Size: 000010
*/
-void SITransferCommands(void)
-{
- /*
- .loc_0x0:
- lis r3, 0xCC00
- lis r0, 0x8000
- stw r0, 0x6438(r3)
- blr
- */
-}
+void SITransferCommands(void) { __SIRegs[SI_STAT] = 0x80000000; }
/*
* --INFO--
@@ -1110,36 +467,21 @@ void SITransferCommands(void)
*/
u32 SISetXY(u32 x, u32 y)
{
- /*
- .loc_0x0:
- mflr r0
- stw r0, 0x4(r1)
- rlwinm r0,r4,8,0,23
- stwu r1, -0x18(r1)
- stw r31, 0x14(r1)
- rlwinm r31,r3,16,0,15
- or r31, r31, r0
- bl -0x6F34
- lis r4, 0x804B
- subi r4, r4, 0x6104
- lwz r0, 0x4(r4)
- addi r5, r4, 0x4
- lis r4, 0xCC00
- rlwinm r0,r0,0,24,5
- stw r0, 0x0(r5)
- lwz r0, 0x0(r5)
- or r0, r0, r31
- stw r0, 0x0(r5)
- lwz r31, 0x0(r5)
- stw r31, 0x6430(r4)
- bl -0x6F40
- mr r3, r31
- lwz r0, 0x1C(r1)
- lwz r31, 0x14(r1)
- addi r1, r1, 0x18
- mtlr r0
- blr
- */
+ u32 poll;
+ BOOL enabled;
+
+ poll = x << 16;
+ poll |= y << 8;
+
+ enabled = OSDisableInterrupts();
+
+ Si.poll &= ~(0x03FF0000 | 0x0000FF00);
+ Si.poll |= poll;
+ poll = Si.poll;
+ __SIRegs[SI_POLL] = poll;
+
+ OSRestoreInterrupts(enabled);
+ return poll;
}
/*
@@ -1149,52 +491,35 @@ u32 SISetXY(u32 x, u32 y)
*/
u32 SIEnablePolling(u32 poll)
{
- /*
- .loc_0x0:
- mflr r0
- stw r0, 0x4(r1)
- stwu r1, -0x18(r1)
- stw r31, 0x14(r1)
- mr. r31, r3
- bne- .loc_0x28
- lis r3, 0x804B
- subi r3, r3, 0x6104
- lwz r3, 0x4(r3)
- b .loc_0x88
-
- .loc_0x28:
- bl -0x6FAC
- lis r4, 0x804B
- subi r4, r4, 0x6104
- rlwinm r31,r31,8,24,31
- lwz r0, 0x4(r4)
- addi r5, r4, 0x4
- rlwinm r4,r31,28,28,31
- andc r0, r0, r4
- stw r0, 0x0(r5)
- oris r0, r4, 0x3FF
- ori r0, r0, 0xFFF0
- and r31, r31, r0
- lwz r0, 0x0(r5)
- rlwinm r31,r31,0,24,5
- or r0, r0, r31
- stw r0, 0x0(r5)
- lis r4, 0xCC00
- addi r4, r4, 0x6400
- lwz r31, 0x0(r5)
- lis r0, 0x8000
- stw r0, 0x38(r4)
- stw r31, 0x30(r4)
- bl -0x6FDC
- mr r3, r31
-
- .loc_0x88:
- lwz r0, 0x1C(r1)
- lwz r31, 0x14(r1)
- addi r1, r1, 0x18
- mtlr r0
- blr
- */
+ BOOL enabled;
+ u32 en;
+
+ if (poll == 0) {
+ return Si.poll;
+ }
+
+ enabled = OSDisableInterrupts();
+
+ poll >>= (31 - 7);
+ en = poll & 0xF0;
+
+ poll &= (en >> 4) | 0x03FFFFF0;
+
+ poll &= ~0x03FFFF00;
+
+ Si.poll &= ~(en >> 4);
+
+ Si.poll |= poll;
+
+ poll = Si.poll;
+
+ SITransferCommands();
+
+ __SIRegs[SI_POLL] = poll;
+
+ OSRestoreInterrupts(enabled);
+
+ return poll;
}
/*
@@ -1204,40 +529,24 @@ u32 SIEnablePolling(u32 poll)
*/
u32 SIDisablePolling(u32 poll)
{
- /*
- .loc_0x0:
- mflr r0
- stw r0, 0x4(r1)
- stwu r1, -0x18(r1)
- stw r31, 0x14(r1)
- mr. r31, r3
- bne- .loc_0x28
- lis r3, 0x804B
- subi r3, r3, 0x6104
- lwz r3, 0x4(r3)
- b .loc_0x58
-
- .loc_0x28:
- bl -0x7048
- lis r4, 0x804B
- subi r4, r4, 0x6104
- lwz r0, 0x4(r4)
- rlwinm r31,r31,8,24,27
- addi r5, r4, 0x4
- lis r4, 0xCC00
- andc r31, r0, r31
- stw r31, 0x6430(r4)
- stw r31, 0x0(r5)
- bl -0x7048
- mr r3, r31
-
- .loc_0x58:
- lwz r0, 0x1C(r1)
- lwz r31, 0x14(r1)
- addi r1, r1, 0x18
- mtlr r0
- blr
- */
+ BOOL enabled;
+
+ if (poll == 0) {
+ return Si.poll;
+ }
+
+ enabled = OSDisableInterrupts();
+
+ poll >>= (31 - 7);
+ poll &= 0xF0;
+
+ poll = Si.poll & ~poll;
+
+ __SIRegs[SI_POLL] = poll;
+ Si.poll = poll;
+
+ OSRestoreInterrupts(enabled);
+ return poll;
}
/*
@@ -1245,70 +554,18 @@ u32 SIDisablePolling(u32 poll)
* Address: 800F5CC4
* Size: 0000D4
*/
-static void SIGetResponseRaw(void)
+static BOOL SIGetResponseRaw(int chan)
{
- /*
- .loc_0x0:
- mflr r0
- lis r4, 0x804F
- stw r0, 0x4(r1)
- stwu r1, -0x28(r1)
- stw r31, 0x24(r1)
- addi r31, r4, 0x7180
- stw r30, 0x20(r1)
- addi r30, r3, 0
- stw r29, 0x1C(r1)
- bl -0x70B0
- lis r4, 0xCC00
- subfic r0, r30, 0x3
- lwz r29, 0x6438(r4)
- rlwinm r0,r0,3,0,28
- srw r29, r29, r0
- rlwinm. r0,r29,0,28,28
- beq- .loc_0x68
- lis r4, 0x804B
- rlwinm r5,r30,2,0,29
- subi r0, r4, 0x60F0
- add r4, r0, r5
- lwz r0, 0x0(r4)
- rlwinm. r0,r0,0,24,24
- bne- .loc_0x68
- li r0, 0x8
- stw r0, 0x0(r4)
-
- .loc_0x68:
- bl -0x70CC
- rlwinm. r0,r29,0,26,26
- beq- .loc_0xB4
- mulli r4, r30, 0xC
- lis r3, 0xCC00
- addi r0, r3, 0x6400
- add r3, r0, r4
- rlwinm r4,r30,3,0,28
- lwz r0, 0x4(r3)
- add r6, r31, r4
- stw r0, 0x1C0(r6)
- rlwinm r0,r30,2,0,29
- add r4, r31, r0
- lwz r5, 0x8(r3)
- li r0, 0x1
- li r3, 0x1
- stw r5, 0x1C4(r6)
- stw r0, 0x1B0(r4)
- b .loc_0xB8
-
- .loc_0xB4:
- li r3, 0
-
- .loc_0xB8:
- lwz r0, 0x2C(r1)
- lwz r31, 0x24(r1)
- lwz r30, 0x20(r1)
- lwz r29, 0x1C(r1)
- addi r1, r1, 0x28
- mtlr r0
- blr
- */
+ u32 sr;
+
+ sr = SIGetStatus(chan);
+ if (sr & SI_ERROR_RDST) {
+ InputBuffer[chan][0] = __SIRegs[3 * chan + 1];
+ InputBuffer[chan][1] = __SIRegs[3 * chan + 2];
+ InputBufferValid[chan] = TRUE;
+ return TRUE;
+ }
+ return FALSE;
}
/*
@@ -1318,62 +575,19 @@ static void SIGetResponseRaw(void)
*/
BOOL SIGetResponse(int chan, void* data)
{
- /*
- .loc_0x0:
- mflr r0
- lis r5, 0x804F
- stw r0, 0x4(r1)
- stwu r1, -0x28(r1)
- stmw r27, 0x14(r1)
- addi r29, r3, 0
- addi r30, r4, 0
- addi r28, r5, 0x7180
- bl -0x7180
- addi r31, r3, 0
- addi r3, r29, 0
- bl -0x314
- rlwinm. r0,r3,0,26,26
- beq- .loc_0x70
- mulli r4, r29, 0xC
- lis r3, 0xCC00
- addi r0, r3, 0x6400
- add r4, r0, r4
- rlwinm r3,r29,3,0,28
- lwz r0, 0x4(r4)
- add r5, r28, r3
- stw r0, 0x1C0(r5)
- rlwinm r0,r29,2,0,29
- add r3, r28, r0
- lwz r4, 0x8(r4)
- li r0, 0x1
- stw r4, 0x1C4(r5)
- stw r0, 0x1B0(r3)
-
- .loc_0x70:
- rlwinm r0,r29,2,0,29
- add r3, r28, r0
- lwz r27, 0x1B0(r3)
- li r0, 0
- cmpwi r27, 0
- stw r0, 0x1B0(r3)
- beq- .loc_0xA4
- rlwinm r0,r29,3,0,28
- add r3, r28, r0
- lwz r0, 0x1C0(r3)
- stw r0, 0x0(r30)
- lwz r0, 0x1C4(r3)
- stw r0, 0x4(r30)
-
- .loc_0xA4:
- mr r3, r31
- bl -0x71E0
- mr r3, r27
- lmw r27, 0x14(r1)
- lwz r0, 0x2C(r1)
- addi r1, r1, 0x28
- mtlr r0
- blr
- */
+ BOOL rc;
+ BOOL enabled;
+
+ enabled = OSDisableInterrupts();
+ SIGetResponseRaw(chan);
+ rc = InputBufferValid[chan];
+ InputBufferValid[chan] = FALSE;
+ if (rc) {
+ ((u32*)data)[0] = InputBuffer[chan][0];
+ ((u32*)data)[1] = InputBuffer[chan][1];
+ }
+ OSRestoreInterrupts(enabled);
+ return rc;
}
/*
@@ -1381,48 +595,19 @@ BOOL SIGetResponse(int chan, void* data)
* Address: 800F5E5C
* Size: 00008C
*/
-static void AlarmHandler(void)
+static void AlarmHandler(OSAlarm* alarm, OSContext* context)
{
- /*
- .loc_0x0:
- mflr r0
- lis r4, 0x804F
- stw r0, 0x4(r1)
- addi r0, r4, 0x7200
- lis r4, 0x6666
- sub r0, r3, r0
- stwu r1, -0x20(r1)
- addi r3, r4, 0x6667
- mulhw r0, r3, r0
- stw r31, 0x1C(r1)
- srawi r0, r0, 0x4
- rlwinm r3,r0,1,31,31
- add r0, r0, r3
- lis r3, 0x804F
- rlwinm r4,r0,5,0,26
- addi r0, r3, 0x7180
- add r31, r0, r4
- lwz r3, 0x0(r31)
- cmpwi r3, -0x1
- beq- .loc_0x78
- lwz r4, 0x4(r31)
- lwz r5, 0x8(r31)
- lwz r6, 0xC(r31)
- lwz r7, 0x10(r31)
- lwz r8, 0x14(r31)
- bl -0x61C
- cmpwi r3, 0
- beq- .loc_0x78
- li r0, -0x1
- stw r0, 0x0(r31)
-
- .loc_0x78:
- lwz r0, 0x24(r1)
- lwz r31, 0x1C(r1)
- addi r1, r1, 0x20
- mtlr r0
- blr
- */
+ s32 chan;
+ SIPacket* packet;
+
+ chan = alarm - Alarm;
+ packet = &Packet[chan];
+ if (packet->chan != -1) {
+ if (__SITransfer(packet->chan, packet->output, packet->outputBytes, packet->input, packet->inputBytes, packet->callback)) {
+
+ packet->chan = -1;
+ }
+ }
}
/*
@@ -1432,114 +617,41 @@ static void AlarmHandler(void)
*/
BOOL SITransfer(int chan, void* output, u32 outputBytes, void* input, u32 inputBytes, SICallback callback, OSTime delay)
{
- /*
- .loc_0x0:
- mflr r0
- stw r0, 0x4(r1)
- stwu r1, -0x60(r1)
- stmw r19, 0x2C(r1)
- addi r24, r3, 0
- lis r3, 0x804F
- addi r23, r3, 0x7180
- rlwinm r0,r24,5,0,26
- addi r25, r4, 0
- addi r26, r5, 0
- addi r27, r6, 0
- addi r28, r7, 0
- addi r29, r8, 0
- addi r31, r9, 0
- addi r30, r10, 0
- add r22, r23, r0
- bl -0x72F0
- lwz r0, 0x0(r22)
- addi r21, r3, 0
- cmpwi r0, -0x1
- bne- .loc_0x64
- lis r3, 0x804B
- lwz r0, -0x6104(r3)
- cmpw r0, r24
- bne- .loc_0x74
-
- .loc_0x64:
- mr r3, r21
- bl -0x72F0
- li r3, 0
- b .loc_0x158
-
- .loc_0x74:
- bl -0x33AC
- li r0, 0
- xor r5, r30, r0
- xor r0, r31, r0
- or. r0, r5, r0
- bne- .loc_0x98
- addi r19, r4, 0
- addi r20, r3, 0
- b .loc_0xB0
-
- .loc_0x98:
- rlwinm r0,r24,3,0,28
- add r6, r23, r0
- lwz r5, 0x144(r6)
- lwz r0, 0x140(r6)
- addc r19, r30, r5
- adde r20, r31, r0
-
- .loc_0xB0:
- xoris r6, r3, 0x8000
- xoris r5, r20, 0x8000
- subc r0, r4, r19
- subfe r5, r5, r6
- subfe r5, r6, r6
- neg. r5, r5
- beq- .loc_0xF8
- mulli r0, r24, 0x28
- subc r30, r19, r4
- subfe r31, r3, r20
- lis r4, 0x800F
- add r3, r23, r0
- addi r7, r4, 0x5E5C
- addi r6, r30, 0
- addi r5, r31, 0
- addi r3, r3, 0x80
- bl -0xA26C
- b .loc_0x12C
-
- .loc_0xF8:
- addi r3, r24, 0
- addi r4, r25, 0
- addi r5, r26, 0
- addi r6, r27, 0
- addi r7, r28, 0
- addi r8, r29, 0
- bl -0x754
- cmpwi r3, 0
- beq- .loc_0x12C
- mr r3, r21
- bl -0x73A8
- li r3, 0x1
- b .loc_0x158
-
- .loc_0x12C:
- stw r24, 0x0(r22)
- mr r3, r21
- stw r25, 0x4(r22)
- stw r26, 0x8(r22)
- stw r27, 0xC(r22)
- stw r28, 0x10(r22)
- stw r29, 0x14(r22)
- stw r19, 0x1C(r22)
- stw r20, 0x18(r22)
- bl -0x73D8
- li r3, 0x1
-
- .loc_0x158:
- lmw r19, 0x2C(r1)
- lwz r0, 0x64(r1)
- addi r1, r1, 0x60
- mtlr r0
- blr
- */
+ BOOL enabled;
+ SIPacket* packet = &Packet[chan];
+ OSTime now;
+ OSTime fire;
+
+ enabled = OSDisableInterrupts();
+ if (packet->chan != -1 || Si.chan == chan) {
+ OSRestoreInterrupts(enabled);
+ return FALSE;
+ }
+
+ now = __OSGetSystemTime();
+ if (delay == 0) {
+ fire = now;
+ } else {
+ fire = XferTime[chan] + delay;
+ }
+ if (now < fire) {
+ delay = fire - now;
+ OSSetAlarm(&Alarm[chan], delay, AlarmHandler);
+ } else if (__SITransfer(chan, output, outputBytes, input, inputBytes, callback)) {
+ OSRestoreInterrupts(enabled);
+ return TRUE;
+ }
+
+ packet->chan = chan;
+ packet->output = output;
+ packet->outputBytes = outputBytes;
+ packet->input = input;
+ packet->inputBytes = inputBytes;
+ packet->callback = callback;
+ packet->fire = fire;
+
+ OSRestoreInterrupts(enabled);
+ return TRUE;
}
/*
@@ -1547,9 +659,18 @@ BOOL SITransfer(int chan, void* output, u32 outputBytes, void* input, u32 inputB
* Address: ........
* Size: 000078
*/
-void CallTypeAndStatusCallback(void)
+void CallTypeAndStatusCallback(int chan, u32 type)
{
- // UNUSED FUNCTION
+ SITypeAndStatusCallback callback;
+ int i;
+
+ for (i = 0; i < 4; ++i) {
+ callback = TypeCallback[chan][i];
+ if (callback) {
+ TypeCallback[chan][i] = 0;
+ callback(chan, type);
+ }
+ }
}
/*
@@ -1557,201 +678,69 @@ void CallTypeAndStatusCallback(void)
* Address: 800F6054
* Size: 000298
*/
-static void GetTypeCallback(void)
+static void GetTypeCallback(int chan, u32 error, OSContext* context)
{
- /*
- .loc_0x0:
- mflr r0
- stw r0, 0x4(r1)
- stwu r1, -0x30(r1)
- stmw r26, 0x18(r1)
- addi r27, r3, 0
- lis r3, 0x804B
- subi r0, r3, 0x60F0
- rlwinm r29,r27,2,0,29
- add r30, r0, r29
- lis r3, 0x804F
- addi r26, r4, 0
- addi r31, r3, 0x7180
- lwz r0, 0x0(r30)
- rlwinm r0,r0,0,25,23
- stw r0, 0x0(r30)
- lwz r0, 0x0(r30)
- or r0, r0, r26
- stw r0, 0x0(r30)
- bl -0x34EC
- rlwinm r0,r27,3,0,28
- add r5, r31, r0
- stw r4, 0x124(r5)
- lis r4, 0x8000
- rlwinm. r0,r26,0,28,31
- stw r3, 0x120(r5)
- srw r4, r4, r27
- lwz r3, -0x6FD8(r13)
- lwz r28, 0x0(r30)
- andc r0, r3, r4
- stw r0, -0x6FD8(r13)
- and r26, r3, r4
- bne- .loc_0xA0
- rlwinm r3,r28,0,3,4
- subis r0, r3, 0x800
- cmplwi r0, 0
- bne- .loc_0xA0
- rlwinm. r0,r28,0,0,0
- beq- .loc_0xA0
- rlwinm. r0,r28,0,5,5
- beq- .loc_0xF8
-
- .loc_0xA0:
- addi r3, r27, 0
- li r4, 0
- bl -0x4AFC
- rlwinm r0,r27,4,0,27
- lwz r30, 0x0(r30)
- add r31, r31, r0
- li r29, 0
- addi r28, r29, 0
- addi r31, r31, 0x160
-
- .loc_0xC4:
- lwz r12, 0x0(r31)
- cmplwi r12, 0
- beq- .loc_0xE4
- stw r28, 0x0(r31)
- mtlr r12
- addi r3, r27, 0
- addi r4, r30, 0
- blrl
-
- .loc_0xE4:
- addi r29, r29, 0x1
- cmpwi r29, 0x4
- addi r31, r31, 0x4
- blt+ .loc_0xC4
- b .loc_0x284
-
- .loc_0xF8:
- mr r3, r27
- bl -0x4BD4
- cmpwi r26, 0
- rlwinm r26,r3,8,8,23
- beq- .loc_0x15C
- rlwinm. r0,r26,0,11,11
- beq- .loc_0x15C
- lis r3, 0xD0
- subi r0, r3, 0x100
- and r0, r26, r0
- oris r0, r0, 0x4E10
- add r4, r31, r29
- stwu r0, 0x1F0(r4)
- li r0, 0x80
- lis r3, 0x800F
- stw r0, 0x0(r30)
- addi r8, r3, 0x6054
- addi r3, r27, 0
- addi r6, r30, 0
- li r5, 0x3
- li r7, 0x3
- li r10, 0
- li r9, 0
- bl -0x2C0
- b .loc_0x284
-
- .loc_0x15C:
- rlwinm. r0,r28,0,11,11
- beq- .loc_0x1D0
- lis r3, 0xD0
- subi r3, r3, 0x100
- and r0, r26, r3
- and r3, r28, r3
- cmplw r0, r3
- beq- .loc_0x23C
- rlwinm. r0,r26,0,11,11
- bne- .loc_0x194
- oris r26, r3, 0x10
- addi r3, r27, 0
- rlwinm r4,r26,24,16,31
- bl -0x4BE4
-
- .loc_0x194:
- oris r0, r26, 0x4E00
- add r4, r31, r29
- stwu r0, 0x1F0(r4)
- li r0, 0x80
- lis r3, 0x800F
- stw r0, 0x0(r30)
- addi r8, r3, 0x6054
- addi r3, r27, 0
- addi r6, r30, 0
- li r5, 0x3
- li r7, 0x3
- li r10, 0
- li r9, 0
- bl -0x334
- b .loc_0x284
-
- .loc_0x1D0:
- rlwinm. r0,r28,0,1,1
- beq- .loc_0x230
- lis r3, 0xD0
- subi r0, r3, 0x100
- and r28, r28, r0
- oris r28, r28, 0x10
- addi r3, r27, 0
- rlwinm r4,r28,24,16,31
- bl -0x4C44
- oris r0, r28, 0x4E00
- add r4, r31, r29
- stwu r0, 0x1F0(r4)
- li r0, 0x80
- lis r3, 0x800F
- stw r0, 0x0(r30)
- addi r8, r3, 0x6054
- addi r3, r27, 0
- addi r6, r30, 0
- li r5, 0x3
- li r7, 0x3
- li r10, 0
- li r9, 0
- bl -0x394
- b .loc_0x284
-
- .loc_0x230:
- addi r3, r27, 0
- li r4, 0
- bl -0x4C8C
-
- .loc_0x23C:
- rlwinm r0,r27,4,0,27
- lwz r30, 0x0(r30)
- add r31, r31, r0
- li r29, 0
- addi r28, r29, 0
- addi r31, r31, 0x160
-
- .loc_0x254:
- lwz r12, 0x0(r31)
- cmplwi r12, 0
- beq- .loc_0x274
- stw r28, 0x0(r31)
- mtlr r12
- addi r3, r27, 0
- addi r4, r30, 0
- blrl
-
- .loc_0x274:
- addi r29, r29, 0x1
- cmpwi r29, 0x4
- addi r31, r31, 0x4
- blt+ .loc_0x254
-
- .loc_0x284:
- lmw r26, 0x18(r1)
- lwz r0, 0x34(r1)
- addi r1, r1, 0x30
- mtlr r0
- blr
- */
+ static u32 cmdFixDevice[SI_MAX_CHAN];
+ u32 type;
+ u32 chanBit;
+ BOOL fix;
+ u32 id;
+
+ Type[chan] &= ~SI_ERROR_BUSY;
+ Type[chan] |= error;
+ TypeTime[chan] = __OSGetSystemTime();
+
+ type = Type[chan];
+
+ chanBit = SI_CHAN0_BIT >> chan;
+ fix = (BOOL)(__PADFixBits & chanBit);
+ __PADFixBits &= ~chanBit;
+
+ if ((error & (SI_ERROR_UNDER_RUN | SI_ERROR_OVER_RUN | SI_ERROR_NO_RESPONSE | SI_ERROR_COLLISION))
+ || (type & SI_TYPE_MASK) != SI_TYPE_DOLPHIN || !(type & SI_GC_WIRELESS) || (type & SI_WIRELESS_IR)) {
+ OSSetWirelessID(chan, 0);
+ CallTypeAndStatusCallback(chan, Type[chan]);
+ return;
+ }
+
+ id = (u32)(OSGetWirelessID(chan) << 8);
+
+ if (fix && (id & SI_WIRELESS_FIX_ID)) {
+ cmdFixDevice[chan] = 0x4Eu << 24 | (id & SI_WIRELESS_TYPE_ID) | SI_WIRELESS_FIX_ID;
+ Type[chan] = SI_ERROR_BUSY;
+ SITransfer(chan, &cmdFixDevice[chan], 3, &Type[chan], 3, GetTypeCallback, 0);
+ return;
+ }
+
+ if (type & SI_WIRELESS_FIX_ID) {
+ if ((id & SI_WIRELESS_TYPE_ID) != (type & SI_WIRELESS_TYPE_ID)) {
+ if (!(id & SI_WIRELESS_FIX_ID)) {
+ id = type & SI_WIRELESS_TYPE_ID;
+ id |= SI_WIRELESS_FIX_ID;
+ OSSetWirelessID(chan, (u16)((id >> 8) & 0xffff));
+ }
+
+ cmdFixDevice[chan] = 0x4E << 24 | id;
+ Type[chan] = SI_ERROR_BUSY;
+ SITransfer(chan, &cmdFixDevice[chan], 3, &Type[chan], 3, GetTypeCallback, 0);
+ return;
+ }
+
+ } else if (type & SI_WIRELESS_RECEIVED) {
+ id = type & SI_WIRELESS_TYPE_ID;
+ id |= SI_WIRELESS_FIX_ID;
+
+ OSSetWirelessID(chan, (u16)((id >> 8) & 0xffff));
+
+ cmdFixDevice[chan] = 0x4E << 24 | id;
+ Type[chan] = SI_ERROR_BUSY;
+ SITransfer(chan, &cmdFixDevice[chan], 3, &Type[chan], 3, GetTypeCallback, 0);
+ return;
+ } else {
+ OSSetWirelessID(chan, 0);
+ }
+
+ CallTypeAndStatusCallback(chan, Type[chan]);
}
/*
@@ -1761,134 +750,39 @@ static void GetTypeCallback(void)
*/
u32 SIGetType(int chan)
{
- /*
- .loc_0x0:
- mflr r0
- stw r0, 0x4(r1)
- stwu r1, -0x28(r1)
- stmw r27, 0x14(r1)
- mr r27, r3
- bl -0x76C8
- lis r4, 0x804B
- rlwinm r5,r27,2,0,29
- subi r0, r4, 0x60F0
- add r30, r0, r5
- lwz r28, 0x0(r30)
- mr r29, r3
- bl -0x376C
- lis r5, 0x804F
- rlwinm r6,r27,3,0,28
- addi r0, r5, 0x72A0
- add r31, r0, r6
- lwz r6, 0x4(r31)
- lis r5, 0x804B
- subi r5, r5, 0x6104
- lwz r0, 0x0(r31)
- subc r4, r4, r6
- subfe r0, r0, r3
- lwz r6, 0x4(r5)
- li r5, 0x80
- sraw r3, r5, r27
- and. r3, r6, r3
- beq- .loc_0xA0
- cmplwi r28, 0x8
- beq- .loc_0x94
- bl -0x37B4
- stw r4, 0x4(r31)
- stw r3, 0x0(r31)
- mr r3, r29
- bl -0x7714
- mr r3, r28
- b .loc_0x1B0
-
- .loc_0x94:
- stw r5, 0x0(r30)
- li r28, 0x80
- b .loc_0x150
-
- .loc_0xA0:
- lis r3, 0x8000
- lwz r6, 0xF8(r3)
- lis r5, 0x1062
- addi r5, r5, 0x4DD3
- rlwinm r6,r6,30,2,31
- mulhwu r5, r5, r6
- rlwinm r5,r5,26,6,31
- mulli r7, r5, 0x32
- li r3, 0
- xoris r6, r3, 0x8000
- xoris r5, r0, 0x8000
- subc r3, r7, r4
- subfe r5, r5, r6
- subfe r5, r6, r6
- neg. r5, r5
- bne- .loc_0xF8
- cmplwi r28, 0x8
- beq- .loc_0xF8
- mr r3, r29
- bl -0x7778
- mr r3, r28
- b .loc_0x1B0
-
- .loc_0xF8:
- lis r3, 0x8000
- lwz r6, 0xF8(r3)
- lis r5, 0x1062
- addi r5, r5, 0x4DD3
- rlwinm r6,r6,30,2,31
- mulhwu r5, r5, r6
- rlwinm r5,r5,26,6,31
- mulli r6, r5, 0x4B
- li r3, 0
- xoris r5, r3, 0x8000
- xoris r3, r0, 0x8000
- subc r0, r6, r4
- subfe r3, r3, r5
- subfe r3, r5, r5
- neg. r3, r3
- bne- .loc_0x144
- li r0, 0x80
- stw r0, 0x0(r30)
- b .loc_0x150
-
- .loc_0x144:
- li r0, 0x80
- stw r0, 0x0(r30)
- li r28, 0x80
-
- .loc_0x150:
- bl -0x388C
- stw r4, 0x4(r31)
- lis r4, 0x431C
- lis r5, 0x800F
- stw r3, 0x0(r31)
- lis r3, 0x8000
- addi r8, r5, 0x6054
- lwz r0, 0xF8(r3)
- subi r4, r4, 0x217D
- addi r3, r27, 0
- rlwinm r0,r0,30,2,31
- mulhwu r0, r4, r0
- rlwinm r0,r0,17,15,31
- mulli r0, r0, 0x41
- rlwinm r10,r0,29,3,31
- addi r6, r30, 0
- subi r4, r13, 0x6FDC
- li r5, 0x1
- li r7, 0x3
- li r9, 0
- bl -0x5A4
- mr r3, r29
- bl -0x7834
- mr r3, r28
-
- .loc_0x1B0:
- lmw r27, 0x14(r1)
- lwz r0, 0x2C(r1)
- addi r1, r1, 0x28
- mtlr r0
- blr
- */
+ static u32 cmdTypeAndStatus;
+ BOOL enabled;
+ u32 type;
+ OSTime diff;
+
+ enabled = OSDisableInterrupts();
+
+ type = Type[chan];
+ diff = __OSGetSystemTime() - TypeTime[chan];
+ if (Si.poll & (0x80 >> chan)) {
+ if (type != SI_ERROR_NO_RESPONSE) {
+ TypeTime[chan] = __OSGetSystemTime();
+ OSRestoreInterrupts(enabled);
+ return type;
+ } else {
+ type = Type[chan] = SI_ERROR_BUSY;
+ }
+
+ } else if (diff <= OSMillisecondsToTicks(50) && type != SI_ERROR_NO_RESPONSE) {
+ OSRestoreInterrupts(enabled);
+ return type;
+ } else if (diff <= OSMillisecondsToTicks(75)) {
+ Type[chan] = SI_ERROR_BUSY;
+ } else {
+ type = Type[chan] = SI_ERROR_BUSY;
+ }
+
+ TypeTime[chan] = __OSGetSystemTime();
+
+ SITransfer(chan, &cmdTypeAndStatus, 1, &Type[chan], 3, GetTypeCallback, OSMicrosecondsToTicks(65));
+
+ OSRestoreInterrupts(enabled);
+ return type;
}
/*
@@ -1898,98 +792,28 @@ u32 SIGetType(int chan)
*/
u32 SIGetTypeAsync(int chan, SITypeAndStatusCallback callback)
{
- /*
- .loc_0x0:
- mflr r0
- stw r0, 0x4(r1)
- stwu r1, -0x20(r1)
- stw r31, 0x1C(r1)
- addi r31, r4, 0
- stw r30, 0x18(r1)
- stw r29, 0x14(r1)
- stw r28, 0x10(r1)
- addi r28, r3, 0
- bl -0x789C
- addi r30, r3, 0
- addi r3, r28, 0
- bl -0x1F4
- lis r4, 0x804B
- rlwinm r5,r28,2,0,29
- subi r0, r4, 0x60F0
- add r4, r0, r5
- lwz r0, 0x0(r4)
- addi r29, r3, 0
- rlwinm. r0,r0,0,24,24
- beq- .loc_0xFC
- lis r3, 0x804F
- rlwinm r4,r28,4,0,27
- addi r0, r3, 0x72E0
- add r4, r0, r4
- lwz r0, 0x0(r4)
- li r5, 0
- cmplw r0, r31
- beq- .loc_0x110
- cmplwi r0, 0
- bne- .loc_0x88
- rlwinm r0,r5,2,0,29
- stwx r31, r4, r0
- b .loc_0x110
-
- .loc_0x88:
- addi r3, r4, 0x4
- lwz r0, 0x4(r4)
- li r5, 0x1
- cmplw r0, r31
- beq- .loc_0x110
- cmplwi r0, 0
- bne- .loc_0xB0
- rlwinm r0,r5,2,0,29
- stwx r31, r4, r0
- b .loc_0x110
-
- .loc_0xB0:
- lwzu r0, 0x4(r3)
- li r5, 0x2
- cmplw r0, r31
- beq- .loc_0x110
- cmplwi r0, 0
- bne- .loc_0xD4
- rlwinm r0,r5,2,0,29
- stwx r31, r4, r0
- b .loc_0x110
-
- .loc_0xD4:
- lwz r0, 0x4(r3)
- li r5, 0x3
- cmplw r0, r31
- beq- .loc_0x110
- cmplwi r0, 0
- bne- .loc_0x110
- rlwinm r0,r5,2,0,29
- stwx r31, r4, r0
- b .loc_0x110
- b .loc_0x110
-
- .loc_0xFC:
- addi r12, r31, 0
- mtlr r12
- addi r3, r28, 0
- addi r4, r29, 0
- blrl
-
- .loc_0x110:
- mr r3, r30
- bl -0x7964
- mr r3, r29
- lwz r0, 0x24(r1)
- lwz r31, 0x1C(r1)
- lwz r30, 0x18(r1)
- lwz r29, 0x14(r1)
- lwz r28, 0x10(r1)
- addi r1, r1, 0x20
- mtlr r0
- blr
- */
+ BOOL enabled;
+ u32 type;
+
+ enabled = OSDisableInterrupts();
+ type = SIGetType(chan);
+ if (Type[chan] & SI_ERROR_BUSY) {
+ int i;
+
+ for (i = 0; i < 4; ++i) {
+ if (TypeCallback[chan][i] == callback) {
+ break;
+ }
+ if (TypeCallback[chan][i] == 0) {
+ TypeCallback[chan][i] = callback;
+ break;
+ }
+ }
+ } else {
+ callback(chan, type);
+ }
+ OSRestoreInterrupts(enabled);
+ return type;
}
/*
@@ -1999,116 +823,64 @@ u32 SIGetTypeAsync(int chan, SITypeAndStatusCallback callback)
*/
u32 SIDecodeType(u32 type)
{
- /*
- .loc_0x0:
- rlwinm. r0,r3,0,28,28
- rlwinm r4,r3,0,24,31
- rlwinm r5,r3,0,0,23
- beq- .loc_0x18
- li r3, 0x8
- blr
-
- .loc_0x18:
- andi. r0, r4, 0x47
- beq- .loc_0x28
- li r3, 0x40
- blr
-
- .loc_0x28:
- cmplwi r4, 0
- beq- .loc_0x38
- li r3, 0x80
- blr
-
- .loc_0x38:
- rlwinm. r3,r5,0,3,4
- bne- .loc_0xA0
- rlwinm r3,r5,0,0,15
- lis r0, 0x4
- cmpw r3, r0
- beqlr-
- bge- .loc_0x74
- lis r0, 0x2
- cmpw r3, r0
- beqlr-
- bge- .loc_0x98
- lis r0, 0x1
- cmpw r3, r0
- beqlr-
- b .loc_0x98
-
- .loc_0x74:
- lis r0, 0x500
- cmpw r3, r0
- beqlr-
- bge- .loc_0x98
- lis r0, 0x200
- cmpw r3, r0
- beqlr-
- b .loc_0x98
- blr
-
- .loc_0x98:
- li r3, 0x40
- blr
-
- .loc_0xA0:
- subis r0, r3, 0x800
- cmplwi r0, 0
- beq- .loc_0xB4
- li r3, 0x40
- blr
-
- .loc_0xB4:
- rlwinm r3,r5,0,0,15
- lis r0, 0x900
- cmpw r3, r0
- beqlr-
- bge- .loc_0xDC
- lis r0, 0x800
- cmpw r3, r0
- beqlr-
- b .loc_0xDC
- blr
-
- .loc_0xDC:
- rlwinm r3,r5,0,0,10
- subis r0, r3, 0x820
- cmplwi r0, 0
- bne- .loc_0xF4
- lis r3, 0x820
- blr
-
- .loc_0xF4:
- rlwinm. r0,r5,0,0,0
- beq- .loc_0x12C
- rlwinm. r0,r5,0,5,5
- bne- .loc_0x12C
- andis. r3, r5, 0x8B10
- addis r0, r3, 0x74F0
- cmplwi r0, 0
- bne- .loc_0x11C
- lis r3, 0x8B10
- blr
-
- .loc_0x11C:
- rlwinm. r0,r5,0,6,6
- bne- .loc_0x12C
- lis r3, 0x8800
- blr
-
- .loc_0x12C:
- andis. r3, r5, 0x900
- subis r0, r3, 0x900
- cmplwi r0, 0
- bne- .loc_0x144
- lis r3, 0x900
- blr
-
- .loc_0x144:
- li r3, 0x40
- blr
- */
+ u32 error;
+
+ error = type & 0xff;
+ type &= ~0xff;
+
+ if (error & SI_ERROR_NO_RESPONSE) {
+ return SI_ERROR_NO_RESPONSE;
+ }
+
+ if (error & (SI_ERROR_UNDER_RUN | SI_ERROR_OVER_RUN | SI_ERROR_COLLISION | SI_ERROR_UNKNOWN)) {
+ return SI_ERROR_UNKNOWN;
+ }
+
+ if (error) {
+ return SI_ERROR_BUSY;
+ }
+
+ if ((type & SI_TYPE_MASK) == SI_TYPE_N64) {
+ switch (type & 0xffff0000) {
+ case SI_N64_CONTROLLER:
+ case SI_N64_MIC:
+ case SI_N64_KEYBOARD:
+ case SI_N64_MOUSE:
+ case SI_GBA:
+ return type & 0xffff0000;
+ }
+
+ return SI_ERROR_UNKNOWN;
+ }
+
+ if ((type & SI_TYPE_MASK) != SI_TYPE_GC) {
+ return SI_ERROR_UNKNOWN;
+ }
+
+ switch (type & 0xffff0000) {
+ case SI_GC_CONTROLLER:
+ case SI_GC_STEERING:
+ return type & 0xffff0000;
+ }
+
+ if ((type & 0xffe00000) == SI_GC_KEYBOARD) {
+ return SI_GC_KEYBOARD;
+ }
+
+ if ((type & SI_GC_WIRELESS) && !(type & SI_WIRELESS_IR)) {
+ if ((type & SI_GC_WAVEBIRD) == SI_GC_WAVEBIRD) {
+ return SI_GC_WAVEBIRD;
+
+ } else if (!(type & SI_WIRELESS_STATE)) {
+ return SI_GC_RECEIVER;
+ }
+ }
+
+ if ((type & SI_GC_CONTROLLER) == SI_GC_CONTROLLER) {
+ return SI_GC_CONTROLLER;
+ }
+
+ return SI_ERROR_UNKNOWN;
}
/*
@@ -2116,28 +888,37 @@ u32 SIDecodeType(u32 type)
* Address: 800F6738
* Size: 000024
*/
-u32 SIProbe(int chan)
-{
- /*
- .loc_0x0:
- mflr r0
- stw r0, 0x4(r1)
- stwu r1, -0x8(r1)
- bl -0x458
- bl -0x15C
- lwz r0, 0xC(r1)
- addi r1, r1, 0x8
- mtlr r0
- blr
- */
-}
+u32 SIProbe(int chan) { return SIDecodeType(SIGetType(chan)); }
/*
* --INFO--
* Address: ........
* Size: 000158
*/
-void SIGetTypeString(void)
+char* SIGetTypeString(u32 type)
{
- // UNUSED FUNCTION
+ switch (SIDecodeType(type)) {
+ case SI_ERROR_NO_RESPONSE:
+ return "No response";
+ case SI_N64_CONTROLLER:
+ return "N64 controller";
+ case SI_N64_MIC:
+ return "N64 microphone";
+ case SI_N64_KEYBOARD:
+ return "N64 keyboard";
+ case SI_N64_MOUSE:
+ return "N64 mouse";
+ case SI_GBA:
+ return "GameBoy Advance";
+ case SI_GC_CONTROLLER:
+ return "Standard controller";
+ case SI_GC_RECEIVER:
+ return "Wireless receiver";
+ case SI_GC_WAVEBIRD:
+ return "WaveBird controller";
+ case SI_GC_KEYBOARD:
+ return "Keyboard";
+ case SI_GC_STEERING:
+ return "Steering";
+ }
}
diff --git a/tools/progress.csv b/tools/progress.csv
index ac8e3cacb..5e6c2de93 100644
--- a/tools/progress.csv
+++ b/tools/progress.csv
@@ -565,3 +565,5 @@ You have 2692 out of 10000 Pokos and 81 out of 201 treasures.",2023-09-19 17:53:
You have 2693 out of 10000 Pokos and 81 out of 201 treasures.",2023-09-19 19:13:40.972156
2757,1282712,0.2757125858060611,82,290944,0.4081385300818118,"
You have 2757 out of 10000 Pokos and 82 out of 201 treasures.",2023-09-19 20:43:49.461791
+2770,1288952,0.27705384287345414,82,291733,0.4092453454835198,"
+You have 2770 out of 10000 Pokos and 82 out of 201 treasures.",2023-09-20 11:27:45.254721