rename MaybeDumpString to WriteString

This commit is contained in:
Connor Olding 2018-08-24 08:24:01 +02:00
parent 912ca3df9b
commit c7a694595e
3 changed files with 56 additions and 56 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 DumpString(name) { macro _WriteString(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,21 +39,21 @@ if K_DEBUG {
} }
} }
macro MaybeDumpString(str) { macro WriteString(str) {
if K_DEBUG { if K_DEBUG {
lui t0, K_BASE lui t0, K_BASE
lw t1, K_CONSOLE_AVAILABLE(t0) lw t1, K_CONSOLE_AVAILABLE(t0)
beqz t1,+ beqz t1,+
DumpString({str}) _WriteString({str})
+ +
} }
} }
macro KMaybeDumpString(str) { macro KWriteString(str) {
if K_DEBUG { if K_DEBUG {
lw t1, K_CONSOLE_AVAILABLE(k0) lw t1, K_CONSOLE_AVAILABLE(k0)
beqz t1,+ beqz t1,+
DumpString({str}) _WriteString({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.
DumpString(KS_ConsoleConfirmed) _WriteString(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)
@ -296,9 +296,9 @@ InterruptHandler:
ISR_Main: // free to modify any GPR from here to ISR_Exit ISR_Main: // free to modify any GPR from here to ISR_Exit
KMaybeDumpString(KS_Newline) KWriteString(KS_Newline)
KMaybeDumpString(KS_Handling) KWriteString(KS_Handling)
KMaybeDumpString(KS_Code) KWriteString(KS_Code)
// switch-case on the cause code: // switch-case on the cause code:
// conveniently, the ExcCode in Cause is already shifted left by 2. // conveniently, the ExcCode in Cause is already shifted left by 2.
@ -325,14 +325,14 @@ if K_DEBUG {
jal DumpRegisters jal DumpRegisters
lli a1, 0x200 lli a1, 0x200
KMaybeDumpString(KS_Newline) KWriteString(KS_Newline)
ori a0, k0, K_XXD ori a0, k0, K_XXD
jal Drive64Write jal Drive64Write
lli a1, 0x200 lli a1, 0x200
KMaybeDumpString(KS_Newline) KWriteString(KS_Newline)
KMaybeDumpString(KS_States) KWriteString(KS_States)
ori a0, k0, K_REASON ori a0, k0, K_REASON
lli a1, 0x20 lli a1, 0x20
@ -340,7 +340,7 @@ if K_DEBUG {
jal DumpAndWrite jal DumpAndWrite
lli a3, 0x20 * 4 lli a3, 0x20 * 4
KMaybeDumpString(KS_Newline) KWriteString(KS_Newline)
} }
ISR_Exit: ISR_Exit:
@ -402,7 +402,7 @@ ReturnFromInterrupt:
// no branch delay for eret // no branch delay for eret
KCode0: KCode0:
KMaybeDumpString(KS_Code0) KWriteString(KS_Code0)
K_MI_Loop: K_MI_Loop:
lui a0, MI_BASE lui a0, MI_BASE
@ -434,7 +434,7 @@ K_MI_Loop:
nop nop
K_MI_SP: K_MI_SP:
KMaybeDumpString(KS_MI_SP) KWriteString(KS_MI_SP)
lli t0, SP_SG3_CLR | SP_INT_CLR // delay slot lli t0, SP_SG3_CLR | SP_INT_CLR // delay slot
lui a1, SP_BASE lui a1, SP_BASE
@ -449,7 +449,7 @@ K_MI_SP:
andi s0, ~MI_INTR_SP andi s0, ~MI_INTR_SP
K_MI_SI: K_MI_SI:
KMaybeDumpString(KS_MI_SI) KWriteString(KS_MI_SI)
lui a1, SI_BASE lui a1, SI_BASE
sw r0, SI_STATUS(a1) sw r0, SI_STATUS(a1)
@ -461,7 +461,7 @@ K_MI_SI:
andi s0, ~MI_INTR_SI andi s0, ~MI_INTR_SI
K_MI_AI: K_MI_AI:
KMaybeDumpString(KS_MI_AI) KWriteString(KS_MI_AI)
lli t0, 0x01 lli t0, 0x01
lui a1, AI_BASE lui a1, AI_BASE
@ -474,7 +474,7 @@ K_MI_AI:
andi s0, ~MI_INTR_AI andi s0, ~MI_INTR_AI
K_MI_VI: K_MI_VI:
KMaybeDumpString(KS_MI_VI) KWriteString(KS_MI_VI)
lui a1, VI_BASE lui a1, VI_BASE
sw r0, VI_V_CURRENT_LINE(a1) sw r0, VI_V_CURRENT_LINE(a1)
@ -486,7 +486,7 @@ K_MI_VI:
andi s0, ~MI_INTR_VI andi s0, ~MI_INTR_VI
K_MI_PI: K_MI_PI:
KMaybeDumpString(KS_MI_PI) KWriteString(KS_MI_PI)
lli t0, 0x02 lli t0, 0x02
lui a1, PI_BASE lui a1, PI_BASE
@ -499,7 +499,7 @@ K_MI_PI:
andi s0, ~MI_INTR_PI andi s0, ~MI_INTR_PI
K_MI_DP: K_MI_DP:
KMaybeDumpString(KS_MI_DP) KWriteString(KS_MI_DP)
lli t0, 0x800 lli t0, 0x800
lui a1, MI_BASE lui a1, MI_BASE
@ -511,37 +511,37 @@ K_MI_DP:
j K_MI_Loop j K_MI_Loop
andi s0, ~MI_INTR_DP andi s0, ~MI_INTR_DP
KCode1:; KMaybeDumpString(KS_Code1); j KCodeDone; nop KCode1:; KWriteString(KS_Code1); j KCodeDone; nop
KCode2:; KMaybeDumpString(KS_Code2); j KCodeDone; nop KCode2:; KWriteString(KS_Code2); j KCodeDone; nop
KCode3:; KMaybeDumpString(KS_Code3); j KCodeDone; nop KCode3:; KWriteString(KS_Code3); j KCodeDone; nop
KCode4:; KMaybeDumpString(KS_Code4); j KCodeDone; nop KCode4:; KWriteString(KS_Code4); j KCodeDone; nop
KCode5:; KMaybeDumpString(KS_Code5); j KCodeDone; nop KCode5:; KWriteString(KS_Code5); j KCodeDone; nop
KCode6:; KMaybeDumpString(KS_Code6); j KCodeDone; nop KCode6:; KWriteString(KS_Code6); j KCodeDone; nop
KCode7:; KMaybeDumpString(KS_Code7); j KCodeDone; nop KCode7:; KWriteString(KS_Code7); j KCodeDone; nop
KCode8:; KMaybeDumpString(KS_Code8); j KCodeDone; nop KCode8:; KWriteString(KS_Code8); j KCodeDone; nop
KCode9:; KMaybeDumpString(KS_Code9); j KCodeDone; nop KCode9:; KWriteString(KS_Code9); j KCodeDone; nop
KCode10:; KMaybeDumpString(KS_Code10); j KCodeDone; nop KCode10:; KWriteString(KS_Code10); j KCodeDone; nop
KCode11:; KMaybeDumpString(KS_Code11); j KCodeDone; nop KCode11:; KWriteString(KS_Code11); j KCodeDone; nop
KCode12:; KMaybeDumpString(KS_Code12); j KCodeDone; nop KCode12:; KWriteString(KS_Code12); j KCodeDone; nop
KCode13:; KMaybeDumpString(KS_Code13); j KCodeDone; nop KCode13:; KWriteString(KS_Code13); j KCodeDone; nop
KCode14:; KMaybeDumpString(KS_Code14); j KCodeDone; nop KCode14:; KWriteString(KS_Code14); j KCodeDone; nop
KCode15:; KMaybeDumpString(KS_Code15); j KCodeDone; nop KCode15:; KWriteString(KS_Code15); j KCodeDone; nop
KCode16:; KMaybeDumpString(KS_Code16); j KCodeDone; nop KCode16:; KWriteString(KS_Code16); j KCodeDone; nop
KCode17:; KMaybeDumpString(KS_Code17); j KCodeDone; nop KCode17:; KWriteString(KS_Code17); j KCodeDone; nop
KCode18:; KMaybeDumpString(KS_Code18); j KCodeDone; nop KCode18:; KWriteString(KS_Code18); j KCodeDone; nop
KCode19:; KMaybeDumpString(KS_Code19); j KCodeDone; nop KCode19:; KWriteString(KS_Code19); j KCodeDone; nop
KCode20:; KMaybeDumpString(KS_Code20); j KCodeDone; nop KCode20:; KWriteString(KS_Code20); j KCodeDone; nop
KCode21:; KMaybeDumpString(KS_Code21); j KCodeDone; nop KCode21:; KWriteString(KS_Code21); j KCodeDone; nop
KCode22:; KMaybeDumpString(KS_Code22); j KCodeDone; nop KCode22:; KWriteString(KS_Code22); j KCodeDone; nop
KCode23:; KMaybeDumpString(KS_Code23); j KCodeDone; nop KCode23:; KWriteString(KS_Code23); j KCodeDone; nop
KCode24:; KMaybeDumpString(KS_Code24); j KCodeDone; nop KCode24:; KWriteString(KS_Code24); j KCodeDone; nop
KCode25:; KMaybeDumpString(KS_Code25); j KCodeDone; nop KCode25:; KWriteString(KS_Code25); j KCodeDone; nop
KCode26:; KMaybeDumpString(KS_Code26); j KCodeDone; nop KCode26:; KWriteString(KS_Code26); j KCodeDone; nop
KCode27:; KMaybeDumpString(KS_Code27); j KCodeDone; nop KCode27:; KWriteString(KS_Code27); j KCodeDone; nop
KCode28:; KMaybeDumpString(KS_Code28); j KCodeDone; nop KCode28:; KWriteString(KS_Code28); j KCodeDone; nop
KCode29:; KMaybeDumpString(KS_Code29); j KCodeDone; nop KCode29:; KWriteString(KS_Code29); j KCodeDone; nop
KCode30:; KMaybeDumpString(KS_Code30); j KCodeDone; nop KCode30:; KWriteString(KS_Code30); j KCodeDone; nop
KCode31:; KMaybeDumpString(KS_Code31); j KCodeDone; nop KCode31:; KWriteString(KS_Code31); j KCodeDone; nop
KCodes: KCodes:
dw KCode0, KCode1, KCode2, KCode3 dw KCode0, KCode1, KCode2, KCode3

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
MaybeDumpString(KS_Newline) WriteString(KS_Newline)
Test3D: Test3D:
// write the jump to our actual instructions // write the jump to our actual instructions
@ -93,7 +93,7 @@ Start3D:
sw t0, SP_STATUS(a0) sw t0, SP_STATUS(a0)
// wait // wait
MaybeDumpString(SWaiting) WriteString(SWaiting)
lui a0, SP_BASE lui a0, SP_BASE
- -
lw t0, SP_STATUS(a0) lw t0, SP_STATUS(a0)
@ -111,13 +111,13 @@ Start3D:
jal PushVideoTask jal PushVideoTask
ori a0, a0, BLAH_SP_TASK ori a0, a0, BLAH_SP_TASK
MaybeDumpString(SWaiting) WriteString(SWaiting)
SP_BUSY_WAIT() SP_BUSY_WAIT()
jal LoadRSPBoot jal LoadRSPBoot
nop nop
MaybeDumpString(SWaiting) WriteString(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!)
@ -135,7 +135,7 @@ MainLoop:
beqz t0, MainLoop beqz t0, MainLoop
nop nop
MaybeDumpString(SNewFrame) WriteString(SNewFrame)
j Start3D j Start3D
nop nop