2017-08-29 13:13:56 +00:00
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace BizHawk.Emulation.Common.Components.LR35902
|
|
|
|
{
|
|
|
|
public partial class LR35902
|
|
|
|
{
|
2017-11-19 00:45:11 +00:00
|
|
|
private void INTERRUPT_()
|
2017-08-29 13:13:56 +00:00
|
|
|
{
|
|
|
|
cur_instr = new ushort[]
|
|
|
|
{IDLE,
|
|
|
|
DEC16, SPl, SPh,
|
|
|
|
IDLE,
|
|
|
|
WR, SPl, SPh, PCh,
|
|
|
|
IDLE,
|
2017-11-19 14:30:18 +00:00
|
|
|
DEC16, SPl, SPh,
|
2017-08-29 13:13:56 +00:00
|
|
|
IDLE,
|
2019-10-08 23:21:40 +00:00
|
|
|
WR, SPl, SPh, PCl,
|
2017-08-29 13:13:56 +00:00
|
|
|
IDLE,
|
2017-11-19 14:30:18 +00:00
|
|
|
IDLE,
|
|
|
|
IDLE,
|
2018-05-09 01:47:35 +00:00
|
|
|
IDLE,
|
|
|
|
IDLE,
|
2019-10-09 16:46:48 +00:00
|
|
|
ASGN, PCh, 0,
|
2018-05-09 01:47:35 +00:00
|
|
|
IDLE,
|
2019-10-09 16:46:48 +00:00
|
|
|
INT_GET, W,// NOTE: here is where we check for a cancelled IRQ
|
2017-11-19 00:45:11 +00:00
|
|
|
TR, PCl, W,
|
2019-10-08 12:54:50 +00:00
|
|
|
IRQ_CLEAR,
|
2019-10-09 16:46:48 +00:00
|
|
|
IDLE,
|
2017-08-29 13:13:56 +00:00
|
|
|
OP };
|
|
|
|
}
|
|
|
|
|
2018-04-03 22:18:41 +00:00
|
|
|
private void INTERRUPT_GBC_NOP()
|
|
|
|
{
|
|
|
|
cur_instr = new ushort[]
|
|
|
|
{IDLE,
|
|
|
|
DEC16, SPl, SPh,
|
|
|
|
IDLE,
|
|
|
|
WR, SPl, SPh, PCh,
|
|
|
|
IDLE,
|
|
|
|
DEC16, SPl, SPh,
|
|
|
|
IDLE,
|
2019-10-08 23:21:40 +00:00
|
|
|
WR, SPl, SPh, PCl,
|
2018-04-03 22:18:41 +00:00
|
|
|
IDLE,
|
|
|
|
IDLE,
|
|
|
|
IDLE,
|
|
|
|
IDLE,
|
|
|
|
IDLE,
|
|
|
|
IDLE,
|
|
|
|
IDLE,
|
2018-05-09 01:47:35 +00:00
|
|
|
IDLE,
|
2019-10-09 16:46:48 +00:00
|
|
|
INT_GET, W,// NOTE: here is where we check for a cancelled IRQ
|
2018-05-09 01:47:35 +00:00
|
|
|
IDLE,
|
2019-10-09 16:46:48 +00:00
|
|
|
TR, PCl, W,
|
2018-05-09 01:47:35 +00:00
|
|
|
IDLE,
|
2019-10-09 16:46:48 +00:00
|
|
|
ASGN, PCh, 0,
|
2019-10-08 12:54:50 +00:00
|
|
|
IRQ_CLEAR,
|
2019-10-09 16:46:48 +00:00
|
|
|
IDLE,
|
2018-04-03 22:18:41 +00:00
|
|
|
OP };
|
|
|
|
}
|
|
|
|
|
2017-11-19 00:45:11 +00:00
|
|
|
private static ushort[] INT_vectors = new ushort[] {0x40, 0x48, 0x50, 0x58, 0x60, 0x00};
|
|
|
|
|
|
|
|
public ushort int_src;
|
2019-10-08 12:54:50 +00:00
|
|
|
public byte int_clear;
|
2018-03-25 14:07:12 +00:00
|
|
|
public int stop_time;
|
|
|
|
public bool stop_check;
|
2018-03-25 21:58:21 +00:00
|
|
|
public bool is_GBC; // GBC automatically adds a NOP to avoid the HALT bug (according to Sinimas)
|
2018-05-02 01:53:20 +00:00
|
|
|
public bool I_use; // in halt mode, the I flag is checked earlier then when deicision to IRQ is taken
|
|
|
|
public bool skip_once;
|
|
|
|
public bool Halt_bug_2;
|
|
|
|
public bool Halt_bug_3;
|
2017-08-29 13:13:56 +00:00
|
|
|
|
|
|
|
private void ResetInterrupts()
|
|
|
|
{
|
2018-05-02 01:53:20 +00:00
|
|
|
I_use = false;
|
|
|
|
skip_once = false;
|
|
|
|
Halt_bug_2 = false;
|
|
|
|
Halt_bug_3 = false;
|
2017-08-29 13:13:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|