mirror of https://github.com/PrimeDecomp/prime.git
114 lines
4.7 KiB
ArmAsm
114 lines
4.7 KiB
ArmAsm
.include "macros.inc"
|
|
|
|
.section .text, "ax"
|
|
.if 1
|
|
/* TODO: Move __close_console and __write_console to their own file (uart_console_io),
|
|
* they're here to work around a bug with CW
|
|
*/
|
|
|
|
.global __close_console
|
|
__close_console:
|
|
/* 80391274 0038E1D4 38 60 00 00 */ li r3, 0
|
|
/* 80391278 0038E1D8 4E 80 00 20 */ blr
|
|
|
|
.global __write_console
|
|
__write_console:
|
|
/* 8039127C 0038E1DC 94 21 FF E0 */ stwu r1, -0x20(r1)
|
|
/* 80391280 0038E1E0 7C 08 02 A6 */ mflr r0
|
|
/* 80391284 0038E1E4 90 01 00 24 */ stw r0, 0x24(r1)
|
|
/* 80391288 0038E1E8 93 E1 00 1C */ stw r31, 0x1c(r1)
|
|
/* 8039128C 0038E1EC 7C DF 33 78 */ mr r31, r6
|
|
/* 80391290 0038E1F0 93 C1 00 18 */ stw r30, 0x18(r1)
|
|
/* 80391294 0038E1F4 7C BE 2B 78 */ mr r30, r5
|
|
/* 80391298 0038E1F8 93 A1 00 14 */ stw r29, 0x14(r1)
|
|
/* 8039129C 0038E1FC 7C 9D 23 78 */ mr r29, r4
|
|
/* 803912A0 0038E200 93 81 00 10 */ stw r28, 0x10(r1)
|
|
/* 803912A4 0038E204 7C 7C 1B 78 */ mr r28, r3
|
|
/* 803912A8 0038E208 38 60 00 00 */ li r3, 0
|
|
/* 803912AC 0038E20C 80 0D AE 18 */ lwz r0, lbl_805A99D8@sda21(r13)
|
|
/* 803912B0 0038E210 2C 00 00 00 */ cmpwi r0, 0
|
|
/* 803912B4 0038E214 40 82 00 20 */ bne lbl_803912D4
|
|
/* 803912B8 0038E218 3C 60 00 01 */ lis r3, 0x0000E100@ha
|
|
/* 803912BC 0038E21C 38 63 E1 00 */ addi r3, r3, 0x0000E100@l
|
|
/* 803912C0 0038E220 48 03 06 31 */ bl InitializeUART
|
|
/* 803912C4 0038E224 2C 03 00 00 */ cmpwi r3, 0
|
|
/* 803912C8 0038E228 40 82 00 0C */ bne lbl_803912D4
|
|
/* 803912CC 0038E22C 38 00 00 01 */ li r0, 1
|
|
/* 803912D0 0038E230 90 0D AE 18 */ stw r0, lbl_805A99D8@sda21(r13)
|
|
lbl_803912D4:
|
|
/* 803912D4 0038E234 2C 03 00 00 */ cmpwi r3, 0
|
|
/* 803912D8 0038E238 41 82 00 0C */ beq lbl_803912E4
|
|
/* 803912DC 0038E23C 38 60 00 01 */ li r3, 1
|
|
/* 803912E0 0038E240 48 00 00 40 */ b lbl_80391320
|
|
lbl_803912E4:
|
|
/* 803912E4 0038E244 80 9E 00 00 */ lwz r4, 0(r30)
|
|
/* 803912E8 0038E248 7F A3 EB 78 */ mr r3, r29
|
|
/* 803912EC 0038E24C 48 03 06 75 */ bl WriteUARTN
|
|
/* 803912F0 0038E250 2C 03 00 00 */ cmpwi r3, 0
|
|
/* 803912F4 0038E254 41 82 00 14 */ beq lbl_80391308
|
|
/* 803912F8 0038E258 38 00 00 00 */ li r0, 0
|
|
/* 803912FC 0038E25C 38 60 00 01 */ li r3, 1
|
|
/* 80391300 0038E260 90 1E 00 00 */ stw r0, 0(r30)
|
|
/* 80391304 0038E264 48 00 00 1C */ b lbl_80391320
|
|
lbl_80391308:
|
|
/* 80391308 0038E268 7F 83 E3 78 */ mr r3, r28
|
|
/* 8039130C 0038E26C 7F A4 EB 78 */ mr r4, r29
|
|
/* 80391310 0038E270 7F C5 F3 78 */ mr r5, r30
|
|
/* 80391314 0038E274 7F E6 FB 78 */ mr r6, r31
|
|
/* 80391318 0038E278 4B C7 23 39 */ bl sub_80003650
|
|
/* 8039131C 0038E27C 38 60 00 00 */ li r3, 0
|
|
lbl_80391320:
|
|
/* 80391320 0038E280 80 01 00 24 */ lwz r0, 0x24(r1)
|
|
/* 80391324 0038E284 83 E1 00 1C */ lwz r31, 0x1c(r1)
|
|
/* 80391328 0038E288 83 C1 00 18 */ lwz r30, 0x18(r1)
|
|
/* 8039132C 0038E28C 83 A1 00 14 */ lwz r29, 0x14(r1)
|
|
/* 80391330 0038E290 83 81 00 10 */ lwz r28, 0x10(r1)
|
|
/* 80391334 0038E294 7C 08 03 A6 */ mtlr r0
|
|
/* 80391338 0038E298 38 21 00 20 */ addi r1, r1, 0x20
|
|
/* 8039133C 0038E29C 4E 80 00 20 */ blr
|
|
.endif
|
|
.global fwide
|
|
fwide:
|
|
/* 80391340 0038E2A0 28 03 00 00 */ cmplwi r3, 0
|
|
/* 80391344 0038E2A4 41 82 00 10 */ beq lbl_80391354
|
|
/* 80391348 0038E2A8 A0 03 00 04 */ lhz r0, 4(r3)
|
|
/* 8039134C 0038E2AC 54 00 D7 7F */ rlwinm. r0, r0, 0x1a, 0x1d, 0x1f
|
|
/* 80391350 0038E2B0 40 82 00 0C */ bne lbl_8039135C
|
|
lbl_80391354:
|
|
/* 80391354 0038E2B4 38 60 00 00 */ li r3, 0
|
|
/* 80391358 0038E2B8 4E 80 00 20 */ blr
|
|
lbl_8039135C:
|
|
/* 8039135C 0038E2BC 88 A3 00 05 */ lbz r5, 5(r3)
|
|
/* 80391360 0038E2C0 54 A0 E7 BE */ rlwinm r0, r5, 0x1c, 0x1e, 0x1f
|
|
/* 80391364 0038E2C4 2C 00 00 01 */ cmpwi r0, 1
|
|
/* 80391368 0038E2C8 41 82 00 58 */ beq lbl_803913C0
|
|
/* 8039136C 0038E2CC 40 80 00 10 */ bge lbl_8039137C
|
|
/* 80391370 0038E2D0 2C 00 00 00 */ cmpwi r0, 0
|
|
/* 80391374 0038E2D4 40 80 00 14 */ bge lbl_80391388
|
|
/* 80391378 0038E2D8 4E 80 00 20 */ blr
|
|
lbl_8039137C:
|
|
/* 8039137C 0038E2DC 2C 00 00 03 */ cmpwi r0, 3
|
|
/* 80391380 0038E2E0 4C 80 00 20 */ bgelr
|
|
/* 80391384 0038E2E4 48 00 00 34 */ b lbl_803913B8
|
|
lbl_80391388:
|
|
/* 80391388 0038E2E8 2C 04 00 00 */ cmpwi r4, 0
|
|
/* 8039138C 0038E2EC 40 81 00 14 */ ble lbl_803913A0
|
|
/* 80391390 0038E2F0 38 00 00 02 */ li r0, 2
|
|
/* 80391394 0038E2F4 50 05 26 B6 */ rlwimi r5, r0, 4, 0x1a, 0x1b
|
|
/* 80391398 0038E2F8 98 A3 00 05 */ stb r5, 5(r3)
|
|
/* 8039139C 0038E2FC 48 00 00 14 */ b lbl_803913B0
|
|
lbl_803913A0:
|
|
/* 803913A0 0038E300 40 80 00 10 */ bge lbl_803913B0
|
|
/* 803913A4 0038E304 38 00 00 01 */ li r0, 1
|
|
/* 803913A8 0038E308 50 05 26 B6 */ rlwimi r5, r0, 4, 0x1a, 0x1b
|
|
/* 803913AC 0038E30C 98 A3 00 05 */ stb r5, 5(r3)
|
|
lbl_803913B0:
|
|
/* 803913B0 0038E310 7C 83 23 78 */ mr r3, r4
|
|
/* 803913B4 0038E314 4E 80 00 20 */ blr
|
|
lbl_803913B8:
|
|
/* 803913B8 0038E318 38 60 00 01 */ li r3, 1
|
|
/* 803913BC 0038E31C 4E 80 00 20 */ blr
|
|
lbl_803913C0:
|
|
/* 803913C0 0038E320 38 60 FF FF */ li r3, -1
|
|
/* 803913C4 0038E324 4E 80 00 20 */ blr
|