summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame
diff options
context:
space:
mode:
authorGravatarGravatar David Haywood <28625134+DavidHaywood@users.noreply.github.com>2019-11-16 13:31:20 +0000
committerGravatarGravatar ajrhacker <ajrhacker@users.noreply.github.com>2019-11-16 08:31:20 -0500
commitbe02946025e1079125a85b0d832cfa537f9aa122 (patch)
tree87ef648ee79e912da1d7a02fc5eefc9389eb16db /src/mame
parentb36749a10b948984f83c496f9910c69bf55a0467 (diff)
add some scrambling modes for various nes_vt based things, polmega and silv35 now boot (nw) (#5907)
* implement vt1682 scrambling (nw) * allow polmega and silv35 to boot (nw) * note about palette (nw)
Diffstat (limited to 'src/mame')
-rw-r--r--src/mame/drivers/nes_vt.cpp76
-rw-r--r--src/mame/machine/m6502_vh2009.cpp65
-rw-r--r--src/mame/machine/m6502_vh2009.h53
-rw-r--r--src/mame/machine/m6502_vt1682.cpp69
-rw-r--r--src/mame/machine/m6502_vt1682.h53
5 files changed, 307 insertions, 9 deletions
diff --git a/src/mame/drivers/nes_vt.cpp b/src/mame/drivers/nes_vt.cpp
index a7502ec9971..baed3118a29 100644
--- a/src/mame/drivers/nes_vt.cpp
+++ b/src/mame/drivers/nes_vt.cpp
@@ -74,6 +74,8 @@
#include "machine/bankdev.h"
#include "video/ppu2c0x_vt.h"
#include "machine/m6502_vtscr.h"
+#include "machine/m6502_vt1682.h"
+#include "machine/m6502_vh2009.h"
#include "screen.h"
#include "speaker.h"
@@ -223,6 +225,37 @@ private:
void do_dma(uint8_t data, bool has_ntsc_bug);
};
+class nes_vt_vt1682_state : public nes_vt_state
+{
+public:
+ nes_vt_vt1682_state(const machine_config& mconfig, device_type type, const char* tag) :
+ nes_vt_state(mconfig, type, tag)
+ { }
+
+ void nes_vt_vt1682(machine_config& config);
+
+protected:
+
+private:
+ void nes_vt_vt1682_map(address_map& map);
+};
+
+class nes_vt_vh2009_state : public nes_vt_state
+{
+public:
+ nes_vt_vh2009_state(const machine_config& mconfig, device_type type, const char* tag) :
+ nes_vt_state(mconfig, type, tag)
+ { }
+
+ void nes_vt_vh2009(machine_config& config);
+
+protected:
+
+private:
+};
+
+
+
class nes_vt_pjoy_state : public nes_vt_state
{
public:
@@ -1618,6 +1651,13 @@ void nes_vt_state::prg_map(address_map &map)
map(0x6000, 0x7fff).bankr("prg_bank3");
}
+void nes_vt_vt1682_state::nes_vt_vt1682_map(address_map &map)
+{
+ nes_vt_map(map);
+ map(0x0000, 0x1fff).ram();
+}
+
+
WRITE_LINE_MEMBER(nes_vt_state::apu_irq)
{
// set_input_line(N2A03_APU_IRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE);
@@ -1803,7 +1843,7 @@ void nes_vt_hh_state::nes_vt_vg(machine_config &config)
nes_vt_dg(config);
m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt_hh_state::nes_vt_hh_map);
- m_ppu->set_palette_mode(PAL_MODE_NEW_VG);;
+ m_ppu->set_palette_mode(PAL_MODE_NEW_VG);
}
// New mystery handheld architecture, VTxx derived
@@ -1839,6 +1879,24 @@ void nes_vt_dg_state::nes_vt_fa(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt_dg_state::nes_vt_fa_map);
}
+void nes_vt_vt1682_state::nes_vt_vt1682(machine_config &config)
+{
+ nes_vt(config);
+
+ M6502_VT1682(config.replace(), m_maincpu, NTSC_APU_CLOCK);
+ m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt_vt1682_state::nes_vt_vt1682_map);
+}
+
+void nes_vt_vh2009_state::nes_vt_vh2009(machine_config &config)
+{
+ nes_vt(config);
+
+ M6502_VH2009(config.replace(), m_maincpu, NTSC_APU_CLOCK);
+ m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt_vh2009_state::nes_vt_map);
+
+ //m_ppu->set_palette_mode(PAL_MODE_NEW_VG); // gives better title screens, but worse ingame, must be able to switch
+}
+
static INPUT_PORTS_START( nes_vt_fp )
PORT_START("CARTSEL")
@@ -2241,11 +2299,17 @@ CONS( 200?, lexcyber, 0, 0, nes_vt_cy, nes_vt, nes_vt_cy_state, empty_init, "
// some menu gfx broken, probably because this is a bad dump
CONS( 2015, dgun2573, 0, 0, nes_vt_fp, nes_vt, nes_vt_hh_state, empty_init, "dreamGEAR", "dreamGEAR My Arcade Gamer V Portable Gaming System (DGUN-2573)", MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
+
// these are VT1682 based and have scrambled CPU opcodes. Will need VT1682 CPU and PPU
// to be emulated
// (no visible tiles in ROM using standard decodes tho, might need moving out of here)
-CONS( 200?, ii8in1, 0, 0, nes_vt, nes_vt, nes_vt_state, empty_init, "Intec", "InterAct 8-in-1", MACHINE_NOT_WORKING )
-CONS( 200?, ii32in1, 0, 0, nes_vt, nes_vt, nes_vt_state, empty_init, "Intec", "InterAct 32-in-1", MACHINE_NOT_WORKING )
+CONS( 200?, ii8in1, 0, 0, nes_vt_vt1682, nes_vt, nes_vt_vt1682_state, empty_init, "Intec", "InterAct 8-in-1", MACHINE_NOT_WORKING )
+CONS( 200?, ii32in1, 0, 0, nes_vt_vt1682, nes_vt, nes_vt_vt1682_state, empty_init, "Intec", "InterAct 32-in-1", MACHINE_NOT_WORKING )
+
+// CPU die is marked 'VH2009' There's also a 62256 RAM chip on the PCB, some scrambled opcodes
+CONS( 200?, polmega, 0, 0, nes_vt_vh2009, nes_vt, nes_vt_vh2009_state, empty_init, "Polaroid", "Megamax GPD001SDG", MACHINE_NOT_WORKING )
+CONS( 200?, silv35, 0, 0, nes_vt_vh2009, nes_vt, nes_vt_vh2009_state, empty_init, "SilverLit", "35 in 1 Super Twins", MACHINE_NOT_WORKING )
+
// this has 'Shark' and 'Octopus' etc. like mc_dgear but uses scrambled bank registers
CONS( 200?, mc_sp69, 0, 0, nes_vt, nes_vt, nes_vt_sp69_state, empty_init, "<unknown>", "Sports Game 69 in 1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND)
@@ -2255,16 +2319,10 @@ CONS( 200?, mc_sp69, 0, 0, nes_vt, nes_vt, nes_vt_sp69_state, empty_init,
// PCB has PP1100-MB 061110 on it, possible date YYMMDD code? (pinball is 050329, guitar fever is 070516, air blaster 050423, kickboxing 061011 etc.)
CONS( 2006, ablping, 0, 0, nes_vt_ablping, nes_vt, nes_vt_ablping_state, empty_init, "Advance Bright Ltd", "Ping Pong / Table Tennis / Super Ping Pong (PP1100, ABL TV Game)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
-// CPU die is marked 'VH2009' There's also a 62256 RAM chip on the PCB, some scrambled opcodes?
-CONS( 200?, polmega, 0, 0, nes_vt, nes_vt, nes_vt_state, empty_init, "Polaroid", "Megamax GPD001SDG", MACHINE_NOT_WORKING )
-CONS( 200?, silv35, 0, 0, nes_vt, nes_vt, nes_vt_state, empty_init, "SilverLit", "35 in 1 Super Twins", MACHINE_NOT_WORKING )
-
// Hummer systems, scrambled bank register
CONS( 200?, mc_sam60, 0, 0, nes_vt, nes_vt, nes_vt_hum_state, empty_init, "Hummer Technology Co., Ltd.", "Samuri (60 in 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
CONS( 200?, zdog, 0, 0, nes_vt, nes_vt, nes_vt_hum_state, empty_init, "Hummer Technology Co., Ltd.", "ZDog (44 in 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
-// titles below don't seem to use the enhanced modes, so probably VT01 / VT02 or plain standalone famiclones?
-
// very plain menus
CONS( 200?, pjoyn50, 0, 0, nes_vt, nes_vt, nes_vt_state, empty_init, "<unknown>", "PowerJoy Navigator 50 in 1", MACHINE_IMPERFECT_GRAPHICS )
CONS( 200?, pjoys30, 0, 0, nes_vt, nes_vt, nes_vt_pjoy_state, empty_init, "<unknown>", "PowerJoy Supermax 30 in 1", MACHINE_IMPERFECT_GRAPHICS )
diff --git a/src/mame/machine/m6502_vh2009.cpp b/src/mame/machine/m6502_vh2009.cpp
new file mode 100644
index 00000000000..baece78e478
--- /dev/null
+++ b/src/mame/machine/m6502_vh2009.cpp
@@ -0,0 +1,65 @@
+// license:BSD-3-Clause
+// copyright-holders:David Shah, David Haywood
+/***************************************************************************
+
+ m6502_vh2009.cpp
+
+ 6502 with instruction scrambling
+
+ Die is marked VH2009, used on polmega, silv35
+
+***************************************************************************/
+
+#include "emu.h"
+#include "m6502_vh2009.h"
+
+DEFINE_DEVICE_TYPE(M6502_VH2009, m6502_vh2009, "m6502_vh2009", "VRT VH2009")
+
+m6502_vh2009::m6502_vh2009(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ m6502_device(mconfig, M6502_VH2009, tag, owner, clock)
+{
+}
+
+void m6502_vh2009::device_start()
+{
+ mintf = std::make_unique<mi_decrypt>();
+ init();
+}
+
+void m6502_vh2009::device_reset()
+{
+ m6502_device::device_reset();
+}
+
+uint8_t m6502_vh2009::mi_decrypt::descramble(uint8_t op)
+{
+ return bitswap<8>(op, 7, 5, 6, 4, 3, 2, 1, 0);
+}
+
+uint8_t m6502_vh2009::mi_decrypt::read_sync(uint16_t adr)
+{
+ uint8_t res = cache->read_byte(adr);
+
+ res = descramble(res);
+
+ return res;
+}
+
+std::unique_ptr<util::disasm_interface> m6502_vh2009::create_disassembler()
+{
+ return std::make_unique<disassembler>(downcast<mi_decrypt *>(mintf.get()));
+}
+
+m6502_vh2009::disassembler::disassembler(mi_decrypt *mi) : mintf(mi)
+{
+}
+
+u32 m6502_vh2009::disassembler::interface_flags() const
+{
+ return SPLIT_DECRYPTION;
+}
+
+u8 m6502_vh2009::disassembler::decrypt8(u8 value, offs_t pc, bool opcode) const
+{
+ return opcode ? mintf->descramble(value) : value;
+}
diff --git a/src/mame/machine/m6502_vh2009.h b/src/mame/machine/m6502_vh2009.h
new file mode 100644
index 00000000000..a595f283d89
--- /dev/null
+++ b/src/mame/machine/m6502_vh2009.h
@@ -0,0 +1,53 @@
+// license:BSD-3-Clause
+// copyright-holders:David Shah, David Haywood
+/***************************************************************************
+
+ m6502_vh2009.h
+
+ 6502 with instruction scrambling
+
+***************************************************************************/
+
+#ifndef MAME_CPU_M6502_VH2009_H
+#define MAME_CPU_M6502_VH2009_H
+
+#pragma once
+
+#include "cpu/m6502/m6502.h"
+#include "cpu/m6502/m6502d.h"
+
+class m6502_vh2009 : public m6502_device {
+public:
+ m6502_vh2009(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ class mi_decrypt : public mi_default {
+ public:
+
+ bool m_scramble_en = false;
+ bool m_next_scramble = false;
+
+ virtual ~mi_decrypt() {}
+ virtual uint8_t read_sync(uint16_t adr) override;
+
+ uint8_t descramble(uint8_t op);
+ };
+
+ class disassembler : public m6502_disassembler {
+ public:
+ mi_decrypt *mintf;
+
+ disassembler(mi_decrypt *m);
+ virtual ~disassembler() = default;
+ virtual u32 interface_flags() const override;
+ virtual u8 decrypt8(u8 value, offs_t pc, bool opcode) const override;
+ };
+
+ virtual void device_reset() override;
+ virtual void device_start() override;
+ virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
+};
+
+DECLARE_DEVICE_TYPE(M6502_VH2009, m6502_vh2009)
+
+#endif // MAME_CPU_M6502_VH2009_H
diff --git a/src/mame/machine/m6502_vt1682.cpp b/src/mame/machine/m6502_vt1682.cpp
new file mode 100644
index 00000000000..21e2a290d58
--- /dev/null
+++ b/src/mame/machine/m6502_vt1682.cpp
@@ -0,0 +1,69 @@
+// license:BSD-3-Clause
+// copyright-holders:David Shah, David Haywood
+/***************************************************************************
+
+ m6502_vt1682.cpp
+
+ 6502 with instruction scrambling
+
+ This form of scrambling is used in the VRT VT1682
+ (it's used for the MiWi2 and InterAct consoles).
+
+ This is simpler, permanently activated and consists of swapping opcode bits
+ 7 and 2.
+
+***************************************************************************/
+
+#include "emu.h"
+#include "m6502_vt1682.h"
+
+DEFINE_DEVICE_TYPE(M6502_VT1682, m6502_vt1682, "m6502_vt1682", "VRT VT1682")
+
+m6502_vt1682::m6502_vt1682(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ m6502_device(mconfig, M6502_VT1682, tag, owner, clock)
+{
+}
+
+void m6502_vt1682::device_start()
+{
+ mintf = std::make_unique<mi_decrypt>();
+ init();
+}
+
+void m6502_vt1682::device_reset()
+{
+ m6502_device::device_reset();
+}
+
+uint8_t m6502_vt1682::mi_decrypt::descramble(uint8_t op)
+{
+ return bitswap<8>(op, 2, 6, 5, 4, 3, 7, 1, 0);
+}
+
+uint8_t m6502_vt1682::mi_decrypt::read_sync(uint16_t adr)
+{
+ uint8_t res = cache->read_byte(adr);
+
+ res = descramble(res);
+
+ return res;
+}
+
+std::unique_ptr<util::disasm_interface> m6502_vt1682::create_disassembler()
+{
+ return std::make_unique<disassembler>(downcast<mi_decrypt *>(mintf.get()));
+}
+
+m6502_vt1682::disassembler::disassembler(mi_decrypt *mi) : mintf(mi)
+{
+}
+
+u32 m6502_vt1682::disassembler::interface_flags() const
+{
+ return SPLIT_DECRYPTION;
+}
+
+u8 m6502_vt1682::disassembler::decrypt8(u8 value, offs_t pc, bool opcode) const
+{
+ return opcode ? mintf->descramble(value) : value;
+}
diff --git a/src/mame/machine/m6502_vt1682.h b/src/mame/machine/m6502_vt1682.h
new file mode 100644
index 00000000000..54f38d20bc2
--- /dev/null
+++ b/src/mame/machine/m6502_vt1682.h
@@ -0,0 +1,53 @@
+// license:BSD-3-Clause
+// copyright-holders:David Shah, David Haywood
+/***************************************************************************
+
+ m6502_vt1682.h
+
+ 6502 with instruction scrambling
+
+***************************************************************************/
+
+#ifndef MAME_CPU_M6502_VT1682_H
+#define MAME_CPU_M6502_VT1682_H
+
+#pragma once
+
+#include "cpu/m6502/m6502.h"
+#include "cpu/m6502/m6502d.h"
+
+class m6502_vt1682 : public m6502_device {
+public:
+ m6502_vt1682(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ class mi_decrypt : public mi_default {
+ public:
+
+ bool m_scramble_en = false;
+ bool m_next_scramble = false;
+
+ virtual ~mi_decrypt() {}
+ virtual uint8_t read_sync(uint16_t adr) override;
+
+ uint8_t descramble(uint8_t op);
+ };
+
+ class disassembler : public m6502_disassembler {
+ public:
+ mi_decrypt *mintf;
+
+ disassembler(mi_decrypt *m);
+ virtual ~disassembler() = default;
+ virtual u32 interface_flags() const override;
+ virtual u8 decrypt8(u8 value, offs_t pc, bool opcode) const override;
+ };
+
+ virtual void device_reset() override;
+ virtual void device_start() override;
+ virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
+};
+
+DECLARE_DEVICE_TYPE(M6502_VT1682, m6502_vt1682)
+
+#endif // MAME_CPU_M6502_VT1682_H