homebrew/inc/n64_util.inc

23 lines
611 B
PHP
Raw Normal View History

2018-08-20 20:10:06 -07:00
macro EnableInt() {
2018-08-23 20:13:08 -07:00
lli t0, MI_INTR_MASK_ALL_SET
2018-08-20 20:10:06 -07:00
lui a0, MI_BASE
sw t0, MI_INTR_MASK(a0)
2018-08-23 20:13:08 -07:00
// careful not to touch unrelated flags here
mfc0 t1, CP0_Status
lli t0, CP0_STATUS_IM_ALL
or t1, t0
2018-08-20 20:10:06 -07:00
mtc0 t1, CP0_Status
}
macro DisableInt() {
2018-08-23 20:13:08 -07:00
lli t0, MI_INTR_MASK_ALL_CLR
2018-08-20 20:10:06 -07:00
lui a0, MI_BASE
sw t0, MI_INTR_MASK(a0)
2018-08-23 20:13:08 -07: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-20 20:10:06 -07:00
mtc0 t1, CP0_Status
}