diff options
author | smf- <smf-@users.noreply.github.com> | 2019-08-16 20:42:34 +0100 |
---|---|---|
committer | smf- <smf-@users.noreply.github.com> | 2019-08-16 20:42:54 +0100 |
commit | 3d3f35ad6451e50d36023a765d4dfb5ccd1ef2a2 (patch) | |
tree | 9ce9876fe3d3465e112f3ca94e28361644da28b8 | |
parent | 67a34e360f63898c3ac519875f666851944b01a6 (diff) |
Decrypt KONAMI1 opcodes in the debugger [smf]
-rw-r--r-- | src/mame/machine/konami1.cpp | 24 | ||||
-rw-r--r-- | src/mame/machine/konami1.h | 12 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/mame/machine/konami1.cpp b/src/mame/machine/konami1.cpp index b4011d84ae3..f856a5da4ed 100644 --- a/src/mame/machine/konami1.cpp +++ b/src/mame/machine/konami1.cpp @@ -23,6 +23,30 @@ void konami1_device::device_start() m6809_base_device::device_start(); } +u32 konami1_device::disassembler::interface_flags() const +{ + return SPLIT_DECRYPTION; +} + +u8 konami1_device::disassembler::decrypt8(u8 value, offs_t pc, bool opcode) const +{ + if (!opcode || pc < m_boundary) + return value; + switch (pc & 0xa) { + default: + case 0x0: return value ^ 0x22; + case 0x2: return value ^ 0x82; + case 0x8: return value ^ 0x28; + case 0xa: return value ^ 0x88; + } + return value; +} + +std::unique_ptr<util::disasm_interface> konami1_device::create_disassembler() +{ + return std::make_unique<disassembler>(m_boundary); +} + void konami1_device::set_encryption_boundary(uint16_t adr) { m_boundary = adr; diff --git a/src/mame/machine/konami1.h b/src/mame/machine/konami1.h index a21542a1967..b1f29f8e78e 100644 --- a/src/mame/machine/konami1.h +++ b/src/mame/machine/konami1.h @@ -7,6 +7,7 @@ #include "cpu/m6809/m6809.h" +#include "cpu/m6809/6x09dasm.h" class konami1_device : public m6809_base_device { public: @@ -23,9 +24,20 @@ protected: virtual uint8_t read_opcode(uint16_t adr) override; }; + class disassembler : public m6809_disassembler { + public: + uint16_t m_boundary; + disassembler(uint16_t boundary) : m6809_disassembler(), m_boundary(boundary) {} + virtual ~disassembler() = default; + virtual u32 interface_flags() const override; + virtual u8 decrypt8(u8 value, offs_t pc, bool opcode) const override; + }; + uint16_t m_boundary; virtual void device_start() override; + + virtual std::unique_ptr<util::disasm_interface> create_disassembler() override; }; DECLARE_DEVICE_TYPE(KONAMI1, konami1_device) |