Skip to content

Commit ab0a33a

Browse files
authored
z80/z80.cpp: Cleaned up unnecessary internal state validation (SA_BUSACK) which caused INT skip (#14294)
1 parent c44ee01 commit ab0a33a

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

src/devices/cpu/z80/z80.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -789,11 +789,9 @@ void z80_device::execute_set_input(int inputnum, int state)
789789
switch (inputnum)
790790
{
791791
case Z80_INPUT_LINE_BUSRQ:
792-
m_busrq_state = state;
793-
if (state != CLEAR_LINE)
792+
if (m_busrq_state == CLEAR_LINE && state != CLEAR_LINE)
794793
set_service_attention<SA_BUSRQ, 1>();
795-
else
796-
set_service_attention<SA_BUSRQ, 0>();
794+
m_busrq_state = state;
797795
break;
798796

799797
case INPUT_LINE_NMI:

src/devices/cpu/z80/z80.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,12 @@ class z80_device : public cpu_device, public z80_daisy_chain_interface
140140
devcb_write_line m_busack_cb;
141141

142142
static constexpr u8 SA_BUSRQ = 0;
143-
static constexpr u8 SA_BUSACK = 1;
144-
static constexpr u8 SA_NMI_PENDING = 2;
145-
static constexpr u8 SA_IRQ_ON = 3;
146-
static constexpr u8 SA_HALT = 4;
147-
static constexpr u8 SA_AFTER_EI = 5;
148-
static constexpr u8 SA_AFTER_LDAIR = 6;
149-
static constexpr u8 SA_NSC800_IRQ_ON = 7;
143+
static constexpr u8 SA_NMI_PENDING = 1;
144+
static constexpr u8 SA_IRQ_ON = 2;
145+
static constexpr u8 SA_HALT = 3;
146+
static constexpr u8 SA_AFTER_EI = 4;
147+
static constexpr u8 SA_AFTER_LDAIR = 5;
148+
static constexpr u8 SA_NSC800_IRQ_ON = 6;
150149
u8 m_service_attention; // bitmap for required handling in service step
151150

152151
PAIR16 m_prvpc;

src/devices/cpu/z80/z80.lst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,17 +1048,18 @@ ffff
10481048
if (m_busrq_state) { // SA_BUSRQ
10491049
if (!m_busack_state) {
10501050
m_busack_state = 1;
1051-
set_service_attention<SA_BUSACK, 1>();
10521051
m_busack_cb(1);
10531052
}
10541053
if (m_icount > 0)
10551054
m_icount = 0;
10561055
m_ref = 0xffff00;
10571056
return;
1058-
} else if (m_busack_state) { // SA_BUSACK
1059-
m_busack_state = 0;
1060-
set_service_attention<SA_BUSACK, 0>();
1061-
m_busack_cb(0);
1057+
} else {
1058+
set_service_attention<SA_BUSRQ, 0>();
1059+
if (m_busack_state) {
1060+
m_busack_state = 0;
1061+
m_busack_cb(0);
1062+
}
10621063
}
10631064
@check_interrupts
10641065
set_service_attention<SA_AFTER_EI, 0>();

0 commit comments

Comments
 (0)