prime/asm/Runtime/file_io.s

153 lines
6.8 KiB
ArmAsm
Raw Normal View History

2022-04-02 21:03:04 +00:00
.include "macros.inc"
.section .text, "ax"
.global fflush
fflush:
/* 8038D274 0038A1D4 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 8038D278 0038A1D8 7C 08 02 A6 */ mflr r0
/* 8038D27C 0038A1DC 90 01 00 14 */ stw r0, 0x14(r1)
/* 8038D280 0038A1E0 93 E1 00 0C */ stw r31, 0xc(r1)
/* 8038D284 0038A1E4 7C 7F 1B 79 */ or. r31, r3, r3
/* 8038D288 0038A1E8 93 C1 00 08 */ stw r30, 8(r1)
/* 8038D28C 0038A1EC 40 82 00 0C */ bne lbl_8038D298
/* 8038D290 0038A1F0 4B FF DE 19 */ bl __flush_all
/* 8038D294 0038A1F4 48 00 01 00 */ b lbl_8038D394
lbl_8038D298:
/* 8038D298 0038A1F8 88 1F 00 0A */ lbz r0, 0xa(r31)
/* 8038D29C 0038A1FC 28 00 00 00 */ cmplwi r0, 0
/* 8038D2A0 0038A200 40 82 00 10 */ bne lbl_8038D2B0
/* 8038D2A4 0038A204 A0 1F 00 04 */ lhz r0, 4(r31)
/* 8038D2A8 0038A208 54 00 D7 7F */ rlwinm. r0, r0, 0x1a, 0x1d, 0x1f
/* 8038D2AC 0038A20C 40 82 00 0C */ bne lbl_8038D2B8
lbl_8038D2B0:
/* 8038D2B0 0038A210 38 60 FF FF */ li r3, -1
/* 8038D2B4 0038A214 48 00 00 E0 */ b lbl_8038D394
lbl_8038D2B8:
/* 8038D2B8 0038A218 88 1F 00 04 */ lbz r0, 4(r31)
/* 8038D2BC 0038A21C 54 00 EF 7E */ rlwinm r0, r0, 0x1d, 0x1d, 0x1f
/* 8038D2C0 0038A220 28 00 00 01 */ cmplwi r0, 1
/* 8038D2C4 0038A224 40 82 00 0C */ bne lbl_8038D2D0
/* 8038D2C8 0038A228 38 60 00 00 */ li r3, 0
/* 8038D2CC 0038A22C 48 00 00 C8 */ b lbl_8038D394
lbl_8038D2D0:
/* 8038D2D0 0038A230 88 7F 00 08 */ lbz r3, 8(r31)
/* 8038D2D4 0038A234 54 60 DF 7E */ rlwinm r0, r3, 0x1b, 0x1d, 0x1f
/* 8038D2D8 0038A238 28 00 00 03 */ cmplwi r0, 3
/* 8038D2DC 0038A23C 41 80 00 10 */ blt lbl_8038D2EC
/* 8038D2E0 0038A240 38 00 00 02 */ li r0, 2
/* 8038D2E4 0038A244 50 03 2E 34 */ rlwimi r3, r0, 5, 0x18, 0x1a
/* 8038D2E8 0038A248 98 7F 00 08 */ stb r3, 8(r31)
lbl_8038D2EC:
/* 8038D2EC 0038A24C 88 1F 00 08 */ lbz r0, 8(r31)
/* 8038D2F0 0038A250 54 00 DF 7E */ rlwinm r0, r0, 0x1b, 0x1d, 0x1f
/* 8038D2F4 0038A254 28 00 00 02 */ cmplwi r0, 2
/* 8038D2F8 0038A258 40 82 00 0C */ bne lbl_8038D304
/* 8038D2FC 0038A25C 38 00 00 00 */ li r0, 0
/* 8038D300 0038A260 90 1F 00 28 */ stw r0, 0x28(r31)
lbl_8038D304:
/* 8038D304 0038A264 88 9F 00 08 */ lbz r4, 8(r31)
/* 8038D308 0038A268 54 80 DF 7E */ rlwinm r0, r4, 0x1b, 0x1d, 0x1f
/* 8038D30C 0038A26C 28 00 00 01 */ cmplwi r0, 1
/* 8038D310 0038A270 41 82 00 18 */ beq lbl_8038D328
/* 8038D314 0038A274 38 00 00 00 */ li r0, 0
/* 8038D318 0038A278 38 60 00 00 */ li r3, 0
/* 8038D31C 0038A27C 50 04 2E 34 */ rlwimi r4, r0, 5, 0x18, 0x1a
/* 8038D320 0038A280 98 9F 00 08 */ stb r4, 8(r31)
/* 8038D324 0038A284 48 00 00 70 */ b lbl_8038D394
lbl_8038D328:
/* 8038D328 0038A288 A0 1F 00 04 */ lhz r0, 4(r31)
/* 8038D32C 0038A28C 54 00 D7 7E */ rlwinm r0, r0, 0x1a, 0x1d, 0x1f
/* 8038D330 0038A290 28 00 00 01 */ cmplwi r0, 1
/* 8038D334 0038A294 41 82 00 0C */ beq lbl_8038D340
/* 8038D338 0038A298 3B C0 00 00 */ li r30, 0
/* 8038D33C 0038A29C 48 00 00 10 */ b lbl_8038D34C
lbl_8038D340:
/* 8038D340 0038A2A0 7F E3 FB 78 */ mr r3, r31
/* 8038D344 0038A2A4 48 00 03 85 */ bl ftell
/* 8038D348 0038A2A8 7C 7E 1B 78 */ mr r30, r3
lbl_8038D34C:
/* 8038D34C 0038A2AC 7F E3 FB 78 */ mr r3, r31
/* 8038D350 0038A2B0 38 80 00 00 */ li r4, 0
/* 8038D354 0038A2B4 4B FF FA D9 */ bl __flush_buffer
/* 8038D358 0038A2B8 2C 03 00 00 */ cmpwi r3, 0
/* 8038D35C 0038A2BC 41 82 00 1C */ beq lbl_8038D378
/* 8038D360 0038A2C0 38 60 00 01 */ li r3, 1
/* 8038D364 0038A2C4 38 00 00 00 */ li r0, 0
/* 8038D368 0038A2C8 98 7F 00 0A */ stb r3, 0xa(r31)
/* 8038D36C 0038A2CC 38 60 FF FF */ li r3, -1
/* 8038D370 0038A2D0 90 1F 00 28 */ stw r0, 0x28(r31)
/* 8038D374 0038A2D4 48 00 00 20 */ b lbl_8038D394
lbl_8038D378:
/* 8038D378 0038A2D8 88 1F 00 08 */ lbz r0, 8(r31)
/* 8038D37C 0038A2DC 38 80 00 00 */ li r4, 0
/* 8038D380 0038A2E0 50 80 2E 34 */ rlwimi r0, r4, 5, 0x18, 0x1a
/* 8038D384 0038A2E4 38 60 00 00 */ li r3, 0
/* 8038D388 0038A2E8 98 1F 00 08 */ stb r0, 8(r31)
/* 8038D38C 0038A2EC 93 DF 00 18 */ stw r30, 0x18(r31)
/* 8038D390 0038A2F0 90 9F 00 28 */ stw r4, 0x28(r31)
lbl_8038D394:
/* 8038D394 0038A2F4 80 01 00 14 */ lwz r0, 0x14(r1)
/* 8038D398 0038A2F8 83 E1 00 0C */ lwz r31, 0xc(r1)
/* 8038D39C 0038A2FC 83 C1 00 08 */ lwz r30, 8(r1)
/* 8038D3A0 0038A300 7C 08 03 A6 */ mtlr r0
/* 8038D3A4 0038A304 38 21 00 10 */ addi r1, r1, 0x10
2022-07-14 05:48:03 +00:00
/* 8038D3A8 0038A308 4E 80 00 20 */ blr
2022-04-02 21:03:04 +00:00
.global fclose
fclose:
/* 8038D3AC 0038A30C 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 8038D3B0 0038A310 7C 08 02 A6 */ mflr r0
/* 8038D3B4 0038A314 90 01 00 24 */ stw r0, 0x24(r1)
/* 8038D3B8 0038A318 93 E1 00 1C */ stw r31, 0x1c(r1)
/* 8038D3BC 0038A31C 93 C1 00 18 */ stw r30, 0x18(r1)
/* 8038D3C0 0038A320 93 A1 00 14 */ stw r29, 0x14(r1)
/* 8038D3C4 0038A324 7C 7D 1B 79 */ or. r29, r3, r3
/* 8038D3C8 0038A328 40 82 00 0C */ bne lbl_8038D3D4
/* 8038D3CC 0038A32C 38 60 FF FF */ li r3, -1
/* 8038D3D0 0038A330 48 00 00 80 */ b lbl_8038D450
lbl_8038D3D4:
/* 8038D3D4 0038A334 A0 1D 00 04 */ lhz r0, 4(r29)
/* 8038D3D8 0038A338 54 00 D7 7F */ rlwinm. r0, r0, 0x1a, 0x1d, 0x1f
/* 8038D3DC 0038A33C 40 82 00 0C */ bne lbl_8038D3E8
/* 8038D3E0 0038A340 38 60 00 00 */ li r3, 0
/* 8038D3E4 0038A344 48 00 00 6C */ b lbl_8038D450
lbl_8038D3E8:
/* 8038D3E8 0038A348 4B FF FE 8D */ bl fflush
/* 8038D3EC 0038A34C 81 9D 00 44 */ lwz r12, 0x44(r29)
/* 8038D3F0 0038A350 7C 7E 1B 78 */ mr r30, r3
/* 8038D3F4 0038A354 80 7D 00 00 */ lwz r3, 0(r29)
/* 8038D3F8 0038A358 7D 89 03 A6 */ mtctr r12
2022-07-14 05:48:03 +00:00
/* 8038D3FC 0038A35C 4E 80 04 21 */ bctrl
2022-04-02 21:03:04 +00:00
/* 8038D400 0038A360 A0 1D 00 04 */ lhz r0, 4(r29)
/* 8038D404 0038A364 38 80 00 00 */ li r4, 0
/* 8038D408 0038A368 50 80 35 F2 */ rlwimi r0, r4, 6, 0x17, 0x19
/* 8038D40C 0038A36C 7C 7F 1B 78 */ mr r31, r3
/* 8038D410 0038A370 B0 1D 00 04 */ sth r0, 4(r29)
/* 8038D414 0038A374 90 9D 00 00 */ stw r4, 0(r29)
/* 8038D418 0038A378 88 1D 00 08 */ lbz r0, 8(r29)
/* 8038D41C 0038A37C 54 00 E7 FF */ rlwinm. r0, r0, 0x1c, 0x1f, 0x1f
/* 8038D420 0038A380 41 82 00 0C */ beq lbl_8038D42C
/* 8038D424 0038A384 80 7D 00 1C */ lwz r3, 0x1c(r29)
2022-07-29 05:03:24 +00:00
/* 8038D428 0038A388 4B FF CF 31 */ bl free
2022-04-02 21:03:04 +00:00
lbl_8038D42C:
/* 8038D42C 0038A38C 2C 1E 00 00 */ cmpwi r30, 0
/* 8038D430 0038A390 38 60 00 00 */ li r3, 0
/* 8038D434 0038A394 40 82 00 0C */ bne lbl_8038D440
/* 8038D438 0038A398 2C 1F 00 00 */ cmpwi r31, 0
/* 8038D43C 0038A39C 41 82 00 08 */ beq lbl_8038D444
lbl_8038D440:
/* 8038D440 0038A3A0 38 60 00 01 */ li r3, 1
lbl_8038D444:
/* 8038D444 0038A3A4 7C 03 00 D0 */ neg r0, r3
/* 8038D448 0038A3A8 7C 00 1B 78 */ or r0, r0, r3
/* 8038D44C 0038A3AC 7C 03 FE 70 */ srawi r3, r0, 0x1f
lbl_8038D450:
/* 8038D450 0038A3B0 80 01 00 24 */ lwz r0, 0x24(r1)
/* 8038D454 0038A3B4 83 E1 00 1C */ lwz r31, 0x1c(r1)
/* 8038D458 0038A3B8 83 C1 00 18 */ lwz r30, 0x18(r1)
/* 8038D45C 0038A3BC 83 A1 00 14 */ lwz r29, 0x14(r1)
/* 8038D460 0038A3C0 7C 08 03 A6 */ mtlr r0
/* 8038D464 0038A3C4 38 21 00 20 */ addi r1, r1, 0x20
2022-07-14 05:48:03 +00:00
/* 8038D468 0038A3C8 4E 80 00 20 */ blr