diff options
Diffstat (limited to 'src/devices/cpu/pdp1')
-rw-r--r-- | src/devices/cpu/pdp1/pdp1.cpp | 6 | ||||
-rw-r--r-- | src/devices/cpu/pdp1/pdp1.h | 4 | ||||
-rw-r--r-- | src/devices/cpu/pdp1/pdp1dasm.cpp | 22 | ||||
-rw-r--r-- | src/devices/cpu/pdp1/pdp1dasm.h | 22 | ||||
-rw-r--r-- | src/devices/cpu/pdp1/tx0.cpp | 12 | ||||
-rw-r--r-- | src/devices/cpu/pdp1/tx0.h | 8 | ||||
-rw-r--r-- | src/devices/cpu/pdp1/tx0dasm.cpp | 20 | ||||
-rw-r--r-- | src/devices/cpu/pdp1/tx0dasm.h | 29 |
8 files changed, 89 insertions, 34 deletions
diff --git a/src/devices/cpu/pdp1/pdp1.cpp b/src/devices/cpu/pdp1/pdp1.cpp index 2a5368ae56f..73482e5b82d 100644 --- a/src/devices/cpu/pdp1/pdp1.cpp +++ b/src/devices/cpu/pdp1/pdp1.cpp @@ -342,6 +342,7 @@ #include "emu.h" #include "debugger.h" #include "pdp1.h" +#include "pdp1dasm.h" #define LOG 0 #define LOG_EXTRA 0 @@ -418,10 +419,9 @@ void pdp1_device::device_config_complete() } -offs_t pdp1_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +util::disasm_interface *pdp1_device::create_disassembler() { - extern CPU_DISASSEMBLE( pdp1 ); - return CPU_DISASSEMBLE_NAME(pdp1)(this, stream, pc, oprom, opram, options); + return new pdp1_disassembler; } diff --git a/src/devices/cpu/pdp1/pdp1.h b/src/devices/cpu/pdp1/pdp1.h index 174317d995e..5a2df5fd91e 100644 --- a/src/devices/cpu/pdp1/pdp1.h +++ b/src/devices/cpu/pdp1/pdp1.h @@ -114,9 +114,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 4; } - virtual uint32_t disasm_max_opcode_bytes() const override { return 4; } - 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; private: address_space_config m_program_config; diff --git a/src/devices/cpu/pdp1/pdp1dasm.cpp b/src/devices/cpu/pdp1/pdp1dasm.cpp index 7376b752538..9b04c91ec87 100644 --- a/src/devices/cpu/pdp1/pdp1dasm.cpp +++ b/src/devices/cpu/pdp1/pdp1dasm.cpp @@ -1,13 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Raphael Nabet #include "emu.h" -#include "cpu/pdp1/pdp1.h" +#include "pdp1dasm.h" +#include "pdp1.h" -/* PDP1 registers */ -static int ib; -static int y; - -static inline void ea (void) +inline void pdp1_disassembler::ea() { /* while (1) { @@ -20,15 +17,20 @@ static inline void ea (void) #define IN if (ib) util::stream_format(stream, " i") -CPU_DISASSEMBLE(pdp1) +u32 pdp1_disassembler::opcode_alignment() const +{ + return 4; +} + +offs_t pdp1_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) { int md; //int etime = 0; - md = oprom[0] << 24 | oprom[1] << 16 | oprom[2] << 8 | oprom[3]; + md = opcodes.r32(pc); - y = md & 07777; - ib = (md >> 12) & 1; /* */ + int y = md & 07777; + int ib = (md >> 12) & 1; /* */ switch (md >> 13) { case pdp1_device::AND: diff --git a/src/devices/cpu/pdp1/pdp1dasm.h b/src/devices/cpu/pdp1/pdp1dasm.h new file mode 100644 index 00000000000..e5dd4b0f031 --- /dev/null +++ b/src/devices/cpu/pdp1/pdp1dasm.h @@ -0,0 +1,22 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet + +#ifndef MAME_CPU_PDP1_PDP1DASM_H +#define MAME_CPU_PDP1_PDP1DASM_H + +#pragma once + +class pdp1_disassembler : public util::disasm_interface +{ +public: + pdp1_disassembler() = default; + virtual ~pdp1_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; + +private: + void ea(); +}; + +#endif diff --git a/src/devices/cpu/pdp1/tx0.cpp b/src/devices/cpu/pdp1/tx0.cpp index 89355ee2ef8..376cf15a346 100644 --- a/src/devices/cpu/pdp1/tx0.cpp +++ b/src/devices/cpu/pdp1/tx0.cpp @@ -12,6 +12,7 @@ #include "emu.h" #include "tx0.h" +#include "tx0dasm.h" #include "debugger.h" #define LOG 0 @@ -1075,15 +1076,12 @@ void tx0_device::io_complete() } -offs_t tx0_8kw_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +util::disasm_interface *tx0_8kw_device::create_disassembler() { - extern CPU_DISASSEMBLE( tx0_8kw ); - return CPU_DISASSEMBLE_NAME(tx0_8kw)(this, stream, pc, oprom, opram, options); + return new tx0_8kw_disassembler; } - -offs_t tx0_64kw_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +util::disasm_interface *tx0_64kw_device::create_disassembler() { - extern CPU_DISASSEMBLE( tx0_64kw ); - return CPU_DISASSEMBLE_NAME(tx0_64kw)(this, stream, pc, oprom, opram, options); + return new tx0_64kw_disassembler; } diff --git a/src/devices/cpu/pdp1/tx0.h b/src/devices/cpu/pdp1/tx0.h index 52cc7f4091a..e9174a46413 100644 --- a/src/devices/cpu/pdp1/tx0.h +++ b/src/devices/cpu/pdp1/tx0.h @@ -67,10 +67,6 @@ protected: // device_memory_interface overrides virtual space_config_vector memory_space_config() const override; - // device_disasm_interface overrides - virtual uint32_t disasm_min_opcode_bytes() const override { return 4; } - virtual uint32_t disasm_max_opcode_bytes() const override { return 4; } - protected: address_space_config m_program_config; @@ -151,7 +147,7 @@ public: protected: virtual void execute_run() 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; private: void execute_instruction_8kw(); @@ -166,7 +162,7 @@ public: protected: virtual void execute_run() 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; private: void execute_instruction_64kw(); diff --git a/src/devices/cpu/pdp1/tx0dasm.cpp b/src/devices/cpu/pdp1/tx0dasm.cpp index cda24ed930c..34d49194ed3 100644 --- a/src/devices/cpu/pdp1/tx0dasm.cpp +++ b/src/devices/cpu/pdp1/tx0dasm.cpp @@ -1,14 +1,19 @@ // license:BSD-3-Clause // copyright-holders:Raphael Nabet #include "emu.h" -#include "cpu/pdp1/tx0.h" +#include "tx0dasm.h" -CPU_DISASSEMBLE(tx0_64kw) +u32 tx0_64kw_disassembler::opcode_alignment() const +{ + return 1; +} + +offs_t tx0_64kw_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) { int md; int x; - md = oprom[0] << 24 | oprom[1] << 16 | oprom[2] << 8 | oprom[3]; + md = opcodes.r32(pc); x = md & 0177777; switch (md >> 16) @@ -29,12 +34,17 @@ CPU_DISASSEMBLE(tx0_64kw) return 1; } -CPU_DISASSEMBLE(tx0_8kw) +u32 tx0_8kw_disassembler::opcode_alignment() const +{ + return 1; +} + +offs_t tx0_8kw_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) { int md; int x; - md = oprom[0] << 24 | oprom[1] << 16 | oprom[2] << 8 | oprom[3]; + md = opcodes.r32(pc); x = md & 0017777; switch (md >> 13) diff --git a/src/devices/cpu/pdp1/tx0dasm.h b/src/devices/cpu/pdp1/tx0dasm.h new file mode 100644 index 00000000000..ae97e2bcc1d --- /dev/null +++ b/src/devices/cpu/pdp1/tx0dasm.h @@ -0,0 +1,29 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet + +#ifndef MAME_CPU_PDP1_TX0DASM_H +#define MAME_CPU_PDP1_TX0DASM_H + +#pragma once + +class tx0_64kw_disassembler : public util::disasm_interface +{ +public: + tx0_64kw_disassembler() = default; + virtual ~tx0_64kw_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; +}; + +class tx0_8kw_disassembler : public util::disasm_interface +{ +public: + tx0_8kw_disassembler() = default; + virtual ~tx0_8kw_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 |