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_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})
+
}
}

View File

@ -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)

View File

@ -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)