summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/devices/cpu/z80/z80daisy.cpp59
-rw-r--r--src/devices/cpu/z80/z80daisy.h8
-rw-r--r--src/mame/drivers/apricotf.cpp30
3 files changed, 83 insertions, 14 deletions
diff --git a/src/devices/cpu/z80/z80daisy.cpp b/src/devices/cpu/z80/z80daisy.cpp
index 094c97b851c..069b1b60b00 100644
--- a/src/devices/cpu/z80/z80daisy.cpp
+++ b/src/devices/cpu/z80/z80daisy.cpp
@@ -24,7 +24,8 @@
device_z80daisy_interface::device_z80daisy_interface(const machine_config &mconfig, device_t &device)
: device_interface(device, "z80daisy"),
- m_daisy_next(nullptr)
+ m_daisy_next(nullptr),
+ m_last_opcode(0)
{
}
@@ -38,6 +39,59 @@ device_z80daisy_interface::~device_z80daisy_interface()
}
+//-------------------------------------------------
+// interface_post_start - work to be done after
+// actually starting a device
+//-------------------------------------------------
+
+void device_z80daisy_interface::interface_post_start()
+{
+ device().save_item(NAME(m_last_opcode));
+}
+
+
+//-------------------------------------------------
+// interface_post_reset - work to be done after a
+// device is reset
+//-------------------------------------------------
+
+void device_z80daisy_interface::interface_post_reset()
+{
+ m_last_opcode = 0;
+}
+
+
+//-------------------------------------------------
+// z80daisy_decode - handle state machine that
+// decodes the RETI instruction from M1 fetches
+//-------------------------------------------------
+
+void device_z80daisy_interface::z80daisy_decode(uint8_t opcode)
+{
+ switch (m_last_opcode)
+ {
+ case 0xed:
+ // ED 4D = RETI
+ if (opcode == 0x4d)
+ z80daisy_irq_reti();
+
+ m_last_opcode = 0;
+ break;
+
+ case 0xcb:
+ case 0xdd:
+ case 0xfd:
+ // CB xx, DD xx, FD xx are just two-byte opcodes
+ m_last_opcode = 0;
+ break;
+
+ default:
+ // TODO: ED affects IEO
+ m_last_opcode = opcode;
+ break;
+ }
+}
+
//**************************************************************************
// Z80 DAISY CHAIN
@@ -188,7 +242,8 @@ void z80_daisy_chain_interface::daisy_call_reti_device()
int state = intf->z80daisy_irq_state();
if (state & Z80_DAISY_IEO)
{
- intf->z80daisy_irq_reti();
+ intf->z80daisy_decode(0xed);
+ intf->z80daisy_decode(0x4d);
return;
}
}
diff --git a/src/devices/cpu/z80/z80daisy.h b/src/devices/cpu/z80/z80daisy.h
index 75a20a38316..f0a1bf780cd 100644
--- a/src/devices/cpu/z80/z80daisy.h
+++ b/src/devices/cpu/z80/z80daisy.h
@@ -60,13 +60,21 @@ public:
device_z80daisy_interface(const machine_config &mconfig, device_t &device);
virtual ~device_z80daisy_interface();
+ // interface-level overrides
+ virtual void interface_post_start() override;
+ virtual void interface_post_reset() override;
+
// required operation overrides
virtual int z80daisy_irq_state() = 0;
virtual int z80daisy_irq_ack() = 0;
virtual void z80daisy_irq_reti() = 0;
+ // instruction decoding
+ void z80daisy_decode(uint8_t opcode);
+
private:
device_z80daisy_interface *m_daisy_next; // next device in the chain
+ uint8_t m_last_opcode;
};
diff --git a/src/mame/drivers/apricotf.cpp b/src/mame/drivers/apricotf.cpp
index eea1b31e3dd..30f51263ac2 100644
--- a/src/mame/drivers/apricotf.cpp
+++ b/src/mame/drivers/apricotf.cpp
@@ -27,7 +27,6 @@
#include "emu.h"
#include "bus/centronics/ctronics.h"
#include "cpu/i86/i86.h"
-#include "cpu/z80/z80daisy.h"
#include "formats/apridisk.h"
#include "imagedev/flopdrv.h"
#include "machine/apricotkb.h"
@@ -95,11 +94,12 @@ public:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_READ16_MEMBER( palette_r );
- DECLARE_WRITE16_MEMBER( palette_w );
- DECLARE_WRITE8_MEMBER( system_w );
- DECLARE_WRITE_LINE_MEMBER( ctc_z1_w );
- DECLARE_WRITE_LINE_MEMBER( ctc_z2_w );
+ DECLARE_READ16_MEMBER(palette_r);
+ DECLARE_WRITE16_MEMBER(palette_w);
+ DECLARE_WRITE8_MEMBER(system_w);
+ DECLARE_WRITE_LINE_MEMBER(ctc_z1_w);
+ DECLARE_WRITE_LINE_MEMBER(ctc_z2_w);
+ DECLARE_WRITE8_MEMBER(m1_w);
int m_40_80;
int m_200_256;
@@ -157,12 +157,12 @@ uint32_t f1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co
return 0;
}
-READ16_MEMBER( f1_state::palette_r )
+READ16_MEMBER(f1_state::palette_r)
{
return m_p_paletteram[offset];
}
-WRITE16_MEMBER( f1_state::palette_w )
+WRITE16_MEMBER(f1_state::palette_w)
{
uint8_t i,r,g,b;
COMBINE_DATA(&m_p_paletteram[offset]);
@@ -196,7 +196,7 @@ static GFXDECODE_START( act_f1 )
GFXDECODE_END
-WRITE8_MEMBER( f1_state::system_w )
+WRITE8_MEMBER(f1_state::system_w)
{
switch(offset)
{
@@ -272,7 +272,7 @@ void f1_state::act_f1_io(address_map &map)
map(0x0000, 0x000f).w(this, FUNC(f1_state::system_w));
map(0x0010, 0x0017).rw(m_ctc, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)).umask16(0x00ff);
map(0x0020, 0x0027).rw(m_sio, FUNC(z80sio_device::ba_cd_r), FUNC(z80sio_device::ba_cd_w)).umask16(0x00ff);
-// AM_RANGE(0x0030, 0x0031) AM_WRITE8(ctc_ack_w, 0x00ff)
+ map(0x0030, 0x0030).w(this, FUNC(f1_state::m1_w));
map(0x0040, 0x0047).rw(m_fdc, FUNC(wd2797_device::read), FUNC(wd2797_device::write)).umask16(0x00ff);
// AM_RANGE(0x01e0, 0x01ff) winchester
}
@@ -300,17 +300,23 @@ INPUT_PORTS_END
// Z80CTC
//-------------------------------------------------
-WRITE_LINE_MEMBER( f1_state::ctc_z1_w )
+WRITE_LINE_MEMBER(f1_state::ctc_z1_w)
{
m_sio->rxcb_w(state);
m_sio->txcb_w(state);
}
-WRITE_LINE_MEMBER( f1_state::ctc_z2_w )
+WRITE_LINE_MEMBER(f1_state::ctc_z2_w)
{
m_sio->txca_w(state);
}
+WRITE8_MEMBER(f1_state::m1_w)
+{
+ m_ctc->z80daisy_decode(data);
+ m_sio->z80daisy_decode(data);
+}
+
//-------------------------------------------------
// floppy
//-------------------------------------------------