i86: add very limited lock support (just enough for the apricot

actually)
This commit is contained in:
Dirk Best 2015-06-09 16:57:51 +02:00
parent 7ff62b4b45
commit bb8ef78d03
2 changed files with 18 additions and 0 deletions

View File

@ -282,6 +282,8 @@ i8086_common_cpu_device::i8086_common_cpu_device(const machine_config &mconfig,
, m_irq_state(0) , m_irq_state(0)
, m_test_state(1) , m_test_state(1)
, m_pc(0) , m_pc(0)
, m_lock(false)
, m_lock_handler(*this)
{ {
static const BREGS reg_name[8]={ AL, CL, DL, BL, AH, CH, DH, BH }; 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(); state_add(STATE_GENFLAGS, "GENFLAGS", m_TF).callimport().callexport().formatstr("%16s").noshow();
m_icountptr = &m_icount; m_icountptr = &m_icount;
m_lock_handler.resolve_safe();
} }
@ -438,6 +442,7 @@ void i8086_common_cpu_device::device_reset()
m_dst = 0; m_dst = 0;
m_src = 0; m_src = 0;
m_halt = false; m_halt = false;
m_lock = false;
} }
@ -1910,7 +1915,9 @@ bool i8086_common_cpu_device::common_op(UINT8 op)
break; break;
case 0xe4: // i_inal case 0xe4: // i_inal
if (m_lock) m_lock_handler(1);
m_regs.b[AL] = read_port_byte( fetch() ); m_regs.b[AL] = read_port_byte( fetch() );
if (m_lock) { m_lock_handler(0); m_lock = false; }
CLK(IN_IMM8); CLK(IN_IMM8);
break; break;
@ -2011,6 +2018,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op)
case 0xf0: // i_lock case 0xf0: // i_lock
logerror("%s: %06x: Warning - BUSLOCK\n", tag(), pc()); logerror("%s: %06x: Warning - BUSLOCK\n", tag(), pc());
m_lock = true;
m_no_interrupt = 1; m_no_interrupt = 1;
CLK(NOP); CLK(NOP);
break; break;

View File

@ -14,6 +14,10 @@ extern const device_type I8088;
#define INPUT_LINE_TEST 20 #define INPUT_LINE_TEST 20
#define MCFG_I8086_LOCK_HANDLER(_write) \
devcb = &i8086_common_cpu_device::set_lock_handler(*device, DEVCB_##_write);
enum enum
{ {
I8086_PC=0, I8086_PC=0,
@ -29,6 +33,9 @@ public:
// construction/destruction // 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); 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: protected:
enum enum
{ {
@ -325,6 +332,9 @@ protected:
UINT8 m_timing[200]; UINT8 m_timing[200];
bool m_halt; bool m_halt;
bool m_lock;
devcb_write_line m_lock_handler;
}; };
class i8086_cpu_device : public i8086_common_cpu_device class i8086_cpu_device : public i8086_common_cpu_device