summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/tms57002
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/tms57002')
-rw-r--r--src/devices/cpu/tms57002/57002dsm.cpp17
-rw-r--r--src/devices/cpu/tms57002/57002dsm.h30
-rw-r--r--src/devices/cpu/tms57002/tms57002.cpp25
-rw-r--r--src/devices/cpu/tms57002/tms57002.h4
-rw-r--r--src/devices/cpu/tms57002/tms57kdec.cpp9
5 files changed, 51 insertions, 34 deletions
diff --git a/src/devices/cpu/tms57002/57002dsm.cpp b/src/devices/cpu/tms57002/57002dsm.cpp
index 0f92c9af145..b8d03ab8172 100644
--- a/src/devices/cpu/tms57002/57002dsm.cpp
+++ b/src/devices/cpu/tms57002/57002dsm.cpp
@@ -9,10 +9,13 @@
***************************************************************************/
#include "emu.h"
-#include "debugger.h"
-#include "tms57002.h"
+#include "57002dsm.h"
-static std::string get_memadr(uint32_t opcode, char type)
+tms57002_disassembler::tms57002_disassembler()
+{
+}
+
+std::string tms57002_disassembler::get_memadr(uint32_t opcode, char type)
{
std::string buf;
@@ -30,11 +33,15 @@ static std::string get_memadr(uint32_t opcode, char type)
return buf;
}
+u32 tms57002_disassembler::opcode_alignment() const
+{
+ return 1;
+}
-CPU_DISASSEMBLE(tms57002)
+offs_t tms57002_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params)
{
std::streampos original_pos = stream.tellp();
- uint32_t opcode = opram[0] | (opram[1] << 8) | (opram[2] << 16);
+ uint32_t opcode = opcodes.r32(pc);
uint8_t fa = opcode >> 18;
if(fa == 0x3f) {
switch((opcode >> 11) & 0x7f) { // category 3
diff --git a/src/devices/cpu/tms57002/57002dsm.h b/src/devices/cpu/tms57002/57002dsm.h
new file mode 100644
index 00000000000..56ed3d0ea25
--- /dev/null
+++ b/src/devices/cpu/tms57002/57002dsm.h
@@ -0,0 +1,30 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+/***************************************************************************
+
+ 57002dsm.c
+
+ TMS57002 "DASP" emulator.
+
+***************************************************************************/
+
+#ifndef MAME_CPU_TMS57002_57002DSM_H
+#define MAME_CPU_TMS57002_57002DSM_H
+
+#pragma once
+
+class tms57002_disassembler : public util::disasm_interface
+{
+public:
+ tms57002_disassembler();
+ virtual ~tms57002_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 std::string get_memadr(uint32_t opcode, char type);
+
+};
+
+#endif
diff --git a/src/devices/cpu/tms57002/tms57002.cpp b/src/devices/cpu/tms57002/tms57002.cpp
index 4b88669298b..f98e0497acf 100644
--- a/src/devices/cpu/tms57002/tms57002.cpp
+++ b/src/devices/cpu/tms57002/tms57002.cpp
@@ -11,6 +11,7 @@
#include "emu.h"
#include "tms57002.h"
#include "debugger.h"
+#include "57002dsm.h"
DEFINE_DEVICE_TYPE(TMS57002, tms57002_device, "tms57002", "TMS57002")
@@ -29,6 +30,10 @@ tms57002_device::tms57002_device(const machine_config &mconfig, const char *tag,
{
}
+util::disasm_interface *tms57002_device::create_disassembler()
+{
+ return new tms57002_disassembler;
+}
WRITE_LINE_MEMBER(tms57002_device::pload_w)
{
@@ -103,7 +108,7 @@ WRITE8_MEMBER(tms57002_device::data_w)
sti = (sti & ~SU_MASK) | SU_PRG;
break;
case SU_PRG:
- program->write_dword(pc++ << 2, val);
+ program->write_dword(pc++, val);
break;
}
}
@@ -684,7 +689,7 @@ int tms57002_device::decode_get_pc()
for(;;) {
short ipc;
- uint32_t opcode = program->read_dword(adr << 2);
+ uint32_t opcode = program->read_dword(adr);
cs.inc = 0;
@@ -892,22 +897,6 @@ uint32_t tms57002_device::execute_input_lines() const
return 0;
}
-uint32_t tms57002_device::disasm_min_opcode_bytes() const
-{
- return 4;
-}
-
-uint32_t tms57002_device::disasm_max_opcode_bytes() const
-{
- return 4;
-}
-
-offs_t tms57002_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options)
-{
- extern CPU_DISASSEMBLE( tms57002 );
- return CPU_DISASSEMBLE_NAME(tms57002)(this, stream, pc, oprom, opram, options);
-}
-
device_memory_interface::space_config_vector tms57002_device::memory_space_config() const
{
return space_config_vector {
diff --git a/src/devices/cpu/tms57002/tms57002.h b/src/devices/cpu/tms57002/tms57002.h
index 361c0b8a7d8..120af046362 100644
--- a/src/devices/cpu/tms57002/tms57002.h
+++ b/src/devices/cpu/tms57002/tms57002.h
@@ -35,9 +35,7 @@ protected:
virtual uint32_t execute_max_cycles() const override;
virtual uint32_t execute_input_lines() const override;
virtual void execute_run() override;
- 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;
private:
enum {
diff --git a/src/devices/cpu/tms57002/tms57kdec.cpp b/src/devices/cpu/tms57002/tms57kdec.cpp
index b3b71cb58e4..8cca7ba825f 100644
--- a/src/devices/cpu/tms57002/tms57kdec.cpp
+++ b/src/devices/cpu/tms57002/tms57kdec.cpp
@@ -72,18 +72,11 @@ inline int tms57002_device::sfma(uint32_t st1)
void tms57002_device::decode_error(uint32_t opcode)
{
- uint8_t opr[3];
if(unsupported_inst_warning)
return;
unsupported_inst_warning = 1;
- opr[0] = opcode;
- opr[1] = opcode >> 8;
- opr[2] = opcode >> 16;
-
- std::stringstream stream;
- disasm_disassemble(stream, pc, opr, opr, 0);
- popmessage("tms57002: %s - Contact Mamedev", stream.str());
+ popmessage("tms57002: %06x - Contact Mamedev", opcode);
}
void tms57002_device::decode_cat1(uint32_t opcode, unsigned short *op, cstate *cs)