n2a03: Put a second irq line logically-ored with the normal one [O. Galibert]

This commit is contained in:
Olivier Galibert 2012-11-07 21:09:10 +00:00
parent bd8de01d51
commit a2d20ed58f
4 changed files with 10 additions and 4 deletions

View File

@ -96,6 +96,7 @@ void m6502_device::init()
save_item(NAME(IR));
save_item(NAME(nmi_state));
save_item(NAME(irq_state));
save_item(NAME(apu_irq_state));
save_item(NAME(v_state));
save_item(NAME(inst_state));
save_item(NAME(inst_substate));
@ -116,6 +117,7 @@ void m6502_device::init()
IR = 0x00;
nmi_state = false;
irq_state = false;
apu_irq_state = false;
irq_taken = false;
v_state = false;
inst_state = STATE_RESET;
@ -131,6 +133,7 @@ void m6502_device::device_reset()
inst_substate = 0;
nmi_state = false;
irq_state = false;
apu_irq_state = false;
irq_taken = false;
v_state = false;
end_cycles = 0;
@ -416,6 +419,7 @@ void m6502_device::execute_set_input(int inputnum, int state)
{
switch(inputnum) {
case IRQ_LINE: irq_state = state == ASSERT_LINE; break;
case APU_IRQ_LINE: apu_irq_state = state == ASSERT_LINE; break;
case NMI_LINE: nmi_state = nmi_state || (state == ASSERT_LINE); break;
case V_LINE:
if(!v_state && state == ASSERT_LINE)
@ -612,7 +616,7 @@ void m6502_device::prefetch()
IR = mintf->read_decrypted(PC);
sync = false;
if((nmi_state || (irq_state && !(P & F_I))) && !inhibit_interrupts) {
if((nmi_state || ((irq_state || apu_irq_state) && !(P & F_I))) && !inhibit_interrupts) {
irq_taken = true;
IR = 0x00;
} else

View File

@ -47,6 +47,7 @@ class m6502_device : public cpu_device {
public:
enum {
IRQ_LINE = INPUT_LINE_IRQ0,
APU_IRQ_LINE = INPUT_LINE_IRQ1,
NMI_LINE = INPUT_LINE_NMI,
V_LINE = 10
};
@ -176,7 +177,7 @@ protected:
memory_interface *mintf;
int inst_state, inst_substate;
int icount;
bool nmi_state, irq_state, v_state;
bool nmi_state, irq_state, apu_irq_state, v_state;
bool irq_taken, sync, direct_disabled, inhibit_interrupts;
UINT64 end_cycles;

View File

@ -87,6 +87,7 @@ protected:
enum {
N2A03_IRQ_LINE = m6502_device::IRQ_LINE,
N2A03_APU_IRQ_LINE = m6502_device::APU_IRQ_LINE,
N2A03_NMI_LINE = m6502_device::NMI_LINE,
N2A03_SET_OVERFLOW = m6502_device::V_LINE,
};

View File

@ -371,7 +371,7 @@ static int8 apu_dpcm(nesapu_state *info, dpcm_t *chan)
if (chan->regs[0] & 0x80) /* IRQ Generator */
{
chan->irq_occurred = TRUE;
downcast<n2a03_device &>(info->APU.dpcm.memory->device()).set_input_line(N2A03_IRQ_LINE, ASSERT_LINE);
downcast<n2a03_device &>(info->APU.dpcm.memory->device()).set_input_line(N2A03_APU_IRQ_LINE, ASSERT_LINE);
}
break;
}
@ -521,7 +521,7 @@ INLINE void apu_regwrite(nesapu_state *info,int address, uint8 value)
case APU_WRE0:
info->APU.dpcm.regs[0] = value;
if (0 == (value & 0x80)) {
downcast<n2a03_device &>(info->APU.dpcm.memory->device()).set_input_line(N2A03_IRQ_LINE, CLEAR_LINE);
downcast<n2a03_device &>(info->APU.dpcm.memory->device()).set_input_line(N2A03_APU_IRQ_LINE, CLEAR_LINE);
info->APU.dpcm.irq_occurred = FALSE;
}
break;