diff options
Diffstat (limited to 'src/devices/cpu/ie15')
-rw-r--r-- | src/devices/cpu/ie15/ie15.cpp | 31 | ||||
-rw-r--r-- | src/devices/cpu/ie15/ie15.h | 6 | ||||
-rw-r--r-- | src/devices/cpu/ie15/ie15dasm.cpp | 19 | ||||
-rw-r--r-- | src/devices/cpu/ie15/ie15dasm.h | 19 |
4 files changed, 37 insertions, 38 deletions
diff --git a/src/devices/cpu/ie15/ie15.cpp b/src/devices/cpu/ie15/ie15.cpp index e09d99c51a8..80c0fecdbe7 100644 --- a/src/devices/cpu/ie15/ie15.cpp +++ b/src/devices/cpu/ie15/ie15.cpp @@ -2,6 +2,7 @@ // copyright-holders:Sergey Svishchev #include "emu.h" #include "ie15.h" +#include "ie15dasm.h" #include "debugger.h" @@ -48,7 +49,7 @@ void ie15_cpu_device::device_start() { // find address spaces m_program = &space(AS_PROGRAM); - m_direct = &m_program->direct(); + m_direct = m_program->direct<0>(); m_io = &space(AS_IO); // save state @@ -149,34 +150,12 @@ void ie15_cpu_device::state_string_export(const device_state_entry &entry, std:: } //------------------------------------------------- -// disasm_min_opcode_bytes - return the length -// of the shortest instruction, in bytes +// create_disassembler //------------------------------------------------- -uint32_t ie15_cpu_device::disasm_min_opcode_bytes() const +util::disasm_interface *ie15_cpu_device::create_disassembler() { - return 1; -} - -//------------------------------------------------- -// disasm_max_opcode_bytes - return the length -// of the longest instruction, in bytes -//------------------------------------------------- - -uint32_t ie15_cpu_device::disasm_max_opcode_bytes() const -{ - return 2; -} - -//------------------------------------------------- -// disasm_disassemble - call the disassembly -// helper function -//------------------------------------------------- - -offs_t ie15_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) -{ - extern CPU_DISASSEMBLE( ie15 ); - return CPU_DISASSEMBLE_NAME(ie15)(nullptr, stream, pc, oprom, opram, 0); + return new ie15_disassembler; } //************************************************************************** diff --git a/src/devices/cpu/ie15/ie15.h b/src/devices/cpu/ie15/ie15.h index 2a39a663fed..f919d81c211 100644 --- a/src/devices/cpu/ie15/ie15.h +++ b/src/devices/cpu/ie15/ie15.h @@ -44,9 +44,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; - virtual uint32_t disasm_max_opcode_bytes() const override; - 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; virtual void execute_one(int opcode); @@ -76,7 +74,7 @@ protected: address_space *m_program; address_space *m_io; - direct_read_data *m_direct; + direct_read_data<0> *m_direct; }; // device type definition diff --git a/src/devices/cpu/ie15/ie15dasm.cpp b/src/devices/cpu/ie15/ie15dasm.cpp index f13e8f52e44..1318c58d6d5 100644 --- a/src/devices/cpu/ie15/ie15dasm.cpp +++ b/src/devices/cpu/ie15/ie15dasm.cpp @@ -1,34 +1,37 @@ // license:BSD-3-Clause // copyright-holders:Sergey Svishchev #include "emu.h" +#include "ie15dasm.h" -#define OP(A) oprom[(A) - PC] -#define ARG(A) opram[(A) - PC] +u32 ie15_disassembler::opcode_alignment() const +{ + return 1; +} -CPU_DISASSEMBLE(ie15) +offs_t ie15_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) { uint32_t flags = 0; uint8_t op; unsigned PC = pc; - op = OP(pc++); + op = opcodes.r8(pc++); switch (op & 0xf0) { case 0x00: util::stream_format(stream, "add r%d", op & 0x0f); break; case 0x10: - util::stream_format(stream, "jmp $%04x", (((op & 0x0f) << 8) | ARG(pc)) + 1); + util::stream_format(stream, "jmp $%04x", (((op & 0x0f) << 8) | params.r8(pc)) + 1); pc+=1; break; case 0x20: - util::stream_format(stream, "ldc r%d, #$%02x", (op & 0x0f), ARG(pc)); + util::stream_format(stream, "ldc r%d, #$%02x", (op & 0x0f), params.r8(pc)); pc+=1; break; case 0x30: switch (op) { case 0x30: - util::stream_format(stream, "lca #$%02x", ARG(pc)); + util::stream_format(stream, "lca #$%02x", params.r8(pc)); pc+=1; break; case 0x33: @@ -123,5 +126,5 @@ CPU_DISASSEMBLE(ie15) break; } - return (pc - PC) | flags | DASMFLAG_SUPPORTED; + return (pc - PC) | flags | SUPPORTED; } diff --git a/src/devices/cpu/ie15/ie15dasm.h b/src/devices/cpu/ie15/ie15dasm.h new file mode 100644 index 00000000000..fb85a7a3d1c --- /dev/null +++ b/src/devices/cpu/ie15/ie15dasm.h @@ -0,0 +1,19 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev + +#ifndef MAME_CPU_IE15_IE15DASM_H +#define MAME_CPU_IE15_IE15DASM_H + +#pragma once + +class ie15_disassembler : public util::disasm_interface +{ +public: + ie15_disassembler() = default; + virtual ~ie15_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 ¶ms) override; +}; + +#endif |