diff options
author | 2014-01-30 03:08:42 +0000 | |
---|---|---|
committer | 2014-01-30 03:08:42 +0000 | |
commit | d9f2f525fdf3ec553109d547d0488bf4ac019b73 (patch) | |
tree | 5049b150df5043ea98c456530c14928cc0191258 /src/emu/cpu/m6502 | |
parent | 6f360f65103ce9c677acf8e2b93d11ef70f1f590 (diff) |
m6502: expose SYNC pin through devcb2 for more flexibility [R. Belmont]
Diffstat (limited to 'src/emu/cpu/m6502')
-rw-r--r-- | src/emu/cpu/m6502/m6502.c | 9 | ||||
-rw-r--r-- | src/emu/cpu/m6502/m6502.h | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/emu/cpu/m6502/m6502.c b/src/emu/cpu/m6502/m6502.c index 06e98d3b559..7341c8d75b2 100644 --- a/src/emu/cpu/m6502/m6502.c +++ b/src/emu/cpu/m6502/m6502.c @@ -45,6 +45,7 @@ const device_type M6502 = &device_creator<m6502_device>; m6502_device::m6502_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : cpu_device(mconfig, M6502, "M6502", tag, owner, clock, "m6502", __FILE__), + sync_w(*this), program_config("program", ENDIANNESS_LITTLE, 8, 16) { direct_disabled = false; @@ -52,6 +53,7 @@ m6502_device::m6502_device(const machine_config &mconfig, const char *tag, devic m6502_device::m6502_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) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source), + sync_w(*this), program_config("program", ENDIANNESS_LITTLE, 8, 16) { direct_disabled = false; @@ -64,6 +66,8 @@ void m6502_device::device_start() else mintf = new mi_default_normal; + sync_w.resolve_safe(); + init(); } @@ -141,6 +145,7 @@ void m6502_device::device_reset() v_state = false; end_cycles = 0; sync = false; + sync_w(CLEAR_LINE); inhibit_interrupts = false; } @@ -652,9 +657,11 @@ offs_t m6502_device::disassemble_generic(char *buffer, offs_t pc, const UINT8 *o void m6502_device::prefetch() { sync = true; + sync_w(ASSERT_LINE); NPC = PC; IR = mintf->read_decrypted(PC); sync = false; + sync_w(CLEAR_LINE); if((nmi_state || ((irq_state || apu_irq_state) && !(P & F_I))) && !inhibit_interrupts) { irq_taken = true; @@ -666,9 +673,11 @@ void m6502_device::prefetch() void m6502_device::prefetch_noirq() { sync = true; + sync_w(ASSERT_LINE); NPC = PC; IR = mintf->read_decrypted(PC); sync = false; + sync_w(CLEAR_LINE); PC++; } diff --git a/src/emu/cpu/m6502/m6502.h b/src/emu/cpu/m6502/m6502.h index df3f365cdbd..c51e98e829c 100644 --- a/src/emu/cpu/m6502/m6502.h +++ b/src/emu/cpu/m6502/m6502.h @@ -43,6 +43,9 @@ #define MCFG_M6502_DISABLE_DIRECT() \ downcast<m6502_device *>(device)->disable_direct(); +#define MCFG_M6502_SYNC_CALLBACK(_cb) \ + devcb = &m6502_device::set_sync_callback(*device, DEVCB2_##_cb) + class m6502_device : public cpu_device { public: enum { @@ -62,6 +65,10 @@ public: bool get_sync() const { return sync; } void disable_direct() { direct_disabled = true; } + template<class _Object> static devcb2_base &set_sync_callback(device_t &device, _Object object) { return downcast<m6502_device &>(device).sync_w.set_callback(object); } + + devcb2_write_line sync_w; + protected: class memory_interface { public: |