papermario/asm/nonmatchings/os/code_44b40_len_a90/osRepairPackId.s
2020-08-12 22:37:16 -04:00

210 lines
9.9 KiB
ArmAsm

.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel osRepairPackId
/* 044BB8 800697B8 27BDFF80 */ addiu $sp, $sp, -0x80
/* 044BBC 800697BC AFB10064 */ sw $s1, 0x64($sp)
/* 044BC0 800697C0 00808821 */ addu $s1, $a0, $zero
/* 044BC4 800697C4 AFB50074 */ sw $s5, 0x74($sp)
/* 044BC8 800697C8 00A0A821 */ addu $s5, $a1, $zero
/* 044BCC 800697CC AFB3006C */ sw $s3, 0x6c($sp)
/* 044BD0 800697D0 00C09821 */ addu $s3, $a2, $zero
/* 044BD4 800697D4 2402FFFF */ addiu $v0, $zero, -1
/* 044BD8 800697D8 AFBF007C */ sw $ra, 0x7c($sp)
/* 044BDC 800697DC AFB60078 */ sw $s6, 0x78($sp)
/* 044BE0 800697E0 AFB40070 */ sw $s4, 0x70($sp)
/* 044BE4 800697E4 AFB20068 */ sw $s2, 0x68($sp)
/* 044BE8 800697E8 AFB00060 */ sw $s0, 0x60($sp)
/* 044BEC 800697EC 0C019680 */ jal osGetCount
/* 044BF0 800697F0 AE620000 */ sw $v0, ($s3)
/* 044BF4 800697F4 AE620004 */ sw $v0, 4($s3)
/* 044BF8 800697F8 8EA20008 */ lw $v0, 8($s5)
/* 044BFC 800697FC 8EA3000C */ lw $v1, 0xc($s5)
/* 044C00 80069800 AE620008 */ sw $v0, 8($s3)
/* 044C04 80069804 AE63000C */ sw $v1, 0xc($s3)
/* 044C08 80069808 8EA20010 */ lw $v0, 0x10($s5)
/* 044C0C 8006980C 8EA30014 */ lw $v1, 0x14($s5)
/* 044C10 80069810 AE620010 */ sw $v0, 0x10($s3)
/* 044C14 80069814 AE630014 */ sw $v1, 0x14($s3)
/* 044C18 80069818 92220065 */ lbu $v0, 0x65($s1)
/* 044C1C 8006981C 10400006 */ beqz $v0, .L80069838
/* 044C20 80069820 00009021 */ addu $s2, $zero, $zero
/* 044C24 80069824 02202021 */ addu $a0, $s1, $zero
/* 044C28 80069828 0C01A5B4 */ jal osPfsSelectBank
/* 044C2C 8006982C 00002821 */ addu $a1, $zero, $zero
/* 044C30 80069830 14400092 */ bnez $v0, .L80069A7C
/* 044C34 80069834 00000000 */ nop
.L80069838:
/* 044C38 80069838 27B40018 */ addiu $s4, $sp, 0x18
/* 044C3C 8006983C 27B60038 */ addiu $s6, $sp, 0x38
/* 044C40 80069840 02202021 */ addu $a0, $s1, $zero
.L80069844:
/* 044C44 80069844 0C01A5B4 */ jal osPfsSelectBank
/* 044C48 80069848 324500FF */ andi $a1, $s2, 0xff
/* 044C4C 8006984C 1440008B */ bnez $v0, .L80069A7C
/* 044C50 80069850 00003021 */ addu $a2, $zero, $zero
/* 044C54 80069854 8E240004 */ lw $a0, 4($s1)
/* 044C58 80069858 8E250008 */ lw $a1, 8($s1)
/* 044C5C 8006985C 0C01A874 */ jal osContRamRead
/* 044C60 80069860 27A70018 */ addiu $a3, $sp, 0x18
/* 044C64 80069864 14400085 */ bnez $v0, .L80069A7C
/* 044C68 80069868 26830001 */ addiu $v1, $s4, 1
/* 044C6C 8006986C 36420080 */ ori $v0, $s2, 0x80
/* 044C70 80069870 A3A20018 */ sb $v0, 0x18($sp)
/* 044C74 80069874 26840020 */ addiu $a0, $s4, 0x20
.L80069878:
/* 044C78 80069878 90620000 */ lbu $v0, ($v1)
/* 044C7C 8006987C 00021027 */ nor $v0, $zero, $v0
/* 044C80 80069880 A0620000 */ sb $v0, ($v1)
/* 044C84 80069884 24630001 */ addiu $v1, $v1, 1
/* 044C88 80069888 0064102A */ slt $v0, $v1, $a0
/* 044C8C 8006988C 1440FFFA */ bnez $v0, .L80069878
/* 044C90 80069890 00003021 */ addu $a2, $zero, $zero
/* 044C94 80069894 AFA00010 */ sw $zero, 0x10($sp)
/* 044C98 80069898 8E240004 */ lw $a0, 4($s1)
/* 044C9C 8006989C 8E250008 */ lw $a1, 8($s1)
/* 044CA0 800698A0 0C01A8F0 */ jal osContRamWrite
/* 044CA4 800698A4 27A70018 */ addiu $a3, $sp, 0x18
/* 044CA8 800698A8 14400074 */ bnez $v0, .L80069A7C
/* 044CAC 800698AC 00003021 */ addu $a2, $zero, $zero
/* 044CB0 800698B0 8E240004 */ lw $a0, 4($s1)
/* 044CB4 800698B4 8E250008 */ lw $a1, 8($s1)
/* 044CB8 800698B8 0C01A874 */ jal osContRamRead
/* 044CBC 800698BC 27A70038 */ addiu $a3, $sp, 0x38
/* 044CC0 800698C0 1440006E */ bnez $v0, .L80069A7C
/* 044CC4 800698C4 00008021 */ addu $s0, $zero, $zero
/* 044CC8 800698C8 02802821 */ addu $a1, $s4, $zero
/* 044CCC 800698CC 02C02021 */ addu $a0, $s6, $zero
.L800698D0:
/* 044CD0 800698D0 90830000 */ lbu $v1, ($a0)
/* 044CD4 800698D4 90A20000 */ lbu $v0, ($a1)
/* 044CD8 800698D8 14620007 */ bne $v1, $v0, .L800698F8
/* 044CDC 800698DC 24020020 */ addiu $v0, $zero, 0x20
/* 044CE0 800698E0 24A50001 */ addiu $a1, $a1, 1
/* 044CE4 800698E4 26100001 */ addiu $s0, $s0, 1
/* 044CE8 800698E8 2A020020 */ slti $v0, $s0, 0x20
/* 044CEC 800698EC 1440FFF8 */ bnez $v0, .L800698D0
/* 044CF0 800698F0 24840001 */ addiu $a0, $a0, 1
/* 044CF4 800698F4 24020020 */ addiu $v0, $zero, 0x20
.L800698F8:
/* 044CF8 800698F8 16020015 */ bne $s0, $v0, .L80069950
/* 044CFC 800698FC 00000000 */ nop
/* 044D00 80069900 1A40000F */ blez $s2, .L80069940
/* 044D04 80069904 02202021 */ addu $a0, $s1, $zero
/* 044D08 80069908 0C01A5B4 */ jal osPfsSelectBank
/* 044D0C 8006990C 00002821 */ addu $a1, $zero, $zero
/* 044D10 80069910 1440005A */ bnez $v0, .L80069A7C
/* 044D14 80069914 00003021 */ addu $a2, $zero, $zero
/* 044D18 80069918 8E240004 */ lw $a0, 4($s1)
/* 044D1C 8006991C 8E250008 */ lw $a1, 8($s1)
/* 044D20 80069920 0C01A874 */ jal osContRamRead
/* 044D24 80069924 02803821 */ addu $a3, $s4, $zero
/* 044D28 80069928 14400054 */ bnez $v0, .L80069A7C
/* 044D2C 8006992C 00000000 */ nop
/* 044D30 80069930 93A30018 */ lbu $v1, 0x18($sp)
/* 044D34 80069934 24020080 */ addiu $v0, $zero, 0x80
/* 044D38 80069938 14620005 */ bne $v1, $v0, .L80069950
/* 044D3C 8006993C 00000000 */ nop
.L80069940:
/* 044D40 80069940 26520001 */ addiu $s2, $s2, 1
/* 044D44 80069944 2A42003E */ slti $v0, $s2, 0x3e
/* 044D48 80069948 1440FFBE */ bnez $v0, .L80069844
/* 044D4C 8006994C 02202021 */ addu $a0, $s1, $zero
.L80069950:
/* 044D50 80069950 92220065 */ lbu $v0, 0x65($s1)
/* 044D54 80069954 10400005 */ beqz $v0, .L8006996C
/* 044D58 80069958 02202021 */ addu $a0, $s1, $zero
/* 044D5C 8006995C 0C01A5B4 */ jal osPfsSelectBank
/* 044D60 80069960 00002821 */ addu $a1, $zero, $zero
/* 044D64 80069964 14400045 */ bnez $v0, .L80069A7C
/* 044D68 80069968 00000000 */ nop
.L8006996C:
/* 044D6C 8006996C 96A20018 */ lhu $v0, 0x18($s5)
/* 044D70 80069970 2666001E */ addiu $a2, $s3, 0x1e
/* 044D74 80069974 02602021 */ addu $a0, $s3, $zero
/* 044D78 80069978 0012182A */ slt $v1, $zero, $s2
/* 044D7C 8006997C A272001A */ sb $s2, 0x1a($s3)
/* 044D80 80069980 3042FFFE */ andi $v0, $v0, 0xfffe
/* 044D84 80069984 00621825 */ or $v1, $v1, $v0
/* 044D88 80069988 A6630018 */ sh $v1, 0x18($s3)
/* 044D8C 8006998C 92A2001B */ lbu $v0, 0x1b($s5)
/* 044D90 80069990 2665001C */ addiu $a1, $s3, 0x1c
/* 044D94 80069994 00A03821 */ addu $a3, $a1, $zero
/* 044D98 80069998 A660001E */ sh $zero, 0x1e($s3)
/* 044D9C 8006999C A660001C */ sh $zero, 0x1c($s3)
/* 044DA0 800699A0 A262001B */ sb $v0, 0x1b($s3)
.L800699A4:
/* 044DA4 800699A4 94830000 */ lhu $v1, ($a0)
/* 044DA8 800699A8 94A20000 */ lhu $v0, ($a1)
/* 044DAC 800699AC 00431021 */ addu $v0, $v0, $v1
/* 044DB0 800699B0 A4A20000 */ sh $v0, ($a1)
/* 044DB4 800699B4 94C20000 */ lhu $v0, ($a2)
/* 044DB8 800699B8 24840002 */ addiu $a0, $a0, 2
/* 044DBC 800699BC 00031827 */ nor $v1, $zero, $v1
/* 044DC0 800699C0 00431021 */ addu $v0, $v0, $v1
/* 044DC4 800699C4 A4C20000 */ sh $v0, ($a2)
/* 044DC8 800699C8 0087102B */ sltu $v0, $a0, $a3
/* 044DCC 800699CC 1440FFF5 */ bnez $v0, .L800699A4
/* 044DD0 800699D0 00008021 */ addu $s0, $zero, $zero
/* 044DD4 800699D4 24140001 */ addiu $s4, $zero, 1
/* 044DD8 800699D8 27B20018 */ addiu $s2, $sp, 0x18
/* 044DDC 800699DC 24020001 */ addiu $v0, $zero, 1
/* 044DE0 800699E0 A7A20058 */ sh $v0, 0x58($sp)
/* 044DE4 800699E4 24020003 */ addiu $v0, $zero, 3
/* 044DE8 800699E8 A7A2005A */ sh $v0, 0x5a($sp)
/* 044DEC 800699EC 24020004 */ addiu $v0, $zero, 4
/* 044DF0 800699F0 A7A2005C */ sh $v0, 0x5c($sp)
/* 044DF4 800699F4 24020006 */ addiu $v0, $zero, 6
/* 044DF8 800699F8 A7A2005E */ sh $v0, 0x5e($sp)
.L800699FC:
/* 044DFC 800699FC 96460040 */ lhu $a2, 0x40($s2)
/* 044E00 80069A00 AFB40010 */ sw $s4, 0x10($sp)
/* 044E04 80069A04 8E240004 */ lw $a0, 4($s1)
/* 044E08 80069A08 8E250008 */ lw $a1, 8($s1)
/* 044E0C 80069A0C 0C01A8F0 */ jal osContRamWrite
/* 044E10 80069A10 02603821 */ addu $a3, $s3, $zero
/* 044E14 80069A14 14400019 */ bnez $v0, .L80069A7C
/* 044E18 80069A18 26100001 */ addiu $s0, $s0, 1
/* 044E1C 80069A1C 2A020004 */ slti $v0, $s0, 4
/* 044E20 80069A20 1440FFF6 */ bnez $v0, .L800699FC
/* 044E24 80069A24 26520002 */ addiu $s2, $s2, 2
/* 044E28 80069A28 8E240004 */ lw $a0, 4($s1)
/* 044E2C 80069A2C 8E250008 */ lw $a1, 8($s1)
/* 044E30 80069A30 24060001 */ addiu $a2, $zero, 1
/* 044E34 80069A34 0C01A874 */ jal osContRamRead
/* 044E38 80069A38 27A70018 */ addiu $a3, $sp, 0x18
/* 044E3C 80069A3C 10400005 */ beqz $v0, .L80069A54
/* 044E40 80069A40 02603021 */ addu $a2, $s3, $zero
/* 044E44 80069A44 0801A69F */ j .L80069A7C
/* 044E48 80069A48 00000000 */ nop
.L80069A4C:
/* 044E4C 80069A4C 0801A69F */ j .L80069A7C
/* 044E50 80069A50 2402000B */ addiu $v0, $zero, 0xb
.L80069A54:
/* 044E54 80069A54 27A40018 */ addiu $a0, $sp, 0x18
/* 044E58 80069A58 24C50020 */ addiu $a1, $a2, 0x20
.L80069A5C:
/* 044E5C 80069A5C 90830000 */ lbu $v1, ($a0)
/* 044E60 80069A60 90C20000 */ lbu $v0, ($a2)
/* 044E64 80069A64 1462FFF9 */ bne $v1, $v0, .L80069A4C
/* 044E68 80069A68 24C60001 */ addiu $a2, $a2, 1
/* 044E6C 80069A6C 00C5102A */ slt $v0, $a2, $a1
/* 044E70 80069A70 1440FFFA */ bnez $v0, .L80069A5C
/* 044E74 80069A74 24840001 */ addiu $a0, $a0, 1
/* 044E78 80069A78 00001021 */ addu $v0, $zero, $zero
.L80069A7C:
/* 044E7C 80069A7C 8FBF007C */ lw $ra, 0x7c($sp)
/* 044E80 80069A80 8FB60078 */ lw $s6, 0x78($sp)
/* 044E84 80069A84 8FB50074 */ lw $s5, 0x74($sp)
/* 044E88 80069A88 8FB40070 */ lw $s4, 0x70($sp)
/* 044E8C 80069A8C 8FB3006C */ lw $s3, 0x6c($sp)
/* 044E90 80069A90 8FB20068 */ lw $s2, 0x68($sp)
/* 044E94 80069A94 8FB10064 */ lw $s1, 0x64($sp)
/* 044E98 80069A98 8FB00060 */ lw $s0, 0x60($sp)
/* 044E9C 80069A9C 03E00008 */ jr $ra
/* 044EA0 80069AA0 27BD0080 */ addiu $sp, $sp, 0x80