donut-decomp/asm/mem/mem_frameHeap.s
2022-10-17 09:44:24 +01:00

193 lines
8.5 KiB
ArmAsm

.include "macros.inc"
.section .text, "ax" # 0x80006A00 - 0x80406260 ; 0x003FF860
.global MEMCreateFrmHeapEx
MEMCreateFrmHeapEx:
/* 800A32E0 0009F120 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 800A32E4 0009F124 7C 08 02 A6 */ mflr r0
/* 800A32E8 0009F128 7C 84 1A 14 */ add r4, r4, r3
/* 800A32EC 0009F12C 90 01 00 14 */ stw r0, 0x14(r1)
/* 800A32F0 0009F130 38 03 00 03 */ addi r0, r3, 0x3
/* 800A32F4 0009F134 54 86 00 3A */ clrrwi r6, r4, 2
/* 800A32F8 0009F138 93 E1 00 0C */ stw r31, 0xc(r1)
/* 800A32FC 0009F13C 54 1F 00 3A */ clrrwi r31, r0, 2
/* 800A3300 0009F140 7C 1F 30 40 */ cmplw r31, r6
/* 800A3304 0009F144 41 81 00 10 */ bgt lbl_800A3314
/* 800A3308 0009F148 7C 1F 30 50 */ subf r0, r31, r6
/* 800A330C 0009F14C 28 00 00 48 */ cmplwi r0, 0x48
/* 800A3310 0009F150 40 80 00 0C */ bge lbl_800A331C
.global lbl_800A3314
lbl_800A3314:
/* 800A3314 0009F154 38 60 00 00 */ li r3, 0x0
/* 800A3318 0009F158 48 00 00 38 */ b lbl_800A3350
.global lbl_800A331C
lbl_800A331C:
/* 800A331C 0009F15C 3C 80 46 52 */ lis r4, 0x4652
/* 800A3320 0009F160 7C A7 2B 78 */ mr r7, r5
/* 800A3324 0009F164 7F E3 FB 78 */ mr r3, r31
/* 800A3328 0009F168 38 BF 00 48 */ addi r5, r31, 0x48
/* 800A332C 0009F16C 38 84 4D 48 */ addi r4, r4, 0x4d48
/* 800A3330 0009F170 4B FF F4 51 */ bl MEMiInitHeapHead
/* 800A3334 0009F174 80 7F 00 18 */ lwz r3, 0x18(r31)
/* 800A3338 0009F178 38 00 00 00 */ li r0, 0x0
/* 800A333C 0009F17C 90 7F 00 3C */ stw r3, 0x3c(r31)
/* 800A3340 0009F180 7F E3 FB 78 */ mr r3, r31
/* 800A3344 0009F184 80 9F 00 1C */ lwz r4, 0x1c(r31)
/* 800A3348 0009F188 90 9F 00 40 */ stw r4, 0x40(r31)
/* 800A334C 0009F18C 90 1F 00 44 */ stw r0, 0x44(r31)
.global lbl_800A3350
lbl_800A3350:
/* 800A3350 0009F190 80 01 00 14 */ lwz r0, 0x14(r1)
/* 800A3354 0009F194 83 E1 00 0C */ lwz r31, 0xc(r1)
/* 800A3358 0009F198 7C 08 03 A6 */ mtlr r0
/* 800A335C 0009F19C 38 21 00 10 */ addi r1, r1, 0x10
/* 800A3360 0009F1A0 4E 80 00 20 */ blr
/* 800A3364 0009F1A4 00 00 00 00 */ .4byte 0x00000000
/* 800A3368 0009F1A8 00 00 00 00 */ .4byte 0x00000000
/* 800A336C 0009F1AC 00 00 00 00 */ .4byte 0x00000000
.global MEMAllocFromFrmHeapEx
MEMAllocFromFrmHeapEx:
/* 800A3370 0009F1B0 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 800A3374 0009F1B4 7C 08 02 A6 */ mflr r0
/* 800A3378 0009F1B8 2C 04 00 00 */ cmpwi r4, 0x0
/* 800A337C 0009F1BC 90 01 00 24 */ stw r0, 0x24(r1)
/* 800A3380 0009F1C0 93 E1 00 1C */ stw r31, 0x1c(r1)
/* 800A3384 0009F1C4 7C 7F 1B 78 */ mr r31, r3
/* 800A3388 0009F1C8 93 C1 00 18 */ stw r30, 0x18(r1)
/* 800A338C 0009F1CC 7C 9E 23 78 */ mr r30, r4
/* 800A3390 0009F1D0 93 A1 00 14 */ stw r29, 0x14(r1)
/* 800A3394 0009F1D4 7C BD 2B 78 */ mr r29, r5
/* 800A3398 0009F1D8 40 82 00 08 */ bne lbl_800A33A0
/* 800A339C 0009F1DC 3B C0 00 01 */ li r30, 0x1
.global lbl_800A33A0
lbl_800A33A0:
/* 800A33A0 0009F1E0 80 03 00 38 */ lwz r0, 0x38(r3)
/* 800A33A4 0009F1E4 38 9E 00 03 */ addi r4, r30, 0x3
/* 800A33A8 0009F1E8 54 9E 00 3A */ clrrwi r30, r4, 2
/* 800A33AC 0009F1EC 54 00 07 7B */ rlwinm. r0, r0, 0, 29, 29
/* 800A33B0 0009F1F0 41 82 00 0C */ beq lbl_800A33BC
/* 800A33B4 0009F1F4 38 63 00 20 */ addi r3, r3, 0x20
/* 800A33B8 0009F1F8 4B F7 F7 E9 */ bl OSLockMutex
.global lbl_800A33BC
lbl_800A33BC:
/* 800A33BC 0009F1FC 2C 1D 00 00 */ cmpwi r29, 0x0
/* 800A33C0 0009F200 41 80 00 54 */ blt lbl_800A3414
/* 800A33C4 0009F204 80 7F 00 3C */ lwz r3, 0x3c(r31)
/* 800A33C8 0009F208 38 1D FF FF */ addi r0, r29, -0x1
/* 800A33CC 0009F20C 7C 05 00 F8 */ nor r5, r0, r0
/* 800A33D0 0009F210 80 1F 00 40 */ lwz r0, 0x40(r31)
/* 800A33D4 0009F214 7C 9D 1A 14 */ add r4, r29, r3
/* 800A33D8 0009F218 38 84 FF FF */ addi r4, r4, -0x1
/* 800A33DC 0009F21C 7C BD 20 38 */ and r29, r5, r4
/* 800A33E0 0009F220 7F DE EA 14 */ add r30, r30, r29
/* 800A33E4 0009F224 7C 1E 00 40 */ cmplw r30, r0
/* 800A33E8 0009F228 40 81 00 0C */ ble lbl_800A33F4
/* 800A33EC 0009F22C 3B A0 00 00 */ li r29, 0x0
/* 800A33F0 0009F230 48 00 00 6C */ b lbl_800A345C
.global lbl_800A33F4
lbl_800A33F4:
/* 800A33F4 0009F234 80 1F 00 38 */ lwz r0, 0x38(r31)
/* 800A33F8 0009F238 7C A3 F0 50 */ subf r5, r3, r30
/* 800A33FC 0009F23C 54 00 07 FF */ clrlwi. r0, r0, 31
/* 800A3400 0009F240 41 82 00 0C */ beq lbl_800A340C
/* 800A3404 0009F244 38 80 00 00 */ li r4, 0x0
/* 800A3408 0009F248 4B F6 0F 49 */ bl memset
.global lbl_800A340C
lbl_800A340C:
/* 800A340C 0009F24C 93 DF 00 3C */ stw r30, 0x3c(r31)
/* 800A3410 0009F250 48 00 00 4C */ b lbl_800A345C
.global lbl_800A3414
lbl_800A3414:
/* 800A3414 0009F254 80 BF 00 40 */ lwz r5, 0x40(r31)
/* 800A3418 0009F258 20 1D FF FF */ subfic r0, r29, -0x1
/* 800A341C 0009F25C 7C 04 00 F8 */ nor r4, r0, r0
/* 800A3420 0009F260 80 1F 00 3C */ lwz r0, 0x3c(r31)
/* 800A3424 0009F264 7C 7E 28 50 */ subf r3, r30, r5
/* 800A3428 0009F268 7C 9D 18 38 */ and r29, r4, r3
/* 800A342C 0009F26C 7C 1D 00 40 */ cmplw r29, r0
/* 800A3430 0009F270 40 80 00 0C */ bge lbl_800A343C
/* 800A3434 0009F274 3B A0 00 00 */ li r29, 0x0
/* 800A3438 0009F278 48 00 00 24 */ b lbl_800A345C
.global lbl_800A343C
lbl_800A343C:
/* 800A343C 0009F27C 80 1F 00 38 */ lwz r0, 0x38(r31)
/* 800A3440 0009F280 7C BD 28 50 */ subf r5, r29, r5
/* 800A3444 0009F284 54 00 07 FF */ clrlwi. r0, r0, 31
/* 800A3448 0009F288 41 82 00 10 */ beq lbl_800A3458
/* 800A344C 0009F28C 7F A3 EB 78 */ mr r3, r29
/* 800A3450 0009F290 38 80 00 00 */ li r4, 0x0
/* 800A3454 0009F294 4B F6 0E FD */ bl memset
.global lbl_800A3458
lbl_800A3458:
/* 800A3458 0009F298 93 BF 00 40 */ stw r29, 0x40(r31)
.global lbl_800A345C
lbl_800A345C:
/* 800A345C 0009F29C 80 1F 00 38 */ lwz r0, 0x38(r31)
/* 800A3460 0009F2A0 54 00 07 7B */ rlwinm. r0, r0, 0, 29, 29
/* 800A3464 0009F2A4 41 82 00 0C */ beq lbl_800A3470
/* 800A3468 0009F2A8 38 7F 00 20 */ addi r3, r31, 0x20
/* 800A346C 0009F2AC 4B F7 F8 15 */ bl OSUnlockMutex
.global lbl_800A3470
lbl_800A3470:
/* 800A3470 0009F2B0 83 E1 00 1C */ lwz r31, 0x1c(r1)
/* 800A3474 0009F2B4 7F A3 EB 78 */ mr r3, r29
/* 800A3478 0009F2B8 83 C1 00 18 */ lwz r30, 0x18(r1)
/* 800A347C 0009F2BC 83 A1 00 14 */ lwz r29, 0x14(r1)
/* 800A3480 0009F2C0 80 01 00 24 */ lwz r0, 0x24(r1)
/* 800A3484 0009F2C4 7C 08 03 A6 */ mtlr r0
/* 800A3488 0009F2C8 38 21 00 20 */ addi r1, r1, 0x20
/* 800A348C 0009F2CC 4E 80 00 20 */ blr
.global MEMFreeToFrmHeap
MEMFreeToFrmHeap:
/* 800A3490 0009F2D0 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 800A3494 0009F2D4 7C 08 02 A6 */ mflr r0
/* 800A3498 0009F2D8 90 01 00 14 */ stw r0, 0x14(r1)
/* 800A349C 0009F2DC 93 E1 00 0C */ stw r31, 0xc(r1)
/* 800A34A0 0009F2E0 7C 9F 23 78 */ mr r31, r4
/* 800A34A4 0009F2E4 93 C1 00 08 */ stw r30, 0x8(r1)
/* 800A34A8 0009F2E8 7C 7E 1B 78 */ mr r30, r3
/* 800A34AC 0009F2EC 80 03 00 38 */ lwz r0, 0x38(r3)
/* 800A34B0 0009F2F0 54 00 07 7B */ rlwinm. r0, r0, 0, 29, 29
/* 800A34B4 0009F2F4 41 82 00 0C */ beq lbl_800A34C0
/* 800A34B8 0009F2F8 38 63 00 20 */ addi r3, r3, 0x20
/* 800A34BC 0009F2FC 4B F7 F6 E5 */ bl OSLockMutex
.global lbl_800A34C0
lbl_800A34C0:
/* 800A34C0 0009F300 57 E0 07 FF */ clrlwi. r0, r31, 31
/* 800A34C4 0009F304 41 82 00 14 */ beq lbl_800A34D8
/* 800A34C8 0009F308 80 7E 00 18 */ lwz r3, 0x18(r30)
/* 800A34CC 0009F30C 38 00 00 00 */ li r0, 0x0
/* 800A34D0 0009F310 90 7E 00 3C */ stw r3, 0x3c(r30)
/* 800A34D4 0009F314 90 1E 00 44 */ stw r0, 0x44(r30)
.global lbl_800A34D8
lbl_800A34D8:
/* 800A34D8 0009F318 57 E0 07 BD */ rlwinm. r0, r31, 0, 30, 30
/* 800A34DC 0009F31C 41 82 00 28 */ beq lbl_800A3504
/* 800A34E0 0009F320 80 7E 00 44 */ lwz r3, 0x44(r30)
/* 800A34E4 0009F324 48 00 00 10 */ b lbl_800A34F4
.global lbl_800A34E8
lbl_800A34E8:
/* 800A34E8 0009F328 80 1E 00 1C */ lwz r0, 0x1c(r30)
/* 800A34EC 0009F32C 90 03 00 08 */ stw r0, 0x8(r3)
/* 800A34F0 0009F330 80 63 00 0C */ lwz r3, 0xc(r3)
.global lbl_800A34F4
lbl_800A34F4:
/* 800A34F4 0009F334 2C 03 00 00 */ cmpwi r3, 0x0
/* 800A34F8 0009F338 40 82 FF F0 */ bne lbl_800A34E8
/* 800A34FC 0009F33C 80 1E 00 1C */ lwz r0, 0x1c(r30)
/* 800A3500 0009F340 90 1E 00 40 */ stw r0, 0x40(r30)
.global lbl_800A3504
lbl_800A3504:
/* 800A3504 0009F344 80 1E 00 38 */ lwz r0, 0x38(r30)
/* 800A3508 0009F348 54 00 07 7B */ rlwinm. r0, r0, 0, 29, 29
/* 800A350C 0009F34C 41 82 00 0C */ beq lbl_800A3518
/* 800A3510 0009F350 38 7E 00 20 */ addi r3, r30, 0x20
/* 800A3514 0009F354 4B F7 F7 6D */ bl OSUnlockMutex
.global lbl_800A3518
lbl_800A3518:
/* 800A3518 0009F358 80 01 00 14 */ lwz r0, 0x14(r1)
/* 800A351C 0009F35C 83 E1 00 0C */ lwz r31, 0xc(r1)
/* 800A3520 0009F360 83 C1 00 08 */ lwz r30, 0x8(r1)
/* 800A3524 0009F364 7C 08 03 A6 */ mtlr r0
/* 800A3528 0009F368 38 21 00 10 */ addi r1, r1, 0x10
/* 800A352C 0009F36C 4E 80 00 20 */ blr