From ca4df8db940c5988da89f6e4851f068a62fd7b5d Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Fri, 24 Aug 2018 08:19:52 +0200 Subject: [PATCH] make a non-kernel variant of MaybeDumpString --- inc/kernel.inc | 14 ++++++++++++-- kernel.asm | 2 +- main.asm | 19 ++++++------------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/inc/kernel.inc b/inc/kernel.inc index 1fd4512..fa3220c 100644 --- a/inc/kernel.inc +++ b/inc/kernel.inc @@ -29,7 +29,7 @@ constant K_INT_XTLB_REFILL(2) constant K_INT_CACHE_ERROR(3) constant K_INT_OTHER(4) -macro KDumpString(name) { +macro DumpString(name) { if K_DEBUG { // does not include error/console-checking! // note: this first instruction must be okay to be in a delay slot. @@ -39,11 +39,21 @@ if K_DEBUG { } } +macro MaybeDumpString(str) { +if K_DEBUG { + lui t0, K_BASE + lw t1, K_CONSOLE_AVAILABLE(t0) + beqz t1,+ + DumpString({str}) ++ +} +} + macro KMaybeDumpString(str) { if K_DEBUG { lw t1, K_CONSOLE_AVAILABLE(k0) beqz t1,+ - KDumpString({str}) + DumpString({str}) + } } diff --git a/kernel.asm b/kernel.asm index 759417b..631e6d9 100644 --- a/kernel.asm +++ b/kernel.asm @@ -118,7 +118,7 @@ Drive64Confirmed: Drive64CheckConsole: // NOTE: we only check at boot, so disconnecting the console // while running will cause a ton of lag (timeouts) until reset. - KDumpString(KS_ConsoleConfirmed) + DumpString(KS_ConsoleConfirmed) lli t0, 1 beqzl v0, Drive64Done sw t0, K_CONSOLE_AVAILABLE(gp) diff --git a/main.asm b/main.asm index 27de332..5c3fd29 100644 --- a/main.asm +++ b/main.asm @@ -55,7 +55,7 @@ Main: ori a2, a0, BLAH_XXD jal DumpAndWrite lli a3, 0x20 * 4 -// KMaybeDumpString(KS_Newline) + MaybeDumpString(KS_Newline) Test3D: // write the jump to our actual instructions @@ -90,6 +90,7 @@ Start3D: sw t0, SP_STATUS(a0) // wait + MaybeDumpString(SWaiting) lui a0, SP_BASE - lw t0, SP_STATUS(a0) @@ -107,20 +108,13 @@ Start3D: jal PushVideoTask ori a0, a0, BLAH_SP_TASK - // take a peek at the Task data we wrote - lui a0, BLAH_BASE - ori a0, a0, BLAH_SP_TASK - lli a1, 0x40 - ori a2, a0, BLAH_XXD - jal DumpAndWrite - lli a3, 0x40 * 4 -// KMaybeDumpString(KS_Newline) - + MaybeDumpString(SWaiting) SP_BUSY_WAIT() jal LoadRSPBoot nop + MaybeDumpString(SWaiting) SP_BUSY_WAIT() // clear all flags that would halt RSP (i.e. tell it to run!) @@ -129,15 +123,14 @@ Start3D: sw t0, SP_STATUS(a0) nop - jal SetupScreen - nop - EnableInt() MainLoop: j MainLoop nop +KSL(SWaiting, "Waiting on RSP...") + SetupScreen: if HICOLOR { ScreenNTSC(WIDTH, HEIGHT, BPP32|INTERLACE|AA_MODE_2|PIXEL_ADV_3, VIDEO_C_BUFFER | UNCACHED)