summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--scripts/src/cpu.lua2
-rw-r--r--scripts/src/sound.lua2
-rw-r--r--src/devices/cpu/m6502/n2a03.cpp19
-rw-r--r--src/devices/cpu/m6502/n2a03.h29
-rw-r--r--src/devices/sound/nes_apu.cpp9
-rw-r--r--src/devices/sound/nes_apu.h2
-rw-r--r--src/devices/sound/nes_apu_vt.cpp28
-rw-r--r--src/devices/sound/nes_apu_vt.h26
-rw-r--r--src/mame/drivers/nes_vt.cpp20
-rw-r--r--src/mame/machine/m6502_swap_op_d5_d6.cpp62
-rw-r--r--src/mame/machine/m6502_swap_op_d5_d6.h40
-rw-r--r--src/mame/machine/nes_vt_soc.cpp12
-rw-r--r--src/mame/machine/nes_vt_soc.h3
13 files changed, 214 insertions, 40 deletions
diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua
index a55cf443fdb..ec5b0e65ff9 100644
--- a/scripts/src/cpu.lua
+++ b/scripts/src/cpu.lua
@@ -1580,7 +1580,7 @@ if (CPUS["M6502"]~=null) then
{ MAME_DIR .. "src/devices/cpu/m6502/om65ce02.lst", GEN_DIR .. "emu/cpu/m6502/m65ce02.hxx", { MAME_DIR .. "src/devices/cpu/m6502/m6502make.py", MAME_DIR .. "src/devices/cpu/m6502/dm65ce02.lst" }, {"@echo Generating m65ce02 disassembler source file...", PYTHON .. " $(1) s m65ce02 $(<) $(2) $(@)" }},
{ MAME_DIR .. "src/devices/cpu/m6502/om6509.lst", GEN_DIR .. "emu/cpu/m6502/m6509.hxx", { MAME_DIR .. "src/devices/cpu/m6502/m6502make.py", MAME_DIR .. "src/devices/cpu/m6502/dm6509.lst" }, {"@echo Generating m6509 disassembler source file...", PYTHON .. " $(1) s m6509 $(<) $(2) $(@)" }},
{ MAME_DIR .. "src/devices/cpu/m6502/om6510.lst", GEN_DIR .. "emu/cpu/m6502/m6510.hxx", { MAME_DIR .. "src/devices/cpu/m6502/m6502make.py", MAME_DIR .. "src/devices/cpu/m6502/dm6510.lst" }, {"@echo Generating m6510 disassembler source file...", PYTHON .. " $(1) s m6510 $(<) $(2) $(@)" }},
- { MAME_DIR .. "src/devices/cpu/m6502/on2a03.lst", GEN_DIR .. "emu/cpu/m6502/n2a03.hxx", { MAME_DIR .. "src/devices/cpu/m6502/m6502make.py", MAME_DIR .. "src/devices/cpu/m6502/dn2a03.lst" }, {"@echo Generating n2a03 disassembler source file...", PYTHON .. " $(1) s n2a03 $(<) $(2) $(@)" }},
+ { MAME_DIR .. "src/devices/cpu/m6502/on2a03.lst", GEN_DIR .. "emu/cpu/m6502/n2a03.hxx", { MAME_DIR .. "src/devices/cpu/m6502/m6502make.py", MAME_DIR .. "src/devices/cpu/m6502/dn2a03.lst" }, {"@echo Generating n2a03 disassembler source file...", PYTHON .. " $(1) s n2a03_core $(<) $(2) $(@)" }},
{ MAME_DIR .. "src/devices/cpu/m6502/om740.lst" , GEN_DIR .. "emu/cpu/m6502/m740.hxx", { MAME_DIR .. "src/devices/cpu/m6502/m6502make.py", MAME_DIR .. "src/devices/cpu/m6502/dm740.lst" }, {"@echo Generating m740 disassembler source file...", PYTHON .. " $(1) s m740 $(<) $(2) $(@)" }},
{ MAME_DIR .. "src/devices/cpu/m6502/dr65c02.lst", GEN_DIR .. "emu/cpu/m6502/r65c02.hxx", { MAME_DIR .. "src/devices/cpu/m6502/m6502make.py", }, {"@echo Generating r65c02 disassembler source file...", PYTHON .. " $(1) s r65c02 - $(<) $(@)" }},
{ MAME_DIR .. "src/devices/cpu/m6502/or65c19.lst", GEN_DIR .. "emu/cpu/m6502/r65c19.hxx", { MAME_DIR .. "src/devices/cpu/m6502/m6502make.py", MAME_DIR .. "src/devices/cpu/m6502/dr65c19.lst" }, {"@echo Generating r65c19 disassembler source file...", PYTHON .. " $(1) s r65c19 $(<) $(2) $(@)" }},
diff --git a/scripts/src/sound.lua b/scripts/src/sound.lua
index a49d74dbc9e..27002fb8bd8 100644
--- a/scripts/src/sound.lua
+++ b/scripts/src/sound.lua
@@ -657,6 +657,8 @@ if (SOUNDS["NES_APU"]~=null) then
MAME_DIR .. "src/devices/sound/nes_apu.cpp",
MAME_DIR .. "src/devices/sound/nes_apu.h",
MAME_DIR .. "src/devices/sound/nes_defs.h",
+ MAME_DIR .. "src/devices/sound/nes_apu_vt.cpp",
+ MAME_DIR .. "src/devices/sound/nes_apu_vt.h",
}
end
diff --git a/src/devices/cpu/m6502/n2a03.cpp b/src/devices/cpu/m6502/n2a03.cpp
index f303f1bf1b6..e1731b62e75 100644
--- a/src/devices/cpu/m6502/n2a03.cpp
+++ b/src/devices/cpu/m6502/n2a03.cpp
@@ -12,6 +12,7 @@
#include "n2a03.h"
#include "n2a03d.h"
+DEFINE_DEVICE_TYPE(N2A03_CORE, n2a03_core_device, "n2a03_core", "Ricoh N2A03 core") // needed for some VT systems with XOP instead of standard APU
DEFINE_DEVICE_TYPE(N2A03, n2a03_device, "n2a03", "Ricoh N2A03")
uint8_t n2a03_device::psg1_4014_r()
@@ -51,15 +52,29 @@ void n2a03_device::n2a03_map(address_map &map)
+n2a03_core_device::n2a03_core_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : m6502_device(mconfig, type, tag, owner, clock)
+{
+}
+
+n2a03_core_device::n2a03_core_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : n2a03_core_device(mconfig, N2A03_CORE, tag, owner, clock)
+{
+}
+
+
+
n2a03_device::n2a03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : m6502_device(mconfig, N2A03, tag, owner, clock)
+ : n2a03_core_device(mconfig, N2A03, tag, owner, clock)
, device_mixer_interface(mconfig, *this, 1)
, m_apu(*this, "nesapu")
{
program_config.m_internal_map = address_map_constructor(FUNC(n2a03_device::n2a03_map), this);
}
-std::unique_ptr<util::disasm_interface> n2a03_device::create_disassembler()
+
+
+std::unique_ptr<util::disasm_interface> n2a03_core_device::create_disassembler()
{
return std::make_unique<n2a03_disassembler>();
}
diff --git a/src/devices/cpu/m6502/n2a03.h b/src/devices/cpu/m6502/n2a03.h
index 5a57bcbed2b..4232093c7a5 100644
--- a/src/devices/cpu/m6502/n2a03.h
+++ b/src/devices/cpu/m6502/n2a03.h
@@ -15,22 +15,18 @@
#include "m6502.h"
#include "sound/nes_apu.h"
-class n2a03_device : public m6502_device, public device_mixer_interface {
+class n2a03_core_device : public m6502_device {
public:
- n2a03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ n2a03_core_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
virtual void do_exec_full() override;
virtual void do_exec_partial() override;
- uint8_t psg1_4014_r();
- uint8_t psg1_4015_r();
- void psg1_4015_w(uint8_t data);
- void psg1_4017_w(uint8_t data);
-
- void n2a03_map(address_map &map);
protected:
+ n2a03_core_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
#define O(o) void o ## _full(); void o ## _partial()
// n2a03 opcodes - same as 6502 with D disabled
@@ -42,6 +38,21 @@ protected:
#undef O
+private:
+};
+
+class n2a03_device : public n2a03_core_device, public device_mixer_interface {
+public:
+ n2a03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ uint8_t psg1_4014_r();
+ uint8_t psg1_4015_r();
+ void psg1_4015_w(uint8_t data);
+ void psg1_4017_w(uint8_t data);
+
+ void n2a03_map(address_map &map);
+protected:
+
required_device<nesapu_device> m_apu;
virtual void device_add_mconfig(machine_config &config) override;
@@ -52,6 +63,7 @@ private:
};
+
/* These are the official XTAL values and clock rates used by Nintendo for
manufacturing throughout the production of the 2A03. PALC_APU_CLOCK is
the clock rate devised by UMC(?) for PAL Famicom clone hardware. */
@@ -69,6 +81,7 @@ enum {
N2A03_SET_OVERFLOW = m6502_device::V_LINE
};
+DECLARE_DEVICE_TYPE(N2A03_CORE, n2a03_core_device)
DECLARE_DEVICE_TYPE(N2A03, n2a03_device)
#endif // MAME_CPU_M6502_N2A03_H
diff --git a/src/devices/sound/nes_apu.cpp b/src/devices/sound/nes_apu.cpp
index f7b4772ddb7..483b337475f 100644
--- a/src/devices/sound/nes_apu.cpp
+++ b/src/devices/sound/nes_apu.cpp
@@ -83,8 +83,8 @@ void nesapu_device::create_syncs(unsigned long sps)
DEFINE_DEVICE_TYPE(NES_APU, nesapu_device, "nesapu", "N2A03 APU")
-nesapu_device::nesapu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, NES_APU, tag, owner, clock)
+nesapu_device::nesapu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
+ : device_t(mconfig, type, tag, owner, clock)
, device_sound_interface(mconfig, *this)
, m_samps_per_sync(0)
, m_buffer_size(0)
@@ -108,6 +108,11 @@ nesapu_device::nesapu_device(const machine_config &mconfig, const char *tag, dev
}
}
+nesapu_device::nesapu_device(const machine_config& mconfig, const char* tag, device_t* owner, u32 clock)
+ : nesapu_device(mconfig, NES_APU, tag, owner, clock)
+{
+}
+
void nesapu_device::device_reset()
{
write(0x15, 0x00);
diff --git a/src/devices/sound/nes_apu.h b/src/devices/sound/nes_apu.h
index 1539f44beab..673c967fec7 100644
--- a/src/devices/sound/nes_apu.h
+++ b/src/devices/sound/nes_apu.h
@@ -56,6 +56,8 @@ public:
void write(offs_t offset, u8 data);
protected:
+ nesapu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
// device-level overrides
virtual void device_start() override;
diff --git a/src/devices/sound/nes_apu_vt.cpp b/src/devices/sound/nes_apu_vt.cpp
new file mode 100644
index 00000000000..f93c3203bac
--- /dev/null
+++ b/src/devices/sound/nes_apu_vt.cpp
@@ -0,0 +1,28 @@
+// license:BSD-3-Clause
+// copyright-holders:David Haywood
+
+// The XOP is the NES APU type found in VT platforms, it roughly doubles the functionality of the APU
+// but in ways that means simply installing 2 APU devices isn't entirely correct (registers on one
+// APU module having an effect on the other)
+
+// TODO: everything
+
+#include "emu.h"
+#include "sound/nes_apu_vt.h"
+
+DEFINE_DEVICE_TYPE(NES_APU_VT, nes_apu_vt_device, "nes_apu_vt", "XOP APU")
+
+nes_apu_vt_device::nes_apu_vt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : nesapu_device(mconfig, NES_APU_VT, tag, owner, clock)
+{
+}
+
+void nes_apu_vt_device::device_start()
+{
+ nesapu_device::device_start();
+}
+
+void nes_apu_vt_device::device_reset()
+{
+ nesapu_device::device_reset();
+}
diff --git a/src/devices/sound/nes_apu_vt.h b/src/devices/sound/nes_apu_vt.h
new file mode 100644
index 00000000000..f93616673fa
--- /dev/null
+++ b/src/devices/sound/nes_apu_vt.h
@@ -0,0 +1,26 @@
+// license:BSD-3-Clause
+// copyright-holders:David Haywood
+
+#ifndef MAME_AUDIO_NES_VT_APU_H
+#define MAME_AUDIO_NES_VT_APU_H
+
+#pragma once
+
+#include "sound/nes_apu.h"
+
+DECLARE_DEVICE_TYPE(NES_APU_VT, nes_apu_vt_device)
+
+class nes_apu_vt_device : public nesapu_device
+{
+public:
+ // construction/destruction
+ nes_apu_vt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+private:
+};
+
+#endif // MAME_AUDIO_NES_VT_APU_H
diff --git a/src/mame/drivers/nes_vt.cpp b/src/mame/drivers/nes_vt.cpp
index 130e21cdeae..02b79c11f1d 100644
--- a/src/mame/drivers/nes_vt.cpp
+++ b/src/mame/drivers/nes_vt.cpp
@@ -140,7 +140,7 @@ public:
void nes_vt_vh2009(machine_config& config);
void nes_vt_vh2009_1mb(machine_config& config);
- void nes_vt_vh2009_2mb_alt(machine_config& config);
+ void nes_vt_vh2009_2mb(machine_config& config);
void nes_vt_vh2009_4mb(machine_config& config);
void nes_vt_vh2009_8mb(machine_config& config);
@@ -1377,7 +1377,7 @@ void nes_vt_swap_op_d5_d6_state::nes_vt_vh2009_1mb(machine_config& config)
m_soc->set_addrmap(AS_PROGRAM, &nes_vt_swap_op_d5_d6_state::vt_external_space_map_1mbyte);
}
-void nes_vt_swap_op_d5_d6_state::nes_vt_vh2009_2mb_alt(machine_config& config)
+void nes_vt_swap_op_d5_d6_state::nes_vt_vh2009_2mb(machine_config& config)
{
nes_vt_vh2009(config);
m_soc->set_addrmap(AS_PROGRAM, &nes_vt_swap_op_d5_d6_state::vt_external_space_map_2mbyte);
@@ -2226,22 +2226,22 @@ CONS( 200?, timetp36, 0, 0, nes_vt_pal_4mb, timetp36, nes_vt_timetp36_state,
CONS( 200?, timetp7, 0, 0, nes_vt_pal_2mb, timetp36, nes_vt_timetp36_state, empty_init, "TimeTop", "Super Game 7-in-1 (TimeTop SuperGame) (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
+// Runs fine, non-sport 121 in 1 games perfect, but minor graphical issues in
+// sport games, also no sound in menu or sport games due to missing PCM
+// emulation
+CONS( 200?, dgun2500, 0, 0, nes_vt_dg_baddma_16mb, nes_vt, nes_vt_dg_state, empty_init, "dreamGEAR", "dreamGEAR Wireless Motion Control with 130 games (DGUN-2500)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND)
+
// this is VT09 based
CONS( 2009, cybar120, 0, 0, nes_vt_vg_16mb, nes_vt, nes_vt_hh_state, empty_init, "Defender", "Defender M2500P 120-in-1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
-CONS( 2005, vgpocket, 0, 0, nes_vt_vg_4mb, nes_vt, nes_vt_hh_state, empty_init, "Performance Designed Products", "VG Pocket (VG-2000)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // Butterfly Catch (same game as Insect Chase in polmega) is broken
+CONS( 2005, vgpocket, 0, 0, nes_vt_vg_4mb, nes_vt, nes_vt_hh_state, empty_init, "Performance Designed Products", "VG Pocket (VG-2000)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
CONS( 200?, vgpmini, 0, 0, nes_vt_vg_4mb, nes_vt, nes_vt_hh_state, empty_init, "Performance Designed Products", "VG Pocket Mini (VG-1500)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
// VG Pocket Max (VG-2500) (blue case, 75 games)
// VG Pocket Max (VG-3000) (white case, 75 games) (does the game selection differ, or only the case?)
// VG Pocket Caplet is SunPlus hardware instead, see spg2xx_lexibook.cpp
-// Runs fine, non-sport 121 in 1 games perfect, but minor graphical issues in
-// sport games, also no sound in menu or sport games due to missing PCM
-// emulation
-CONS( 200?, dgun2500, 0, 0, nes_vt_dg_baddma_16mb, nes_vt, nes_vt_dg_state, empty_init, "dreamGEAR", "dreamGEAR Wireless Motion Control with 130 games (DGUN-2500)", 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( 2004, polmega, 0, 0, nes_vt_vh2009_4mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "Polaroid", "Megamax GPD001SDG", MACHINE_NOT_WORKING ) // Insect Chase is broken
-CONS( 2004, vsmaxx17, 0, 0, nes_vt_vh2009_2mb_alt, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "Senario", "Vs. Maxx 17-in-1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // from a Green unit, '17 Classic & Racing Game'
+CONS( 2004, polmega, 0, 0, nes_vt_vh2009_4mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "Polaroid", "TV MegaMax active power game system 30-in-1 (MegaMax GPD001SDG)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
+CONS( 2004, vsmaxx17, 0, 0, nes_vt_vh2009_2mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "Senario", "Vs. Maxx 17-in-1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // from a Green unit, '17 Classic & Racing Game'
CONS( 200?, silv35, 0, 0, nes_vt_vh2009_4mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "SilverLit", "35 in 1 Super Twins", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
// die is marked as VH2009, as above, but no scrambled opcodes here
CONS( 201?, techni4, 0, 0, nes_vt_pal_2mb, nes_vt, nes_vt_state, empty_init, "Technigame", "Technigame Super 4-in-1 Sports (PAL)", MACHINE_IMPERFECT_GRAPHICS )
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;
+}
+
diff --git a/src/mame/machine/m6502_swap_op_d5_d6.h b/src/mame/machine/m6502_swap_op_d5_d6.h
index efcd4a69c17..aec61cf077f 100644
--- a/src/mame/machine/m6502_swap_op_d5_d6.h
+++ b/src/mame/machine/m6502_swap_op_d5_d6.h
@@ -4,7 +4,7 @@
m6502_swap_op_d5_d6.h
- 6502 with instruction scrambling
+ 6502 / N2A03 with instruction scrambling
***************************************************************************/
@@ -13,8 +13,8 @@
#pragma once
-#include "cpu/m6502/m6502.h"
-#include "cpu/m6502/m6502d.h"
+#include "cpu/m6502/n2a03.h"
+#include "cpu/m6502/n2a03d.h"
class m6502_swap_op_d5_d6 : public m6502_device {
public:
@@ -24,9 +24,6 @@ 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;
@@ -48,6 +45,37 @@ protected:
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
};
+class n2a03_core_swap_op_d5_d6 : public n2a03_core_device {
+public:
+ n2a03_core_swap_op_d5_d6(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ class mi_decrypt : public mi_default {
+ public:
+
+ virtual ~mi_decrypt() {}
+ virtual uint8_t read_sync(uint16_t adr) override;
+
+ uint8_t descramble(uint8_t op);
+ };
+
+ class disassembler : public n2a03_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_SWAP_OP_D5_D6, m6502_swap_op_d5_d6)
+DECLARE_DEVICE_TYPE(N2A03_CORE_SWAP_OP_D5_D6, n2a03_core_swap_op_d5_d6)
#endif // MAME_M6502_SWAP_OP_D5_D6_H
diff --git a/src/mame/machine/nes_vt_soc.cpp b/src/mame/machine/nes_vt_soc.cpp
index 1237c4e3584..84bffe4c4ba 100644
--- a/src/mame/machine/nes_vt_soc.cpp
+++ b/src/mame/machine/nes_vt_soc.cpp
@@ -1214,7 +1214,7 @@ void nes_vt_soc_device::do_pal_timings_and_ppu_replacement(machine_config& confi
void nes_vt_soc_device::device_add_mconfig(machine_config &config)
{
- M6502(config, m_maincpu, NTSC_APU_CLOCK);
+ N2A03_CORE(config, m_maincpu, NTSC_APU_CLOCK); // Butterfly Catch in vgpocket confirms N2A03 core type, not 6502
m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt_soc_device::nes_vt_map);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
@@ -1235,11 +1235,7 @@ void nes_vt_soc_device::device_add_mconfig(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- /* this should actually be a custom *almost* doubled up APU, however requires more thought
- than just using 2 APUs as registers in the 2nd one affect the PCM channel mode but the
- DMA control still comes from the 1st, but in the new mode, sound always outputs via the
- 2nd. Probably need to split the APU into interface and sound gen logic. */
- NES_APU(config, m_apu, NTSC_APU_CLOCK);
+ NES_APU_VT(config, m_apu, NTSC_APU_CLOCK);
m_apu->irq().set(FUNC(nes_vt_soc_device::apu_irq));
m_apu->mem_read().set(FUNC(nes_vt_soc_device::apu_read_mem));
m_apu->add_route(ALL_OUTPUTS, "mono", 0.50);
@@ -1260,7 +1256,7 @@ void nes_vt_soc_scramble_device::device_add_mconfig(machine_config& config)
{
nes_vt_soc_device::device_add_mconfig(config);
- M6502_SWAP_OP_D5_D6(config.replace(), m_maincpu, NTSC_APU_CLOCK);
+ N2A03_CORE_SWAP_OP_D5_D6(config.replace(), m_maincpu, NTSC_APU_CLOCK); // Insect Chase in polmega confirms N2A03 core type, not 6502
m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt_soc_scramble_device::nes_vt_map);
}
@@ -1461,7 +1457,7 @@ void nes_vt_soc_4kram_fp_device::device_add_mconfig(machine_config& config)
{
nes_vt_soc_device::device_add_mconfig(config);
- M6502_VTSCR(config.replace(), m_maincpu, NTSC_APU_CLOCK);
+ M6502_VTSCR(config.replace(), m_maincpu, NTSC_APU_CLOCK); // are these later chips N2A03 core, or 6502 core derived?
m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt_soc_4kram_fp_device::nes_vt_fp_map);
}
diff --git a/src/mame/machine/nes_vt_soc.h b/src/mame/machine/nes_vt_soc.h
index c6695ecf812..18efbcb993f 100644
--- a/src/mame/machine/nes_vt_soc.h
+++ b/src/mame/machine/nes_vt_soc.h
@@ -7,6 +7,7 @@
#pragma once
#include "cpu/m6502/n2a03.h"
+#include "sound/nes_apu_vt.h"
#include "machine/m6502_vtscr.h"
#include "machine/m6502_swap_op_d5_d6.h"
#include "video/ppu2c0x_vt.h"
@@ -67,7 +68,7 @@ protected:
required_device<cpu_device> m_maincpu;
required_device<screen_device> m_screen;
required_device<ppu_vt03_device> m_ppu;
- required_device<nesapu_device> m_apu;
+ required_device<nes_apu_vt_device> m_apu;
void nes_vt_map(address_map& map);