prime/asm/Dolphin/card/CARDCreate.s

237 lines
11 KiB
ArmAsm
Raw Normal View History

2022-04-02 09:50:35 +00:00
.include "macros.inc"
.section .text, "ax"
CreateCallbackFat:
/* 803BD1C0 003BA120 7C 08 02 A6 */ mflr r0
/* 803BD1C4 003BA124 90 01 00 04 */ stw r0, 4(r1)
/* 803BD1C8 003BA128 94 21 FF D8 */ stwu r1, -0x28(r1)
/* 803BD1CC 003BA12C BF 61 00 14 */ stmw r27, 0x14(r1)
/* 803BD1D0 003BA130 3B 83 00 00 */ addi r28, r3, 0
2022-07-30 09:12:25 +00:00
/* 803BD1D4 003BA134 3C 60 80 57 */ lis r3, __CARDBlock@ha
2022-04-02 09:50:35 +00:00
/* 803BD1D8 003BA138 1C BC 01 10 */ mulli r5, r28, 0x110
2022-07-30 09:12:25 +00:00
/* 803BD1DC 003BA13C 38 03 9A 58 */ addi r0, r3, __CARDBlock@l
2022-04-02 09:50:35 +00:00
/* 803BD1E0 003BA140 7F E0 2A 14 */ add r31, r0, r5
/* 803BD1E4 003BA144 83 BF 00 D0 */ lwz r29, 0xd0(r31)
/* 803BD1E8 003BA148 3B 60 00 00 */ li r27, 0
/* 803BD1EC 003BA14C 7C 9E 23 79 */ or. r30, r4, r4
/* 803BD1F0 003BA150 93 7F 00 D0 */ stw r27, 0xd0(r31)
/* 803BD1F4 003BA154 41 80 00 C0 */ blt lbl_803BD2B4
/* 803BD1F8 003BA158 7F E3 FB 78 */ mr r3, r31
/* 803BD1FC 003BA15C 4B FF D7 75 */ bl __CARDGetDirBlock
/* 803BD200 003BA160 A0 1F 00 BC */ lhz r0, 0xbc(r31)
/* 803BD204 003BA164 38 A0 00 04 */ li r5, 4
/* 803BD208 003BA168 80 9F 01 0C */ lwz r4, 0x10c(r31)
/* 803BD20C 003BA16C 54 00 30 32 */ slwi r0, r0, 6
/* 803BD210 003BA170 7F C3 02 14 */ add r30, r3, r0
/* 803BD214 003BA174 38 7E 00 00 */ addi r3, r30, 0
/* 803BD218 003BA178 4B C4 62 79 */ bl memcpy
/* 803BD21C 003BA17C 80 9F 01 0C */ lwz r4, 0x10c(r31)
/* 803BD220 003BA180 38 7E 00 04 */ addi r3, r30, 4
/* 803BD224 003BA184 38 A0 00 02 */ li r5, 2
/* 803BD228 003BA188 38 84 00 04 */ addi r4, r4, 4
/* 803BD22C 003BA18C 4B C4 62 65 */ bl memcpy
/* 803BD230 003BA190 38 00 00 04 */ li r0, 4
/* 803BD234 003BA194 98 1E 00 34 */ stb r0, 0x34(r30)
/* 803BD238 003BA198 38 00 FF FF */ li r0, -1
/* 803BD23C 003BA19C 3C 60 80 00 */ lis r3, 0x800000F8@ha
/* 803BD240 003BA1A0 9B 7E 00 35 */ stb r27, 0x35(r30)
/* 803BD244 003BA1A4 A0 9F 00 BE */ lhz r4, 0xbe(r31)
/* 803BD248 003BA1A8 B0 9E 00 36 */ sth r4, 0x36(r30)
/* 803BD24C 003BA1AC 9B 7E 00 07 */ stb r27, 7(r30)
/* 803BD250 003BA1B0 90 1E 00 2C */ stw r0, 0x2c(r30)
/* 803BD254 003BA1B4 B3 7E 00 30 */ sth r27, 0x30(r30)
/* 803BD258 003BA1B8 B3 7E 00 32 */ sth r27, 0x32(r30)
/* 803BD25C 003BA1BC 90 1E 00 3C */ stw r0, 0x3c(r30)
/* 803BD260 003BA1C0 A0 1E 00 32 */ lhz r0, 0x32(r30)
/* 803BD264 003BA1C4 54 00 00 3A */ rlwinm r0, r0, 0, 0, 0x1d
/* 803BD268 003BA1C8 60 00 00 01 */ ori r0, r0, 1
/* 803BD26C 003BA1CC B0 1E 00 32 */ sth r0, 0x32(r30)
/* 803BD270 003BA1D0 80 9F 00 C0 */ lwz r4, 0xc0(r31)
/* 803BD274 003BA1D4 93 64 00 08 */ stw r27, 8(r4)
/* 803BD278 003BA1D8 A0 1E 00 36 */ lhz r0, 0x36(r30)
/* 803BD27C 003BA1DC 80 9F 00 C0 */ lwz r4, 0xc0(r31)
/* 803BD280 003BA1E0 B0 04 00 10 */ sth r0, 0x10(r4)
/* 803BD284 003BA1E4 80 03 00 F8 */ lwz r0, 0x800000F8@l(r3)
/* 803BD288 003BA1E8 54 1B F0 BE */ srwi r27, r0, 2
/* 803BD28C 003BA1EC 4B FC 81 1D */ bl OSGetTime
/* 803BD290 003BA1F0 38 DB 00 00 */ addi r6, r27, 0
/* 803BD294 003BA1F4 38 A0 00 00 */ li r5, 0
/* 803BD298 003BA1F8 4B FC C9 35 */ bl __div2i
/* 803BD29C 003BA1FC 90 9E 00 28 */ stw r4, 0x28(r30)
/* 803BD2A0 003BA200 38 7C 00 00 */ addi r3, r28, 0
/* 803BD2A4 003BA204 38 9D 00 00 */ addi r4, r29, 0
/* 803BD2A8 003BA208 4B FF D8 69 */ bl __CARDUpdateDir
/* 803BD2AC 003BA20C 7C 7E 1B 79 */ or. r30, r3, r3
/* 803BD2B0 003BA210 40 80 00 2C */ bge lbl_803BD2DC
lbl_803BD2B4:
/* 803BD2B4 003BA214 38 7F 00 00 */ addi r3, r31, 0
/* 803BD2B8 003BA218 38 9E 00 00 */ addi r4, r30, 0
/* 803BD2BC 003BA21C 4B FF BB 9D */ bl __CARDPutControlBlock
/* 803BD2C0 003BA220 28 1D 00 00 */ cmplwi r29, 0
/* 803BD2C4 003BA224 41 82 00 18 */ beq lbl_803BD2DC
/* 803BD2C8 003BA228 39 9D 00 00 */ addi r12, r29, 0
/* 803BD2CC 003BA22C 7D 88 03 A6 */ mtlr r12
/* 803BD2D0 003BA230 38 7C 00 00 */ addi r3, r28, 0
/* 803BD2D4 003BA234 38 9E 00 00 */ addi r4, r30, 0
2022-07-14 05:48:03 +00:00
/* 803BD2D8 003BA238 4E 80 00 21 */ blrl
2022-04-02 09:50:35 +00:00
lbl_803BD2DC:
/* 803BD2DC 003BA23C BB 61 00 14 */ lmw r27, 0x14(r1)
/* 803BD2E0 003BA240 80 01 00 2C */ lwz r0, 0x2c(r1)
/* 803BD2E4 003BA244 38 21 00 28 */ addi r1, r1, 0x28
/* 803BD2E8 003BA248 7C 08 03 A6 */ mtlr r0
2022-07-14 05:48:03 +00:00
/* 803BD2EC 003BA24C 4E 80 00 20 */ blr
2022-04-02 09:50:35 +00:00
.global CARDCreateAsync
CARDCreateAsync:
/* 803BD2F0 003BA250 7C 08 02 A6 */ mflr r0
/* 803BD2F4 003BA254 90 01 00 04 */ stw r0, 4(r1)
/* 803BD2F8 003BA258 94 21 FF B8 */ stwu r1, -0x48(r1)
/* 803BD2FC 003BA25C BE E1 00 24 */ stmw r23, 0x24(r1)
/* 803BD300 003BA260 3B 44 00 00 */ addi r26, r4, 0
/* 803BD304 003BA264 3B 23 00 00 */ addi r25, r3, 0
/* 803BD308 003BA268 3B 65 00 00 */ addi r27, r5, 0
/* 803BD30C 003BA26C 3B 86 00 00 */ addi r28, r6, 0
/* 803BD310 003BA270 3B A7 00 00 */ addi r29, r7, 0
/* 803BD314 003BA274 38 7A 00 00 */ addi r3, r26, 0
/* 803BD318 003BA278 4B FD 2E A9 */ bl strlen
/* 803BD31C 003BA27C 28 03 00 20 */ cmplwi r3, 0x20
/* 803BD320 003BA280 40 81 00 0C */ ble lbl_803BD32C
/* 803BD324 003BA284 38 60 FF F4 */ li r3, -12
/* 803BD328 003BA288 48 00 01 D4 */ b lbl_803BD4FC
lbl_803BD32C:
/* 803BD32C 003BA28C 38 79 00 00 */ addi r3, r25, 0
/* 803BD330 003BA290 38 81 00 1C */ addi r4, r1, 0x1c
/* 803BD334 003BA294 4B FF BA 6D */ bl __CARDGetControlBlock
/* 803BD338 003BA298 2C 03 00 00 */ cmpwi r3, 0
/* 803BD33C 003BA29C 40 80 00 08 */ bge lbl_803BD344
/* 803BD340 003BA2A0 48 00 01 BC */ b lbl_803BD4FC
lbl_803BD344:
/* 803BD344 003BA2A4 28 1B 00 00 */ cmplwi r27, 0
/* 803BD348 003BA2A8 41 82 00 1C */ beq lbl_803BD364
/* 803BD34C 003BA2AC 80 61 00 1C */ lwz r3, 0x1c(r1)
/* 803BD350 003BA2B0 80 83 00 0C */ lwz r4, 0xc(r3)
/* 803BD354 003BA2B4 7C 1B 23 96 */ divwu r0, r27, r4
/* 803BD358 003BA2B8 7C 00 21 D6 */ mullw r0, r0, r4
/* 803BD35C 003BA2BC 7C 00 D8 51 */ subf. r0, r0, r27
/* 803BD360 003BA2C0 41 82 00 0C */ beq lbl_803BD36C
lbl_803BD364:
/* 803BD364 003BA2C4 38 60 FF 80 */ li r3, -128
/* 803BD368 003BA2C8 48 00 01 94 */ b lbl_803BD4FC
lbl_803BD36C:
/* 803BD36C 003BA2CC 3C 80 00 01 */ lis r4, 0x0000FFFF@ha
/* 803BD370 003BA2D0 3B C4 FF FF */ addi r30, r4, 0x0000FFFF@l
/* 803BD374 003BA2D4 4B FF D5 FD */ bl __CARDGetDirBlock
/* 803BD378 003BA2D8 3B E3 00 00 */ addi r31, r3, 0
/* 803BD37C 003BA2DC 3B 1F 00 00 */ addi r24, r31, 0
/* 803BD380 003BA2E0 3A E0 00 00 */ li r23, 0
/* 803BD384 003BA2E4 48 00 00 8C */ b lbl_803BD410
lbl_803BD388:
/* 803BD388 003BA2E8 88 18 00 00 */ lbz r0, 0(r24)
/* 803BD38C 003BA2EC 28 00 00 FF */ cmplwi r0, 0xff
/* 803BD390 003BA2F0 40 82 00 18 */ bne lbl_803BD3A8
/* 803BD394 003BA2F4 57 C0 04 3E */ clrlwi r0, r30, 0x10
/* 803BD398 003BA2F8 28 00 FF FF */ cmplwi r0, 0xffff
/* 803BD39C 003BA2FC 40 82 00 6C */ bne lbl_803BD408
/* 803BD3A0 003BA300 7E FE BB 78 */ mr r30, r23
/* 803BD3A4 003BA304 48 00 00 64 */ b lbl_803BD408
lbl_803BD3A8:
/* 803BD3A8 003BA308 80 81 00 1C */ lwz r4, 0x1c(r1)
/* 803BD3AC 003BA30C 38 78 00 00 */ addi r3, r24, 0
/* 803BD3B0 003BA310 38 A0 00 04 */ li r5, 4
/* 803BD3B4 003BA314 80 84 01 0C */ lwz r4, 0x10c(r4)
/* 803BD3B8 003BA318 4B FD 04 C5 */ bl memcmp
/* 803BD3BC 003BA31C 2C 03 00 00 */ cmpwi r3, 0
/* 803BD3C0 003BA320 40 82 00 48 */ bne lbl_803BD408
/* 803BD3C4 003BA324 80 81 00 1C */ lwz r4, 0x1c(r1)
/* 803BD3C8 003BA328 38 78 00 04 */ addi r3, r24, 4
/* 803BD3CC 003BA32C 38 A0 00 02 */ li r5, 2
/* 803BD3D0 003BA330 80 84 01 0C */ lwz r4, 0x10c(r4)
/* 803BD3D4 003BA334 38 84 00 04 */ addi r4, r4, 4
/* 803BD3D8 003BA338 4B FD 04 A5 */ bl memcmp
/* 803BD3DC 003BA33C 2C 03 00 00 */ cmpwi r3, 0
/* 803BD3E0 003BA340 40 82 00 28 */ bne lbl_803BD408
/* 803BD3E4 003BA344 38 78 00 00 */ addi r3, r24, 0
/* 803BD3E8 003BA348 38 9A 00 00 */ addi r4, r26, 0
/* 803BD3EC 003BA34C 4B FF F9 81 */ bl __CARDCompareFileName
/* 803BD3F0 003BA350 2C 03 00 00 */ cmpwi r3, 0
/* 803BD3F4 003BA354 41 82 00 14 */ beq lbl_803BD408
/* 803BD3F8 003BA358 80 61 00 1C */ lwz r3, 0x1c(r1)
/* 803BD3FC 003BA35C 38 80 FF F9 */ li r4, -7
/* 803BD400 003BA360 4B FF BA 59 */ bl __CARDPutControlBlock
/* 803BD404 003BA364 48 00 00 F8 */ b lbl_803BD4FC
lbl_803BD408:
/* 803BD408 003BA368 3B 18 00 40 */ addi r24, r24, 0x40
/* 803BD40C 003BA36C 3A F7 00 01 */ addi r23, r23, 1
lbl_803BD410:
/* 803BD410 003BA370 56 E0 04 3E */ clrlwi r0, r23, 0x10
/* 803BD414 003BA374 28 00 00 7F */ cmplwi r0, 0x7f
/* 803BD418 003BA378 41 80 FF 70 */ blt lbl_803BD388
/* 803BD41C 003BA37C 57 C0 04 3E */ clrlwi r0, r30, 0x10
/* 803BD420 003BA380 28 00 FF FF */ cmplwi r0, 0xffff
/* 803BD424 003BA384 40 82 00 14 */ bne lbl_803BD438
/* 803BD428 003BA388 80 61 00 1C */ lwz r3, 0x1c(r1)
/* 803BD42C 003BA38C 38 80 FF F8 */ li r4, -8
/* 803BD430 003BA390 4B FF BA 29 */ bl __CARDPutControlBlock
/* 803BD434 003BA394 48 00 00 C8 */ b lbl_803BD4FC
lbl_803BD438:
/* 803BD438 003BA398 80 61 00 1C */ lwz r3, 0x1c(r1)
/* 803BD43C 003BA39C 4B FF D1 31 */ bl __CARDGetFatBlock
/* 803BD440 003BA3A0 80 81 00 1C */ lwz r4, 0x1c(r1)
/* 803BD444 003BA3A4 A0 03 00 06 */ lhz r0, 6(r3)
/* 803BD448 003BA3A8 80 64 00 0C */ lwz r3, 0xc(r4)
/* 803BD44C 003BA3AC 7C 03 01 D6 */ mullw r0, r3, r0
/* 803BD450 003BA3B0 7C 00 D8 40 */ cmplw r0, r27
/* 803BD454 003BA3B4 40 80 00 14 */ bge lbl_803BD468
/* 803BD458 003BA3B8 38 64 00 00 */ addi r3, r4, 0
/* 803BD45C 003BA3BC 38 80 FF F7 */ li r4, -9
/* 803BD460 003BA3C0 4B FF B9 F9 */ bl __CARDPutControlBlock
/* 803BD464 003BA3C4 48 00 00 98 */ b lbl_803BD4FC
lbl_803BD468:
/* 803BD468 003BA3C8 28 1D 00 00 */ cmplwi r29, 0
/* 803BD46C 003BA3CC 41 82 00 0C */ beq lbl_803BD478
/* 803BD470 003BA3D0 7F A0 EB 78 */ mr r0, r29
/* 803BD474 003BA3D4 48 00 00 0C */ b lbl_803BD480
lbl_803BD478:
/* 803BD478 003BA3D8 3C 60 80 3B */ lis r3, __CARDDefaultApiCallback@ha
/* 803BD47C 003BA3DC 38 03 7E 74 */ addi r0, r3, __CARDDefaultApiCallback@l
lbl_803BD480:
/* 803BD480 003BA3E0 90 04 00 D0 */ stw r0, 0xd0(r4)
/* 803BD484 003BA3E4 57 C0 32 B2 */ rlwinm r0, r30, 6, 0xa, 0x19
/* 803BD488 003BA3E8 7C FF 02 14 */ add r7, r31, r0
/* 803BD48C 003BA3EC 80 61 00 1C */ lwz r3, 0x1c(r1)
/* 803BD490 003BA3F0 57 DD 04 3E */ clrlwi r29, r30, 0x10
/* 803BD494 003BA3F4 38 9A 00 00 */ addi r4, r26, 0
/* 803BD498 003BA3F8 B3 C3 00 BC */ sth r30, 0xbc(r3)
/* 803BD49C 003BA3FC 38 67 00 08 */ addi r3, r7, 8
/* 803BD4A0 003BA400 38 A0 00 20 */ li r5, 0x20
/* 803BD4A4 003BA404 80 C1 00 1C */ lwz r6, 0x1c(r1)
/* 803BD4A8 003BA408 80 06 00 0C */ lwz r0, 0xc(r6)
/* 803BD4AC 003BA40C 7C 1B 03 96 */ divwu r0, r27, r0
/* 803BD4B0 003BA410 B0 07 00 38 */ sth r0, 0x38(r7)
/* 803BD4B4 003BA414 4B FD 2C 11 */ bl strncpy
/* 803BD4B8 003BA418 80 81 00 1C */ lwz r4, 0x1c(r1)
/* 803BD4BC 003BA41C 3C 60 80 3C */ lis r3, CreateCallbackFat@ha
/* 803BD4C0 003BA420 38 A3 D1 C0 */ addi r5, r3, CreateCallbackFat@l
/* 803BD4C4 003BA424 93 84 00 C0 */ stw r28, 0xc0(r4)
/* 803BD4C8 003BA428 7F 23 CB 78 */ mr r3, r25
/* 803BD4CC 003BA42C 93 3C 00 00 */ stw r25, 0(r28)
/* 803BD4D0 003BA430 93 BC 00 04 */ stw r29, 4(r28)
/* 803BD4D4 003BA434 80 81 00 1C */ lwz r4, 0x1c(r1)
/* 803BD4D8 003BA438 80 04 00 0C */ lwz r0, 0xc(r4)
/* 803BD4DC 003BA43C 7C 9B 03 96 */ divwu r4, r27, r0
/* 803BD4E0 003BA440 4B FF D2 31 */ bl __CARDAllocBlock
/* 803BD4E4 003BA444 7C 64 1B 79 */ or. r4, r3, r3
/* 803BD4E8 003BA448 40 80 00 10 */ bge lbl_803BD4F8
/* 803BD4EC 003BA44C 80 61 00 1C */ lwz r3, 0x1c(r1)
/* 803BD4F0 003BA450 4B FF B9 69 */ bl __CARDPutControlBlock
/* 803BD4F4 003BA454 48 00 00 08 */ b lbl_803BD4FC
lbl_803BD4F8:
/* 803BD4F8 003BA458 7C 83 23 78 */ mr r3, r4
lbl_803BD4FC:
/* 803BD4FC 003BA45C BA E1 00 24 */ lmw r23, 0x24(r1)
/* 803BD500 003BA460 80 01 00 4C */ lwz r0, 0x4c(r1)
/* 803BD504 003BA464 38 21 00 48 */ addi r1, r1, 0x48
/* 803BD508 003BA468 7C 08 03 A6 */ mtlr r0
2022-07-14 05:48:03 +00:00
/* 803BD50C 003BA46C 4E 80 00 20 */ blr