donut-decomp/asm/MSL_C.PPCEABI.bare.H/MSL_Common/Src/file_io.s

165 lines
7 KiB
ArmAsm

.include "macros.inc"
.section .text, "ax" # 0x80006A00 - 0x80406260 ; 0x003FF860
.global fclose
fclose:
/* 8000A6F4 00006534 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 8000A6F8 00006538 7C 08 02 A6 */ mflr r0
/* 8000A6FC 0000653C 2C 03 00 00 */ cmpwi r3, 0x0
/* 8000A700 00006540 90 01 00 24 */ stw r0, 0x24(r1)
/* 8000A704 00006544 93 E1 00 1C */ stw r31, 0x1c(r1)
/* 8000A708 00006548 93 C1 00 18 */ stw r30, 0x18(r1)
/* 8000A70C 0000654C 93 A1 00 14 */ stw r29, 0x14(r1)
/* 8000A710 00006550 7C 7D 1B 78 */ mr r29, r3
/* 8000A714 00006554 40 82 00 0C */ bne lbl_8000A720
/* 8000A718 00006558 38 60 FF FF */ li r3, -0x1
/* 8000A71C 0000655C 48 00 00 78 */ b lbl_8000A794
.global lbl_8000A720
lbl_8000A720:
/* 8000A720 00006560 80 03 00 04 */ lwz r0, 0x4(r3)
/* 8000A724 00006564 54 00 57 7F */ extrwi. r0, r0, 3, 7
/* 8000A728 00006568 40 82 00 0C */ bne lbl_8000A734
/* 8000A72C 0000656C 38 60 00 00 */ li r3, 0x0
/* 8000A730 00006570 48 00 00 64 */ b lbl_8000A794
.global lbl_8000A734
lbl_8000A734:
/* 8000A734 00006574 48 00 00 7D */ bl fflush
/* 8000A738 00006578 81 9D 00 44 */ lwz r12, 0x44(r29)
/* 8000A73C 0000657C 7C 7E 1B 78 */ mr r30, r3
/* 8000A740 00006580 80 7D 00 00 */ lwz r3, 0x0(r29)
/* 8000A744 00006584 7D 89 03 A6 */ mtctr r12
/* 8000A748 00006588 4E 80 04 21 */ bctrl
/* 8000A74C 0000658C 80 1D 00 08 */ lwz r0, 0x8(r29)
/* 8000A750 00006590 38 A0 00 00 */ li r5, 0x0
/* 8000A754 00006594 80 9D 00 04 */ lwz r4, 0x4(r29)
/* 8000A758 00006598 7C 7F 1B 78 */ mr r31, r3
/* 8000A75C 0000659C 54 00 27 FF */ extrwi. r0, r0, 1, 3
/* 8000A760 000065A0 90 BD 00 00 */ stw r5, 0x0(r29)
/* 8000A764 000065A4 54 84 02 8C */ rlwinm r4, r4, 0, 10, 6
/* 8000A768 000065A8 90 9D 00 04 */ stw r4, 0x4(r29)
/* 8000A76C 000065AC 41 82 00 0C */ beq lbl_8000A778
/* 8000A770 000065B0 80 7D 00 1C */ lwz r3, 0x1c(r29)
/* 8000A774 000065B4 4B FF EE A5 */ bl free
.global lbl_8000A778
lbl_8000A778:
/* 8000A778 000065B8 2C 1E 00 00 */ cmpwi r30, 0x0
/* 8000A77C 000065BC 38 00 00 00 */ li r0, 0x0
/* 8000A780 000065C0 40 82 00 0C */ bne lbl_8000A78C
/* 8000A784 000065C4 2C 1F 00 00 */ cmpwi r31, 0x0
/* 8000A788 000065C8 41 82 00 08 */ beq lbl_8000A790
.global lbl_8000A78C
lbl_8000A78C:
/* 8000A78C 000065CC 38 00 00 01 */ li r0, 0x1
.global lbl_8000A790
lbl_8000A790:
/* 8000A790 000065D0 7C 60 00 D0 */ neg r3, r0
.global lbl_8000A794
lbl_8000A794:
/* 8000A794 000065D4 80 01 00 24 */ lwz r0, 0x24(r1)
/* 8000A798 000065D8 83 E1 00 1C */ lwz r31, 0x1c(r1)
/* 8000A79C 000065DC 83 C1 00 18 */ lwz r30, 0x18(r1)
/* 8000A7A0 000065E0 83 A1 00 14 */ lwz r29, 0x14(r1)
/* 8000A7A4 000065E4 7C 08 03 A6 */ mtlr r0
/* 8000A7A8 000065E8 38 21 00 20 */ addi r1, r1, 0x20
/* 8000A7AC 000065EC 4E 80 00 20 */ blr
.global fflush
fflush:
/* 8000A7B0 000065F0 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 8000A7B4 000065F4 7C 08 02 A6 */ mflr r0
/* 8000A7B8 000065F8 2C 03 00 00 */ cmpwi r3, 0x0
/* 8000A7BC 000065FC 90 01 00 14 */ stw r0, 0x14(r1)
/* 8000A7C0 00006600 93 E1 00 0C */ stw r31, 0xc(r1)
/* 8000A7C4 00006604 7C 7F 1B 78 */ mr r31, r3
/* 8000A7C8 00006608 93 C1 00 08 */ stw r30, 0x8(r1)
/* 8000A7CC 0000660C 40 82 00 0C */ bne lbl_8000A7D8
/* 8000A7D0 00006610 4B FF F0 1D */ bl __flush_all
/* 8000A7D4 00006614 48 00 00 F8 */ b lbl_8000A8CC
.global lbl_8000A7D8
lbl_8000A7D8:
/* 8000A7D8 00006618 88 03 00 0A */ lbz r0, 0xa(r3)
/* 8000A7DC 0000661C 2C 00 00 00 */ cmpwi r0, 0x0
/* 8000A7E0 00006620 40 82 00 10 */ bne lbl_8000A7F0
/* 8000A7E4 00006624 80 83 00 04 */ lwz r4, 0x4(r3)
/* 8000A7E8 00006628 54 80 57 7F */ extrwi. r0, r4, 3, 7
/* 8000A7EC 0000662C 40 82 00 0C */ bne lbl_8000A7F8
.global lbl_8000A7F0
lbl_8000A7F0:
/* 8000A7F0 00006630 38 60 FF FF */ li r3, -0x1
/* 8000A7F4 00006634 48 00 00 D8 */ b lbl_8000A8CC
.global lbl_8000A7F8
lbl_8000A7F8:
/* 8000A7F8 00006638 54 80 2F 7E */ extrwi r0, r4, 3, 2
/* 8000A7FC 0000663C 28 00 00 01 */ cmplwi r0, 0x1
/* 8000A800 00006640 40 82 00 0C */ bne lbl_8000A80C
/* 8000A804 00006644 38 60 00 00 */ li r3, 0x0
/* 8000A808 00006648 48 00 00 C4 */ b lbl_8000A8CC
.global lbl_8000A80C
lbl_8000A80C:
/* 8000A80C 0000664C 80 83 00 08 */ lwz r4, 0x8(r3)
/* 8000A810 00006650 54 80 1F 7E */ srwi r0, r4, 29
/* 8000A814 00006654 28 00 00 03 */ cmplwi r0, 0x3
/* 8000A818 00006658 41 80 00 10 */ blt lbl_8000A828
/* 8000A81C 0000665C 38 00 00 02 */ li r0, 0x2
/* 8000A820 00006660 50 04 E8 04 */ rlwimi r4, r0, 29, 0, 2
/* 8000A824 00006664 90 83 00 08 */ stw r4, 0x8(r3)
.global lbl_8000A828
lbl_8000A828:
/* 8000A828 00006668 80 03 00 08 */ lwz r0, 0x8(r3)
/* 8000A82C 0000666C 54 00 1F 7E */ srwi r0, r0, 29
/* 8000A830 00006670 28 00 00 02 */ cmplwi r0, 0x2
/* 8000A834 00006674 40 82 00 0C */ bne lbl_8000A840
/* 8000A838 00006678 38 00 00 00 */ li r0, 0x0
/* 8000A83C 0000667C 90 03 00 28 */ stw r0, 0x28(r3)
.global lbl_8000A840
lbl_8000A840:
/* 8000A840 00006680 80 83 00 08 */ lwz r4, 0x8(r3)
/* 8000A844 00006684 54 80 1F 7E */ srwi r0, r4, 29
/* 8000A848 00006688 28 00 00 01 */ cmplwi r0, 0x1
/* 8000A84C 0000668C 41 82 00 14 */ beq lbl_8000A860
/* 8000A850 00006690 54 80 00 FE */ clrlwi r0, r4, 3
/* 8000A854 00006694 90 03 00 08 */ stw r0, 0x8(r3)
/* 8000A858 00006698 38 60 00 00 */ li r3, 0x0
/* 8000A85C 0000669C 48 00 00 70 */ b lbl_8000A8CC
.global lbl_8000A860
lbl_8000A860:
/* 8000A860 000066A0 80 03 00 04 */ lwz r0, 0x4(r3)
/* 8000A864 000066A4 54 00 57 7E */ extrwi r0, r0, 3, 7
/* 8000A868 000066A8 28 00 00 01 */ cmplwi r0, 0x1
/* 8000A86C 000066AC 41 82 00 0C */ beq lbl_8000A878
/* 8000A870 000066B0 3B C0 00 00 */ li r30, 0x0
/* 8000A874 000066B4 48 00 00 10 */ b lbl_8000A884
.global lbl_8000A878
lbl_8000A878:
/* 8000A878 000066B8 7F E3 FB 78 */ mr r3, r31
/* 8000A87C 000066BC 48 00 01 11 */ bl ftell
/* 8000A880 000066C0 7C 7E 1B 78 */ mr r30, r3
.global lbl_8000A884
lbl_8000A884:
/* 8000A884 000066C4 7F E3 FB 78 */ mr r3, r31
/* 8000A888 000066C8 38 80 00 00 */ li r4, 0x0
/* 8000A88C 000066CC 4B FF FA 79 */ bl __flush_buffer
/* 8000A890 000066D0 2C 03 00 00 */ cmpwi r3, 0x0
/* 8000A894 000066D4 41 82 00 1C */ beq lbl_8000A8B0
/* 8000A898 000066D8 38 60 00 01 */ li r3, 0x1
/* 8000A89C 000066DC 38 00 00 00 */ li r0, 0x0
/* 8000A8A0 000066E0 98 7F 00 0A */ stb r3, 0xa(r31)
/* 8000A8A4 000066E4 38 60 FF FF */ li r3, -0x1
/* 8000A8A8 000066E8 90 1F 00 28 */ stw r0, 0x28(r31)
/* 8000A8AC 000066EC 48 00 00 20 */ b lbl_8000A8CC
.global lbl_8000A8B0
lbl_8000A8B0:
/* 8000A8B0 000066F0 80 1F 00 08 */ lwz r0, 0x8(r31)
/* 8000A8B4 000066F4 38 80 00 00 */ li r4, 0x0
/* 8000A8B8 000066F8 93 DF 00 18 */ stw r30, 0x18(r31)
/* 8000A8BC 000066FC 38 60 00 00 */ li r3, 0x0
/* 8000A8C0 00006700 54 00 00 FE */ clrlwi r0, r0, 3
/* 8000A8C4 00006704 90 1F 00 08 */ stw r0, 0x8(r31)
/* 8000A8C8 00006708 90 9F 00 28 */ stw r4, 0x28(r31)
.global lbl_8000A8CC
lbl_8000A8CC:
/* 8000A8CC 0000670C 80 01 00 14 */ lwz r0, 0x14(r1)
/* 8000A8D0 00006710 83 E1 00 0C */ lwz r31, 0xc(r1)
/* 8000A8D4 00006714 83 C1 00 08 */ lwz r30, 0x8(r1)
/* 8000A8D8 00006718 7C 08 03 A6 */ mtlr r0
/* 8000A8DC 0000671C 38 21 00 10 */ addi r1, r1, 0x10
/* 8000A8E0 00006720 4E 80 00 20 */ blr