From 55ead0c9975483770f99e9e016816d3a8b4b8a3e Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 2 Feb 2019 19:48:10 -0500 Subject: g65816: WDM is a 2-byte opcode per WDC docs, added WDM callback. [R. Belmont] --- src/devices/cpu/g65816/g65816.cpp | 7 +++++++ src/devices/cpu/g65816/g65816.h | 3 +++ src/devices/cpu/g65816/g65816ds.cpp | 2 +- src/devices/cpu/g65816/g65816op.h | 3 ++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/devices/cpu/g65816/g65816.cpp b/src/devices/cpu/g65816/g65816.cpp index a65122b6153..93c93f96ed8 100644 --- a/src/devices/cpu/g65816/g65816.cpp +++ b/src/devices/cpu/g65816/g65816.cpp @@ -17,6 +17,10 @@ All rights reserved. /* Changes: + 1.02 (2019-02-02): + R. Belmont + - Corrected WDM to take 2 bytes and added callback + 1.01 (2010-04-04): Angelo Salese - Added boundary checks for MVP and MVN in M mode. @@ -115,6 +119,7 @@ g65816_device::g65816_device(const machine_config &mconfig, device_type type, co , m_data_config("data", ENDIANNESS_LITTLE, 8, 24, 0, internal) , m_opcode_config("opcodes", ENDIANNESS_LITTLE, 8, 24, 0, internal) , m_vector_config("vectors", ENDIANNESS_LITTLE, 8, 5, 0) + , m_wdm_w(*this) , m_cpu_type(cpu_type) { } @@ -860,6 +865,8 @@ void g65816_device::device_start() m_program_cache = program_space.cache<0, 0, ENDIANNESS_LITTLE>(); m_opcode_cache = (has_space(AS_OPCODES) ? space(AS_OPCODES) : program_space).cache<0, 0, ENDIANNESS_LITTLE>(); + m_wdm_w.resolve_safe(); + save_item(NAME(m_a)); save_item(NAME(m_b)); save_item(NAME(m_x)); diff --git a/src/devices/cpu/g65816/g65816.h b/src/devices/cpu/g65816/g65816.h index e53f9eb784b..154dd015783 100644 --- a/src/devices/cpu/g65816/g65816.h +++ b/src/devices/cpu/g65816/g65816.h @@ -56,6 +56,8 @@ public: // construction/destruction g65816_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + auto wdm_handler() { return m_wdm_w.bind(); } + protected: /* Registers - used by g65816_set_reg() and g65816_get_reg() */ enum @@ -96,6 +98,7 @@ protected: address_space_config m_data_config; address_space_config m_opcode_config; address_space_config m_vector_config; + devcb_write8 m_wdm_w; /* WDM callback */ typedef void (g65816_device::*opcode_func) (); typedef unsigned (g65816_device::*get_reg_func)(int regnum); diff --git a/src/devices/cpu/g65816/g65816ds.cpp b/src/devices/cpu/g65816/g65816ds.cpp index 0f40b42f5d6..355be140f99 100644 --- a/src/devices/cpu/g65816/g65816ds.cpp +++ b/src/devices/cpu/g65816/g65816ds.cpp @@ -101,7 +101,7 @@ const g65816_disassembler::opcode_struct g65816_disassembler::s_opcodes[256] = {op::BIT, M, DX }, {op::AND, M, DX }, {op::ROL, M, DX }, {op::AND, M, DLIY}, {op::SEC, I, IMP }, {op::AND, M, AY }, {op::DEA, I, IMP }, {op::TSC, I, IMP }, {op::BIT, M, AX }, {op::AND, M, AX }, {op::ROL, M, AX }, {op::AND, M, ALX }, - {op::RTI, I, IMP }, {op::EOR, M, DXI }, {op::WDM, I, IMP }, {op::EOR, M, S }, + {op::RTI, I, IMP }, {op::EOR, M, DXI }, {op::WDM, I, SIG }, {op::EOR, M, S }, {op::MVP, I, MVP }, {op::EOR, M, D }, {op::LSR, M, D }, {op::EOR, M, DLI }, {op::PHA, I, IMP }, {op::EOR, M, IMM }, {op::LSR, M, ACC }, {op::PHK, I, IMP }, {op::JMP, I, A }, {op::EOR, M, A }, {op::LSR, M, A }, {op::EOR, M, AL }, diff --git a/src/devices/cpu/g65816/g65816op.h b/src/devices/cpu/g65816/g65816op.h index 97b198e9385..727117c0f29 100644 --- a/src/devices/cpu/g65816/g65816op.h +++ b/src/devices/cpu/g65816/g65816op.h @@ -1428,7 +1428,8 @@ #undef OP_WDM #define OP_WDM() \ CLK(CLK_OP + CLK_IMPLIED); \ - REGISTER_PC++ + SRC = OPER_8_IMM(); \ + m_wdm_w(SRC); /* G65816 Exchange accum high and low bytes */ #undef OP_XBA -- cgit v1.2.3