make a non-kernel variant of MaybeDumpString

This commit is contained in:
Connor Olding 2018-08-24 08:19:52 +02:00
parent 5d79e8f4c3
commit ca4df8db94
3 changed files with 19 additions and 16 deletions

View file

@ -29,7 +29,7 @@ constant K_INT_XTLB_REFILL(2)
constant K_INT_CACHE_ERROR(3) constant K_INT_CACHE_ERROR(3)
constant K_INT_OTHER(4) constant K_INT_OTHER(4)
macro KDumpString(name) { macro DumpString(name) {
if K_DEBUG { if K_DEBUG {
// does not include error/console-checking! // does not include error/console-checking!
// note: this first instruction must be okay to be in a delay slot. // 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) { macro KMaybeDumpString(str) {
if K_DEBUG { if K_DEBUG {
lw t1, K_CONSOLE_AVAILABLE(k0) lw t1, K_CONSOLE_AVAILABLE(k0)
beqz t1,+ beqz t1,+
KDumpString({str}) DumpString({str})
+ +
} }
} }

View file

@ -118,7 +118,7 @@ Drive64Confirmed:
Drive64CheckConsole: Drive64CheckConsole:
// NOTE: we only check at boot, so disconnecting the console // NOTE: we only check at boot, so disconnecting the console
// while running will cause a ton of lag (timeouts) until reset. // while running will cause a ton of lag (timeouts) until reset.
KDumpString(KS_ConsoleConfirmed) DumpString(KS_ConsoleConfirmed)
lli t0, 1 lli t0, 1
beqzl v0, Drive64Done beqzl v0, Drive64Done
sw t0, K_CONSOLE_AVAILABLE(gp) sw t0, K_CONSOLE_AVAILABLE(gp)

View file

@ -55,7 +55,7 @@ Main:
ori a2, a0, BLAH_XXD ori a2, a0, BLAH_XXD
jal DumpAndWrite jal DumpAndWrite
lli a3, 0x20 * 4 lli a3, 0x20 * 4
// KMaybeDumpString(KS_Newline) MaybeDumpString(KS_Newline)
Test3D: Test3D:
// write the jump to our actual instructions // write the jump to our actual instructions
@ -90,6 +90,7 @@ Start3D:
sw t0, SP_STATUS(a0) sw t0, SP_STATUS(a0)
// wait // wait
MaybeDumpString(SWaiting)
lui a0, SP_BASE lui a0, SP_BASE
- -
lw t0, SP_STATUS(a0) lw t0, SP_STATUS(a0)
@ -107,20 +108,13 @@ Start3D:
jal PushVideoTask jal PushVideoTask
ori a0, a0, BLAH_SP_TASK ori a0, a0, BLAH_SP_TASK
// take a peek at the Task data we wrote MaybeDumpString(SWaiting)
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)
SP_BUSY_WAIT() SP_BUSY_WAIT()
jal LoadRSPBoot jal LoadRSPBoot
nop nop
MaybeDumpString(SWaiting)
SP_BUSY_WAIT() SP_BUSY_WAIT()
// clear all flags that would halt RSP (i.e. tell it to run!) // clear all flags that would halt RSP (i.e. tell it to run!)
@ -129,15 +123,14 @@ Start3D:
sw t0, SP_STATUS(a0) sw t0, SP_STATUS(a0)
nop nop
jal SetupScreen
nop
EnableInt() EnableInt()
MainLoop: MainLoop:
j MainLoop j MainLoop
nop nop
KSL(SWaiting, "Waiting on RSP...")
SetupScreen: SetupScreen:
if HICOLOR { if HICOLOR {
ScreenNTSC(WIDTH, HEIGHT, BPP32|INTERLACE|AA_MODE_2|PIXEL_ADV_3, VIDEO_C_BUFFER | UNCACHED) ScreenNTSC(WIDTH, HEIGHT, BPP32|INTERLACE|AA_MODE_2|PIXEL_ADV_3, VIDEO_C_BUFFER | UNCACHED)