summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/z8
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/z8')
-rw-r--r--src/devices/cpu/z8/z8.cpp10
-rw-r--r--src/devices/cpu/z8/z8.h6
-rw-r--r--src/devices/cpu/z8/z8dasm.cpp33
-rw-r--r--src/devices/cpu/z8/z8dasm.h24
4 files changed, 50 insertions, 23 deletions
diff --git a/src/devices/cpu/z8/z8.cpp b/src/devices/cpu/z8/z8.cpp
index 5ef2c5c505d..1f21ebbab49 100644
--- a/src/devices/cpu/z8/z8.cpp
+++ b/src/devices/cpu/z8/z8.cpp
@@ -22,6 +22,7 @@
#include "emu.h"
#include "z8.h"
+#include "z8dasm.h"
#include "debugger.h"
/***************************************************************************
@@ -207,13 +208,12 @@ z8681_device::z8681_device(const machine_config &mconfig, const char *tag, devic
{
}
-
-offs_t z8_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options)
+util::disasm_interface *z8_device::create_disassembler()
{
- extern CPU_DISASSEMBLE( z8 );
- return CPU_DISASSEMBLE_NAME(z8)(this, stream, pc, oprom, opram, options);
+ return new z8_disassembler;
}
+
device_memory_interface::space_config_vector z8_device::memory_space_config() const
{
// Separate data space is optional
@@ -778,7 +778,7 @@ void z8_device::device_start()
/* find address spaces */
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_data = has_space(AS_DATA) ? &space(AS_DATA) : m_program;
/* allocate timers */
diff --git a/src/devices/cpu/z8/z8.h b/src/devices/cpu/z8/z8.h
index b7064c82ae7..1f6f8a7c890 100644
--- a/src/devices/cpu/z8/z8.h
+++ b/src/devices/cpu/z8/z8.h
@@ -91,9 +91,7 @@ protected:
virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
// device_disasm_interface overrides
- virtual uint32_t disasm_min_opcode_bytes() const override { return 1; }
- virtual uint32_t disasm_max_opcode_bytes() const override { return 3; }
- virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override;
+ virtual util::disasm_interface *create_disassembler() override;
DECLARE_ADDRESS_MAP(program_2kb, 8);
DECLARE_ADDRESS_MAP(program_4kb, 8);
@@ -103,7 +101,7 @@ private:
address_space_config m_data_config;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_data;
// callbacks
diff --git a/src/devices/cpu/z8/z8dasm.cpp b/src/devices/cpu/z8/z8dasm.cpp
index 8cd29344f2a..a832dab8fe9 100644
--- a/src/devices/cpu/z8/z8dasm.cpp
+++ b/src/devices/cpu/z8/z8dasm.cpp
@@ -1,14 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Curt Coder
+
#include "emu.h"
-#include "debugger.h"
-#include "z8.h"
+#include "z8dasm.h"
/***************************************************************************
CONSTANTS
***************************************************************************/
-static const char *const REGISTER_NAME[256] =
+const char *const z8_disassembler::REGISTER_NAME[256] =
{
"P0", "P1", "P2", "P3", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
@@ -28,7 +28,7 @@ static const char *const REGISTER_NAME[256] =
"SIO", "TMR", "T1", "PRE1", "T0", "PRE0", "P2M", "P3M", "P01M", "IPR", "IRQ", "IMR", "FLAGS", "RP", "SPH", "SPL"
};
-static const char *const CONDITION_CODE[16] =
+const char *const z8_disassembler::CONDITION_CODE[16] =
{
"F", "LT", "LE", "ULE", "OV", "MI", "Z", "C",
"", "GE", "GT", "UGT", "NOV", "PL", "NZ", "NC"
@@ -50,8 +50,8 @@ static const char *const CONDITION_CODE[16] =
#define DA "%04Xh"
#define RA "%04Xh"
-#define B0 oprom[0]
-#define B1 oprom[1]
+#define B0 opcodes.r8(pos)
+#define B1 opcodes.r8(pos+1)
#define B0H (B0 >> 4)
#define B0L (B0 & 0x0f)
#define OPH (opcode >> 4)
@@ -74,19 +74,24 @@ static const char *const CONDITION_CODE[16] =
#define illegal util::stream_format(stream, "Illegal")
#define mnemonic(_mnemonic) util::stream_format(stream, "%-5s", _mnemonic)
-#define bytes(_count) oprom += (_count - 1)
-#define step_over flags = DASMFLAG_STEP_OVER
-#define step_out flags = DASMFLAG_STEP_OUT
+#define bytes(_count) pos += (_count - 1)
+#define step_over flags = STEP_OVER
+#define step_out flags = STEP_OUT
/***************************************************************************
DISASSEMBLER
***************************************************************************/
-CPU_DISASSEMBLE(z8)
+u32 z8_disassembler::opcode_alignment() const
+{
+ return 1;
+}
+
+offs_t z8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params)
{
- const uint8_t *startrom = oprom;
+ offs_t pos = pc;
uint32_t flags = 0;
- uint8_t opcode = *oprom++;
+ uint8_t opcode = opcodes.r8(pos++);
int argc = 0;
switch (pc)
@@ -97,7 +102,7 @@ CPU_DISASSEMBLE(z8)
case 0x0006:
case 0x0008:
case 0x000a:
- util::stream_format(stream, "IRQ%u Vector %04Xh", pc / 2, opcode << 8 | *oprom++); break;
+ util::stream_format(stream, "IRQ%u Vector %04Xh", pc / 2, opcode << 8 | opcodes.r8(pos++)); break;
default:
switch (opcode)
{
@@ -375,5 +380,5 @@ CPU_DISASSEMBLE(z8)
}
}
- return (oprom - startrom) | flags | DASMFLAG_SUPPORTED;
+ return (pos - pc) | flags | SUPPORTED;
}
diff --git a/src/devices/cpu/z8/z8dasm.h b/src/devices/cpu/z8/z8dasm.h
new file mode 100644
index 00000000000..653b6e0cb26
--- /dev/null
+++ b/src/devices/cpu/z8/z8dasm.h
@@ -0,0 +1,24 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+
+#ifndef MAME_CPU_Z8_Z8DASM_H
+#define MAME_CPU_Z8_Z8DASM_H
+
+#pragma once
+
+class z8_disassembler : public util::disasm_interface
+{
+public:
+ z8_disassembler() = default;
+ virtual ~z8_disassembler() = default;
+
+ virtual u32 opcode_alignment() const override;
+ virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params) override;
+
+private:
+ static const char *const REGISTER_NAME[256];
+ static const char *const CONDITION_CODE[16];
+
+};
+
+#endif