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

170 lines
7.8 KiB
ArmAsm

.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel osMotorInit
/* 043344 80067F44 27BDFF88 */ addiu $sp, $sp, -0x78
/* 043348 80067F48 AFB00060 */ sw $s0, 0x60($sp)
/* 04334C 80067F4C 00808021 */ addu $s0, $a0, $zero
/* 043350 80067F50 AFB20068 */ sw $s2, 0x68($sp)
/* 043354 80067F54 00A09021 */ addu $s2, $a1, $zero
/* 043358 80067F58 AFB10064 */ sw $s1, 0x64($sp)
/* 04335C 80067F5C 00C08821 */ addu $s1, $a2, $zero
/* 043360 80067F60 02402021 */ addu $a0, $s2, $zero
/* 043364 80067F64 240500FE */ addiu $a1, $zero, 0xfe
/* 043368 80067F68 240200FF */ addiu $v0, $zero, 0xff
/* 04336C 80067F6C AFBF0070 */ sw $ra, 0x70($sp)
/* 043370 80067F70 AFB3006C */ sw $s3, 0x6c($sp)
/* 043374 80067F74 AE500004 */ sw $s0, 4($s2)
/* 043378 80067F78 AE510008 */ sw $s1, 8($s2)
/* 04337C 80067F7C A2420065 */ sb $v0, 0x65($s2)
/* 043380 80067F80 0C01A5B4 */ jal osPfsSelectBank
/* 043384 80067F84 AE400000 */ sw $zero, ($s2)
/* 043388 80067F88 24130002 */ addiu $s3, $zero, 2
/* 04338C 80067F8C 14530003 */ bne $v0, $s3, .L80067F9C
/* 043390 80067F90 02402021 */ addu $a0, $s2, $zero
/* 043394 80067F94 0C01A5B4 */ jal osPfsSelectBank
/* 043398 80067F98 24050080 */ addiu $a1, $zero, 0x80
.L80067F9C:
/* 04339C 80067F9C 14400074 */ bnez $v0, .L80068170
/* 0433A0 80067FA0 02002021 */ addu $a0, $s0, $zero
/* 0433A4 80067FA4 02202821 */ addu $a1, $s1, $zero
/* 0433A8 80067FA8 24060400 */ addiu $a2, $zero, 0x400
/* 0433AC 80067FAC 0C01A874 */ jal osContRamRead
/* 0433B0 80067FB0 27A70010 */ addiu $a3, $sp, 0x10
/* 0433B4 80067FB4 50530001 */ beql $v0, $s3, .L80067FBC
/* 0433B8 80067FB8 24020004 */ addiu $v0, $zero, 4
.L80067FBC:
/* 0433BC 80067FBC 1440006C */ bnez $v0, .L80068170
/* 0433C0 80067FC0 00000000 */ nop
/* 0433C4 80067FC4 93A3002F */ lbu $v1, 0x2f($sp)
/* 0433C8 80067FC8 240200FE */ addiu $v0, $zero, 0xfe
/* 0433CC 80067FCC 10620013 */ beq $v1, $v0, .L8006801C
/* 0433D0 80067FD0 02402021 */ addu $a0, $s2, $zero
/* 0433D4 80067FD4 0C01A5B4 */ jal osPfsSelectBank
/* 0433D8 80067FD8 24050080 */ addiu $a1, $zero, 0x80
/* 0433DC 80067FDC 50530001 */ beql $v0, $s3, .L80067FE4
/* 0433E0 80067FE0 24020004 */ addiu $v0, $zero, 4
.L80067FE4:
/* 0433E4 80067FE4 14400062 */ bnez $v0, .L80068170
/* 0433E8 80067FE8 02002021 */ addu $a0, $s0, $zero
/* 0433EC 80067FEC 02202821 */ addu $a1, $s1, $zero
/* 0433F0 80067FF0 24060400 */ addiu $a2, $zero, 0x400
/* 0433F4 80067FF4 0C01A874 */ jal osContRamRead
/* 0433F8 80067FF8 27A70010 */ addiu $a3, $sp, 0x10
/* 0433FC 80067FFC 50530001 */ beql $v0, $s3, .L80068004
/* 043400 80068000 24020004 */ addiu $v0, $zero, 4
.L80068004:
/* 043404 80068004 1440005A */ bnez $v0, .L80068170
/* 043408 80068008 00000000 */ nop
/* 04340C 8006800C 93A3002F */ lbu $v1, 0x2f($sp)
/* 043410 80068010 24020080 */ addiu $v0, $zero, 0x80
/* 043414 80068014 10620003 */ beq $v1, $v0, .L80068024
/* 043418 80068018 00000000 */ nop
.L8006801C:
/* 04341C 8006801C 0801A05C */ j .L80068170
/* 043420 80068020 2402000B */ addiu $v0, $zero, 0xb
.L80068024:
/* 043424 80068024 8E420000 */ lw $v0, ($s2)
/* 043428 80068028 30420008 */ andi $v0, $v0, 8
/* 04342C 8006802C 1440004E */ bnez $v0, .L80068168
/* 043430 80068030 24020008 */ addiu $v0, $zero, 8
/* 043434 80068034 00111980 */ sll $v1, $s1, 6
/* 043438 80068038 3C02800B */ lui $v0, 0x800b
/* 04343C 8006803C 24420B30 */ addiu $v0, $v0, 0xb30
/* 043440 80068040 00628021 */ addu $s0, $v1, $v0
/* 043444 80068044 24040600 */ addiu $a0, $zero, 0x600
/* 043448 80068048 240200FF */ addiu $v0, $zero, 0xff
/* 04344C 8006804C A3A20030 */ sb $v0, 0x30($sp)
/* 043450 80068050 24020023 */ addiu $v0, $zero, 0x23
/* 043454 80068054 A3A20031 */ sb $v0, 0x31($sp)
/* 043458 80068058 24020001 */ addiu $v0, $zero, 1
/* 04345C 8006805C A3A20032 */ sb $v0, 0x32($sp)
/* 043460 80068060 24020003 */ addiu $v0, $zero, 3
/* 043464 80068064 A3A20033 */ sb $v0, 0x33($sp)
/* 043468 80068068 240200C0 */ addiu $v0, $zero, 0xc0
/* 04346C 8006806C 0C01B218 */ jal osContAddressCrc
/* 043470 80068070 A3A20034 */ sb $v0, 0x34($sp)
/* 043474 80068074 12200008 */ beqz $s1, .L80068098
/* 043478 80068078 A3A20035 */ sb $v0, 0x35($sp)
/* 04347C 8006807C 1A200006 */ blez $s1, .L80068098
/* 043480 80068080 00001821 */ addu $v1, $zero, $zero
.L80068084:
/* 043484 80068084 A2000000 */ sb $zero, ($s0)
/* 043488 80068088 24630001 */ addiu $v1, $v1, 1
/* 04348C 8006808C 0071102A */ slt $v0, $v1, $s1
/* 043490 80068090 1440FFFC */ bnez $v0, .L80068084
/* 043494 80068094 26100001 */ addiu $s0, $s0, 1
.L80068098:
/* 043498 80068098 27A60030 */ addiu $a2, $sp, 0x30
/* 04349C 8006809C 00D01025 */ or $v0, $a2, $s0
/* 0434A0 800680A0 30420003 */ andi $v0, $v0, 3
/* 0434A4 800680A4 10400017 */ beqz $v0, .L80068104
/* 0434A8 800680A8 02003821 */ addu $a3, $s0, $zero
/* 0434AC 800680AC 27A80050 */ addiu $t0, $sp, 0x50
.L800680B0:
/* 0434B0 800680B0 88C20000 */ lwl $v0, ($a2)
/* 0434B4 800680B4 98C20003 */ lwr $v0, 3($a2)
/* 0434B8 800680B8 88C30004 */ lwl $v1, 4($a2)
/* 0434BC 800680BC 98C30007 */ lwr $v1, 7($a2)
/* 0434C0 800680C0 88C40008 */ lwl $a0, 8($a2)
/* 0434C4 800680C4 98C4000B */ lwr $a0, 0xb($a2)
/* 0434C8 800680C8 88C5000C */ lwl $a1, 0xc($a2)
/* 0434CC 800680CC 98C5000F */ lwr $a1, 0xf($a2)
/* 0434D0 800680D0 A8E20000 */ swl $v0, ($a3)
/* 0434D4 800680D4 B8E20003 */ swr $v0, 3($a3)
/* 0434D8 800680D8 A8E30004 */ swl $v1, 4($a3)
/* 0434DC 800680DC B8E30007 */ swr $v1, 7($a3)
/* 0434E0 800680E0 A8E40008 */ swl $a0, 8($a3)
/* 0434E4 800680E4 B8E4000B */ swr $a0, 0xb($a3)
/* 0434E8 800680E8 A8E5000C */ swl $a1, 0xc($a3)
/* 0434EC 800680EC B8E5000F */ swr $a1, 0xf($a3)
/* 0434F0 800680F0 24C60010 */ addiu $a2, $a2, 0x10
/* 0434F4 800680F4 14C8FFEE */ bne $a2, $t0, .L800680B0
/* 0434F8 800680F8 24E70010 */ addiu $a3, $a3, 0x10
/* 0434FC 800680FC 0801A04D */ j .L80068134
/* 043500 80068100 00000000 */ nop
.L80068104:
/* 043504 80068104 27A80050 */ addiu $t0, $sp, 0x50
.L80068108:
/* 043508 80068108 8CC20000 */ lw $v0, ($a2)
/* 04350C 8006810C 8CC30004 */ lw $v1, 4($a2)
/* 043510 80068110 8CC40008 */ lw $a0, 8($a2)
/* 043514 80068114 8CC5000C */ lw $a1, 0xc($a2)
/* 043518 80068118 ACE20000 */ sw $v0, ($a3)
/* 04351C 8006811C ACE30004 */ sw $v1, 4($a3)
/* 043520 80068120 ACE40008 */ sw $a0, 8($a3)
/* 043524 80068124 ACE5000C */ sw $a1, 0xc($a3)
/* 043528 80068128 24C60010 */ addiu $a2, $a2, 0x10
/* 04352C 8006812C 14C8FFF6 */ bne $a2, $t0, .L80068108
/* 043530 80068130 24E70010 */ addiu $a3, $a3, 0x10
.L80068134:
/* 043534 80068134 88C20000 */ lwl $v0, ($a2)
/* 043538 80068138 98C20003 */ lwr $v0, 3($a2)
/* 04353C 8006813C 80C30004 */ lb $v1, 4($a2)
/* 043540 80068140 80C40005 */ lb $a0, 5($a2)
/* 043544 80068144 80C50006 */ lb $a1, 6($a2)
/* 043548 80068148 A8E20000 */ swl $v0, ($a3)
/* 04354C 8006814C B8E20003 */ swr $v0, 3($a3)
/* 043550 80068150 A0E30004 */ sb $v1, 4($a3)
/* 043554 80068154 A0E40005 */ sb $a0, 5($a3)
/* 043558 80068158 A0E50006 */ sb $a1, 6($a3)
/* 04355C 8006815C 240200FE */ addiu $v0, $zero, 0xfe
/* 043560 80068160 A2020027 */ sb $v0, 0x27($s0)
/* 043564 80068164 24020008 */ addiu $v0, $zero, 8
.L80068168:
/* 043568 80068168 AE420000 */ sw $v0, ($s2)
/* 04356C 8006816C 00001021 */ addu $v0, $zero, $zero
.L80068170:
/* 043570 80068170 8FBF0070 */ lw $ra, 0x70($sp)
/* 043574 80068174 8FB3006C */ lw $s3, 0x6c($sp)
/* 043578 80068178 8FB20068 */ lw $s2, 0x68($sp)
/* 04357C 8006817C 8FB10064 */ lw $s1, 0x64($sp)
/* 043580 80068180 8FB00060 */ lw $s0, 0x60($sp)
/* 043584 80068184 03E00008 */ jr $ra
/* 043588 80068188 27BD0078 */ addiu $sp, $sp, 0x78
/* 04358C 8006818C 00000000 */ nop