m5074x.cpp: Protect interrupt request bits against being set by writes

- m740: A few more timing corrections
This commit is contained in:
AJR 2020-10-29 11:26:51 -04:00
parent 282a8d49a9
commit bf80796b15
2 changed files with 18 additions and 26 deletions

View File

@ -164,16 +164,13 @@ void m5074x_device::execute_set_input(int inputnum, int state)
{ {
switch (inputnum) switch (inputnum)
{ {
case M5074X_INT1_LINE: case M5074X_INT1_LINE:
if (state == ASSERT_LINE) // FIXME: edge-triggered
{ if (state == ASSERT_LINE)
m_intctrl |= IRQ_INTREQ; {
} m_intctrl |= IRQ_INTREQ;
else }
{ break;
m_intctrl &= ~IRQ_INTREQ;
}
break;
} }
recalc_irqs(); recalc_irqs();
@ -442,12 +439,13 @@ void m5074x_device::tmrirq_w(offs_t offset, uint8_t data)
break; break;
case 5: case 5:
m_intctrl = data; // Interrupt request bits can only be reset
m_intctrl = data & (m_intctrl | ~(IRQ_CNTRREQ | IRQ_INTREQ));
recalc_irqs(); recalc_irqs();
break; break;
case 6: case 6:
m_tmrctrl = data; m_tmrctrl = data & (m_tmrctrl | ~TMRC_TMRXREQ);
recalc_irqs(); recalc_irqs();
break; break;
} }
@ -589,25 +587,19 @@ void m50753_device::execute_set_input(int inputnum, int state)
switch (inputnum) switch (inputnum)
{ {
case M50753_INT1_LINE: case M50753_INT1_LINE:
// FIXME: edge-triggered
if (state == ASSERT_LINE) if (state == ASSERT_LINE)
{ {
m_intctrl |= IRQ_50753_INT1REQ; m_intctrl |= IRQ_50753_INT1REQ;
} }
else
{
m_intctrl &= ~IRQ_50753_INT1REQ;
}
break; break;
case M50753_INT2_LINE: case M50753_INT2_LINE:
// FIXME: edge-triggered
if (state == ASSERT_LINE) if (state == ASSERT_LINE)
{ {
m_intctrl |= IRQ_50753_INT2REQ; m_intctrl |= IRQ_50753_INT2REQ;
} }
else
{
m_intctrl &= ~IRQ_50753_INT2REQ;
}
break; break;
} }

View File

@ -126,16 +126,15 @@ rrf_zpg
prefetch(); prefetch();
bra_rel bra_rel
TMP = read_pc(); TMP = read_pc_noinc();
read_pc_noinc(); read_arg(set_l(PC, PC+1));
if(page_changing(PC, int8_t(TMP))) { PC++;
read_arg(set_l(PC, PC+int8_t(TMP))); read_arg(set_l(PC, PC+int8_t(TMP)));
}
PC += int8_t(TMP); PC += int8_t(TMP);
prefetch(); prefetch();
jmp_zpi jmp_zpi
TMP2 = read_pc(); TMP2 = read_pc_noinc();
TMP = read(TMP2 & 0xff); TMP = read(TMP2 & 0xff);
TMP = set_h(TMP, read((TMP2+1) & 0xff)); TMP = set_h(TMP, read((TMP2+1) & 0xff));
PC = TMP; PC = TMP;
@ -359,6 +358,7 @@ andt_zpx
com_zpg com_zpg
TMP = read_pc(); TMP = read_pc();
TMP2 = read(TMP); TMP2 = read(TMP);
read(TMP);
TMP2 ^= 0xff; TMP2 ^= 0xff;
set_nz(TMP2); set_nz(TMP2);
write(TMP, TMP2); write(TMP, TMP2);