summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/hpc/hpcdasm.h
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2019-03-26 11:13:37 +1100
committer Vas Crabb <vas@vastheman.com>2019-03-26 11:13:37 +1100
commit97b67170277437131adf6ed4d60139c172529e4f (patch)
tree7a5cbf608f191075f1612b1af15832c206a3fe2d /src/devices/cpu/hpc/hpcdasm.h
parentb380514764cf857469bae61c11143a19f79a74c5 (diff)
(nw) Clean up the mess on master
This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at 598cd5227223c3b04ca31f0dbc1981256d9ea3ff. Before pushing, please check that what you're about to push is sane. Check your local commit log and ensure there isn't anything out-of-place before pushing to mainline. When things like this happen, it wastes everyone's time. I really don't need this in a week when real work™ is busting my balls and I'm behind where I want to be with preparing for MAME release.
Diffstat (limited to 'src/devices/cpu/hpc/hpcdasm.h')
-rw-r--r--src/devices/cpu/hpc/hpcdasm.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/devices/cpu/hpc/hpcdasm.h b/src/devices/cpu/hpc/hpcdasm.h
new file mode 100644
index 00000000000..ed57c6b1a35
--- /dev/null
+++ b/src/devices/cpu/hpc/hpcdasm.h
@@ -0,0 +1,58 @@
+// license:BSD-3-Clause
+// copyright-holders:AJR
+
+#ifndef MAME_CPU_HPC_HPCDASM_H
+#define MAME_CPU_HPC_HPCDASM_H
+
+#pragma once
+
+class hpc_disassembler : public util::disasm_interface
+{
+protected:
+ enum : u16
+ {
+ REGISTER_A = 0x00c8,
+ REGISTER_K = 0x00ca,
+ REGISTER_B = 0x00cc,
+ REGISTER_X = 0x00ce
+ };
+
+ // construction/destruction
+ hpc_disassembler(const char *const regs[]);
+
+ // disassembler overrides
+ 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:
+ // internal helpers
+ void format_register(std::ostream &stream, u16 reg) const;
+ void format_immediate_byte(std::ostream &stream, u8 data) const;
+ void format_immediate_word(std::ostream &stream, u16 data) const;
+ void disassemble_op(std::ostream &stream, const char *op, u16 reg, u16 src, bool imm, bool indir, bool idx, bool w) const;
+ void disassemble_unary_op(std::ostream &stream, const char *op, u16 offset, u16 src, bool indir, bool idx, bool w) const;
+ void disassemble_bit_op(std::ostream &stream, const char *op, u8 bit, u16 offset, u16 src, bool indir, bool idx) const;
+
+ // register names
+ const char *const *m_regs;
+};
+
+class hpc16083_disassembler : public hpc_disassembler
+{
+public:
+ hpc16083_disassembler() : hpc_disassembler(s_regs) { }
+
+private:
+ static const char *const s_regs[128];
+};
+
+class hpc16164_disassembler : public hpc_disassembler
+{
+public:
+ hpc16164_disassembler() : hpc_disassembler(s_regs) { }
+
+private:
+ static const char *const s_regs[128];
+};
+
+#endif // MAME_CPU_HPC_HPCDASM_H