summaryrefslogtreecommitdiff
path: root/src/heapbar.S
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/heapbar.S236
1 files changed, 118 insertions, 118 deletions
diff --git a/src/heapbar.S b/src/heapbar.S
index 35d45e5..4f86fbe 100644
--- a/src/heapbar.S
+++ b/src/heapbar.S
@@ -1,118 +1,118 @@
-# memory debugger - fun!
-# GX stuff is implemented in C++, this just gets the lowlevel info
-
-#ifndef __MWERKS__
-.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4
-.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
-.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
-.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19
-.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24
-.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29
-.set r30,30; .set r31,31; .set f0,0; .set f2,2; .set f3,3
-#endif
-
-#define HEAP_EGGRootMEM1 1
-#define HEAP_EGGRootMEM2 2
-
-.extern cppGXStart
-.extern cppGXEnd
-.extern cppProcessHeap
-.extern MEMGetTotalFreeSizeForExpHeap
-.extern GameHeap1
-.extern GameHeap2
-
-.set sp,1
-.set rtoc,2
-.set this,31
-
-.text
-
-.align 4
-
-.global doHeapBar
-
-doHeapBar:
- blr
-
- stwu sp, -0x10(sp)
- mflr r0
- stw r0, 0x14(sp)
-
- stw this, 0xC(sp)
-
- #lis r3, EGGTSystem_Pointer@h
- #ori r3, r3, EGGTSystem_Pointer@l
- #lwz this, 0(r3)
-
- bl cppGXStart
-
- #lwz r3, 0x18(this)
- #lis r3, dSys_c__RootHeapMEM1@h
- #ori r3, r3, dSys_c__RootHeapMEM1@l
- lis r3, GameHeap1@h
- ori r3, r3, GameHeap1@l
- lwz r3, 0(r3)
- li r4, HEAP_EGGRootMEM1
- bl asmProcessHeap
-
- #lwz r3, 0x1C(this)
- #lis r3, dSys_c__RootHeapMEM2@h
- #ori r3, r3, dSys_c__RootHeapMEM2@l
- lis r3, GameHeap2@h
- ori r3, r3, GameHeap2@l
- lwz r3, 0(r3)
- li r4, HEAP_EGGRootMEM2
- bl asmProcessHeap
-
- bl cppGXEnd
-
- lwz this, 0xC(sp)
- lwz r0, 0x14(sp)
- mtlr r0
- addi sp, sp, 0x10
- blr
-
-
-
-asmProcessHeap:
-
- stwu sp, -0x10(sp)
- mflr r0
- stw r0, 0x14(sp)
-
- stw r31, 0xC(sp)
- stw r30, 0x8(sp)
-
- mr r31, r3
- mr r30, r4
-
- # get all the required data from the heap
- # cppProcessHeap(u32 freeSize, u32 heapSize, int heapID, char *name)
-
- # get free size first so the function doesn't destroy our volatile regs
- # because I'm too lazy to save them >.>
- lwz r3, 0x10(r31)
- bl MEMGetTotalFreeSizeForExpHeap
-
- # get name
- lwz r6, 0x34(r31)
-
- # get heapID
- mr r5, r30
-
- # get heap size
- # this was a fucking pain to figure out -_-
- lwz r4, 0x10(r31) # get the MEMiHeapHead*
- lwz r7, 0x18(r4) # get heapStart
- lwz r8, 0x1C(r4) # get heapEnd
- sub r4, r8, r7 # heapSize = heapEnd - heapStart probably
-
- # now do it
- bl cppProcessHeap
-
- lwz r30, 0x8(sp)
- lwz r31, 0xC(sp)
- lwz r0, 0x14(sp)
- mtlr r0
- addi sp, sp, 0x10
- blr
+# memory debugger - fun!
+# GX stuff is implemented in C++, this just gets the lowlevel info
+
+#ifndef __MWERKS__
+.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4
+.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
+.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
+.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19
+.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24
+.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29
+.set r30,30; .set r31,31; .set f0,0; .set f2,2; .set f3,3
+#endif
+
+#define HEAP_EGGRootMEM1 1
+#define HEAP_EGGRootMEM2 2
+
+.extern cppGXStart
+.extern cppGXEnd
+.extern cppProcessHeap
+.extern MEMGetTotalFreeSizeForExpHeap
+.extern GameHeap1
+.extern GameHeap2
+
+.set sp,1
+.set rtoc,2
+.set this,31
+
+.text
+
+.align 4
+
+.global doHeapBar
+
+doHeapBar:
+ blr
+
+ stwu sp, -0x10(sp)
+ mflr r0
+ stw r0, 0x14(sp)
+
+ stw this, 0xC(sp)
+
+ #lis r3, EGGTSystem_Pointer@h
+ #ori r3, r3, EGGTSystem_Pointer@l
+ #lwz this, 0(r3)
+
+ bl cppGXStart
+
+ #lwz r3, 0x18(this)
+ #lis r3, dSys_c__RootHeapMEM1@h
+ #ori r3, r3, dSys_c__RootHeapMEM1@l
+ lis r3, GameHeap1@h
+ ori r3, r3, GameHeap1@l
+ lwz r3, 0(r3)
+ li r4, HEAP_EGGRootMEM1
+ bl asmProcessHeap
+
+ #lwz r3, 0x1C(this)
+ #lis r3, dSys_c__RootHeapMEM2@h
+ #ori r3, r3, dSys_c__RootHeapMEM2@l
+ lis r3, GameHeap2@h
+ ori r3, r3, GameHeap2@l
+ lwz r3, 0(r3)
+ li r4, HEAP_EGGRootMEM2
+ bl asmProcessHeap
+
+ bl cppGXEnd
+
+ lwz this, 0xC(sp)
+ lwz r0, 0x14(sp)
+ mtlr r0
+ addi sp, sp, 0x10
+ blr
+
+
+
+asmProcessHeap:
+
+ stwu sp, -0x10(sp)
+ mflr r0
+ stw r0, 0x14(sp)
+
+ stw r31, 0xC(sp)
+ stw r30, 0x8(sp)
+
+ mr r31, r3
+ mr r30, r4
+
+ # get all the required data from the heap
+ # cppProcessHeap(u32 freeSize, u32 heapSize, int heapID, char *name)
+
+ # get free size first so the function doesn't destroy our volatile regs
+ # because I'm too lazy to save them >.>
+ lwz r3, 0x10(r31)
+ bl MEMGetTotalFreeSizeForExpHeap
+
+ # get name
+ lwz r6, 0x34(r31)
+
+ # get heapID
+ mr r5, r30
+
+ # get heap size
+ # this was a fucking pain to figure out -_-
+ lwz r4, 0x10(r31) # get the MEMiHeapHead*
+ lwz r7, 0x18(r4) # get heapStart
+ lwz r8, 0x1C(r4) # get heapEnd
+ sub r4, r8, r7 # heapSize = heapEnd - heapStart probably
+
+ # now do it
+ bl cppProcessHeap
+
+ lwz r30, 0x8(sp)
+ lwz r31, 0xC(sp)
+ lwz r0, 0x14(sp)
+ mtlr r0
+ addi sp, sp, 0x10
+ blr