homebrew/inc/n64_util.inc

23 lines
611 B
PHP
Raw Normal View History

2018-08-21 05:10:06 +02:00
macro EnableInt() {
2018-08-24 05:13:08 +02:00
lli t0, MI_INTR_MASK_ALL_SET
2018-08-21 05:10:06 +02:00
lui a0, MI_BASE
sw t0, MI_INTR_MASK(a0)
2018-08-24 05:13:08 +02:00
// careful not to touch unrelated flags here
mfc0 t1, CP0_Status
lli t0, CP0_STATUS_IM_ALL
or t1, t0
2018-08-21 05:10:06 +02:00
mtc0 t1, CP0_Status
}
macro DisableInt() {
2018-08-24 05:13:08 +02:00
lli t0, MI_INTR_MASK_ALL_CLR
2018-08-21 05:10:06 +02:00
lui a0, MI_BASE
sw t0, MI_INTR_MASK(a0)
2018-08-24 05:13:08 +02:00
// careful not to touch unrelated flags here
mfc0 t1, CP0_Status
lli t0, CP0_STATUS_IM_ALL
nor t0, r0 // invert the mask (including upper halfword)
and t1, t0
2018-08-21 05:10:06 +02:00
mtc0 t1, CP0_Status
}