summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/pps4
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/pps4')
-rw-r--r--src/devices/cpu/pps4/pps4.cpp8
-rw-r--r--src/devices/cpu/pps4/pps4.h6
-rw-r--r--src/devices/cpu/pps4/pps4dasm.cpp52
-rw-r--r--src/devices/cpu/pps4/pps4dasm.h59
4 files changed, 80 insertions, 45 deletions
diff --git a/src/devices/cpu/pps4/pps4.cpp b/src/devices/cpu/pps4/pps4.cpp
index c0b5ad60aa8..8decf412b8d 100644
--- a/src/devices/cpu/pps4/pps4.cpp
+++ b/src/devices/cpu/pps4/pps4.cpp
@@ -78,6 +78,7 @@
#include "emu.h"
#include "pps4.h"
+#include "pps4dasm.h"
#include "debugger.h"
@@ -139,10 +140,9 @@ void pps4_device::W(u8 data)
m_SAG = 0;
}
-offs_t pps4_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options)
+util::disasm_interface *pps4_device::create_disassembler()
{
- extern CPU_DISASSEMBLE( pps4 );
- return CPU_DISASSEMBLE_NAME(pps4)(this, stream, pc, oprom, opram, options);
+ return new pps4_disassembler;
}
/**
@@ -1570,7 +1570,7 @@ void pps4_device::execute_run()
void pps4_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_direct = &m_program->direct();
+ m_direct = m_program->direct<0>();
m_data = &space(AS_DATA);
m_io = &space(AS_IO);
diff --git a/src/devices/cpu/pps4/pps4.h b/src/devices/cpu/pps4/pps4.h
index ef3c4dee977..fcf1d790756 100644
--- a/src/devices/cpu/pps4/pps4.h
+++ b/src/devices/cpu/pps4/pps4.h
@@ -82,9 +82,7 @@ protected:
virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
// device_disasm_interface overrides
- virtual u32 disasm_min_opcode_bytes() const override { return 1; }
- virtual u32 disasm_max_opcode_bytes() const override { return 2; }
- virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override;
+ virtual util::disasm_interface *create_disassembler() override;
address_space_config m_program_config;
address_space_config m_data_config;
@@ -95,7 +93,7 @@ protected:
devcb_write8 m_do_cb;
address_space *m_program;
- direct_read_data *m_direct;
+ direct_read_data<0> *m_direct;
address_space *m_data;
address_space *m_io;
int m_icount;
diff --git a/src/devices/cpu/pps4/pps4dasm.cpp b/src/devices/cpu/pps4/pps4dasm.cpp
index 71bf93dcb44..edb15db12b3 100644
--- a/src/devices/cpu/pps4/pps4dasm.cpp
+++ b/src/devices/cpu/pps4/pps4dasm.cpp
@@ -11,36 +11,9 @@
*
*****************************************************************************/
#include "emu.h"
+#include "pps4dasm.h"
-#define OP(A) oprom[(A) - PC]
-#define ARG(A) opram[(A) - PC]
-
-typedef enum pps4_token_e {
- t_AD, t_ADC, t_ADSK, t_ADCSK, t_ADI,
- t_DC, t_AND, t_OR, t_EOR, t_COMP,
- t_SC, t_RC, t_SF1, t_RF1, t_SF2,
- t_RF2, t_LD, t_EX, t_EXD, t_LDI,
- t_LAX, t_LXA, t_LABL, t_LBMX, t_LBUA,
- t_XABL, t_XBMX, t_XAX, t_XS, t_CYS,
- t_LB, t_LBL, t_INCB, t_DECB, t_T,
- t_TM, t_TL, t_TML, t_SKC, t_SKZ,
- t_SKBI, t_SKF1, t_SKF2, t_RTN, t_RTNSK,
- t_IOL, t_DIA, t_DIB, t_DOA, t_SAG,
- t_COUNT,
- t_MASK = (1 << 6) - 1,
- t_I3c = 1 << 6, /* immediate 3 bit constant, complemented */
- t_I4 = 1 << 7, /* immediate 4 bit constant */
- t_I4c = 1 << 8, /* immediate 4 bit constant, complemented */
- t_I4p = 1 << 9, /* immediate 4 bit offset into page 3 */
- t_I6p = 1 << 10, /* immediate 6 bit constant; address in current page */
- t_I6i = 1 << 11, /* immediate 6 bit indirect page 3 offset (16 ... 63) + followed by page 1 address */
- t_I8 = 1 << 12, /* immediate 8 bit constant (I/O port number) */
- t_I8c = 1 << 13, /* immediate 8 bit constant inverted */
- t_OVER = 1 << 14, /* Debugger step over (CALL) */
- t_OUT = 1 << 15 /* Debugger step out (RETURN) */
-} pps4_token_e;
-
-static const char *token_str[t_COUNT] = {
+const char *pps4_disassembler::token_str[t_COUNT] = {
"ad", /* add */
"adc", /* add with carry-in */
"adsk", /* add and skip on carry-out */
@@ -93,7 +66,7 @@ static const char *token_str[t_COUNT] = {
"sag" /* special address generation */
};
-static const uint16_t table[] = {
+const uint16_t pps4_disassembler::table[] = {
/* 00 */ t_LBL | t_I8c,
/* 01 */ t_TML | t_I4 | t_I8,
/* 02 */ t_TML | t_I4 | t_I8,
@@ -367,11 +340,16 @@ static const uint16_t table[] = {
/* ff */ t_TM | t_I6i | t_OVER
};
-CPU_DISASSEMBLE(pps4)
+u32 pps4_disassembler::opcode_alignment() const
+{
+ return 1;
+}
+
+offs_t pps4_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params)
{
uint32_t flags = 0;
unsigned PC = pc;
- uint8_t op = OP(pc++);
+ uint8_t op = opcodes.r8(pc++);
uint32_t tok = table[op];
if (0 == (tok & t_MASK)) {
@@ -422,21 +400,21 @@ CPU_DISASSEMBLE(pps4)
if (tok & t_I8) {
// 8 bit immediate I/O port address
- uint8_t arg = ARG(pc++);
+ uint8_t arg = params.r8(pc++);
util::stream_format(stream, "%02x", arg);
}
if (tok & t_I8c) {
// 8 bit immediate offset into page
- uint16_t arg = ~ARG(pc++) & 255;
+ uint16_t arg = ~params.r8(pc++) & 255;
util::stream_format(stream, "%02x", arg);
}
if (tok & t_OVER) // TL or TML
- flags |= DASMFLAG_STEP_OVER;
+ flags |= STEP_OVER;
if (tok & t_OUT) // RTN or RTNSK
- flags |= DASMFLAG_STEP_OUT;
+ flags |= STEP_OUT;
- return (pc - PC) | flags | DASMFLAG_SUPPORTED;
+ return (pc - PC) | flags | SUPPORTED;
}
diff --git a/src/devices/cpu/pps4/pps4dasm.h b/src/devices/cpu/pps4/pps4dasm.h
new file mode 100644
index 00000000000..7e0f0ab9b91
--- /dev/null
+++ b/src/devices/cpu/pps4/pps4dasm.h
@@ -0,0 +1,59 @@
+// license:BSD-3-Clause
+// copyright-holders:Juergen Buchmueller
+/*****************************************************************************
+ *
+ * pps4dasm.c
+ *
+ * Rockwell PPS-4 CPU Disassembly
+ *
+ *
+ * TODO: double verify all opcodes with t_Ixx flags
+ *
+ *****************************************************************************/
+
+#ifndef MAME_CPU_PPS4_PPS4DASM_H
+#define MAME_CPU_PPS4_PPS4DASM_H
+
+#pragma once
+
+class pps4_disassembler : public util::disasm_interface
+{
+public:
+ pps4_disassembler() = default;
+ virtual ~pps4_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:
+ typedef enum pps4_token_e {
+ t_AD, t_ADC, t_ADSK, t_ADCSK, t_ADI,
+ t_DC, t_AND, t_OR, t_EOR, t_COMP,
+ t_SC, t_RC, t_SF1, t_RF1, t_SF2,
+ t_RF2, t_LD, t_EX, t_EXD, t_LDI,
+ t_LAX, t_LXA, t_LABL, t_LBMX, t_LBUA,
+ t_XABL, t_XBMX, t_XAX, t_XS, t_CYS,
+ t_LB, t_LBL, t_INCB, t_DECB, t_T,
+ t_TM, t_TL, t_TML, t_SKC, t_SKZ,
+ t_SKBI, t_SKF1, t_SKF2, t_RTN, t_RTNSK,
+ t_IOL, t_DIA, t_DIB, t_DOA, t_SAG,
+ t_COUNT,
+ t_MASK = (1 << 6) - 1,
+ t_I3c = 1 << 6, /* immediate 3 bit constant, complemented */
+ t_I4 = 1 << 7, /* immediate 4 bit constant */
+ t_I4c = 1 << 8, /* immediate 4 bit constant, complemented */
+ t_I4p = 1 << 9, /* immediate 4 bit offset into page 3 */
+ t_I6p = 1 << 10, /* immediate 6 bit constant; address in current page */
+ t_I6i = 1 << 11, /* immediate 6 bit indirect page 3 offset (16 ... 63) + followed by page 1 address */
+ t_I8 = 1 << 12, /* immediate 8 bit constant (I/O port number) */
+ t_I8c = 1 << 13, /* immediate 8 bit constant inverted */
+ t_OVER = 1 << 14, /* Debugger step over (CALL) */
+ t_OUT = 1 << 15 /* Debugger step out (RETURN) */
+ } pps4_token_e;
+
+ static const char *token_str[t_COUNT];
+ static const uint16_t table[];
+
+};
+
+#endif