summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/pic16/pic16d.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/pic16/pic16d.h')
-rw-r--r--src/devices/cpu/pic16/pic16d.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/devices/cpu/pic16/pic16d.h b/src/devices/cpu/pic16/pic16d.h
new file mode 100644
index 00000000000..8ebde81740c
--- /dev/null
+++ b/src/devices/cpu/pic16/pic16d.h
@@ -0,0 +1,40 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+// PIC16 generic disassembler, with extended opcodes
+
+#ifndef MAME_CPU_PIC16_PIC16D_H
+#define MAME_CPU_PIC16_PIC16D_H
+
+#pragma once
+
+class pic16_disassembler : public util::disasm_interface
+{
+public:
+ pic16_disassembler() = default;
+ virtual ~pic16_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:
+ struct instruction {
+ u16 value;
+ u16 mask;
+ u32 (*cb)(std::ostream &, const pic16_disassembler *, u16, u16);
+ };
+
+ static const instruction instructions[];
+
+ std::string freg(u16 opcode) const;
+ static char fw(u16 opcode);
+ static std::string imm8(u16 opcode);
+ static std::string imm7(u16 opcode);
+ static std::string imm6(u16 opcode);
+ static std::string imm6s(u16 opcode);
+ static std::string imm5(u16 opcode);
+ static std::string rel9(u16 opcode, u16 pc);
+ std::string abs11(u16 opcode, u16 pc) const;
+};
+
+#endif // MAME_CPU_PIC16_PIC16D_H