summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Dirk Best <mail@dirk-best.de>2015-06-09 16:57:51 +0200
committer Dirk Best <mail@dirk-best.de>2015-06-09 17:01:07 +0200
commitbb8ef78d03e10b0983dcca40fafa1b8607c5a61c (patch)
tree0f7d1eb6d6efd1e75829634904bad88d375b98d3
parent7ff62b4b455e08a797709abe9c9444bf9858c64b (diff)
i86: add very limited lock support (just enough for the apricot
actually)
-rw-r--r--src/emu/cpu/i86/i86.c8
-rw-r--r--src/emu/cpu/i86/i86.h10
2 files changed, 18 insertions, 0 deletions
diff --git a/src/emu/cpu/i86/i86.c b/src/emu/cpu/i86/i86.c
index 7a308da61a9..299d85b1f59 100644
--- a/src/emu/cpu/i86/i86.c
+++ b/src/emu/cpu/i86/i86.c
@@ -282,6 +282,8 @@ i8086_common_cpu_device::i8086_common_cpu_device(const machine_config &mconfig,
, m_irq_state(0)
, m_test_state(1)
, m_pc(0)
+ , m_lock(false)
+ , m_lock_handler(*this)
{
static const BREGS reg_name[8]={ AL, CL, DL, BL, AH, CH, DH, BH };
@@ -391,6 +393,8 @@ void i8086_common_cpu_device::device_start()
state_add(STATE_GENFLAGS, "GENFLAGS", m_TF).callimport().callexport().formatstr("%16s").noshow();
m_icountptr = &m_icount;
+
+ m_lock_handler.resolve_safe();
}
@@ -438,6 +442,7 @@ void i8086_common_cpu_device::device_reset()
m_dst = 0;
m_src = 0;
m_halt = false;
+ m_lock = false;
}
@@ -1910,7 +1915,9 @@ bool i8086_common_cpu_device::common_op(UINT8 op)
break;
case 0xe4: // i_inal
+ if (m_lock) m_lock_handler(1);
m_regs.b[AL] = read_port_byte( fetch() );
+ if (m_lock) { m_lock_handler(0); m_lock = false; }
CLK(IN_IMM8);
break;
@@ -2011,6 +2018,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op)
case 0xf0: // i_lock
logerror("%s: %06x: Warning - BUSLOCK\n", tag(), pc());
+ m_lock = true;
m_no_interrupt = 1;
CLK(NOP);
break;
diff --git a/src/emu/cpu/i86/i86.h b/src/emu/cpu/i86/i86.h
index ff1c56c2e92..6e48fecd71e 100644
--- a/src/emu/cpu/i86/i86.h
+++ b/src/emu/cpu/i86/i86.h
@@ -14,6 +14,10 @@ extern const device_type I8088;
#define INPUT_LINE_TEST 20
+#define MCFG_I8086_LOCK_HANDLER(_write) \
+ devcb = &i8086_common_cpu_device::set_lock_handler(*device, DEVCB_##_write);
+
+
enum
{
I8086_PC=0,
@@ -29,6 +33,9 @@ public:
// construction/destruction
i8086_common_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
+ template<class _Object> static devcb_base &set_lock_handler(device_t &device, _Object object)
+ { return downcast<i8086_common_cpu_device &>(device).m_lock_handler.set_callback(object); }
+
protected:
enum
{
@@ -325,6 +332,9 @@ protected:
UINT8 m_timing[200];
bool m_halt;
+
+ bool m_lock;
+ devcb_write_line m_lock_handler;
};
class i8086_cpu_device : public i8086_common_cpu_device