From a2212d6ca6db0caaffedde04989a2e56b60add57 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Fri, 28 Sep 2018 10:40:22 +0200 Subject: [PATCH] minor cleanup --- kernel.asm | 4 ++-- main.asm | 30 +++++++++++++++++++++++------- task.asm | 6 +++--- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/kernel.asm b/kernel.asm index 80d277a..e74606f 100644 --- a/kernel.asm +++ b/kernel.asm @@ -40,7 +40,7 @@ Start: // enable CPU interrupts. mfc0 t1, CP0_Status - ori t1, t1, CP0_STATUS_IM_ALL | CP0_STATUS_IE + ori t1, CP0_STATUS_IM_ALL | CP0_STATUS_IE mtc0 t1, CP0_Status // enable even more interrupts. @@ -74,7 +74,7 @@ Start: // SP defaults to RSP instruction memory: 0xA4001FF0 // we can do better than that. - li sp, K_STACK_INIT + la sp, K_STACK_INIT // SP should always be 8-byte aligned // so that SD and LD instructions don't fail on it. // we also need 4 empty words for storing diff --git a/main.asm b/main.asm index fa16922..505809b 100644 --- a/main.asm +++ b/main.asm @@ -23,9 +23,11 @@ if origin() != 0x1000 { include "kernel.asm" Main: - lui s0, MAIN_BASE if 0 { +DecompImage: + lui s0, MAIN_BASE + nop; nop; nop; nop mfc0 t0, CP0_Count sw t0, MAIN_COUNTS+0(s0) @@ -48,14 +50,11 @@ if 0 { jal PokeDataCache nop -} lui a0, MAIN_BASE + jal MainDumpWrite lli a1, 0x20 - ori a2, a0, MAIN_XXD - jal DumpAndWrite - lli a3, 0x20 * 4 - WriteString(KS_Newline) +} Test3D: // write the jump to our actual commands @@ -107,7 +106,6 @@ Start3D: lui a0, SP_BASE lli t0, SP_INT_ON_BREAK_SET | SP_SINGLE_STEP_CLR | SP_BREAK_CLR | SP_HALT_CLR sw t0, SP_STATUS(a0) - nop SetIntMask() @@ -154,6 +152,24 @@ if HICOLOR { jr ra nop +MainDumpWrite: + subiu sp, 0x18 + sw ra, 0x10(sp) + + lui a2, MAIN_BASE + ori a2, MAIN_XXD + jal DumpAndWrite // a0,a1 passthru + lli a3, 0x200 + WriteString(KS_Newline) + + lw ra, 0x10(sp) + jr ra + addiu sp, 0x18 + +Die: + j Die + nop + include "lzss.baku.unsafe.asm" include "dlist.asm" include "task.asm" diff --git a/task.asm b/task.asm index ec18dcc..20de4e1 100644 --- a/task.asm +++ b/task.asm @@ -1,6 +1,6 @@ PushVideoTask: // a0: Task RDRAM Pointer (size: 0x40) (should probably be row-aligned) - subiu sp, sp, 0x18 + subiu sp, 0x18 sw ra, 0x10(sp) lli t0, 1 // mode: video @@ -46,11 +46,11 @@ PushVideoTask: li t9, ADDR_MASK jal PushRSPTask - and a0, a0, t9 + and a0, t9 lw ra, 0x10(sp) jr ra - addiu sp, sp, 0x18 + addiu sp, 0x18 PushRSPTask: lli t3, 0x40 - 1 // DMA quirk