split toggling masks and interrupts themselves
This commit is contained in:
parent
c7a694595e
commit
2aa87bb878
5 changed files with 23 additions and 7 deletions
|
@ -43,7 +43,7 @@ constant CP0_STATUS_IM4($1000) // Interrupt Mask 4 (External)
|
||||||
constant CP0_STATUS_IM5($2000) // Interrupt Mask 5 (External)
|
constant CP0_STATUS_IM5($2000) // Interrupt Mask 5 (External)
|
||||||
constant CP0_STATUS_IM6($4000) // Interrupt Mask 6 (External)
|
constant CP0_STATUS_IM6($4000) // Interrupt Mask 6 (External)
|
||||||
constant CP0_STATUS_IM7($8000) // Interrupt Mask 7 (External)
|
constant CP0_STATUS_IM7($8000) // Interrupt Mask 7 (External)
|
||||||
constant CP0_STATUS_IM_ALL($FF01) // enable all interrupts
|
constant CP0_STATUS_IM_ALL($FF00) // all interrupt masks
|
||||||
|
|
||||||
// note that these are all masks.
|
// note that these are all masks.
|
||||||
constant CP0_CAUSE_CODE($007C) // actually supposed to be called ExcCode
|
constant CP0_CAUSE_CODE($007C) // actually supposed to be called ExcCode
|
||||||
|
|
|
@ -77,7 +77,7 @@ macro SP_BUSY_WAIT() {
|
||||||
-
|
-
|
||||||
lw t0, SP_STATUS(a0)
|
lw t0, SP_STATUS(a0)
|
||||||
andi t0, 0x1C
|
andi t0, 0x1C
|
||||||
sltu t0, r0, t0 // TODO: rewrite this
|
sltu t0, r0, t0
|
||||||
bnez t0,-
|
bnez t0,-
|
||||||
nop
|
nop
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,20 @@
|
||||||
macro EnableInt() {
|
macro EnableInt() {
|
||||||
|
// careful not to touch unrelated flags here
|
||||||
|
mfc0 t0, CP0_Status
|
||||||
|
addiu at, r0, CP0_STATUS_IE
|
||||||
|
or t0, at
|
||||||
|
mtc0 t0, CP0_Status
|
||||||
|
}
|
||||||
|
|
||||||
|
macro DisableInt() {
|
||||||
|
// careful not to touch unrelated flags here
|
||||||
|
mfc0 t0, CP0_Status
|
||||||
|
addiu at, r0, ~CP0_STATUS_IE
|
||||||
|
and t0, at
|
||||||
|
mtc0 t0, CP0_Status
|
||||||
|
}
|
||||||
|
|
||||||
|
macro SetIntMask() {
|
||||||
lli t0, MI_INTR_MASK_ALL_SET
|
lli t0, MI_INTR_MASK_ALL_SET
|
||||||
lui a0, MI_BASE
|
lui a0, MI_BASE
|
||||||
sw t0, MI_INTR_MASK(a0)
|
sw t0, MI_INTR_MASK(a0)
|
||||||
|
@ -9,7 +25,7 @@ macro EnableInt() {
|
||||||
mtc0 t1, CP0_Status
|
mtc0 t1, CP0_Status
|
||||||
}
|
}
|
||||||
|
|
||||||
macro DisableInt() {
|
macro ClearIntMask() {
|
||||||
lli t0, MI_INTR_MASK_ALL_CLR
|
lli t0, MI_INTR_MASK_ALL_CLR
|
||||||
lui a0, MI_BASE
|
lui a0, MI_BASE
|
||||||
sw t0, MI_INTR_MASK(a0)
|
sw t0, MI_INTR_MASK(a0)
|
||||||
|
|
|
@ -40,7 +40,7 @@ Start:
|
||||||
|
|
||||||
// enable CPU interrupts.
|
// enable CPU interrupts.
|
||||||
mfc0 t1, CP0_Status
|
mfc0 t1, CP0_Status
|
||||||
ori t1, t1, CP0_STATUS_IM_ALL
|
ori t1, t1, CP0_STATUS_IM_ALL | CP0_STATUS_IE
|
||||||
mtc0 t1, CP0_Status
|
mtc0 t1, CP0_Status
|
||||||
|
|
||||||
// enable even more interrupts.
|
// enable even more interrupts.
|
||||||
|
@ -440,7 +440,7 @@ K_MI_SP:
|
||||||
lui a1, SP_BASE
|
lui a1, SP_BASE
|
||||||
sw t0, SP_STATUS(a1)
|
sw t0, SP_STATUS(a1)
|
||||||
|
|
||||||
// then check andi t1, SG1 | SG2 ?
|
// then check andi t1, SP_SG1 | SP_SG2 ?
|
||||||
|
|
||||||
lw t0, K_HISTORY(k0)
|
lw t0, K_HISTORY(k0)
|
||||||
ori t0, 0x01
|
ori t0, 0x01
|
||||||
|
|
4
main.asm
4
main.asm
|
@ -85,7 +85,7 @@ include "dlist.asm" // takes a0
|
||||||
nop
|
nop
|
||||||
|
|
||||||
Start3D:
|
Start3D:
|
||||||
DisableInt()
|
ClearIntMask()
|
||||||
|
|
||||||
// stuff i'm borrowing from zelda:
|
// stuff i'm borrowing from zelda:
|
||||||
lui a0, SP_BASE
|
lui a0, SP_BASE
|
||||||
|
@ -126,7 +126,7 @@ Start3D:
|
||||||
sw t0, SP_STATUS(a0)
|
sw t0, SP_STATUS(a0)
|
||||||
nop
|
nop
|
||||||
|
|
||||||
EnableInt()
|
SetIntMask()
|
||||||
|
|
||||||
MainLoop:
|
MainLoop:
|
||||||
lui a0, K_BASE
|
lui a0, K_BASE
|
||||||
|
|
Loading…
Reference in a new issue