summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine/m6502_swap_op_d5_d6.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/machine/m6502_swap_op_d5_d6.cpp')
-rw-r--r--src/mame/machine/m6502_swap_op_d5_d6.cpp62
1 files changed, 60 insertions, 2 deletions
diff --git a/src/mame/machine/m6502_swap_op_d5_d6.cpp b/src/mame/machine/m6502_swap_op_d5_d6.cpp
index d3c661f8c2b..df832634684 100644
--- a/src/mame/machine/m6502_swap_op_d5_d6.cpp
+++ b/src/mame/machine/m6502_swap_op_d5_d6.cpp
@@ -4,10 +4,13 @@
m6502_swap_op_d5_d6.cpp
- 6502 with instruction scrambling
+ 6502 / N2A03 with instruction scrambling
Seen on die marked VH2009, used on polmega, silv35
- but also elsewhere
+ these are N2A03 derived CPUs used on VTxx systems
+
+ VT1682 systems with this scrambling currently derive from M6502 type
+ but this might be incorrect
***************************************************************************/
@@ -15,6 +18,7 @@
#include "m6502_swap_op_d5_d6.h"
DEFINE_DEVICE_TYPE(M6502_SWAP_OP_D5_D6, m6502_swap_op_d5_d6, "m6502_swap_op_d5_d6", "M6502 swapped D5/D6")
+DEFINE_DEVICE_TYPE(N2A03_CORE_SWAP_OP_D5_D6, n2a03_core_swap_op_d5_d6, "n2a03_core_swap_op_d5_d6", "N2A03 core with swapped D5/D6")
m6502_swap_op_d5_d6::m6502_swap_op_d5_d6(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
m6502_device(mconfig, M6502_SWAP_OP_D5_D6, tag, owner, clock)
@@ -64,3 +68,57 @@ u8 m6502_swap_op_d5_d6::disassembler::decrypt8(u8 value, offs_t pc, bool opcode)
{
return opcode ? mintf->descramble(value) : value;
}
+
+
+
+
+
+n2a03_core_swap_op_d5_d6::n2a03_core_swap_op_d5_d6(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ n2a03_core_device(mconfig, N2A03_CORE_SWAP_OP_D5_D6, tag, owner, clock)
+{
+}
+
+void n2a03_core_swap_op_d5_d6::device_start()
+{
+ mintf = std::make_unique<mi_decrypt>();
+ init();
+}
+
+void n2a03_core_swap_op_d5_d6::device_reset()
+{
+ n2a03_core_device::device_reset();
+}
+
+uint8_t n2a03_core_swap_op_d5_d6::mi_decrypt::descramble(uint8_t op)
+{
+ return bitswap<8>(op, 7, 5, 6, 4, 3, 2, 1, 0);
+}
+
+uint8_t n2a03_core_swap_op_d5_d6::mi_decrypt::read_sync(uint16_t adr)
+{
+ uint8_t res = cprogram.read_byte(adr);
+
+ res = descramble(res);
+
+ return res;
+}
+
+std::unique_ptr<util::disasm_interface> n2a03_core_swap_op_d5_d6::create_disassembler()
+{
+ return std::make_unique<disassembler>(downcast<mi_decrypt *>(mintf.get()));
+}
+
+n2a03_core_swap_op_d5_d6::disassembler::disassembler(mi_decrypt *mi) : mintf(mi)
+{
+}
+
+u32 n2a03_core_swap_op_d5_d6::disassembler::interface_flags() const
+{
+ return SPLIT_DECRYPTION;
+}
+
+u8 n2a03_core_swap_op_d5_d6::disassembler::decrypt8(u8 value, offs_t pc, bool opcode) const
+{
+ return opcode ? mintf->descramble(value) : value;
+}
+