diff options
Diffstat (limited to 'src/devices/cpu/pdp8')
-rw-r--r-- | src/devices/cpu/pdp8/pdp8.cpp | 32 | ||||
-rw-r--r-- | src/devices/cpu/pdp8/pdp8.h | 4 | ||||
-rw-r--r-- | src/devices/cpu/pdp8/pdp8dasm.cpp | 21 | ||||
-rw-r--r-- | src/devices/cpu/pdp8/pdp8dasm.h | 24 |
4 files changed, 38 insertions, 43 deletions
diff --git a/src/devices/cpu/pdp8/pdp8.cpp b/src/devices/cpu/pdp8/pdp8.cpp index 1a9150a236d..b3ade64fc75 100644 --- a/src/devices/cpu/pdp8/pdp8.cpp +++ b/src/devices/cpu/pdp8/pdp8.cpp @@ -9,8 +9,7 @@ #include "emu.h" #include "debugger.h" #include "pdp8.h" - -CPU_DISASSEMBLE( pdp8 ); +#include "pdp8dasm.h" #define OP ((op >> 011) & 07) @@ -148,36 +147,13 @@ void pdp8_device::state_string_export(const device_state_entry &entry, std::stri //------------------------------------------------- -// disasm_min_opcode_bytes - return the length -// of the shortest instruction, in bytes -//------------------------------------------------- - -uint32_t pdp8_device::disasm_min_opcode_bytes() const -{ - return 2; -} - - -//------------------------------------------------- -// disasm_max_opcode_bytes - return the length -// of the longest instruction, in bytes -//------------------------------------------------- - -uint32_t pdp8_device::disasm_max_opcode_bytes() const -{ - return 2; -} - - -//------------------------------------------------- -// disasm_disassemble - call the disassembly +// disassemble - call the disassembly // helper function //------------------------------------------------- -offs_t pdp8_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +util::disasm_interface *pdp8_cpu_device::create_disassembler() { - extern CPU_DISASSEMBLE( pdp8 ); - return CPU_DISASSEMBLE_NAME(pdp8)(this, stream, pc, oprom, opram, options); + return new pdp8_disassembler; } diff --git a/src/devices/cpu/pdp8/pdp8.h b/src/devices/cpu/pdp8/pdp8.h index b21371fd181..c6dc47ce56f 100644 --- a/src/devices/cpu/pdp8/pdp8.h +++ b/src/devices/cpu/pdp8/pdp8.h @@ -40,9 +40,7 @@ public: virtual space_config_vector memory_space_config() 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; // device_state_interface overrides virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; diff --git a/src/devices/cpu/pdp8/pdp8dasm.cpp b/src/devices/cpu/pdp8/pdp8dasm.cpp index 5c2219af4f8..389cf11fda7 100644 --- a/src/devices/cpu/pdp8/pdp8dasm.cpp +++ b/src/devices/cpu/pdp8/pdp8dasm.cpp @@ -7,9 +7,16 @@ */ #include "emu.h" +#include "pdp8dasm.h" -static offs_t pdp8_dasm_one(std::ostream &stream, offs_t pc, uint16_t op) +u32 pdp8_disassembler::opcode_alignment() const { + return 2; +} + +offs_t pdp8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) +{ + uint16_t op = opcodes.r16(pc); uint8_t opcode = (op >> 011) & 07; uint16_t current_page = pc & 07600; uint16_t zero_addr = op & 0177; @@ -157,15 +164,5 @@ static offs_t pdp8_dasm_one(std::ostream &stream, offs_t pc, uint16_t op) } } - return 2 | DASMFLAG_SUPPORTED; -} - - -/*****************************************************************************/ - -CPU_DISASSEMBLE( pdp8 ) -{ - uint16_t op = (*(uint8_t *)(opram + 0) << 8) | - (*(uint8_t *)(opram + 1) << 0); - return pdp8_dasm_one(stream, pc, op); + return 2 | SUPPORTED; } diff --git a/src/devices/cpu/pdp8/pdp8dasm.h b/src/devices/cpu/pdp8/pdp8dasm.h new file mode 100644 index 00000000000..df6c92e9ddb --- /dev/null +++ b/src/devices/cpu/pdp8/pdp8dasm.h @@ -0,0 +1,24 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/* + First-gen DEC PDP-8 disassembler + + Written by Ryan Holtz +*/ + +#ifndef MAME_CPU_PDP8_PDP8DASM_H +#define MAME_CPU_PDP8_PDP8DASM_H + +#pragma once + +class pdp8_disassembler : public util::disasm_interface +{ +public: + pdp8_disassembler() = default; + virtual ~pdp8_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 |