diff options
Diffstat (limited to '')
-rw-r--r-- | src/prolog.S | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/prolog.S b/src/prolog.S new file mode 100644 index 0000000..1a988ec --- /dev/null +++ b/src/prolog.S @@ -0,0 +1,65 @@ +.text +.align 4 +.set sp, 1 + +.extern __ctor_loc +.extern OSReport + +.global Prolog +Prolog: + stwu sp, -0x10(sp) + mflr r0 + stw r0, 0x14(sp) + stw r31, 0xC(sp) + stw r30, 0x8(sp) + # -- Go! + + li r30, 0 + + lis r31, __ctor_loc@h + ori r31, r31, __ctor_loc@l + + lis r3, PMsg@h + ori r3, r3, PMsg@l + mr r4, r31 + crclr 4*cr1+eq + bl OSReport + + b startLoop + +loop: + mtctr r12 + bctrl + addi r31, r31, 4 + addi r30, r30, 1 +startLoop: + lwz r12, 0(r31) + cmpwi r12, 0 + bne loop + + lis r3, PMsg2@h + ori r3, r3, PMsg2@l + mr r4, r30 + crclr 4*cr1+eq + bl OSReport + + # -- Done + li r3, 1 + lwz r31, 0xC(sp) + lwz r30, 0x8(sp) + lwz r0, 0x14(sp) + mtlr r0 + addi sp, sp, 0x10 + blr + + +.data +PMsg: + .string "Newer Super Mario Bros. Wii - Hacks by Treeki 2009-2011\n.ctors: %p\n" + +PMsg2: + .string "%d inits called\n" + +.align 4 + + |