summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/upd7725
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/upd7725')
-rw-r--r--src/devices/cpu/upd7725/dasm7725.cpp13
-rw-r--r--src/devices/cpu/upd7725/dasm7725.h27
-rw-r--r--src/devices/cpu/upd7725/upd7725.cpp37
-rw-r--r--src/devices/cpu/upd7725/upd7725.h6
4 files changed, 46 insertions, 37 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 &params)
+{
+ 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 &params) override;
+};
+
+#endif
diff --git a/src/devices/cpu/upd7725/upd7725.cpp b/src/devices/cpu/upd7725/upd7725.cpp
index 7ef876613db..716fa45ccf9 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"
//**************************************************************************
@@ -67,7 +68,7 @@ void necdsp_device::device_start()
// get our address spaces
m_program = &space(AS_PROGRAM);
m_data = &space(AS_DATA);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<-2>();
// register our state for the debugger
state_add(STATE_GENPC, "GENPC", regs.pc).noshow();
@@ -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()
@@ -361,7 +340,7 @@ void necdsp_device::execute_run()
if (m_irq_firing == 0) // normal opcode
{
- opcode = m_direct->read_dword(regs.pc<<2)>>8;
+ opcode = m_direct->read_dword(regs.pc) >> 8;
regs.pc++;
}
else if (m_irq_firing == 1) // if we're in an interrupt cycle, execute a op 'nop' first...
@@ -413,7 +392,7 @@ void necdsp_device::exec_op(uint32_t opcode) {
case 3: regs.idb = regs.tr; break;
case 4: regs.idb = regs.dp; break;
case 5: regs.idb = regs.rp; break;
- case 6: regs.idb = m_data->read_word(regs.rp<<1); break;
+ case 6: regs.idb = m_data->read_word(regs.rp); break;
case 7: regs.idb = 0x8000 - regs.flaga.s1; break; //SGN
case 8: regs.idb = regs.dr; regs.sr.rqm = 1; break;
case 9: regs.idb = regs.dr; break;
@@ -610,7 +589,7 @@ void necdsp_device::exec_ld(uint32_t opcode) {
case 8: regs.so = BITSWAP16(id, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); break; //LSB first output, output tapped at bit 15 shifting left
case 9: regs.so = id; break; //MSB first output, output tapped at bit 15 shifting left
case 10: regs.k = id; break;
- case 11: regs.k = id; regs.l = m_data->read_word(regs.rp<<1); break;
+ case 11: regs.k = id; regs.l = m_data->read_word(regs.rp); break;
case 12: regs.l = id; regs.k = dataRAM[regs.dp | 0x40]; break;
case 13: regs.l = id; break;
case 14: regs.trb = id; break;
diff --git a/src/devices/cpu/upd7725/upd7725.h b/src/devices/cpu/upd7725/upd7725.h
index 76cc13b9226..c52959124a1 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;
@@ -191,7 +189,7 @@ private:
// 2 = next opcode is the second half of int firing 'CALL 0100'
int m_irq_firing;
address_space *m_program, *m_data;
- direct_read_data *m_direct;
+ direct_read_data<-2> *m_direct;
protected:
// device callbacks