diff options
author | 2017-07-05 11:44:49 +0200 | |
---|---|---|
committer | 2017-11-26 17:41:27 +0100 | |
commit | 6caef2579a1490f05d28bcede731cbdd45fc5c65 (patch) | |
tree | 8055384e183be3cb27e7d0894ac53dc96c09e6fa /src/devices/cpu/upd7725 | |
parent | 34b222062c89adbeed822f56be6130421777e11f (diff) |
dvdisasm: Overhaul [O. Galibert]
Disassemblers are now independant classes. Not only the code is
cleaner, but unidasm has access to all the cpu cores again. The
interface to the disassembly method has changed from byte buffers to
objects that give a result to read methods. This also adds support
for lfsr and/or paged PCs.
Diffstat (limited to 'src/devices/cpu/upd7725')
-rw-r--r-- | src/devices/cpu/upd7725/dasm7725.cpp | 13 | ||||
-rw-r--r-- | src/devices/cpu/upd7725/dasm7725.h | 27 | ||||
-rw-r--r-- | src/devices/cpu/upd7725/upd7725.cpp | 29 | ||||
-rw-r--r-- | src/devices/cpu/upd7725/upd7725.h | 4 |
4 files changed, 41 insertions, 32 deletions
diff --git a/src/devices/cpu/upd7725/dasm7725.cpp b/src/devices/cpu/upd7725/dasm7725.cpp index f2e644e0bec..06a9fdd3d16 100644 --- a/src/devices/cpu/upd7725/dasm7725.cpp +++ b/src/devices/cpu/upd7725/dasm7725.cpp @@ -10,11 +10,16 @@ ***************************************************************************/ #include "emu.h" -#include "upd7725.h" +#include "dasm7725.h" -CPU_DISASSEMBLE(upd7725) +u32 necdsp_disassembler::opcode_alignment() const { - uint32_t opcode = oprom[2] | (oprom[1] << 8) | (oprom[0] << 16); + return 1; +} + +offs_t necdsp_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) +{ + uint32_t opcode = opcodes.r32(pc); uint32_t type = (opcode >> 22); // printf("dasm: PC %x opcode %08x\n", pc, opcode); @@ -220,5 +225,5 @@ CPU_DISASSEMBLE(upd7725) } } - return 1 | DASMFLAG_SUPPORTED; + return 1 | SUPPORTED; } diff --git a/src/devices/cpu/upd7725/dasm7725.h b/src/devices/cpu/upd7725/dasm7725.h new file mode 100644 index 00000000000..5280c3e4a46 --- /dev/null +++ b/src/devices/cpu/upd7725/dasm7725.h @@ -0,0 +1,27 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont,byuu +/*************************************************************************** + + dasm7725.c + Disassembler for the portable uPD7725 emulator. + Written by byuu + MAME conversion by R. Belmont + +***************************************************************************/ + +#ifndef MAME_CPU_UPD7725_DASM7725_H +#define MAME_CPU_UPD7725_DASM7725_H + +#pragma once + +class necdsp_disassembler : public util::disasm_interface +{ +public: + necdsp_disassembler() = default; + virtual ~necdsp_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 diff --git a/src/devices/cpu/upd7725/upd7725.cpp b/src/devices/cpu/upd7725/upd7725.cpp index 7ef876613db..b509c302aa0 100644 --- a/src/devices/cpu/upd7725/upd7725.cpp +++ b/src/devices/cpu/upd7725/upd7725.cpp @@ -14,6 +14,7 @@ #include "emu.h" #include "debugger.h" #include "upd7725.h" +#include "dasm7725.h" //************************************************************************** @@ -316,35 +317,13 @@ void necdsp_device::execute_set_input(int inputnum, int state) } //------------------------------------------------- -// disasm_min_opcode_bytes - return the length -// of the shortest instruction, in bytes -//------------------------------------------------- - -uint32_t necdsp_device::disasm_min_opcode_bytes() const -{ - return 4; -} - - -//------------------------------------------------- -// disasm_max_opcode_bytes - return the length -// of the longest instruction, in bytes -//------------------------------------------------- - -uint32_t necdsp_device::disasm_max_opcode_bytes() const -{ - return 4; -} - -//------------------------------------------------- -// disasm_disassemble - call the disassembly +// disassemble - call the disassembly // helper function //------------------------------------------------- -offs_t necdsp_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +util::disasm_interface *necdsp_device::create_disassembler() { - extern CPU_DISASSEMBLE( upd7725 ); - return CPU_DISASSEMBLE_NAME(upd7725)(this, stream, pc, oprom, opram, options); + return new necdsp_disassembler; } void necdsp_device::execute_run() diff --git a/src/devices/cpu/upd7725/upd7725.h b/src/devices/cpu/upd7725/upd7725.h index 76cc13b9226..63f7b888ef8 100644 --- a/src/devices/cpu/upd7725/upd7725.h +++ b/src/devices/cpu/upd7725/upd7725.h @@ -107,9 +107,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; // inline data const address_space_config m_program_config, m_data_config; |