From 97a5df742b7011f19f0d36398eac53f8c26f9c23 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Wed, 7 May 2025 22:10:12 +0100 Subject: [PATCH 01/35] create derived 6502 for VT369 SPU --- scripts/src/cpu.lua | 25 +++++ src/devices/cpu/m6502/dvt3xx_spu.lst | 20 ++++ src/devices/cpu/m6502/ovt3xx_spu.lst | 4 + src/devices/cpu/m6502/vt3xx_spu.cpp | 105 ++++++++++++++++++ src/devices/cpu/m6502/vt3xx_spu.h | 56 ++++++++++ src/devices/cpu/m6502/vt3xx_spud.cpp | 15 +++ src/devices/cpu/m6502/vt3xx_spud.h | 26 +++++ src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 2 +- src/mame/nintendo/nes_vt369_vtunknown_soc.h | 1 + 9 files changed, 253 insertions(+), 1 deletion(-) create mode 100644 src/devices/cpu/m6502/dvt3xx_spu.lst create mode 100644 src/devices/cpu/m6502/ovt3xx_spu.lst create mode 100644 src/devices/cpu/m6502/vt3xx_spu.cpp create mode 100644 src/devices/cpu/m6502/vt3xx_spu.h create mode 100644 src/devices/cpu/m6502/vt3xx_spud.cpp create mode 100644 src/devices/cpu/m6502/vt3xx_spud.h diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua index cb130e07527b8..5192733015827 100644 --- a/scripts/src/cpu.lua +++ b/scripts/src/cpu.lua @@ -1761,6 +1761,7 @@ end --@src/devices/cpu/m6502/st2xxx.h,CPUS["ST2XXX"] = true --@src/devices/cpu/m6502/st2204.h,CPUS["ST2XXX"] = true --@src/devices/cpu/m6502/st2205u.h,CPUS["ST2XXX"] = true +--@src/devices/cpu/m6502/vt3xx_spu.h,CPUS["VT3XX_SPU"] = true --@src/devices/cpu/m6502/w65c02.h,CPUS["M6502"] = true --@src/devices/cpu/m6502/w65c02s.h,CPUS["M6502"] = true --@src/devices/cpu/m6502/xavix.h,CPUS["XAVIX"] = true @@ -1868,6 +1869,21 @@ if CPUS["ST2XXX"] then } end +if CPUS["VT3XX_SPU"] then + files { + MAME_DIR .. "src/devices/cpu/m6502/vt3xx_spu.cpp", + MAME_DIR .. "src/devices/cpu/m6502/vt3xx_spu.h", + } + + custombuildtask { + { MAME_DIR .. "src/devices/cpu/m6502/ovt3xx_spu.lst", GEN_DIR .. "emu/cpu/m6502/vt3xx_spu.hxx", { MAME_DIR .. "src/devices/cpu/m6502/m6502make.py", MAME_DIR .. "src/devices/cpu/m6502/dvt3xx_spu.lst" }, {"@echo Generating VT3xx SPU instruction source file...", PYTHON .. " $(1) s vt3xx_spu $(<) $(2) $(@)" }}, + } + + dependency { + { MAME_DIR .. "src/devices/cpu/m6502/vt3xx_spu.cpp", GEN_DIR .. "emu/cpu/m6502/vt3xx_spu.hxx" }, + } +end + if CPUS["XAVIX"] then files { MAME_DIR .. "src/devices/cpu/m6502/xavix.cpp", @@ -1947,6 +1963,15 @@ if opt_tool(CPUS, "M6502") then table.insert(disasm_files, MAME_DIR .. "src/devices/cpu/m6502/w65c02d.h") end +if opt_tool(CPUS, "VT3XX_SPU") then + table.insert(disasm_custombuildtask, { MAME_DIR .. "src/devices/cpu/m6502/ovt3xx_spu.lst", GEN_DIR .. "emu/cpu/m6502/vt3xx_spud.hxx", { MAME_DIR .. "src/devices/cpu/m6502/m6502make.py", MAME_DIR .. "src/devices/cpu/m6502/dvt3xx_spu.lst" }, {"@echo Generating VT3xx SPU disassembler source file...", PYTHON .. " $(1) d vt3xx_spu $(<) $(2) $(@)" }}) + + table.insert(disasm_dependency, { MAME_DIR .. "src/devices/cpu/m6502/vt3xx_spud.cpp", GEN_DIR .. "emu/cpu/m6502/vt3xx_spud.hxx" }) + + table.insert(disasm_files, MAME_DIR .. "src/devices/cpu/m6502/vt3xx_spud.cpp") + table.insert(disasm_files, MAME_DIR .. "src/devices/cpu/m6502/vt3xx_spud.h") +end + if opt_tool(CPUS, "XAVIX") then table.insert(disasm_custombuildtask, { MAME_DIR .. "src/devices/cpu/m6502/oxavix.lst", GEN_DIR .. "emu/cpu/m6502/xavixd.hxx", { MAME_DIR .. "src/devices/cpu/m6502/m6502make.py", MAME_DIR .. "src/devices/cpu/m6502/dxavix.lst" }, {"@echo Generating xavix disassembler source file...", PYTHON .. " $(1) d xavix $(<) $(2) $(@)" }}) diff --git a/src/devices/cpu/m6502/dvt3xx_spu.lst b/src/devices/cpu/m6502/dvt3xx_spu.lst new file mode 100644 index 0000000000000..e5a54b93f7ee6 --- /dev/null +++ b/src/devices/cpu/m6502/dvt3xx_spu.lst @@ -0,0 +1,20 @@ +# license:BSD-3-Clause +# copyright-holders:David Haywood +# vt3xx_spu - m6502 with custom opcodes +brk_imp ora_idx kil_non slo_idx nop_zpg ora_zpg asl_zpg slo_zpg php_imp ora_imm asl_acc anc_imm nop_aba ora_aba asl_aba slo_aba +bpl_rel ora_idy kil_non slo_idy nop_zpx ora_zpx asl_zpx slo_zpx clc_imp ora_aby nop_imp slo_aby nop_abx ora_abx asl_abx slo_abx +jsr_adr and_idx kil_non rla_idx bit_zpg and_zpg rol_zpg rla_zpg plp_imp and_imm rol_acc anc_imm bit_aba and_aba rol_aba rla_aba +bmi_rel and_idy kil_non rla_idy nop_zpx and_zpx rol_zpx rla_zpx sec_imp and_aby nop_imp rla_aby nop_abx and_abx rol_abx rla_abx +rti_imp eor_idx kil_non sre_idx nop_zpg eor_zpg lsr_zpg sre_zpg pha_imp eor_imm lsr_acc asr_imm jmp_adr eor_aba lsr_aba sre_aba +bvc_rel eor_idy kil_non sre_idy nop_zpx eor_zpx lsr_zpx sre_zpx cli_imp eor_aby nop_imp sre_aby nop_abx eor_abx lsr_abx sre_abx +rts_imp adc_idx kil_non rra_idx nop_zpg adc_zpg ror_zpg rra_zpg pla_imp adc_imm ror_acc arr_imm jmp_ind adc_aba ror_aba rra_aba +bvs_rel adc_idy kil_non rra_idy nop_zpx adc_zpx ror_zpx rra_zpx sei_imp adc_aby nop_imp rra_aby nop_abx adc_abx ror_abx rra_abx +nop_imm sta_idx nop_imm sax_idx sty_zpg sta_zpg stx_zpg sax_zpg dey_imp nop_imm txa_imp ane_imm sty_aba sta_aba stx_aba sax_aba +bcc_rel sta_idy kil_non sha_idy sty_zpx sta_zpx stx_zpy sax_zpy tya_imp sta_aby txs_imp shs_aby shy_abx sta_abx shx_aby sha_aby +ldy_imm lda_idx ldx_imm lax_idx ldy_zpg lda_zpg ldx_zpg lax_zpg tay_imp lda_imm tax_imp lxa_imm ldy_aba lda_aba ldx_aba lax_aba +bcs_rel lda_idy kil_non lax_idy ldy_zpx lda_zpx ldx_zpy lax_zpy clv_imp lda_aby tsx_imp las_aby ldy_abx lda_abx ldx_aby lax_aby +cpy_imm cmp_idx nop_imm dcp_idx cpy_zpg cmp_zpg dec_zpg dcp_zpg iny_imp cmp_imm dex_imp sbx_imm cpy_aba cmp_aba dec_aba dcp_aba +bne_rel cmp_idy kil_non dcp_idy nop_zpx cmp_zpx dec_zpx dcp_zpx cld_imp cmp_aby nop_imp dcp_aby nop_abx cmp_abx dec_abx dcp_abx +cpx_imm sbc_idx nop_imm isb_idx cpx_zpg sbc_zpg inc_zpg isb_zpg inx_imp sbc_imm nop_imp sbc_imm cpx_aba sbc_aba inc_aba isb_aba +beq_rel sbc_idy kil_non isb_idy nop_zpx sbc_zpx inc_zpx isb_zpx sed_imp sbc_aby nop_imp isb_aby nop_abx sbc_abx inc_abx isb_abx +reset diff --git a/src/devices/cpu/m6502/ovt3xx_spu.lst b/src/devices/cpu/m6502/ovt3xx_spu.lst new file mode 100644 index 0000000000000..6948bca3f5716 --- /dev/null +++ b/src/devices/cpu/m6502/ovt3xx_spu.lst @@ -0,0 +1,4 @@ +# license:BSD-3-Clause +# copyright-holders:David Haywood +# vt3xx_spu opcodes + diff --git a/src/devices/cpu/m6502/vt3xx_spu.cpp b/src/devices/cpu/m6502/vt3xx_spu.cpp new file mode 100644 index 0000000000000..1e15204e7a671 --- /dev/null +++ b/src/devices/cpu/m6502/vt3xx_spu.cpp @@ -0,0 +1,105 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +/*************************************************************************** + + vt3xx_spu.cpp + + Sound CPU for VT3xx series chips + +***************************************************************************/ + +#include "emu.h" +#include "vt3xx_spu.h" +#include "vt3xx_spud.h" + +DEFINE_DEVICE_TYPE(VT3XX_SPU, vt3xx_spu_device, "vt3xx_spu", "VT3xx SPU") + +vt3xx_spu_device::vt3xx_spu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + vt3xx_spu_device(mconfig, VT3XX_SPU, tag, owner, clock) +{ +} + +vt3xx_spu_device::vt3xx_spu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : + m6502_device(mconfig, type, tag, owner, clock), + m_lowbus_config("lowbus", ENDIANNESS_LITTLE, 8, 15) +{ + program_config.m_addr_width = 24; + program_config.m_logaddr_width = 24; + sprogram_config.m_addr_width = 24; + sprogram_config.m_logaddr_width = 24; + // XaviX specific spaces + m_lowbus_config.m_addr_width = 15; + m_lowbus_config.m_logaddr_width = 15; +} + + +std::unique_ptr vt3xx_spu_device::create_disassembler() +{ + return std::make_unique(); +} + +void vt3xx_spu_device::device_start() +{ + m6502_device::device_start(); + + m_lowbus_space = &space(5); + + state_add(VT3XX_SPU_DATABANK, "DATBNK", m_databank).callimport().formatstr("%2s"); +} + +void vt3xx_spu_device::device_reset() +{ + set_databank(0); + m6502_device::device_reset(); +} + + +inline void vt3xx_spu_device::set_databank(uint8_t bank) +{ + m_databank = bank; +} + +inline uint8_t vt3xx_spu_device::get_databank() +{ + return m_databank; +} + +device_memory_interface::space_config_vector vt3xx_spu_device::memory_space_config() const +{ + if(has_configured_map(AS_OPCODES)) + return space_config_vector { + std::make_pair(AS_PROGRAM, &program_config), + std::make_pair(AS_OPCODES, &sprogram_config), + std::make_pair(5, &m_lowbus_config), + }; + else + return space_config_vector { + std::make_pair(AS_PROGRAM, &program_config), + std::make_pair(5, &m_lowbus_config), + }; +} + +void vt3xx_spu_device::state_import(const device_state_entry &entry) +{ + m6502_device::state_import(entry); + + switch(entry.index()) + { + case VT3XX_SPU_DATABANK: + break; + } +} + +void vt3xx_spu_device::state_string_export(const device_state_entry &entry, std::string &str) const +{ + m6502_device::state_string_export(entry, str); + + switch(entry.index()) + { + case VT3XX_SPU_DATABANK: + str = string_format("%02x", m_databank); + break; + } +} + +#include "cpu/m6502/vt3xx_spu.hxx" diff --git a/src/devices/cpu/m6502/vt3xx_spu.h b/src/devices/cpu/m6502/vt3xx_spu.h new file mode 100644 index 0000000000000..7c2eb03198703 --- /dev/null +++ b/src/devices/cpu/m6502/vt3xx_spu.h @@ -0,0 +1,56 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +/*************************************************************************** + + vt3xx_spu.h + +***************************************************************************/ +#ifndef MAME_CPU_M6502_VT3XX_SPU_H +#define MAME_CPU_M6502_VT3XX_SPU_H + +#pragma once + +#include "m6502.h" + +class vt3xx_spu_device : public m6502_device { +public: + vt3xx_spu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + virtual std::unique_ptr create_disassembler() override; + virtual void do_exec_full() override; + virtual void do_exec_partial() override; + +#define O(o) void o ## _full(); void o ## _partial() + + +#undef O + +protected: + uint8_t m_databank; + + vt3xx_spu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + virtual void device_start() override ATTR_COLD; + virtual void device_reset() override ATTR_COLD; + virtual void state_import(const device_state_entry &entry) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; + + // device_memory_interface overrides + virtual space_config_vector memory_space_config() const override; + + address_space_config m_lowbus_config; + address_space *m_lowbus_space; + +protected: + void set_databank(uint8_t bank); + uint8_t get_databank(); +}; + +enum { + VT3XX_SPU_DATABANK = M6502_IR+1, +}; + + +DECLARE_DEVICE_TYPE(VT3XX_SPU, vt3xx_spu_device) + +#endif // MAME_CPU_M6502_VT3XX_SPU_H diff --git a/src/devices/cpu/m6502/vt3xx_spud.cpp b/src/devices/cpu/m6502/vt3xx_spud.cpp new file mode 100644 index 0000000000000..397f16e4d2791 --- /dev/null +++ b/src/devices/cpu/m6502/vt3xx_spud.cpp @@ -0,0 +1,15 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +/*************************************************************************** + + vt3xx_spud.cpp + +***************************************************************************/ + +#include "emu.h" +#include "vt3xx_spud.h" +#include "cpu/m6502/vt3xx_spud.hxx" + +vt3xx_spu_disassembler::vt3xx_spu_disassembler() : m6502_base_disassembler(disasm_entries) +{ +} diff --git a/src/devices/cpu/m6502/vt3xx_spud.h b/src/devices/cpu/m6502/vt3xx_spud.h new file mode 100644 index 0000000000000..a9e10bb85aaa4 --- /dev/null +++ b/src/devices/cpu/m6502/vt3xx_spud.h @@ -0,0 +1,26 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +/*************************************************************************** + + vt3xx_spud.h + +***************************************************************************/ + +#ifndef MAME_CPU_M6502_VT3XX_SPUD_H +#define MAME_CPU_M6502_VT3XX_SPUD_H + +#pragma once + +#include "m6502d.h" + +class vt3xx_spu_disassembler : public m6502_base_disassembler +{ +public: + vt3xx_spu_disassembler(); + virtual ~vt3xx_spu_disassembler() = default; + +private: + static const disasm_entry disasm_entries[0x100]; +}; + +#endif diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index f2dabfe483226..e2c36259c7131 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -72,7 +72,7 @@ void nes_vt369_soc_device::device_add_mconfig(machine_config& config) VT_VT1682_ALU(config, m_alu, 0); - M6502(config, m_soundcpu, RP2A03_NTSC_XTAL); + VT3XX_SPU(config, m_soundcpu, RP2A03_NTSC_XTAL); m_soundcpu->set_addrmap(AS_PROGRAM, &nes_vt369_soc_device::vt369_sound_map); } diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.h b/src/mame/nintendo/nes_vt369_vtunknown_soc.h index 021b99251570e..4a15498fffc25 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.h +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.h @@ -7,6 +7,7 @@ #include "nes_vt09_soc.h" #include "cpu/m6502/rp2a03.h" +#include "cpu/m6502/vt3xx_spu.h" #include "sound/nes_apu_vt.h" #include "m6502_swap_op_d5_d6.h" #include "vt1682_alu.h" From ce047ac98a3f8619ec9e0593cba691658a8ddc36 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 14:02:22 +0100 Subject: [PATCH 02/35] a few ops --- src/devices/cpu/m6502/dvt3xx_spu.lst | 14 +++---- src/devices/cpu/m6502/ovt3xx_spu.lst | 55 ++++++++++++++++++++++++++++ src/devices/cpu/m6502/vt3xx_spu.cpp | 26 +++++++------ src/devices/cpu/m6502/vt3xx_spu.h | 14 ++++++- 4 files changed, 88 insertions(+), 21 deletions(-) diff --git a/src/devices/cpu/m6502/dvt3xx_spu.lst b/src/devices/cpu/m6502/dvt3xx_spu.lst index e5a54b93f7ee6..f3723bc5e5a78 100644 --- a/src/devices/cpu/m6502/dvt3xx_spu.lst +++ b/src/devices/cpu/m6502/dvt3xx_spu.lst @@ -4,17 +4,17 @@ brk_imp ora_idx kil_non slo_idx nop_zpg ora_zpg asl_zpg slo_zpg php_imp ora_imm asl_acc anc_imm nop_aba ora_aba asl_aba slo_aba bpl_rel ora_idy kil_non slo_idy nop_zpx ora_zpx asl_zpx slo_zpx clc_imp ora_aby nop_imp slo_aby nop_abx ora_abx asl_abx slo_abx jsr_adr and_idx kil_non rla_idx bit_zpg and_zpg rol_zpg rla_zpg plp_imp and_imm rol_acc anc_imm bit_aba and_aba rol_aba rla_aba -bmi_rel and_idy kil_non rla_idy nop_zpx and_zpx rol_zpx rla_zpx sec_imp and_aby nop_imp rla_aby nop_abx and_abx rol_abx rla_abx +bmi_rel and_idy kil_non rla_idy ply_vt_imp and_zpx rol_zpx rla_zpx sec_imp and_aby nop_imp rla_aby plx_vt_imp and_abx rol_abx rla_abx rti_imp eor_idx kil_non sre_idx nop_zpg eor_zpg lsr_zpg sre_zpg pha_imp eor_imm lsr_acc asr_imm jmp_adr eor_aba lsr_aba sre_aba -bvc_rel eor_idy kil_non sre_idy nop_zpx eor_zpx lsr_zpx sre_zpx cli_imp eor_aby nop_imp sre_aby nop_abx eor_abx lsr_abx sre_abx +bvc_rel eor_idy kil_non sre_idy nop_zpx eor_zpx lsr_zpx sre_zpx cli_imp eor_aby setdbk_vt_imp sre_aby nop_abx eor_abx lsr_abx sre_abx rts_imp adc_idx kil_non rra_idx nop_zpg adc_zpg ror_zpg rra_zpg pla_imp adc_imm ror_acc arr_imm jmp_ind adc_aba ror_aba rra_aba -bvs_rel adc_idy kil_non rra_idy nop_zpx adc_zpx ror_zpx rra_zpx sei_imp adc_aby nop_imp rra_aby nop_abx adc_abx ror_abx rra_abx +bvs_rel adc_idy kil_non rra_idy nop_zpx adc_zpx ror_zpx rra_zpx sei_imp adc_aby getdbk_vt_imp rra_aby nop_abx adc_abx ror_abx rra_abx nop_imm sta_idx nop_imm sax_idx sty_zpg sta_zpg stx_zpg sax_zpg dey_imp nop_imm txa_imp ane_imm sty_aba sta_aba stx_aba sax_aba bcc_rel sta_idy kil_non sha_idy sty_zpx sta_zpx stx_zpy sax_zpy tya_imp sta_aby txs_imp shs_aby shy_abx sta_abx shx_aby sha_aby -ldy_imm lda_idx ldx_imm lax_idx ldy_zpg lda_zpg ldx_zpg lax_zpg tay_imp lda_imm tax_imp lxa_imm ldy_aba lda_aba ldx_aba lax_aba -bcs_rel lda_idy kil_non lax_idy ldy_zpx lda_zpx ldx_zpy lax_zpy clv_imp lda_aby tsx_imp las_aby ldy_abx lda_abx ldx_aby lax_aby -cpy_imm cmp_idx nop_imm dcp_idx cpy_zpg cmp_zpg dec_zpg dcp_zpg iny_imp cmp_imm dex_imp sbx_imm cpy_aba cmp_aba dec_aba dcp_aba -bne_rel cmp_idy kil_non dcp_idy nop_zpx cmp_zpx dec_zpx dcp_zpx cld_imp cmp_aby nop_imp dcp_aby nop_abx cmp_abx dec_abx dcp_abx +ldy_imm lda_idx ldx_imm lax_idx ldy_zpg lda_zpg ldx_zpg readdbk2_vt_abx tay_imp lda_imm tax_imp lxa_imm ldy_aba lda_aba ldx_aba lax_aba +bcs_rel lda_idy kil_non lax_idy ldy_zpx lda_zpx ldx_zpy lax_zpy clv_imp lda_aby tsx_imp las_aby ldy_abx lda_abx ldx_aby readdbk_vt_abx +cpy_imm cmp_idx phx_vt_imp dcp_idx cpy_zpg cmp_zpg dec_zpg dcp_zpg iny_imp cmp_imm dex_imp sbx_imm cpy_aba cmp_aba dec_aba dcp_aba +bne_rel cmp_idy phy_vt_imp dcp_idy nop_zpx cmp_zpx dec_zpx dcp_zpx cld_imp cmp_aby nop_imp dcp_aby nop_abx cmp_abx dec_abx dcp_abx cpx_imm sbc_idx nop_imm isb_idx cpx_zpg sbc_zpg inc_zpg isb_zpg inx_imp sbc_imm nop_imp sbc_imm cpx_aba sbc_aba inc_aba isb_aba beq_rel sbc_idy kil_non isb_idy nop_zpx sbc_zpx inc_zpx isb_zpx sed_imp sbc_aby nop_imp isb_aby nop_abx sbc_abx inc_abx isb_abx reset diff --git a/src/devices/cpu/m6502/ovt3xx_spu.lst b/src/devices/cpu/m6502/ovt3xx_spu.lst index 6948bca3f5716..a1602f8b15007 100644 --- a/src/devices/cpu/m6502/ovt3xx_spu.lst +++ b/src/devices/cpu/m6502/ovt3xx_spu.lst @@ -2,3 +2,58 @@ # copyright-holders:David Haywood # vt3xx_spu opcodes +phy_vt_imp + read_pc(); + write(SP, Y); + dec_SP(); + prefetch(); + +phx_vt_imp + read_pc(); + write(SP, X); + dec_SP(); + prefetch(); + +plx_vt_imp + read_pc(); + read(SP); + inc_SP(); + X = read(SP); + set_nz(X); + prefetch(); + +ply_vt_imp + read_pc(); + read(SP); + inc_SP(); + Y = read(SP); + set_nz(Y); + prefetch(); + +getdbk_vt_imp + read_pc(); + A = m_databank; + prefetch(); + +setdbk_vt_imp + read_pc(); + m_databank = A; + prefetch(); + +readdbk_vt_abx + TMP = read_pc(); + PC++; + TMP = set_h(TMP, read_pc()); + PC++; + A = m_extdata_space->read_byte((m_databank << 16) | set_l(TMP, TMP+X)); + set_nz(A); + prefetch(); + +readdbk2_vt_abx + TMP = read_pc(); // this is currently the same as readdbk_vt_abx, it probably shouldn't be + PC++; + TMP = set_h(TMP, read_pc()); + PC++; + A = m_extdata_space->read_byte((m_databank << 16) | set_l(TMP, TMP+X)); + set_nz(A); + prefetch(); diff --git a/src/devices/cpu/m6502/vt3xx_spu.cpp b/src/devices/cpu/m6502/vt3xx_spu.cpp index 1e15204e7a671..2162a18bc0380 100644 --- a/src/devices/cpu/m6502/vt3xx_spu.cpp +++ b/src/devices/cpu/m6502/vt3xx_spu.cpp @@ -4,7 +4,14 @@ vt3xx_spu.cpp - Sound CPU for VT3xx series chips + 6502 derived sound/sub CPU for VT3xx series chips + + has some additional opcodes for reading/writing the 24-bit 'onebus' + with an extra register to store the upper 8-bits of the access address + + - should this instead derive from the rp2a03 as is the case for the + main CPUs on many of the VT chips, or is using the m6502 as a base + correct in this case? ***************************************************************************/ @@ -21,15 +28,8 @@ vt3xx_spu_device::vt3xx_spu_device(const machine_config &mconfig, const char *ta vt3xx_spu_device::vt3xx_spu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : m6502_device(mconfig, type, tag, owner, clock), - m_lowbus_config("lowbus", ENDIANNESS_LITTLE, 8, 15) + m_extdata_config("extdata", ENDIANNESS_LITTLE, 8, 24) { - program_config.m_addr_width = 24; - program_config.m_logaddr_width = 24; - sprogram_config.m_addr_width = 24; - sprogram_config.m_logaddr_width = 24; - // XaviX specific spaces - m_lowbus_config.m_addr_width = 15; - m_lowbus_config.m_logaddr_width = 15; } @@ -42,9 +42,11 @@ void vt3xx_spu_device::device_start() { m6502_device::device_start(); - m_lowbus_space = &space(5); + m_extdata_space = &space(5); state_add(VT3XX_SPU_DATABANK, "DATBNK", m_databank).callimport().formatstr("%2s"); + + save_item(NAME(m_databank)); } void vt3xx_spu_device::device_reset() @@ -70,12 +72,12 @@ device_memory_interface::space_config_vector vt3xx_spu_device::memory_space_conf return space_config_vector { std::make_pair(AS_PROGRAM, &program_config), std::make_pair(AS_OPCODES, &sprogram_config), - std::make_pair(5, &m_lowbus_config), + std::make_pair(5, &m_extdata_config), }; else return space_config_vector { std::make_pair(AS_PROGRAM, &program_config), - std::make_pair(5, &m_lowbus_config), + std::make_pair(5, &m_extdata_config), }; } diff --git a/src/devices/cpu/m6502/vt3xx_spu.h b/src/devices/cpu/m6502/vt3xx_spu.h index 7c2eb03198703..94357966fb0b0 100644 --- a/src/devices/cpu/m6502/vt3xx_spu.h +++ b/src/devices/cpu/m6502/vt3xx_spu.h @@ -22,6 +22,16 @@ class vt3xx_spu_device : public m6502_device { #define O(o) void o ## _full(); void o ## _partial() + O(phx_vt_imp); + O(phy_vt_imp); + O(plx_vt_imp); + O(ply_vt_imp); + + O(setdbk_vt_imp); + O(getdbk_vt_imp); + + O(readdbk_vt_abx); + O(readdbk2_vt_abx); #undef O @@ -38,8 +48,8 @@ class vt3xx_spu_device : public m6502_device { // device_memory_interface overrides virtual space_config_vector memory_space_config() const override; - address_space_config m_lowbus_config; - address_space *m_lowbus_space; + address_space_config m_extdata_config; + address_space *m_extdata_space; protected: void set_databank(uint8_t bank); From 4adf74c73cdcf40c85a66ee7efea305f0ac7ff5a Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 17:52:05 +0100 Subject: [PATCH 03/35] allow it to see .. something (maybe not the right thing, but something) --- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 5 +++++ src/mame/nintendo/nes_vt369_vtunknown_soc.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index e2c36259c7131..c44ed2d7c161b 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -74,6 +74,7 @@ void nes_vt369_soc_device::device_add_mconfig(machine_config& config) VT3XX_SPU(config, m_soundcpu, RP2A03_NTSC_XTAL); m_soundcpu->set_addrmap(AS_PROGRAM, &nes_vt369_soc_device::vt369_sound_map); + m_soundcpu->set_addrmap(5, &nes_vt369_soc_device::vt369_sound_external_map); } void nes_vt369_soc_device::vt369_soundcpu_control_w(offs_t offset, uint8_t data) @@ -163,6 +164,10 @@ void nes_vt369_soc_device::vt369_sound_map(address_map &map) map(0xf800, 0xffff).ram().share("soundram"); // doesn't actually map here, the CPU fetches vectors from lower addressse } +void nes_vt369_soc_device::vt369_sound_external_map(address_map &map) +{ + map(0x000000, 0xffffff).r(FUNC(sound_read_external)); +} void nes_vt369_soc_device::vt369_411c_bank6000_enable_w(offs_t offset, uint8_t data) diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.h b/src/mame/nintendo/nes_vt369_vtunknown_soc.h index 4a15498fffc25..a305c3263b4bc 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.h +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.h @@ -46,6 +46,9 @@ class nes_vt369_soc_device : public nes_vt09_soc_device private: void vt369_sound_map(address_map &map) ATTR_COLD; + void vt369_sound_external_map(address_map& map) ATTR_COLD; + + uint8_t sound_read_external(offs_t offset) { return space(AS_PROGRAM).read_byte(offset); } required_device m_alu; required_device m_soundcpu; From af0b245bbfe51410035cacb47cc79e6411f2a36b Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 18:39:39 +0100 Subject: [PATCH 04/35] less complex logic works better here, correct data is copied --- src/devices/cpu/m6502/ovt3xx_spu.lst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/devices/cpu/m6502/ovt3xx_spu.lst b/src/devices/cpu/m6502/ovt3xx_spu.lst index a1602f8b15007..a9e81430c8c92 100644 --- a/src/devices/cpu/m6502/ovt3xx_spu.lst +++ b/src/devices/cpu/m6502/ovt3xx_spu.lst @@ -43,17 +43,17 @@ setdbk_vt_imp readdbk_vt_abx TMP = read_pc(); PC++; - TMP = set_h(TMP, read_pc()); + TMP2 = read_pc(); PC++; - A = m_extdata_space->read_byte((m_databank << 16) | set_l(TMP, TMP+X)); + A = m_extdata_space->read_byte(((m_databank << 16) | (TMP2 << 8) | TMP) + X); set_nz(A); prefetch(); readdbk2_vt_abx - TMP = read_pc(); // this is currently the same as readdbk_vt_abx, it probably shouldn't be + TMP = read_pc(); // this is currently the same as readdbk_vt_abx, it probably shouldn't be, maybe reads with highest exbus bit set to give 25 bits? PC++; - TMP = set_h(TMP, read_pc()); + TMP2 = read_pc(); PC++; - A = m_extdata_space->read_byte((m_databank << 16) | set_l(TMP, TMP+X)); + A = m_extdata_space->read_byte(((m_databank << 16) | (TMP2 << 8) | TMP) + X); set_nz(A); prefetch(); From 86623498fed13984f0cfa1204ead05891c4d8ba9 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 19:16:54 +0100 Subject: [PATCH 05/35] this is also customized --- src/devices/cpu/m6502/dvt3xx_spu.lst | 10 +++++----- src/devices/cpu/m6502/ovt3xx_spu.lst | 19 ++++++++++++++----- src/devices/cpu/m6502/vt3xx_spu.h | 9 +++++---- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/devices/cpu/m6502/dvt3xx_spu.lst b/src/devices/cpu/m6502/dvt3xx_spu.lst index f3723bc5e5a78..8802e4b434a2e 100644 --- a/src/devices/cpu/m6502/dvt3xx_spu.lst +++ b/src/devices/cpu/m6502/dvt3xx_spu.lst @@ -6,13 +6,13 @@ bpl_rel ora_idy kil_non slo_idy nop_zpx ora_zpx asl_zpx jsr_adr and_idx kil_non rla_idx bit_zpg and_zpg rol_zpg rla_zpg plp_imp and_imm rol_acc anc_imm bit_aba and_aba rol_aba rla_aba bmi_rel and_idy kil_non rla_idy ply_vt_imp and_zpx rol_zpx rla_zpx sec_imp and_aby nop_imp rla_aby plx_vt_imp and_abx rol_abx rla_abx rti_imp eor_idx kil_non sre_idx nop_zpg eor_zpg lsr_zpg sre_zpg pha_imp eor_imm lsr_acc asr_imm jmp_adr eor_aba lsr_aba sre_aba -bvc_rel eor_idy kil_non sre_idy nop_zpx eor_zpx lsr_zpx sre_zpx cli_imp eor_aby setdbk_vt_imp sre_aby nop_abx eor_abx lsr_abx sre_abx -rts_imp adc_idx kil_non rra_idx nop_zpg adc_zpg ror_zpg rra_zpg pla_imp adc_imm ror_acc arr_imm jmp_ind adc_aba ror_aba rra_aba -bvs_rel adc_idy kil_non rra_idy nop_zpx adc_zpx ror_zpx rra_zpx sei_imp adc_aby getdbk_vt_imp rra_aby nop_abx adc_abx ror_abx rra_abx +bvc_rel eor_idy kil_non sre_idy nop_zpx eor_zpx lsr_zpx sre_zpx cli_imp eor_aby vtsetdbk_imp sre_aby nop_abx eor_abx lsr_abx sre_abx +rts_imp adc_idx vtadcx_aba rra_idx nop_zpg adc_zpg ror_zpg rra_zpg pla_imp adc_imm ror_acc arr_imm jmp_ind adc_aba ror_aba rra_aba +bvs_rel adc_idy kil_non rra_idy nop_zpx adc_zpx ror_zpx rra_zpx sei_imp adc_aby vtgetdbk_imp rra_aby nop_abx adc_abx ror_abx rra_abx nop_imm sta_idx nop_imm sax_idx sty_zpg sta_zpg stx_zpg sax_zpg dey_imp nop_imm txa_imp ane_imm sty_aba sta_aba stx_aba sax_aba bcc_rel sta_idy kil_non sha_idy sty_zpx sta_zpx stx_zpy sax_zpy tya_imp sta_aby txs_imp shs_aby shy_abx sta_abx shx_aby sha_aby -ldy_imm lda_idx ldx_imm lax_idx ldy_zpg lda_zpg ldx_zpg readdbk2_vt_abx tay_imp lda_imm tax_imp lxa_imm ldy_aba lda_aba ldx_aba lax_aba -bcs_rel lda_idy kil_non lax_idy ldy_zpx lda_zpx ldx_zpy lax_zpy clv_imp lda_aby tsx_imp las_aby ldy_abx lda_abx ldx_aby readdbk_vt_abx +ldy_imm lda_idx ldx_imm lax_idx ldy_zpg lda_zpg ldx_zpg vtldabank2_abx tay_imp lda_imm tax_imp lxa_imm ldy_aba lda_aba ldx_aba lax_aba +bcs_rel lda_idy kil_non lax_idy ldy_zpx lda_zpx ldx_zpy lax_zpy clv_imp lda_aby tsx_imp las_aby ldy_abx lda_abx ldx_aby vtldabank_abx cpy_imm cmp_idx phx_vt_imp dcp_idx cpy_zpg cmp_zpg dec_zpg dcp_zpg iny_imp cmp_imm dex_imp sbx_imm cpy_aba cmp_aba dec_aba dcp_aba bne_rel cmp_idy phy_vt_imp dcp_idy nop_zpx cmp_zpx dec_zpx dcp_zpx cld_imp cmp_aby nop_imp dcp_aby nop_abx cmp_abx dec_abx dcp_abx cpx_imm sbc_idx nop_imm isb_idx cpx_zpg sbc_zpg inc_zpg isb_zpg inx_imp sbc_imm nop_imp sbc_imm cpx_aba sbc_aba inc_aba isb_aba diff --git a/src/devices/cpu/m6502/ovt3xx_spu.lst b/src/devices/cpu/m6502/ovt3xx_spu.lst index a9e81430c8c92..d05bfad2193c7 100644 --- a/src/devices/cpu/m6502/ovt3xx_spu.lst +++ b/src/devices/cpu/m6502/ovt3xx_spu.lst @@ -30,17 +30,17 @@ ply_vt_imp set_nz(Y); prefetch(); -getdbk_vt_imp +vtgetdbk_imp read_pc(); A = m_databank; prefetch(); -setdbk_vt_imp +vtsetdbk_imp read_pc(); m_databank = A; prefetch(); -readdbk_vt_abx +vtldabank_abx TMP = read_pc(); PC++; TMP2 = read_pc(); @@ -49,11 +49,20 @@ readdbk_vt_abx set_nz(A); prefetch(); -readdbk2_vt_abx - TMP = read_pc(); // this is currently the same as readdbk_vt_abx, it probably shouldn't be, maybe reads with highest exbus bit set to give 25 bits? +vtldabank2_abx + TMP = read_pc(); // this is currently the same as vtldabank_abx, it probably shouldn't be, maybe reads with highest exbus bit set to give 25 bits? PC++; TMP2 = read_pc(); PC++; A = m_extdata_space->read_byte(((m_databank << 16) | (TMP2 << 8) | TMP) + X); set_nz(A); prefetch(); + +vtadcx_aba + TMP = read_pc(); + PC++; + TMP2 = read_pc(); + PC++; + A = m_extdata_space->read_byte((TMP2 << 8) | TMP) + X; + set_nz(A); // other flags? + prefetch(); diff --git a/src/devices/cpu/m6502/vt3xx_spu.h b/src/devices/cpu/m6502/vt3xx_spu.h index 94357966fb0b0..2880cfc4cfd26 100644 --- a/src/devices/cpu/m6502/vt3xx_spu.h +++ b/src/devices/cpu/m6502/vt3xx_spu.h @@ -27,11 +27,12 @@ class vt3xx_spu_device : public m6502_device { O(plx_vt_imp); O(ply_vt_imp); - O(setdbk_vt_imp); - O(getdbk_vt_imp); + O(vtsetdbk_imp); + O(vtgetdbk_imp); - O(readdbk_vt_abx); - O(readdbk2_vt_abx); + O(vtldabank_abx); + O(vtldabank2_abx); + O(vtadcx_aba); #undef O From b4baf45d4d96d3164e120cee8ad6062c343ee9ec Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 19:19:20 +0100 Subject: [PATCH 06/35] fix build --- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index c44ed2d7c161b..6607411d92566 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -166,7 +166,7 @@ void nes_vt369_soc_device::vt369_sound_map(address_map &map) void nes_vt369_soc_device::vt369_sound_external_map(address_map &map) { - map(0x000000, 0xffffff).r(FUNC(sound_read_external)); + map(0x000000, 0xffffff).r(FUNC(nes_vt369_soc_device::sound_read_external)); } From 5faf6c5f0906b385a2fcc5b5bec18cb87be35971 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 19:45:22 +0100 Subject: [PATCH 07/35] more realistic opcode here, maybe not correct though --- src/devices/cpu/m6502/dvt3xx_spu.lst | 2 +- src/devices/cpu/m6502/ovt3xx_spu.lst | 8 +++----- src/devices/cpu/m6502/vt3xx_spu.h | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/devices/cpu/m6502/dvt3xx_spu.lst b/src/devices/cpu/m6502/dvt3xx_spu.lst index 8802e4b434a2e..d2ec444e553e9 100644 --- a/src/devices/cpu/m6502/dvt3xx_spu.lst +++ b/src/devices/cpu/m6502/dvt3xx_spu.lst @@ -11,7 +11,7 @@ rts_imp adc_idx vtadcx_aba rra_idx nop_zpg adc_zpg ror_z bvs_rel adc_idy kil_non rra_idy nop_zpx adc_zpx ror_zpx rra_zpx sei_imp adc_aby vtgetdbk_imp rra_aby nop_abx adc_abx ror_abx rra_abx nop_imm sta_idx nop_imm sax_idx sty_zpg sta_zpg stx_zpg sax_zpg dey_imp nop_imm txa_imp ane_imm sty_aba sta_aba stx_aba sax_aba bcc_rel sta_idy kil_non sha_idy sty_zpx sta_zpx stx_zpy sax_zpy tya_imp sta_aby txs_imp shs_aby shy_abx sta_abx shx_aby sha_aby -ldy_imm lda_idx ldx_imm lax_idx ldy_zpg lda_zpg ldx_zpg vtldabank2_abx tay_imp lda_imm tax_imp lxa_imm ldy_aba lda_aba ldx_aba lax_aba +ldy_imm lda_idx ldx_imm lax_idx ldy_zpg lda_zpg ldx_zpg vtldabank2_zpy tay_imp lda_imm tax_imp lxa_imm ldy_aba lda_aba ldx_aba lax_aba bcs_rel lda_idy kil_non lax_idy ldy_zpx lda_zpx ldx_zpy lax_zpy clv_imp lda_aby tsx_imp las_aby ldy_abx lda_abx ldx_aby vtldabank_abx cpy_imm cmp_idx phx_vt_imp dcp_idx cpy_zpg cmp_zpg dec_zpg dcp_zpg iny_imp cmp_imm dex_imp sbx_imm cpy_aba cmp_aba dec_aba dcp_aba bne_rel cmp_idy phy_vt_imp dcp_idy nop_zpx cmp_zpx dec_zpx dcp_zpx cld_imp cmp_aby nop_imp dcp_aby nop_abx cmp_abx dec_abx dcp_abx diff --git a/src/devices/cpu/m6502/ovt3xx_spu.lst b/src/devices/cpu/m6502/ovt3xx_spu.lst index d05bfad2193c7..7940cc03e7be0 100644 --- a/src/devices/cpu/m6502/ovt3xx_spu.lst +++ b/src/devices/cpu/m6502/ovt3xx_spu.lst @@ -49,12 +49,10 @@ vtldabank_abx set_nz(A); prefetch(); -vtldabank2_abx - TMP = read_pc(); // this is currently the same as vtldabank_abx, it probably shouldn't be, maybe reads with highest exbus bit set to give 25 bits? - PC++; - TMP2 = read_pc(); +vtldabank2_zpy + TMP = read_pc(); PC++; - A = m_extdata_space->read_byte(((m_databank << 16) | (TMP2 << 8) | TMP) + X); + A = m_extdata_space->read_byte(read(uint8_t(TMP+Y))); set_nz(A); prefetch(); diff --git a/src/devices/cpu/m6502/vt3xx_spu.h b/src/devices/cpu/m6502/vt3xx_spu.h index 2880cfc4cfd26..4872683b333cc 100644 --- a/src/devices/cpu/m6502/vt3xx_spu.h +++ b/src/devices/cpu/m6502/vt3xx_spu.h @@ -31,7 +31,7 @@ class vt3xx_spu_device : public m6502_device { O(vtgetdbk_imp); O(vtldabank_abx); - O(vtldabank2_abx); + O(vtldabank2_zpy); O(vtadcx_aba); #undef O From 63683c4e8225aae49ed95582ccf494db3d586ede Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 20:26:25 +0100 Subject: [PATCH 08/35] address notes for sound cpu --- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index 6607411d92566..562a41247cb2d 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -160,7 +160,13 @@ void nes_vt369_soc_device::vt369_sound_map(address_map &map) { map(0x0000, 0x17ff).ram(); map(0x1800, 0x1fff).ram().share("soundram"); - + //map(0x2100, 0x2103) // Timer Control (w) + //map(0x2205, 0x2206) // Adder Data(RAM) Address (w) + //map(0x2210, 0x2211) // Adder Result (r) + //map(0x2400, 0x2401) // Multiplier Data(RAM) Address (w) + //map(0x2402, 0x2403) // Multiplier Result (r) + //map(0x2404, 0x2404) // Multiplier Status (r) + //map(0x2800, 0x2803) // DAC (w) map(0xf800, 0xffff).ram().share("soundram"); // doesn't actually map here, the CPU fetches vectors from lower addressse } From be8c56e60705935faae9a2bf2e66312c97ef2103 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 21:12:02 +0100 Subject: [PATCH 09/35] reorganize some VT3xx code for later --- src/mame/nintendo/nes_vt369_vtunknown.cpp | 12 +- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 209 +++++++++--------- src/mame/nintendo/nes_vt369_vtunknown_soc.h | 44 ++-- 3 files changed, 137 insertions(+), 128 deletions(-) diff --git a/src/mame/nintendo/nes_vt369_vtunknown.cpp b/src/mame/nintendo/nes_vt369_vtunknown.cpp index ba44d1955fe0f..74d2d442c4256 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown.cpp @@ -396,7 +396,7 @@ void nes_vt369_vtunknown_cy_state::nes_vt369_vtunknown_cy(machine_config &config { nes_vt369_vtunknown_4k_ram(config); - NES_VTUNKNOWN_SOC_CY(config.replace(), m_soc, NTSC_APU_CLOCK); + VT3XX_SOC(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); } @@ -410,7 +410,7 @@ void nes_vt369_vtunknown_cy_state::nes_vt369_vtunknown_bt(machine_config &config { nes_vt369_vtunknown_4k_ram(config); - NES_VTUNKNOWN_SOC_BT(config.replace(), m_soc, NTSC_APU_CLOCK); + VT3XX_SOC_UNK_BT(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); } @@ -433,7 +433,7 @@ void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_unk(machine_config &conf { nes_vt369_vtunknown_4k_ram(config); - NES_VTUNKNOWN_SOC_DG(config.replace(), m_soc, NTSC_APU_CLOCK); + VT3XX_SOC_UNK_DG(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->force_bad_dma(); } @@ -469,7 +469,7 @@ void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_hh(machine_config &confi { nes_vt369_vtunknown_4k_ram(config); - NES_VT369_SOC(config.replace(), m_soc, NTSC_APU_CLOCK); + VT369_SOC_INTROM_NOSWAP(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_default_palette_mode(PAL_MODE_NEW_RGB); @@ -480,7 +480,7 @@ void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_hh_swap_8mb(machine_conf { nes_vt369_vtunknown_4k_ram(config); - NES_VT369_SOC_SWAP(config.replace(), m_soc, NTSC_APU_CLOCK); + VT369_SOC_INTROM_SWAP(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_default_palette_mode(PAL_MODE_NEW_RGB); @@ -584,7 +584,7 @@ void nes_vt369_vtunknown_dg_fapocket_state::nes_vt369_vtunknown_fa_4x16mb(machin { nes_vt369_vtunknown_4k_ram(config); - NES_VTUNKNOWN_SOC_FA(config.replace(), m_soc, NTSC_APU_CLOCK); + VT3XX_SOC_UNK_FA(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_dg_fapocket_state::vt_external_space_map_fapocket_4x16mbyte); diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index 562a41247cb2d..e774a1ccb7e16 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -6,58 +6,63 @@ // this has a new RGB555 mode -DEFINE_DEVICE_TYPE(NES_VT369_SOC, nes_vt369_alt_soc_device, "nes_vt369_soc", "VT369 series System on a Chip") -DEFINE_DEVICE_TYPE(NES_VT369_SOC_SWAP, nes_vt369_alt_swap_d5_d6_soc_device, "nes_vt369_soc_swap", "VT369 series System on a Chip (with opcode swapping)") +DEFINE_DEVICE_TYPE(VT369_SOC_INTROM_NOSWAP, vt369_soc_introm_noswap_device, "nes_vt369_soc", "VT369 series System on a Chip") +DEFINE_DEVICE_TYPE(VT369_SOC_INTROM_SWAP, vt369_soc_introm_swap_device, "nes_vt369_soc_swap", "VT369 series System on a Chip (with opcode swapping)") // uncertain -DEFINE_DEVICE_TYPE(NES_VTUNKNOWN_SOC_CY, nes_vt369_soc_device, "nes_vtunknown_soc_cy", "VTxx series System on a Chip (CY)") -DEFINE_DEVICE_TYPE(NES_VTUNKNOWN_SOC_BT, nes_vtunknown_soc_bt_device, "nes_vtunknown_soc_bt", "VTxx series System on a Chip (BT)") +DEFINE_DEVICE_TYPE(VT3XX_SOC, vt3xx_soc_base_device, "nes_vtunknown_soc_cy", "VT3xx series System on a Chip (CY)") +DEFINE_DEVICE_TYPE(VT3XX_SOC_UNK_BT, vt3xx_soc_unk_bt_device, "nes_vtunknown_soc_bt", "VT3xx series System on a Chip (BT)") -DEFINE_DEVICE_TYPE(NES_VTUNKNOWN_SOC_DG, nes_vtunknown_soc_dg_device, "nes_vtunknown_soc_dg", "VTxx series System on a Chip (DG)") -DEFINE_DEVICE_TYPE(NES_VTUNKNOWN_SOC_FA, nes_vtunknown_soc_fa_device, "nes_vtunknown_soc_fa", "VTxx series System on a Chip (Family Pocket)") +DEFINE_DEVICE_TYPE(VT3XX_SOC_UNK_DG, vt3xx_soc_unk_dg_device, "nes_vtunknown_soc_dg", "VT3xx series System on a Chip (DG)") +DEFINE_DEVICE_TYPE(VT3XX_SOC_UNK_FA, vt3xx_soc_unk_fa_device, "nes_vtunknown_soc_fa", "VT3xx series System on a Chip (Family Pocket)") -nes_vt369_soc_device::nes_vt369_soc_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : - nes_vt09_soc_device(mconfig, NES_VTUNKNOWN_SOC_CY, tag, owner, clock), +vt3xx_soc_base_device::vt3xx_soc_base_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : + vt3xx_soc_base_device(mconfig, VT3XX_SOC, tag, owner, clock) +{ +} + +vt3xx_soc_base_device::vt3xx_soc_base_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock) : + nes_vt09_soc_device(mconfig, type, tag, owner, clock), m_alu(*this, "alu"), m_soundcpu(*this, "soundcpu") { } -nes_vtunknown_soc_bt_device::nes_vtunknown_soc_bt_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : - nes_vt09_soc_device(mconfig, NES_VTUNKNOWN_SOC_BT, tag, owner, clock) +vt3xx_soc_unk_bt_device::vt3xx_soc_unk_bt_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : + vt3xx_soc_base_device(mconfig, VT3XX_SOC_UNK_BT, tag, owner, clock) { } -nes_vt369_alt_soc_device::nes_vt369_alt_soc_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock) : - nes_vt09_soc_device(mconfig, type, tag, owner, clock) +vt369_soc_introm_noswap_device::vt369_soc_introm_noswap_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock) : + vt3xx_soc_base_device(mconfig, type, tag, owner, clock) { } -nes_vt369_alt_soc_device::nes_vt369_alt_soc_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : - nes_vt369_alt_soc_device(mconfig, NES_VT369_SOC, tag, owner, clock) +vt369_soc_introm_noswap_device::vt369_soc_introm_noswap_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : + vt369_soc_introm_noswap_device(mconfig, VT369_SOC_INTROM_NOSWAP, tag, owner, clock) { } -nes_vt369_alt_swap_d5_d6_soc_device::nes_vt369_alt_swap_d5_d6_soc_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : - nes_vt369_alt_soc_device(mconfig, NES_VT369_SOC_SWAP, tag, owner, clock) +vt369_soc_introm_swap_device::vt369_soc_introm_swap_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : + vt369_soc_introm_noswap_device(mconfig, VT369_SOC_INTROM_SWAP, tag, owner, clock) { } -nes_vtunknown_soc_dg_device::nes_vtunknown_soc_dg_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock) : - nes_vt09_soc_device(mconfig, type, tag, owner, clock) +vt3xx_soc_unk_dg_device::vt3xx_soc_unk_dg_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock) : + vt3xx_soc_base_device(mconfig, type, tag, owner, clock) { } -nes_vtunknown_soc_dg_device::nes_vtunknown_soc_dg_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : - nes_vtunknown_soc_dg_device(mconfig, NES_VTUNKNOWN_SOC_DG, tag, owner, clock) +vt3xx_soc_unk_dg_device::vt3xx_soc_unk_dg_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : + vt3xx_soc_unk_dg_device(mconfig, VT3XX_SOC_UNK_DG, tag, owner, clock) { } -nes_vtunknown_soc_fa_device::nes_vtunknown_soc_fa_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : - nes_vtunknown_soc_dg_device(mconfig, NES_VTUNKNOWN_SOC_FA, tag, owner, clock) +vt3xx_soc_unk_fa_device::vt3xx_soc_unk_fa_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : + vt3xx_soc_unk_dg_device(mconfig, VT3XX_SOC_UNK_FA, tag, owner, clock) { } @@ -65,19 +70,19 @@ nes_vtunknown_soc_fa_device::nes_vtunknown_soc_fa_device(const machine_config& m /* VT369? */ /***********************************************************************************************************************************************************/ -void nes_vt369_soc_device::device_add_mconfig(machine_config& config) +void vt3xx_soc_base_device::device_add_mconfig(machine_config& config) { nes_vt02_vt03_soc_device::device_add_mconfig(config); - m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt369_soc_device::nes_vt369_map); + m_maincpu->set_addrmap(AS_PROGRAM, &vt3xx_soc_base_device::nes_vt369_map); VT_VT1682_ALU(config, m_alu, 0); VT3XX_SPU(config, m_soundcpu, RP2A03_NTSC_XTAL); - m_soundcpu->set_addrmap(AS_PROGRAM, &nes_vt369_soc_device::vt369_sound_map); - m_soundcpu->set_addrmap(5, &nes_vt369_soc_device::vt369_sound_external_map); + m_soundcpu->set_addrmap(AS_PROGRAM, &vt3xx_soc_base_device::vt369_sound_map); + m_soundcpu->set_addrmap(5, &vt3xx_soc_base_device::vt369_sound_external_map); } -void nes_vt369_soc_device::vt369_soundcpu_control_w(offs_t offset, uint8_t data) +void vt3xx_soc_base_device::vt369_soundcpu_control_w(offs_t offset, uint8_t data) { logerror("%s: write to sound cpu control reg (reset etc.) %02x\n", machine().describe_context(), data); @@ -87,14 +92,14 @@ void nes_vt369_soc_device::vt369_soundcpu_control_w(offs_t offset, uint8_t data) m_soundcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); } -void nes_vt369_soc_device::vt369_relative_w(offs_t offset, uint8_t data) +void vt3xx_soc_base_device::vt369_relative_w(offs_t offset, uint8_t data) { logerror("%s: vt369_relative_w %02x %02x\n", machine().describe_context(), offset, data); m_relative[offset] = data; } -void nes_vt369_soc_device::nes_vt369_map(address_map &map) +void vt3xx_soc_base_device::nes_vt369_map(address_map &map) { map(0x0000, 0x1fff).ram(); // 8k RAM? @@ -104,30 +109,30 @@ void nes_vt369_soc_device::nes_vt369_map(address_map &map) map(0x4000, 0x4017).w(m_apu, FUNC(nes_apu_vt_device::write)); - map(0x4014, 0x4014).w(FUNC(nes_vt369_soc_device::vt_dma_w)); + map(0x4014, 0x4014).w(FUNC(vt3xx_soc_base_device::vt_dma_w)); map(0x4015, 0x4015).r(m_apu, FUNC(nes_apu_vt_device::status_r)); // PSG status / first control register - map(0x4016, 0x4016).rw(FUNC(nes_vt369_soc_device::in0_r), FUNC(nes_vt369_soc_device::in0_w)); - map(0x4017, 0x4017).r(FUNC(nes_vt369_soc_device::in1_r)); + map(0x4016, 0x4016).rw(FUNC(vt3xx_soc_base_device::in0_r), FUNC(vt3xx_soc_base_device::in0_w)); + map(0x4017, 0x4017).r(FUNC(vt3xx_soc_base_device::in1_r)); - map(0x4034, 0x4034).w(FUNC(nes_vt369_soc_device::vt03_4034_w)); // secondary DMA + map(0x4034, 0x4034).w(FUNC(vt3xx_soc_base_device::vt03_4034_w)); // secondary DMA - map(0x4100, 0x410b).r(FUNC(nes_vt369_soc_device::vt03_410x_r)).w(FUNC(nes_vt369_soc_device::vt03_410x_w)); + map(0x4100, 0x410b).r(FUNC(vt3xx_soc_base_device::vt03_410x_r)).w(FUNC(vt3xx_soc_base_device::vt03_410x_w)); // 0x410c unused - map(0x410d, 0x410d).w(FUNC(nes_vt369_soc_device::extra_io_control_w)); - map(0x410e, 0x410e).rw(FUNC(nes_vt369_soc_device::extrain_01_r), FUNC(nes_vt369_soc_device::extraout_01_w)); - map(0x410f, 0x410f).rw(FUNC(nes_vt369_soc_device::extrain_23_r), FUNC(nes_vt369_soc_device::extraout_23_w)); + map(0x410d, 0x410d).w(FUNC(vt3xx_soc_base_device::extra_io_control_w)); + map(0x410e, 0x410e).rw(FUNC(vt3xx_soc_base_device::extrain_01_r), FUNC(vt3xx_soc_base_device::extraout_01_w)); + map(0x410f, 0x410f).rw(FUNC(vt3xx_soc_base_device::extrain_23_r), FUNC(vt3xx_soc_base_device::extraout_23_w)); - map(0x4112, 0x4112).w(FUNC(nes_vt369_soc_device::vt369_4112_bank6000_select_w)); + map(0x4112, 0x4112).w(FUNC(vt3xx_soc_base_device::vt369_4112_bank6000_select_w)); // 0x4114 RS232 timer (low) // 0x4115 RS232 timer (high) // 0x4116 unused // 0x4117 unused // 0x4118 unused - map(0x4119, 0x4119).r(FUNC(nes_vt369_soc_device::rs232flags_region_r)); + map(0x4119, 0x4119).r(FUNC(vt3xx_soc_base_device::rs232flags_region_r)); // 0x411a RS232 TX data // 0x411b RS232 RX data - map(0x411c, 0x411c).w(FUNC(nes_vt369_soc_device::vt369_411c_bank6000_enable_w)); + map(0x411c, 0x411c).w(FUNC(vt3xx_soc_base_device::vt369_411c_bank6000_enable_w)); map(0x4130, 0x4130).rw(m_alu, FUNC(vrt_vt1682_alu_device::alu_out_1_r), FUNC(vrt_vt1682_alu_device::alu_oprand_1_w)); map(0x4131, 0x4131).rw(m_alu, FUNC(vrt_vt1682_alu_device::alu_out_2_r), FUNC(vrt_vt1682_alu_device::alu_oprand_2_w)); @@ -138,25 +143,25 @@ void nes_vt369_soc_device::nes_vt369_map(address_map &map) map(0x4136, 0x4136).w(m_alu, FUNC(vrt_vt1682_alu_device::alu_oprand_5_div_w)); map(0x4137, 0x4137).w(m_alu, FUNC(vrt_vt1682_alu_device::alu_oprand_6_div_w)); - map(0x414f, 0x414f).r(FUNC(nes_vt369_soc_device::vt369_414f_r)); - map(0x415c, 0x415c).r(FUNC(nes_vt369_soc_device::vt369_415c_r)); + map(0x414f, 0x414f).r(FUNC(vt3xx_soc_base_device::vt369_414f_r)); + map(0x415c, 0x415c).r(FUNC(vt3xx_soc_base_device::vt369_415c_r)); - map(0x4160, 0x4161).w(FUNC(nes_vt369_soc_device::vt369_relative_w)); - map(0x4162, 0x4162).w(FUNC(nes_vt369_soc_device::vt369_soundcpu_control_w)); + map(0x4160, 0x4161).w(FUNC(vt3xx_soc_base_device::vt369_relative_w)); + map(0x4162, 0x4162).w(FUNC(vt3xx_soc_base_device::vt369_soundcpu_control_w)); - map(0x41b0, 0x41bf).r(FUNC(nes_vt369_soc_device::vt369_41bx_r)).w(FUNC(nes_vt369_soc_device::vt369_41bx_w)); + map(0x41b0, 0x41bf).r(FUNC(vt3xx_soc_base_device::vt369_41bx_r)).w(FUNC(vt3xx_soc_base_device::vt369_41bx_w)); -// map(0x48a0, 0x48af).r(FUNC(nes_vt369_soc_device::vt369_48ax_r)).w(FUNC(nes_vt369_soc_device::vt369_48ax_w)); +// map(0x48a0, 0x48af).r(FUNC(vt3xx_soc_base_device::vt369_48ax_r)).w(FUNC(vt3xx_soc_base_device::vt369_48ax_w)); map(0x4800, 0x4fff).ram().share("soundram"); // sound program for 2nd CPU is uploaded here, but some sets aren't uploading anything, do they rely on an internal ROM? other DMA? possibility to map ROM? - map(0x6000, 0x7fff).r(FUNC(nes_vt369_soc_device::vt369_6000_r)).w(FUNC(nes_vt369_soc_device::vt369_6000_w)); + map(0x6000, 0x7fff).r(FUNC(vt3xx_soc_base_device::vt369_6000_r)).w(FUNC(vt3xx_soc_base_device::vt369_6000_w)); - map(0x8000, 0xffff).rw(FUNC(nes_vt369_soc_device::external_space_read), FUNC(nes_vt369_soc_device::external_space_write)); + map(0x8000, 0xffff).rw(FUNC(vt3xx_soc_base_device::external_space_read), FUNC(vt3xx_soc_base_device::external_space_write)); } -void nes_vt369_soc_device::vt369_sound_map(address_map &map) +void vt3xx_soc_base_device::vt369_sound_map(address_map &map) { map(0x0000, 0x17ff).ram(); map(0x1800, 0x1fff).ram().share("soundram"); @@ -170,20 +175,20 @@ void nes_vt369_soc_device::vt369_sound_map(address_map &map) map(0xf800, 0xffff).ram().share("soundram"); // doesn't actually map here, the CPU fetches vectors from lower addressse } -void nes_vt369_soc_device::vt369_sound_external_map(address_map &map) +void vt3xx_soc_base_device::vt369_sound_external_map(address_map &map) { - map(0x000000, 0xffffff).r(FUNC(nes_vt369_soc_device::sound_read_external)); + map(0x000000, 0xffffff).r(FUNC(vt3xx_soc_base_device::sound_read_external)); } -void nes_vt369_soc_device::vt369_411c_bank6000_enable_w(offs_t offset, uint8_t data) +void vt3xx_soc_base_device::vt369_411c_bank6000_enable_w(offs_t offset, uint8_t data) { logerror("enable bank at 0x6000 (%02x)\n", data); m_bank6000_enable = data; } -void nes_vt369_soc_device::vt369_4112_bank6000_select_w(offs_t offset, uint8_t data) +void vt3xx_soc_base_device::vt369_4112_bank6000_select_w(offs_t offset, uint8_t data) { logerror("set bank at 0x6000 to %02x\n", data); m_bank6000 = data; @@ -192,7 +197,7 @@ void nes_vt369_soc_device::vt369_4112_bank6000_select_w(offs_t offset, uint8_t d } -uint8_t nes_vt369_soc_device::vt369_6000_r(offs_t offset) +uint8_t vt3xx_soc_base_device::vt369_6000_r(offs_t offset) { if (m_bank6000_enable & 0x40) { @@ -206,7 +211,7 @@ uint8_t nes_vt369_soc_device::vt369_6000_r(offs_t offset) } } -void nes_vt369_soc_device::vt369_6000_w(offs_t offset, uint8_t data) +void vt3xx_soc_base_device::vt369_6000_w(offs_t offset, uint8_t data) { if (m_bank6000_enable & 0x40) { @@ -219,7 +224,7 @@ void nes_vt369_soc_device::vt369_6000_w(offs_t offset, uint8_t data) } -void nes_vt369_soc_device::device_start() +void vt3xx_soc_base_device::device_start() { nes_vt02_vt03_soc_device::device_start(); @@ -234,14 +239,14 @@ void nes_vt369_soc_device::device_start() save_item(NAME(m_relative)); } -void nes_vt369_soc_device::device_reset() +void vt3xx_soc_base_device::device_reset() { nes_vt02_vt03_soc_device::device_reset(); m_soundcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); } -uint8_t nes_vt369_soc_device::vt369_41bx_r(offs_t offset) +uint8_t vt3xx_soc_base_device::vt369_41bx_r(offs_t offset) { switch (offset) { @@ -252,29 +257,29 @@ uint8_t nes_vt369_soc_device::vt369_41bx_r(offs_t offset) } } -void nes_vt369_soc_device::vt369_41bx_w(offs_t offset, uint8_t data) +void vt3xx_soc_base_device::vt369_41bx_w(offs_t offset, uint8_t data) { logerror("vt369_41bx_w %02x %02x\n", offset, data); } -uint8_t nes_vt369_soc_device::vt369_414f_r() +uint8_t vt3xx_soc_base_device::vt369_414f_r() { return 0xff; } -uint8_t nes_vt369_soc_device::vt369_415c_r() +uint8_t vt3xx_soc_base_device::vt369_415c_r() { return 0xff; } -void nes_vt369_soc_device::vt369_48ax_w(offs_t offset, uint8_t data) +void vt3xx_soc_base_device::vt369_48ax_w(offs_t offset, uint8_t data) { logerror("vt369_48ax_w %02x %02x\n", offset, data); } -uint8_t nes_vt369_soc_device::vt369_48ax_r(offs_t offset) +uint8_t vt3xx_soc_base_device::vt369_48ax_r(offs_t offset) { switch (offset) { @@ -291,13 +296,13 @@ uint8_t nes_vt369_soc_device::vt369_48ax_r(offs_t offset) /* this might just be the same as vt369 but with the games not using all features */ /***********************************************************************************************************************************************************/ -void nes_vt369_alt_soc_device::device_add_mconfig(machine_config& config) +void vt369_soc_introm_noswap_device::device_add_mconfig(machine_config& config) { - nes_vt02_vt03_soc_device::device_add_mconfig(config); - m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt369_alt_soc_device::nes_vt_hh_map); + vt3xx_soc_base_device::device_add_mconfig(config); + m_maincpu->set_addrmap(AS_PROGRAM, &vt369_soc_introm_noswap_device::nes_vt_hh_map); } -void nes_vt369_alt_soc_device::vtfp_411d_w(uint8_t data) +void vt369_soc_introm_noswap_device::vtfp_411d_w(uint8_t data) { // controls chram access and mapper emulation modes in later models logerror("vtfp_411d_w %02x\n", data); @@ -305,32 +310,32 @@ void nes_vt369_alt_soc_device::vtfp_411d_w(uint8_t data) update_banks(); } -uint8_t nes_vt369_alt_soc_device::vthh_414a_r() +uint8_t vt369_soc_introm_noswap_device::vthh_414a_r() { return 0x80; } -uint8_t nes_vt369_alt_soc_device::extra_rom_r() +uint8_t vt369_soc_introm_noswap_device::extra_rom_r() { // this reads from the 'extra ROM' area (serial style protocol) and code is copied on gtct885 to e00 in RAM, jumps to it at EDF9: jsr $0e1c return machine().rand(); } -void nes_vt369_alt_soc_device::nes_vt_hh_map(address_map &map) +void vt369_soc_introm_noswap_device::nes_vt_hh_map(address_map &map) { nes_vt02_vt03_soc_device::nes_vt_map(map); map(0x0000, 0x1fff).mask(0x0fff).ram(); - map(0x414a, 0x414a).r(FUNC(nes_vt369_alt_soc_device::vthh_414a_r)); - map(0x411d, 0x411d).w(FUNC(nes_vt369_alt_soc_device::vtfp_411d_w)); + map(0x414a, 0x414a).r(FUNC(vt369_soc_introm_noswap_device::vthh_414a_r)); + map(0x411d, 0x411d).w(FUNC(vt369_soc_introm_noswap_device::vtfp_411d_w)); - map(0x4153, 0x4153).r(FUNC(nes_vt369_alt_soc_device::extra_rom_r)); // extra SPI? / SEEPROM port? + map(0x4153, 0x4153).r(FUNC(vt369_soc_introm_noswap_device::extra_rom_r)); // extra SPI? / SEEPROM port? } -void nes_vt369_alt_swap_d5_d6_soc_device::encryption_4169_w(uint8_t data) +void vt369_soc_introm_swap_device::encryption_4169_w(uint8_t data) { if (data == 0x01) downcast(*m_maincpu).set_encryption_state(false); @@ -340,65 +345,65 @@ void nes_vt369_alt_swap_d5_d6_soc_device::encryption_4169_w(uint8_t data) logerror("%s: encryption_4169_w %02x\n", machine().describe_context(), data); } -void nes_vt369_alt_swap_d5_d6_soc_device::nes_vt_hh_swap_map(address_map &map) +void vt369_soc_introm_swap_device::nes_vt_hh_swap_map(address_map &map) { - nes_vt369_alt_soc_device::nes_vt_hh_map(map); + vt369_soc_introm_noswap_device::nes_vt_hh_map(map); - map(0x4169, 0x4169).w(FUNC(nes_vt369_alt_swap_d5_d6_soc_device::encryption_4169_w)); + map(0x4169, 0x4169).w(FUNC(vt369_soc_introm_swap_device::encryption_4169_w)); } -void nes_vt369_alt_swap_d5_d6_soc_device::device_add_mconfig(machine_config& config) +void vt369_soc_introm_swap_device::device_add_mconfig(machine_config& config) { - nes_vt02_vt03_soc_device::device_add_mconfig(config); + vt3xx_soc_base_device::device_add_mconfig(config); RP2A03_CORE_SWAP_OP_D5_D6(config.replace(), m_maincpu, NTSC_APU_CLOCK); - m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt369_alt_swap_d5_d6_soc_device::nes_vt_hh_swap_map); + m_maincpu->set_addrmap(AS_PROGRAM, &vt369_soc_introm_swap_device::nes_vt_hh_swap_map); } /***********************************************************************************************************************************************************/ /* this might also just be the same as vt369 but with the games not using all features */ /***********************************************************************************************************************************************************/ -void nes_vtunknown_soc_dg_device::device_add_mconfig(machine_config& config) +void vt3xx_soc_unk_dg_device::device_add_mconfig(machine_config& config) { - nes_vt02_vt03_soc_device::device_add_mconfig(config); - m_maincpu->set_addrmap(AS_PROGRAM, &nes_vtunknown_soc_dg_device::nes_vt_dg_map); + vt3xx_soc_base_device::device_add_mconfig(config); + m_maincpu->set_addrmap(AS_PROGRAM, &vt3xx_soc_unk_dg_device::nes_vt_dg_map); } -void nes_vtunknown_soc_dg_device::vt03_411c_w(uint8_t data) +void vt3xx_soc_unk_dg_device::vt03_411c_w(uint8_t data) { logerror("vt03_411c_w %02x\n", data); m_411c = data; update_banks(); } -void nes_vtunknown_soc_dg_device::nes_vt_dg_map(address_map &map) +void vt3xx_soc_unk_dg_device::nes_vt_dg_map(address_map &map) { nes_vt02_vt03_soc_device::nes_vt_map(map); map(0x0000, 0x1fff).ram(); - map(0x411c, 0x411c).w(FUNC(nes_vtunknown_soc_dg_device::vt03_411c_w)); + map(0x411c, 0x411c).w(FUNC(vt3xx_soc_unk_dg_device::vt03_411c_w)); } /***********************************************************************************************************************************************************/ /* 'BT' specifics (base = '4K') */ /***********************************************************************************************************************************************************/ -void nes_vtunknown_soc_bt_device::device_add_mconfig(machine_config& config) +void vt3xx_soc_unk_bt_device::device_add_mconfig(machine_config& config) { - nes_vt02_vt03_soc_device::device_add_mconfig(config); - m_maincpu->set_addrmap(AS_PROGRAM, &nes_vtunknown_soc_bt_device::nes_vt_bt_map); + vt3xx_soc_base_device::device_add_mconfig(config); + m_maincpu->set_addrmap(AS_PROGRAM, &vt3xx_soc_unk_bt_device::nes_vt_bt_map); } -void nes_vtunknown_soc_bt_device::nes_vt_bt_map(address_map &map) +void vt3xx_soc_unk_bt_device::nes_vt_bt_map(address_map &map) { nes_vt_4k_ram_map(map); - map(0x412c, 0x412c).w(FUNC(nes_vtunknown_soc_bt_device::vt03_412c_extbank_w)); + map(0x412c, 0x412c).w(FUNC(vt3xx_soc_unk_bt_device::vt03_412c_extbank_w)); } -void nes_vtunknown_soc_bt_device::vt03_412c_extbank_w(uint8_t data) +void vt3xx_soc_unk_bt_device::vt03_412c_extbank_w(uint8_t data) { m_upper_write_412c_callback(data); } @@ -408,34 +413,34 @@ void nes_vtunknown_soc_bt_device::vt03_412c_extbank_w(uint8_t data) /* 'FA' specifics (base = 'DG') */ // used by fapocket /***********************************************************************************************************************************************************/ -void nes_vtunknown_soc_fa_device::device_add_mconfig(machine_config& config) +void vt3xx_soc_unk_fa_device::device_add_mconfig(machine_config& config) { - nes_vt02_vt03_soc_device::device_add_mconfig(config); - m_maincpu->set_addrmap(AS_PROGRAM, &nes_vtunknown_soc_fa_device::nes_vt_fa_map); + vt3xx_soc_base_device::device_add_mconfig(config); + m_maincpu->set_addrmap(AS_PROGRAM, &vt3xx_soc_unk_fa_device::nes_vt_fa_map); } -uint8_t nes_vtunknown_soc_fa_device::vtfa_412c_r() +uint8_t vt3xx_soc_unk_fa_device::vtfa_412c_r() { return m_upper_read_412c_callback(); } -void nes_vtunknown_soc_fa_device::vtfa_412c_extbank_w(uint8_t data) +void vt3xx_soc_unk_fa_device::vtfa_412c_extbank_w(uint8_t data) { m_upper_write_412c_callback(data); } -void nes_vtunknown_soc_fa_device::vtfp_4242_w(uint8_t data) +void vt3xx_soc_unk_fa_device::vtfp_4242_w(uint8_t data) { logerror("vtfp_4242_w %02x\n", data); m_4242 = data; } -void nes_vtunknown_soc_fa_device::nes_vt_fa_map(address_map &map) +void vt3xx_soc_unk_fa_device::nes_vt_fa_map(address_map &map) { - nes_vtunknown_soc_dg_device::nes_vt_dg_map(map); + vt3xx_soc_unk_dg_device::nes_vt_dg_map(map); - map(0x412c, 0x412c).r(FUNC(nes_vtunknown_soc_fa_device::vtfa_412c_r)).w(FUNC(nes_vtunknown_soc_fa_device::vtfa_412c_extbank_w)); - map(0x4242, 0x4242).w(FUNC(nes_vtunknown_soc_fa_device::vtfp_4242_w)); + map(0x412c, 0x412c).r(FUNC(vt3xx_soc_unk_fa_device::vtfa_412c_r)).w(FUNC(vt3xx_soc_unk_fa_device::vtfa_412c_extbank_w)); + map(0x4242, 0x4242).w(FUNC(vt3xx_soc_unk_fa_device::vtfp_4242_w)); } diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.h b/src/mame/nintendo/nes_vt369_vtunknown_soc.h index a305c3263b4bc..a9592621630d3 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.h +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.h @@ -15,12 +15,14 @@ #include "screen.h" #include "speaker.h" -class nes_vt369_soc_device : public nes_vt09_soc_device +class vt3xx_soc_base_device : public nes_vt09_soc_device { public: - nes_vt369_soc_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); + vt3xx_soc_base_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); protected: + vt3xx_soc_base_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock); + virtual void device_add_mconfig(machine_config& config) override; void device_start() override ATTR_COLD; void device_reset() override ATTR_COLD; @@ -58,10 +60,10 @@ class nes_vt369_soc_device : public nes_vt09_soc_device uint8_t m_bank6000_enable = 0; }; -class nes_vtunknown_soc_bt_device : public nes_vt09_soc_device +class vt3xx_soc_unk_bt_device : public vt3xx_soc_base_device { public: - nes_vtunknown_soc_bt_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); + vt3xx_soc_unk_bt_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); protected: virtual void device_add_mconfig(machine_config& config) override; @@ -71,13 +73,13 @@ class nes_vtunknown_soc_bt_device : public nes_vt09_soc_device void vt03_412c_extbank_w(uint8_t data); }; -class nes_vt369_alt_soc_device : public nes_vt09_soc_device +class vt369_soc_introm_noswap_device : public vt3xx_soc_base_device { public: - nes_vt369_alt_soc_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); + vt369_soc_introm_noswap_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); protected: - nes_vt369_alt_soc_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock); + vt369_soc_introm_noswap_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock); virtual void device_add_mconfig(machine_config& config) override; @@ -88,10 +90,10 @@ class nes_vt369_alt_soc_device : public nes_vt09_soc_device void vtfp_411d_w(uint8_t data); }; -class nes_vt369_alt_swap_d5_d6_soc_device : public nes_vt369_alt_soc_device +class vt369_soc_introm_swap_device : public vt369_soc_introm_noswap_device { public: - nes_vt369_alt_swap_d5_d6_soc_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); + vt369_soc_introm_swap_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); virtual void device_add_mconfig(machine_config& config) override; @@ -101,13 +103,13 @@ class nes_vt369_alt_swap_d5_d6_soc_device : public nes_vt369_alt_soc_device }; -class nes_vtunknown_soc_dg_device : public nes_vt09_soc_device +class vt3xx_soc_unk_dg_device : public vt3xx_soc_base_device { public: - nes_vtunknown_soc_dg_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); + vt3xx_soc_unk_dg_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); protected: - nes_vtunknown_soc_dg_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock); + vt3xx_soc_unk_dg_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock); virtual void device_add_mconfig(machine_config& config) override; @@ -116,10 +118,10 @@ class nes_vtunknown_soc_dg_device : public nes_vt09_soc_device void vt03_411c_w(uint8_t data); }; -class nes_vtunknown_soc_fa_device : public nes_vtunknown_soc_dg_device +class vt3xx_soc_unk_fa_device : public vt3xx_soc_unk_dg_device { public: - nes_vtunknown_soc_fa_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); + vt3xx_soc_unk_fa_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); protected: @@ -133,12 +135,14 @@ class nes_vtunknown_soc_fa_device : public nes_vtunknown_soc_dg_device }; -DECLARE_DEVICE_TYPE(NES_VTUNKNOWN_SOC_CY, nes_vt369_soc_device) -DECLARE_DEVICE_TYPE(NES_VTUNKNOWN_SOC_BT, nes_vtunknown_soc_bt_device) -DECLARE_DEVICE_TYPE(NES_VT369_SOC, nes_vt369_alt_soc_device) -DECLARE_DEVICE_TYPE(NES_VT369_SOC_SWAP, nes_vt369_alt_swap_d5_d6_soc_device) +DECLARE_DEVICE_TYPE(VT3XX_SOC, vt3xx_soc_base_device) + +DECLARE_DEVICE_TYPE(VT369_SOC_INTROM_NOSWAP, vt369_soc_introm_noswap_device) +DECLARE_DEVICE_TYPE(VT369_SOC_INTROM_SWAP, vt369_soc_introm_swap_device) + +DECLARE_DEVICE_TYPE(VT3XX_SOC_UNK_BT, vt3xx_soc_unk_bt_device) -DECLARE_DEVICE_TYPE(NES_VTUNKNOWN_SOC_DG, nes_vtunknown_soc_dg_device) -DECLARE_DEVICE_TYPE(NES_VTUNKNOWN_SOC_FA, nes_vtunknown_soc_fa_device) +DECLARE_DEVICE_TYPE(VT3XX_SOC_UNK_DG, vt3xx_soc_unk_dg_device) +DECLARE_DEVICE_TYPE(VT3XX_SOC_UNK_FA, vt3xx_soc_unk_fa_device) #endif // MAME_NINTENDO_NES_VT369_VTUNKNOWN_SOC_H From fbc13972cba0e83bf2670fa7a7db52851a4ca824 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 21:46:25 +0100 Subject: [PATCH 10/35] allow default encryption state to be changed --- src/mame/nintendo/m6502_swap_op_d5_d6.cpp | 7 ++++--- src/mame/nintendo/m6502_swap_op_d5_d6.h | 5 +++++ src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 8 ++++++++ src/mame/nintendo/nes_vt369_vtunknown_soc.h | 1 + 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/mame/nintendo/m6502_swap_op_d5_d6.cpp b/src/mame/nintendo/m6502_swap_op_d5_d6.cpp index 90616b793968d..d32e0201b660b 100644 --- a/src/mame/nintendo/m6502_swap_op_d5_d6.cpp +++ b/src/mame/nintendo/m6502_swap_op_d5_d6.cpp @@ -18,7 +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(RP2A03_CORE_SWAP_OP_D5_D6, rp2a03_core_swap_op_d5_d6, "rp2a03_core_swap_op_d5_d6", "RP2A03 core with swapped D5/D6") +DEFINE_DEVICE_TYPE(RP2A03_CORE_SWAP_OP_D5_D6, rp2a03_core_swap_op_d5_d6, "rp2a03_core_swap_op_d5_d6", "RP2A03 core with optional 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) @@ -83,7 +83,8 @@ u8 m6502_swap_op_d5_d6::disassembler::decrypt8(u8 value, offs_t pc, bool opcode) rp2a03_core_swap_op_d5_d6::rp2a03_core_swap_op_d5_d6(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - rp2a03_core_device(mconfig, RP2A03_CORE_SWAP_OP_D5_D6, tag, owner, clock) + rp2a03_core_device(mconfig, RP2A03_CORE_SWAP_OP_D5_D6, tag, owner, clock), + m_encryption_enabled_on_reset(true) { } @@ -95,7 +96,7 @@ void rp2a03_core_swap_op_d5_d6::device_start() void rp2a03_core_swap_op_d5_d6::device_reset() { - downcast(*mintf).m_encryption_enabled = true; + downcast(*mintf).m_encryption_enabled = m_encryption_enabled_on_reset; rp2a03_core_device::device_reset(); } diff --git a/src/mame/nintendo/m6502_swap_op_d5_d6.h b/src/mame/nintendo/m6502_swap_op_d5_d6.h index b21ec63f97b3b..600548d194616 100644 --- a/src/mame/nintendo/m6502_swap_op_d5_d6.h +++ b/src/mame/nintendo/m6502_swap_op_d5_d6.h @@ -52,6 +52,8 @@ class rp2a03_core_swap_op_d5_d6 : public rp2a03_core_device { public: rp2a03_core_swap_op_d5_d6(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + void disable_encryption_on_reset() { m_encryption_enabled_on_reset = false; } + void set_encryption_state(bool state); protected: class mi_decrypt : public mi_default { @@ -78,6 +80,9 @@ class rp2a03_core_swap_op_d5_d6 : public rp2a03_core_device { virtual void device_reset() override ATTR_COLD; virtual void device_start() override ATTR_COLD; virtual std::unique_ptr create_disassembler() override; + +private: + bool m_encryption_enabled_on_reset; }; diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index e774a1ccb7e16..56897b032bc04 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -299,9 +299,17 @@ uint8_t vt3xx_soc_base_device::vt369_48ax_r(offs_t offset) void vt369_soc_introm_noswap_device::device_add_mconfig(machine_config& config) { vt3xx_soc_base_device::device_add_mconfig(config); + + RP2A03_CORE_SWAP_OP_D5_D6(config.replace(), m_maincpu, NTSC_APU_CLOCK); m_maincpu->set_addrmap(AS_PROGRAM, &vt369_soc_introm_noswap_device::nes_vt_hh_map); } +void vt369_soc_introm_noswap_device::device_start() +{ + vt3xx_soc_base_device::device_start(); + downcast(*m_maincpu).disable_encryption_on_reset(); +} + void vt369_soc_introm_noswap_device::vtfp_411d_w(uint8_t data) { // controls chram access and mapper emulation modes in later models diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.h b/src/mame/nintendo/nes_vt369_vtunknown_soc.h index a9592621630d3..e42d06f5232e9 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.h +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.h @@ -81,6 +81,7 @@ class vt369_soc_introm_noswap_device : public vt3xx_soc_base_device protected: vt369_soc_introm_noswap_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock); + virtual void device_start() override; virtual void device_add_mconfig(machine_config& config) override; void nes_vt_hh_map(address_map &map) ATTR_COLD; From aae86979d9573d815b6caea9dbe87b0caa4ac662 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 22:16:29 +0100 Subject: [PATCH 11/35] small reshuffle --- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 45 +++++++++---------- src/mame/nintendo/nes_vt369_vtunknown_soc.h | 10 ++--- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index 56897b032bc04..b9620296c577e 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -308,6 +308,13 @@ void vt369_soc_introm_noswap_device::device_start() { vt3xx_soc_base_device::device_start(); downcast(*m_maincpu).disable_encryption_on_reset(); + m_encryption_allowed = false; +} + +void vt369_soc_introm_swap_device::device_start() +{ + vt3xx_soc_base_device::device_start(); + m_encryption_allowed = true; } void vt369_soc_introm_noswap_device::vtfp_411d_w(uint8_t data) @@ -340,34 +347,26 @@ void vt369_soc_introm_noswap_device::nes_vt_hh_map(address_map &map) map(0x411d, 0x411d).w(FUNC(vt369_soc_introm_noswap_device::vtfp_411d_w)); map(0x4153, 0x4153).r(FUNC(vt369_soc_introm_noswap_device::extra_rom_r)); // extra SPI? / SEEPROM port? -} - -void vt369_soc_introm_swap_device::encryption_4169_w(uint8_t data) -{ - if (data == 0x01) - downcast(*m_maincpu).set_encryption_state(false); - else if (data == 0x00) - downcast(*m_maincpu).set_encryption_state(true); - else - logerror("%s: encryption_4169_w %02x\n", machine().describe_context(), data); + map(0x4169, 0x4169).w(FUNC(vt369_soc_introm_noswap_device::encryption_4169_w)); } -void vt369_soc_introm_swap_device::nes_vt_hh_swap_map(address_map &map) -{ - vt369_soc_introm_noswap_device::nes_vt_hh_map(map); - - map(0x4169, 0x4169).w(FUNC(vt369_soc_introm_swap_device::encryption_4169_w)); -} - - -void vt369_soc_introm_swap_device::device_add_mconfig(machine_config& config) +void vt369_soc_introm_noswap_device::encryption_4169_w(uint8_t data) { - vt3xx_soc_base_device::device_add_mconfig(config); - - RP2A03_CORE_SWAP_OP_D5_D6(config.replace(), m_maincpu, NTSC_APU_CLOCK); - m_maincpu->set_addrmap(AS_PROGRAM, &vt369_soc_introm_swap_device::nes_vt_hh_swap_map); + if (m_encryption_allowed) + { + if (data == 0x01) + downcast(*m_maincpu).set_encryption_state(false); + else if (data == 0x00) + downcast(*m_maincpu).set_encryption_state(true); + else + logerror("%s: encryption_4169_w %02x\n", machine().describe_context(), data); + } + else + { + logerror("%s: encryption_4169_w %02x on SoC with no support (check!)\n", machine().describe_context(), data); + } } /***********************************************************************************************************************************************************/ diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.h b/src/mame/nintendo/nes_vt369_vtunknown_soc.h index e42d06f5232e9..a8bdfa7fe8952 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.h +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.h @@ -89,6 +89,9 @@ class vt369_soc_introm_noswap_device : public vt3xx_soc_base_device uint8_t extra_rom_r(); uint8_t vthh_414a_r(); void vtfp_411d_w(uint8_t data); + void encryption_4169_w(uint8_t data); + + bool m_encryption_allowed; }; class vt369_soc_introm_swap_device : public vt369_soc_introm_noswap_device @@ -96,11 +99,8 @@ class vt369_soc_introm_swap_device : public vt369_soc_introm_noswap_device public: vt369_soc_introm_swap_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); - virtual void device_add_mconfig(machine_config& config) override; - -private: - void encryption_4169_w(uint8_t data); - void nes_vt_hh_swap_map(address_map &map) ATTR_COLD; +protected: + virtual void device_start() override; }; From efe00aa9b6e18338524c1cb051678890708ffa3c Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 22:33:49 +0100 Subject: [PATCH 12/35] move the internal SoC ROMs as they seem standard issue --- src/mame/nintendo/nes_vt369_vtunknown.cpp | 52 ++++++------------- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 39 ++++++++++---- src/mame/nintendo/nes_vt369_vtunknown_soc.h | 4 +- 3 files changed, 50 insertions(+), 45 deletions(-) diff --git a/src/mame/nintendo/nes_vt369_vtunknown.cpp b/src/mame/nintendo/nes_vt369_vtunknown.cpp index 74d2d442c4256..73dcb0db22d63 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown.cpp @@ -788,17 +788,11 @@ ROM_END ROM_START( lpgm240 ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "w25q64jv.u1", 0x00000, 0x800000, CRC(b973e65b) SHA1(36ff137068ea56b4679c2db386ac0067de0a9eaf) ) - - ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) ROM_END ROM_START( tup240 ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "mini_arcade240.bin", 0x00000, 0x800000, CRC(d4b4bf6c) SHA1(9cf4557e27bc8659079c62abdd22a311e1843047) ) - - ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) ROM_END ROM_START( sy889 ) @@ -850,34 +844,22 @@ ROM_END ROM_START( myarccn ) ROM_REGION( 0x100000, "mainrom", 0 ) ROM_LOAD( "my_arcade_caveman_ninja.bin", 0x00000, 0x100000, CRC(dcc5590c) SHA1(a734cb9c81e58346ff5fa934347d7cb24a32cb39) ) - - ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_END ROM_START( hkb502 ) ROM_REGION( 0x400000, "mainrom", 0 ) ROM_LOAD( "red console.bin", 0x00000, 0x400000, CRC(e4766383) SHA1(64b0c20592f38928b3a639fa42b468ff09664808) ) - - ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_END ROM_START( hkb502a ) ROM_REGION( 0x400000, "mainrom", 0 ) ROM_LOAD( "hkb-502.bin", 0x00000, 0x400000, CRC(970f54d2) SHA1(b45df00d85a2e29fe9418563927584a048db94b3) ) - - ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_END ROM_START( lxcap ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "lexibook_cyber_arcade_pocket.bin", 0x00000, 0x800000, CRC(245d0cd3) SHA1(d91cca2d0f99a6ca202fa9ba6d03587ea8af0cd9) ) - ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) - ROM_REGION( 0x100, "extra", 0 ) // data from additional 8-pin chip for protection ROM_LOAD( "mystery chip.bin", 0x00000, 0x100, CRC(491d206b) SHA1(a5411a7afe3b4df93b1b22e5533f5010bd3aaa93) ) ROM_END @@ -1001,30 +983,30 @@ CONS( 2017, fapocket, 0, 0, nes_vt369_vtunknown_fa_4x16mb, nes_vt369_v CONS( 2012, lexi30, 0,0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Arcade Center (JL1800_01)", MACHINE_NOT_WORKING ) // don't even get to menu. very enhanced chipset, VT368/9? -CONS( 2012, dgun2561, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "dreamGEAR", "My Arcade Portable Gaming System with 140 Games (DGUN-2561)", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme +CONS( 2012, dgun2561, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Portable Gaming System with 140 Games (DGUN-2561)", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme -CONS( 2012, lxccatv, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Compact Cyber Arcade TV - 120 in 1 (JL2370)", MACHINE_NOT_WORKING ) // 32MByte ROM, 2011 on case, 2012 on PCB +CONS( 2012, lxccatv, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade TV - 120 in 1 (JL2370)", MACHINE_NOT_WORKING ) // 32MByte ROM, 2011 on case, 2012 on PCB // All Lexibook units below have 64Mbyte ROMs, must be externally banked, or different addressing scheme -CONS( 200?, lxcmcy, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Compact Cyber Arcade", MACHINE_NOT_WORKING ) -CONS( 200?, lxcmc250, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Compact Cyber Arcade - 250-in-1 (JL2375)", MACHINE_NOT_WORKING ) -CONS( 200?, lxcmcysw, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Compact Cyber Arcade - Star Wars Rebels", MACHINE_NOT_WORKING ) -CONS( 200?, lxcmcyfz, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Compact Cyber Arcade - Frozen", MACHINE_NOT_WORKING ) -CONS( 200?, lxcmcydp, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Compact Cyber Arcade - Disney Princess", MACHINE_NOT_WORKING ) -CONS( 200?, lxcmcysp, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Compact Cyber Arcade - Marvel Ultimate Spider-Man", MACHINE_NOT_WORKING ) // is this the low-resolution pocket version? ROM structure is quite different -CONS( 200?, lxcmcycr, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Compact Cyber Arcade - Cars", MACHINE_NOT_WORKING ) -CONS( 200?, lxcmcypj, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Compact Cyber Arcade - PJ Masks", MACHINE_NOT_WORKING ) -CONS( 200?, lxcmcyba, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Compact Cyber Arcade - Barbie (JL2365BB)", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcy, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmc250, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - 250-in-1 (JL2375)", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcysw, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Star Wars Rebels", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcyfz, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Frozen", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcydp, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Disney Princess", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcysp, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Marvel Ultimate Spider-Man", MACHINE_NOT_WORKING ) // is this the low-resolution pocket version? ROM structure is quite different +CONS( 200?, lxcmcycr, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Cars", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcypj, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - PJ Masks", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcyba, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Barbie (JL2365BB)", MACHINE_NOT_WORKING ) // the data order is swapped for this one, maybe other internal differences? -CONS( 200?, lxcmcypp, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, init_lxcmcypp, "Lexibook", "Compact Cyber Arcade - Paw Patrol", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcypp, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, init_lxcmcypp, "Lexibook", "Compact Cyber Arcade - Paw Patrol", MACHINE_NOT_WORKING ) -CONS( 200?, lxccminn, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Console Colour - Minnie Mouse", MACHINE_NOT_WORKING ) -CONS( 200?, lxccplan, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Console Colour - Disney's Planes", MACHINE_NOT_WORKING ) +CONS( 200?, lxccminn, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Console Colour - Minnie Mouse", MACHINE_NOT_WORKING ) +CONS( 200?, lxccplan, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Console Colour - Disney's Planes", MACHINE_NOT_WORKING ) -CONS( 2020, lxpcsp, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Power Console - Marvel Spider-Man", MACHINE_NOT_WORKING ) +CONS( 2020, lxpcsp, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Power Console - Marvel Spider-Man", MACHINE_NOT_WORKING ) // GB-NO13-Main-VT389-2 on PCBs -CONS( 2016, rtvgc300, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Retro TV Game Console - 300 Games", MACHINE_NOT_WORKING ) -CONS( 2017, rtvgc300fz,0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Lexibook", "Retro TV Game Console - Frozen - 300 Games", MACHINE_NOT_WORKING ) +CONS( 2016, rtvgc300, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Retro TV Game Console - 300 Games", MACHINE_NOT_WORKING ) +CONS( 2017, rtvgc300fz,0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Retro TV Game Console - Frozen - 300 Games", MACHINE_NOT_WORKING ) /* The following are also confirmed to be NES/VT derived units, most having a standard set of games with a handful of lazy graphic mods thrown in to fit the unit theme diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index b9620296c577e..a99c8623a4c74 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -301,7 +301,7 @@ void vt369_soc_introm_noswap_device::device_add_mconfig(machine_config& config) vt3xx_soc_base_device::device_add_mconfig(config); RP2A03_CORE_SWAP_OP_D5_D6(config.replace(), m_maincpu, NTSC_APU_CLOCK); - m_maincpu->set_addrmap(AS_PROGRAM, &vt369_soc_introm_noswap_device::nes_vt_hh_map); + m_maincpu->set_addrmap(AS_PROGRAM, &vt369_soc_introm_noswap_device::nes_vt369_introm_map); } void vt369_soc_introm_noswap_device::device_start() @@ -311,12 +311,6 @@ void vt369_soc_introm_noswap_device::device_start() m_encryption_allowed = false; } -void vt369_soc_introm_swap_device::device_start() -{ - vt3xx_soc_base_device::device_start(); - m_encryption_allowed = true; -} - void vt369_soc_introm_noswap_device::vtfp_411d_w(uint8_t data) { // controls chram access and mapper emulation modes in later models @@ -337,11 +331,12 @@ uint8_t vt369_soc_introm_noswap_device::extra_rom_r() } -void vt369_soc_introm_noswap_device::nes_vt_hh_map(address_map &map) +void vt369_soc_introm_noswap_device::nes_vt369_introm_map(address_map &map) { nes_vt02_vt03_soc_device::nes_vt_map(map); - map(0x0000, 0x1fff).mask(0x0fff).ram(); + map(0x0000, 0x0fff).ram(); + map(0x1000, 0x1fff).rom().region("internal", 0); map(0x414a, 0x414a).r(FUNC(vt369_soc_introm_noswap_device::vthh_414a_r)); map(0x411d, 0x411d).w(FUNC(vt369_soc_introm_noswap_device::vtfp_411d_w)); @@ -369,6 +364,32 @@ void vt369_soc_introm_noswap_device::encryption_4169_w(uint8_t data) } } +ROM_START( vt3xx_noswap ) + ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) +ROM_END + +const tiny_rom_entry *vt369_soc_introm_noswap_device::device_rom_region() const +{ + return ROM_NAME( vt3xx_noswap ); +} + +void vt369_soc_introm_swap_device::device_start() +{ + vt3xx_soc_base_device::device_start(); + m_encryption_allowed = true; +} + +ROM_START( vt3xx_swap ) + ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) +ROM_END + +const tiny_rom_entry *vt369_soc_introm_swap_device::device_rom_region() const +{ + return ROM_NAME( vt3xx_swap ); +} + /***********************************************************************************************************************************************************/ /* this might also just be the same as vt369 but with the games not using all features */ /***********************************************************************************************************************************************************/ diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.h b/src/mame/nintendo/nes_vt369_vtunknown_soc.h index a8bdfa7fe8952..29403859ab2e5 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.h +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.h @@ -83,8 +83,9 @@ class vt369_soc_introm_noswap_device : public vt3xx_soc_base_device virtual void device_start() override; virtual void device_add_mconfig(machine_config& config) override; + virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; - void nes_vt_hh_map(address_map &map) ATTR_COLD; + void nes_vt369_introm_map(address_map &map) ATTR_COLD; uint8_t extra_rom_r(); uint8_t vthh_414a_r(); @@ -101,6 +102,7 @@ class vt369_soc_introm_swap_device : public vt369_soc_introm_noswap_device protected: virtual void device_start() override; + virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; }; From 5dee4b757fcf790753f84aa47022638fd56891e0 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 22:55:25 +0100 Subject: [PATCH 13/35] remove some dead code --- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 31 +++---------------- src/mame/nintendo/nes_vt369_vtunknown_soc.h | 3 -- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index a99c8623a4c74..493b9d637da88 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -151,7 +151,6 @@ void vt3xx_soc_base_device::nes_vt369_map(address_map &map) map(0x41b0, 0x41bf).r(FUNC(vt3xx_soc_base_device::vt369_41bx_r)).w(FUNC(vt3xx_soc_base_device::vt369_41bx_w)); -// map(0x48a0, 0x48af).r(FUNC(vt3xx_soc_base_device::vt369_48ax_r)).w(FUNC(vt3xx_soc_base_device::vt369_48ax_w)); map(0x4800, 0x4fff).ram().share("soundram"); // sound program for 2nd CPU is uploaded here, but some sets aren't uploading anything, do they rely on an internal ROM? other DMA? possibility to map ROM? map(0x6000, 0x7fff).r(FUNC(vt3xx_soc_base_device::vt369_6000_r)).w(FUNC(vt3xx_soc_base_device::vt369_6000_w)); @@ -273,25 +272,6 @@ uint8_t vt3xx_soc_base_device::vt369_415c_r() return 0xff; } - -void vt3xx_soc_base_device::vt369_48ax_w(offs_t offset, uint8_t data) -{ - logerror("vt369_48ax_w %02x %02x\n", offset, data); -} - -uint8_t vt3xx_soc_base_device::vt369_48ax_r(offs_t offset) -{ - switch (offset) - { - case 0x04: - return 0x01; - case 0x05: - return 0x01; - default: - return 0x00; - } -} - /***********************************************************************************************************************************************************/ /* this might just be the same as vt369 but with the games not using all features */ /***********************************************************************************************************************************************************/ @@ -333,7 +313,7 @@ uint8_t vt369_soc_introm_noswap_device::extra_rom_r() void vt369_soc_introm_noswap_device::nes_vt369_introm_map(address_map &map) { - nes_vt02_vt03_soc_device::nes_vt_map(map); + vt3xx_soc_base_device::nes_vt369_map(map); map(0x0000, 0x0fff).ram(); map(0x1000, 0x1fff).rom().region("internal", 0); @@ -409,9 +389,7 @@ void vt3xx_soc_unk_dg_device::vt03_411c_w(uint8_t data) void vt3xx_soc_unk_dg_device::nes_vt_dg_map(address_map &map) { - nes_vt02_vt03_soc_device::nes_vt_map(map); - - map(0x0000, 0x1fff).ram(); + vt3xx_soc_base_device::nes_vt369_map(map); map(0x411c, 0x411c).w(FUNC(vt3xx_soc_unk_dg_device::vt03_411c_w)); } @@ -427,7 +405,7 @@ void vt3xx_soc_unk_bt_device::device_add_mconfig(machine_config& config) void vt3xx_soc_unk_bt_device::nes_vt_bt_map(address_map &map) { - nes_vt_4k_ram_map(map); + vt3xx_soc_base_device::nes_vt369_map(map); map(0x412c, 0x412c).w(FUNC(vt3xx_soc_unk_bt_device::vt03_412c_extbank_w)); } @@ -466,8 +444,7 @@ void vt3xx_soc_unk_fa_device::vtfp_4242_w(uint8_t data) void vt3xx_soc_unk_fa_device::nes_vt_fa_map(address_map &map) { - vt3xx_soc_unk_dg_device::nes_vt_dg_map(map); - + vt3xx_soc_base_device::nes_vt369_map(map); map(0x412c, 0x412c).r(FUNC(vt3xx_soc_unk_fa_device::vtfa_412c_r)).w(FUNC(vt3xx_soc_unk_fa_device::vtfa_412c_extbank_w)); map(0x4242, 0x4242).w(FUNC(vt3xx_soc_unk_fa_device::vtfp_4242_w)); } diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.h b/src/mame/nintendo/nes_vt369_vtunknown_soc.h index 29403859ab2e5..c7ef599228ec8 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.h +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.h @@ -35,9 +35,6 @@ class vt3xx_soc_base_device : public nes_vt09_soc_device uint8_t vt369_414f_r(); uint8_t vt369_415c_r(); - void vt369_48ax_w(offs_t offset, uint8_t data); - uint8_t vt369_48ax_r(offs_t offset); - uint8_t vt369_6000_r(offs_t offset); void vt369_6000_w(offs_t offset, uint8_t data); From 5b34d558a126d0ed6d9c37a03a4bfe634db5d54a Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 23:43:04 +0100 Subject: [PATCH 14/35] actually don't move these to a device ROM yet, some of them look like they might be different still --- src/mame/nintendo/nes_vt369_vtunknown.cpp | 23 ++++++++++-- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 37 +++++++++---------- src/mame/nintendo/nes_vt369_vtunknown_soc.h | 4 +- 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/src/mame/nintendo/nes_vt369_vtunknown.cpp b/src/mame/nintendo/nes_vt369_vtunknown.cpp index 73dcb0db22d63..84edd1b3c1b99 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown.cpp @@ -788,11 +788,17 @@ ROM_END ROM_START( lpgm240 ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "w25q64jv.u1", 0x00000, 0x800000, CRC(b973e65b) SHA1(36ff137068ea56b4679c2db386ac0067de0a9eaf) ) + + ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) ROM_END ROM_START( tup240 ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "mini_arcade240.bin", 0x00000, 0x800000, CRC(d4b4bf6c) SHA1(9cf4557e27bc8659079c62abdd22a311e1843047) ) + + ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) ROM_END ROM_START( sy889 ) @@ -844,22 +850,34 @@ ROM_END ROM_START( myarccn ) ROM_REGION( 0x100000, "mainrom", 0 ) ROM_LOAD( "my_arcade_caveman_ninja.bin", 0x00000, 0x100000, CRC(dcc5590c) SHA1(a734cb9c81e58346ff5fa934347d7cb24a32cb39) ) + + ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_END ROM_START( hkb502 ) ROM_REGION( 0x400000, "mainrom", 0 ) ROM_LOAD( "red console.bin", 0x00000, 0x400000, CRC(e4766383) SHA1(64b0c20592f38928b3a639fa42b468ff09664808) ) + + ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_END ROM_START( hkb502a ) ROM_REGION( 0x400000, "mainrom", 0 ) ROM_LOAD( "hkb-502.bin", 0x00000, 0x400000, CRC(970f54d2) SHA1(b45df00d85a2e29fe9418563927584a048db94b3) ) + + ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_END ROM_START( lxcap ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "lexibook_cyber_arcade_pocket.bin", 0x00000, 0x800000, CRC(245d0cd3) SHA1(d91cca2d0f99a6ca202fa9ba6d03587ea8af0cd9) ) + ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) + ROM_REGION( 0x100, "extra", 0 ) // data from additional 8-pin chip for protection ROM_LOAD( "mystery chip.bin", 0x00000, 0x100, CRC(491d206b) SHA1(a5411a7afe3b4df93b1b22e5533f5010bd3aaa93) ) ROM_END @@ -1119,6 +1137,8 @@ CONS( 201?, rd5_240, 0, 0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtun CONS( 201?, hkb502, 0, 0, nes_vt369_vtunknown_hh_4mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "HKB-502 268-in-1 (set 1)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) CONS( 201?, hkb502a, hkb502, 0, nes_vt369_vtunknown_hh_4mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "HKB-502 268-in-1 (set 2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +// similar to above, fewer games in menu +CONS( 2021, unk128vt, 0, 0, nes_vt369_vtunknown_unk_4mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "unknown VT369 based 128-in-1 (GC31-369-20210702-V2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // uses a LCD with resolution of 160x128 (image scaled to fit for some games, others run natively at 160x128) // contains a protection chip, command 80 XX returns a byte @@ -1142,9 +1162,6 @@ CONS( 2021, pactin, 0, 0, nes_vt369_vtunknown_unk_1mb, nes_vt369_vtu CONS( 2021, tetrtin, 0, 0, nes_vt369_vtunknown_unk_1mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Fizz Creations", "Tetris Arcade in a Tin", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -// boots, has a lower resolution screen. menu is natively in low resolution, other games should be scaled down -CONS( 2021, unk128vt, 0, 0, nes_vt369_vtunknown_unk_4mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "unknown VT369 based 128-in-1 (GC31-369-20210702-V2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) - // uses a low res display like the above CONS( 2021, matet10, 0, 0, nes_vt369_vtunknown_unk_2mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (DGUNL-7083, Pixel Pocket, with 10 bonus games)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index 493b9d637da88..f02a279644988 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -36,7 +36,8 @@ vt3xx_soc_unk_bt_device::vt3xx_soc_unk_bt_device(const machine_config& mconfig, vt369_soc_introm_noswap_device::vt369_soc_introm_noswap_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock) : - vt3xx_soc_base_device(mconfig, type, tag, owner, clock) + vt3xx_soc_base_device(mconfig, type, tag, owner, clock), + m_internal_rom(*this, ":internal") { } @@ -310,13 +311,24 @@ uint8_t vt369_soc_introm_noswap_device::extra_rom_r() return machine().rand(); } +uint8_t vt369_soc_introm_noswap_device::read_internal(offs_t offset) +{ + if (!m_internal_rom) + { + if (!machine().side_effects_disabled()) + logerror("%s: read from internal ROM (offset %04x), but no internal ROM loaded\n", machine().describe_context(), offset); + return 0x00; + } + + return m_internal_rom[offset]; +} void vt369_soc_introm_noswap_device::nes_vt369_introm_map(address_map &map) { vt3xx_soc_base_device::nes_vt369_map(map); map(0x0000, 0x0fff).ram(); - map(0x1000, 0x1fff).rom().region("internal", 0); + map(0x1000, 0x1fff).r(FUNC(vt369_soc_introm_noswap_device::read_internal)); map(0x414a, 0x414a).r(FUNC(vt369_soc_introm_noswap_device::vthh_414a_r)); map(0x411d, 0x411d).w(FUNC(vt369_soc_introm_noswap_device::vtfp_411d_w)); @@ -344,31 +356,16 @@ void vt369_soc_introm_noswap_device::encryption_4169_w(uint8_t data) } } -ROM_START( vt3xx_noswap ) - ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) -ROM_END - -const tiny_rom_entry *vt369_soc_introm_noswap_device::device_rom_region() const -{ - return ROM_NAME( vt3xx_noswap ); -} - void vt369_soc_introm_swap_device::device_start() { vt3xx_soc_base_device::device_start(); m_encryption_allowed = true; } -ROM_START( vt3xx_swap ) - ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) -ROM_END -const tiny_rom_entry *vt369_soc_introm_swap_device::device_rom_region() const -{ - return ROM_NAME( vt3xx_swap ); -} + + + /***********************************************************************************************************************************************************/ /* this might also just be the same as vt369 but with the games not using all features */ diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.h b/src/mame/nintendo/nes_vt369_vtunknown_soc.h index c7ef599228ec8..c96341c058254 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.h +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.h @@ -80,7 +80,6 @@ class vt369_soc_introm_noswap_device : public vt3xx_soc_base_device virtual void device_start() override; virtual void device_add_mconfig(machine_config& config) override; - virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; void nes_vt369_introm_map(address_map &map) ATTR_COLD; @@ -88,7 +87,9 @@ class vt369_soc_introm_noswap_device : public vt3xx_soc_base_device uint8_t vthh_414a_r(); void vtfp_411d_w(uint8_t data); void encryption_4169_w(uint8_t data); + uint8_t read_internal(offs_t offset); + optional_region_ptr m_internal_rom; bool m_encryption_allowed; }; @@ -99,7 +100,6 @@ class vt369_soc_introm_swap_device : public vt369_soc_introm_noswap_device protected: virtual void device_start() override; - virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; }; From 0b9cffa60e52f327a0bdf4b8b4a0340f9642e377 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 23:47:55 +0100 Subject: [PATCH 15/35] drop some nes_ prefixes --- src/mame/nintendo/nes_vt369_vtunknown.cpp | 420 +++++++++--------- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 28 +- src/mame/nintendo/nes_vt369_vtunknown_soc.h | 4 +- 3 files changed, 226 insertions(+), 226 deletions(-) diff --git a/src/mame/nintendo/nes_vt369_vtunknown.cpp b/src/mame/nintendo/nes_vt369_vtunknown.cpp index 84edd1b3c1b99..3d388bdcea5cc 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown.cpp @@ -29,10 +29,10 @@ namespace { -class nes_vt369_vtunknown_base_state : public driver_device +class vt369_vtunknown_base_state : public driver_device { public: - nes_vt369_vtunknown_base_state(const machine_config& mconfig, device_type type, const char* tag) : + vt369_vtunknown_base_state(const machine_config& mconfig, device_type type, const char* tag) : driver_device(mconfig, type, tag), m_io0(*this, "IO0"), m_io1(*this, "IO1"), @@ -49,7 +49,7 @@ class nes_vt369_vtunknown_base_state : public driver_device virtual uint8_t in1_r(); virtual void in0_w(uint8_t data); - void nes_vt369_vtunknown_map(address_map &map) ATTR_COLD; + void vt369_vtunknown_map(address_map &map) ATTR_COLD; optional_ioport m_io0; optional_ioport m_io1; @@ -83,16 +83,16 @@ class nes_vt369_vtunknown_base_state : public driver_device template uint8_t extrain_r(); }; -class nes_vt369_vtunknown_state : public nes_vt369_vtunknown_base_state +class vt369_vtunknown_state : public vt369_vtunknown_base_state { public: - nes_vt369_vtunknown_state(const machine_config& mconfig, device_type type, const char* tag) : - nes_vt369_vtunknown_base_state(mconfig, type, tag), + vt369_vtunknown_state(const machine_config& mconfig, device_type type, const char* tag) : + vt369_vtunknown_base_state(mconfig, type, tag), m_soc(*this, "soc") { } - void nes_vt369_vtunknown_4k_ram(machine_config& config); - void nes_vt369_vtunknown_4k_ram_16mb(machine_config& config); + void vt369_vtunknown_4k_ram(machine_config& config); + void vt369_vtunknown_4k_ram_16mb(machine_config& config); void vt_external_space_map_32mbyte(address_map &map) ATTR_COLD; void vt_external_space_map_16mbyte(address_map &map) ATTR_COLD; @@ -108,17 +108,17 @@ class nes_vt369_vtunknown_state : public nes_vt369_vtunknown_base_state required_device m_soc; }; -class nes_vt369_vtunknown_cy_state : public nes_vt369_vtunknown_state +class vt369_vtunknown_cy_state : public vt369_vtunknown_state { public: - nes_vt369_vtunknown_cy_state(const machine_config& mconfig, device_type type, const char* tag) : - nes_vt369_vtunknown_state(mconfig, type, tag) + vt369_vtunknown_cy_state(const machine_config& mconfig, device_type type, const char* tag) : + vt369_vtunknown_state(mconfig, type, tag) { } - void nes_vt369_vtunknown_cy(machine_config& config); - void nes_vt369_vtunknown_cy_bigger(machine_config& config); - void nes_vt369_vtunknown_bt(machine_config& config); - void nes_vt369_vtunknown_bt_2x16mb(machine_config& config); + void vt369_vtunknown_cy(machine_config& config); + void vt369_vtunknown_cy_bigger(machine_config& config); + void vt369_vtunknown_bt(machine_config& config); + void vt369_vtunknown_bt_2x16mb(machine_config& config); void vt_external_space_map_bitboy_2x16mbyte(address_map &map) ATTR_COLD; @@ -131,14 +131,14 @@ class nes_vt369_vtunknown_cy_state : public nes_vt369_vtunknown_state -class nes_vt369_vtunknown_dg_fapocket_state : public nes_vt369_vtunknown_state +class vt369_vtunknown_dg_fapocket_state : public vt369_vtunknown_state { public: - nes_vt369_vtunknown_dg_fapocket_state(const machine_config& mconfig, device_type type, const char* tag) : - nes_vt369_vtunknown_state(mconfig, type, tag) + vt369_vtunknown_dg_fapocket_state(const machine_config& mconfig, device_type type, const char* tag) : + vt369_vtunknown_state(mconfig, type, tag) { } - void nes_vt369_vtunknown_fa_4x16mb(machine_config& config); + void vt369_vtunknown_fa_4x16mb(machine_config& config); protected: virtual void machine_reset() override ATTR_COLD; @@ -153,115 +153,115 @@ class nes_vt369_vtunknown_dg_fapocket_state : public nes_vt369_vtunknown_state }; -class nes_vt369_vtunknown_unk_state : public nes_vt369_vtunknown_state +class vt369_vtunknown_unk_state : public vt369_vtunknown_state { public: - nes_vt369_vtunknown_unk_state(const machine_config& mconfig, device_type type, const char* tag) : - nes_vt369_vtunknown_state(mconfig, type, tag) + vt369_vtunknown_unk_state(const machine_config& mconfig, device_type type, const char* tag) : + vt369_vtunknown_state(mconfig, type, tag) { } - void nes_vt369_vtunknown_hh(machine_config& config); - void nes_vt369_vtunknown_hh_1mb(machine_config& config); - void nes_vt369_vtunknown_hh_4mb(machine_config& config); - void nes_vt369_vtunknown_hh_8mb(machine_config& config); - void nes_vt369_vtunknown_hh_16mb(machine_config& config); + void vt369_vtunknown_hh(machine_config& config); + void vt369_vtunknown_hh_1mb(machine_config& config); + void vt369_vtunknown_hh_4mb(machine_config& config); + void vt369_vtunknown_hh_8mb(machine_config& config); + void vt369_vtunknown_hh_16mb(machine_config& config); - void nes_vt369_vtunknown_hh_swap_8mb(machine_config& config); + void vt369_vtunknown_hh_swap_8mb(machine_config& config); - void nes_vt369_vtunknown_unk(machine_config& config); - void nes_vt369_vtunknown_unk_1mb(machine_config& config); - void nes_vt369_vtunknown_unk_2mb(machine_config& config); - void nes_vt369_vtunknown_unk_4mb(machine_config& config); - void nes_vt369_vtunknown_unk_16mb(machine_config& config); + void vt369_vtunknown_unk(machine_config& config); + void vt369_vtunknown_unk_1mb(machine_config& config); + void vt369_vtunknown_unk_2mb(machine_config& config); + void vt369_vtunknown_unk_4mb(machine_config& config); + void vt369_vtunknown_unk_16mb(machine_config& config); - void nes_vt369_vtunknown_fp(machine_config& config); - void nes_vt369_vtunknown_fp_16mb(machine_config& config); + void vt369_vtunknown_fp(machine_config& config); + void vt369_vtunknown_fp_16mb(machine_config& config); private: uint8_t vt_rom_banked_r(offs_t offset); [[maybe_unused]] void vt_external_space_map_fp_2x32mbyte(address_map &map) ATTR_COLD; }; -uint8_t nes_vt369_vtunknown_base_state::vt_rom_r(offs_t offset) +uint8_t vt369_vtunknown_base_state::vt_rom_r(offs_t offset) { return m_prgrom[offset]; } -void nes_vt369_vtunknown_base_state::vtspace_w(offs_t offset, uint8_t data) +void vt369_vtunknown_base_state::vtspace_w(offs_t offset, uint8_t data) { logerror("%s: vtspace_w %08x : %02x", machine().describe_context(), offset, data); } // VTxx can address 25-bit address space (32MB of ROM) so use maps with mirroring in depending on ROM size -void nes_vt369_vtunknown_state::vt_external_space_map_32mbyte(address_map &map) +void vt369_vtunknown_state::vt_external_space_map_32mbyte(address_map &map) { - map(0x0000000, 0x1ffffff).r(FUNC(nes_vt369_vtunknown_state::vt_rom_r)); + map(0x0000000, 0x1ffffff).r(FUNC(vt369_vtunknown_state::vt_rom_r)); } -void nes_vt369_vtunknown_state::vt_external_space_map_16mbyte(address_map &map) +void vt369_vtunknown_state::vt_external_space_map_16mbyte(address_map &map) { - map(0x0000000, 0x0ffffff).mirror(0x1000000).r(FUNC(nes_vt369_vtunknown_state::vt_rom_r)); + map(0x0000000, 0x0ffffff).mirror(0x1000000).r(FUNC(vt369_vtunknown_state::vt_rom_r)); } -void nes_vt369_vtunknown_state::vt_external_space_map_8mbyte(address_map &map) +void vt369_vtunknown_state::vt_external_space_map_8mbyte(address_map &map) { - map(0x0000000, 0x07fffff).mirror(0x1800000).r(FUNC(nes_vt369_vtunknown_state::vt_rom_r)); + map(0x0000000, 0x07fffff).mirror(0x1800000).r(FUNC(vt369_vtunknown_state::vt_rom_r)); } -void nes_vt369_vtunknown_state::vt_external_space_map_4mbyte(address_map &map) +void vt369_vtunknown_state::vt_external_space_map_4mbyte(address_map &map) { - map(0x0000000, 0x03fffff).mirror(0x1c00000).r(FUNC(nes_vt369_vtunknown_state::vt_rom_r)); + map(0x0000000, 0x03fffff).mirror(0x1c00000).r(FUNC(vt369_vtunknown_state::vt_rom_r)); } -void nes_vt369_vtunknown_state::vt_external_space_map_2mbyte(address_map &map) +void vt369_vtunknown_state::vt_external_space_map_2mbyte(address_map &map) { - map(0x0000000, 0x01fffff).mirror(0x1e00000).r(FUNC(nes_vt369_vtunknown_state::vt_rom_r)); + map(0x0000000, 0x01fffff).mirror(0x1e00000).r(FUNC(vt369_vtunknown_state::vt_rom_r)); } -void nes_vt369_vtunknown_state::vt_external_space_map_1mbyte(address_map &map) +void vt369_vtunknown_state::vt_external_space_map_1mbyte(address_map &map) { - map(0x0000000, 0x00fffff).mirror(0x1f00000).r(FUNC(nes_vt369_vtunknown_state::vt_rom_r)); + map(0x0000000, 0x00fffff).mirror(0x1f00000).r(FUNC(vt369_vtunknown_state::vt_rom_r)); } -void nes_vt369_vtunknown_state::vt_external_space_map_512kbyte(address_map &map) +void vt369_vtunknown_state::vt_external_space_map_512kbyte(address_map &map) { - map(0x0000000, 0x007ffff).mirror(0x1f80000).r(FUNC(nes_vt369_vtunknown_state::vt_rom_r)); + map(0x0000000, 0x007ffff).mirror(0x1f80000).r(FUNC(vt369_vtunknown_state::vt_rom_r)); } // bitboy is 2 16Mbyte banks -uint8_t nes_vt369_vtunknown_cy_state::vt_rom_banked_r(offs_t offset) +uint8_t vt369_vtunknown_cy_state::vt_rom_banked_r(offs_t offset) { return m_prgrom[m_ahigh | offset]; } -void nes_vt369_vtunknown_cy_state::vt_external_space_map_bitboy_2x16mbyte(address_map &map) +void vt369_vtunknown_cy_state::vt_external_space_map_bitboy_2x16mbyte(address_map &map) { - map(0x0000000, 0x0ffffff).mirror(0x1000000).r(FUNC(nes_vt369_vtunknown_cy_state::vt_rom_banked_r)); + map(0x0000000, 0x0ffffff).mirror(0x1000000).r(FUNC(vt369_vtunknown_cy_state::vt_rom_banked_r)); } // fapocket is 4 16Mbyte banks -uint8_t nes_vt369_vtunknown_dg_fapocket_state::vt_rom_banked_r(offs_t offset) +uint8_t vt369_vtunknown_dg_fapocket_state::vt_rom_banked_r(offs_t offset) { return m_prgrom[m_ahigh | offset]; } -void nes_vt369_vtunknown_dg_fapocket_state::vt_external_space_map_fapocket_4x16mbyte(address_map &map) +void vt369_vtunknown_dg_fapocket_state::vt_external_space_map_fapocket_4x16mbyte(address_map &map) { - map(0x0000000, 0x0ffffff).mirror(0x1000000).r(FUNC(nes_vt369_vtunknown_dg_fapocket_state::vt_rom_banked_r)); + map(0x0000000, 0x0ffffff).mirror(0x1000000).r(FUNC(vt369_vtunknown_dg_fapocket_state::vt_rom_banked_r)); } -uint8_t nes_vt369_vtunknown_unk_state::vt_rom_banked_r(offs_t offset) +uint8_t vt369_vtunknown_unk_state::vt_rom_banked_r(offs_t offset) { return m_prgrom[m_ahigh | offset]; } -void nes_vt369_vtunknown_unk_state::vt_external_space_map_fp_2x32mbyte(address_map &map) +void vt369_vtunknown_unk_state::vt_external_space_map_fp_2x32mbyte(address_map &map) { - map(0x0000000, 0x1ffffff).r(FUNC(nes_vt369_vtunknown_unk_state::vt_rom_banked_r)); + map(0x0000000, 0x1ffffff).r(FUNC(vt369_vtunknown_unk_state::vt_rom_banked_r)); } -template uint8_t nes_vt369_vtunknown_base_state::extrain_r() +template uint8_t vt369_vtunknown_base_state::extrain_r() { if (m_exin[NUM]) return m_exin[NUM]->read(); @@ -275,7 +275,7 @@ template uint8_t nes_vt369_vtunknown_base_state::extrain_r() /* Standard I/O handlers (NES Controller clone) */ -uint8_t nes_vt369_vtunknown_base_state::in0_r() +uint8_t vt369_vtunknown_base_state::in0_r() { //logerror("%s: in0_r\n", machine().describe_context()); uint8_t ret = 0x40; @@ -284,7 +284,7 @@ uint8_t nes_vt369_vtunknown_base_state::in0_r() return ret; } -uint8_t nes_vt369_vtunknown_base_state::in1_r() +uint8_t vt369_vtunknown_base_state::in1_r() { //logerror("%s: in1_r\n", machine().describe_context()); uint8_t ret = 0x40; @@ -293,7 +293,7 @@ uint8_t nes_vt369_vtunknown_base_state::in1_r() return ret; } -void nes_vt369_vtunknown_base_state::in0_w(uint8_t data) +void vt369_vtunknown_base_state::in0_w(uint8_t data) { //logerror("%s: in0_w %02x\n", machine().describe_context(), data); if ((data & 0x01) != (m_previous_port0 & 0x01)) @@ -309,7 +309,7 @@ void nes_vt369_vtunknown_base_state::in0_w(uint8_t data) } -void nes_vt369_vtunknown_base_state::machine_start() +void vt369_vtunknown_base_state::machine_start() { m_latch0 = 0; m_latch1 = 0; @@ -330,14 +330,14 @@ void nes_vt369_vtunknown_base_state::machine_start() save_item(NAME(m_411d)); } -void nes_vt369_vtunknown_base_state::machine_reset() +void vt369_vtunknown_base_state::machine_reset() { } -void nes_vt369_vtunknown_dg_fapocket_state::machine_reset() +void vt369_vtunknown_dg_fapocket_state::machine_reset() { - nes_vt369_vtunknown_base_state::machine_reset(); + vt369_vtunknown_base_state::machine_reset(); // fapocket needs this, fcpocket instead reads the switch in software? if (m_cartsel) @@ -345,129 +345,129 @@ void nes_vt369_vtunknown_dg_fapocket_state::machine_reset() else m_ahigh = 0; } -void nes_vt369_vtunknown_base_state::configure_soc(nes_vt02_vt03_soc_device* soc) +void vt369_vtunknown_base_state::configure_soc(nes_vt02_vt03_soc_device* soc) { - soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_state::vt_external_space_map_32mbyte); - soc->read_0_callback().set(FUNC(nes_vt369_vtunknown_base_state::in0_r)); - soc->read_1_callback().set(FUNC(nes_vt369_vtunknown_base_state::in1_r)); - soc->write_0_callback().set(FUNC(nes_vt369_vtunknown_base_state::in0_w)); - - soc->extra_read_0_callback().set(FUNC(nes_vt369_vtunknown_base_state::extrain_r<0>)); - soc->extra_read_1_callback().set(FUNC(nes_vt369_vtunknown_base_state::extrain_r<1>)); - soc->extra_read_2_callback().set(FUNC(nes_vt369_vtunknown_base_state::extrain_r<2>)); - soc->extra_read_3_callback().set(FUNC(nes_vt369_vtunknown_base_state::extrain_r<3>)); + soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_state::vt_external_space_map_32mbyte); + soc->read_0_callback().set(FUNC(vt369_vtunknown_base_state::in0_r)); + soc->read_1_callback().set(FUNC(vt369_vtunknown_base_state::in1_r)); + soc->write_0_callback().set(FUNC(vt369_vtunknown_base_state::in0_w)); + + soc->extra_read_0_callback().set(FUNC(vt369_vtunknown_base_state::extrain_r<0>)); + soc->extra_read_1_callback().set(FUNC(vt369_vtunknown_base_state::extrain_r<1>)); + soc->extra_read_2_callback().set(FUNC(vt369_vtunknown_base_state::extrain_r<2>)); + soc->extra_read_3_callback().set(FUNC(vt369_vtunknown_base_state::extrain_r<3>)); } -uint8_t nes_vt369_vtunknown_base_state::upper_412c_r() +uint8_t vt369_vtunknown_base_state::upper_412c_r() { logerror("%s: upper_412c_r\n", machine().describe_context()); return 0x00; } -uint8_t nes_vt369_vtunknown_base_state::upper_412d_r() +uint8_t vt369_vtunknown_base_state::upper_412d_r() { logerror("%s: upper_412d_r\n", machine().describe_context()); return 0x00; } -void nes_vt369_vtunknown_base_state::upper_412c_w(uint8_t data) +void vt369_vtunknown_base_state::upper_412c_w(uint8_t data) { logerror("%s: upper_412c_w %02x\n", machine().describe_context(), data); } -void nes_vt369_vtunknown_state::nes_vt369_vtunknown_4k_ram(machine_config &config) +void vt369_vtunknown_state::vt369_vtunknown_4k_ram(machine_config &config) { /* basic machine hardware */ NES_VT09_SOC(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); - dynamic_cast(*m_soc).upper_read_412c_callback().set(FUNC(nes_vt369_vtunknown_state::upper_412c_r)); - dynamic_cast(*m_soc).upper_read_412d_callback().set(FUNC(nes_vt369_vtunknown_state::upper_412d_r)); - dynamic_cast(*m_soc).upper_write_412c_callback().set(FUNC(nes_vt369_vtunknown_state::upper_412c_w)); + dynamic_cast(*m_soc).upper_read_412c_callback().set(FUNC(vt369_vtunknown_state::upper_412c_r)); + dynamic_cast(*m_soc).upper_read_412d_callback().set(FUNC(vt369_vtunknown_state::upper_412d_r)); + dynamic_cast(*m_soc).upper_write_412c_callback().set(FUNC(vt369_vtunknown_state::upper_412c_w)); } -void nes_vt369_vtunknown_state::nes_vt369_vtunknown_4k_ram_16mb(machine_config &config) +void vt369_vtunknown_state::vt369_vtunknown_4k_ram_16mb(machine_config &config) { - nes_vt369_vtunknown_4k_ram(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_state::vt_external_space_map_16mbyte); + vt369_vtunknown_4k_ram(config); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_state::vt_external_space_map_16mbyte); } -void nes_vt369_vtunknown_cy_state::nes_vt369_vtunknown_cy(machine_config &config) +void vt369_vtunknown_cy_state::vt369_vtunknown_cy(machine_config &config) { - nes_vt369_vtunknown_4k_ram(config); + vt369_vtunknown_4k_ram(config); VT3XX_SOC(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); } -void nes_vt369_vtunknown_cy_state::nes_vt369_vtunknown_cy_bigger(machine_config &config) +void vt369_vtunknown_cy_state::vt369_vtunknown_cy_bigger(machine_config &config) { - nes_vt369_vtunknown_cy(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_cy_state::vt_external_space_map_32mbyte); // must be some banking of this kind of VT can address over 32mb + vt369_vtunknown_cy(config); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_cy_state::vt_external_space_map_32mbyte); // must be some banking of this kind of VT can address over 32mb } -void nes_vt369_vtunknown_cy_state::nes_vt369_vtunknown_bt(machine_config &config) +void vt369_vtunknown_cy_state::vt369_vtunknown_bt(machine_config &config) { - nes_vt369_vtunknown_4k_ram(config); + vt369_vtunknown_4k_ram(config); VT3XX_SOC_UNK_BT(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); } -void nes_vt369_vtunknown_cy_state::bittboy_412c_w(uint8_t data) +void vt369_vtunknown_cy_state::bittboy_412c_w(uint8_t data) { // bittboy (ok) logerror("%s: vt03_412c_extbank_w %02x\n", machine().describe_context(), data); m_ahigh = (data & 0x04) ? (1 << 24) : 0x0; } -void nes_vt369_vtunknown_cy_state::nes_vt369_vtunknown_bt_2x16mb(machine_config& config) +void vt369_vtunknown_cy_state::vt369_vtunknown_bt_2x16mb(machine_config& config) { - nes_vt369_vtunknown_bt(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_cy_state::vt_external_space_map_bitboy_2x16mbyte); + vt369_vtunknown_bt(config); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_cy_state::vt_external_space_map_bitboy_2x16mbyte); - dynamic_cast(*m_soc).upper_write_412c_callback().set(FUNC(nes_vt369_vtunknown_cy_state::bittboy_412c_w)); + dynamic_cast(*m_soc).upper_write_412c_callback().set(FUNC(vt369_vtunknown_cy_state::bittboy_412c_w)); } -void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_unk(machine_config &config) +void vt369_vtunknown_unk_state::vt369_vtunknown_unk(machine_config &config) { - nes_vt369_vtunknown_4k_ram(config); + vt369_vtunknown_4k_ram(config); VT3XX_SOC_UNK_DG(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->force_bad_dma(); } -void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_unk_16mb(machine_config& config) +void vt369_vtunknown_unk_state::vt369_vtunknown_unk_16mb(machine_config& config) { - nes_vt369_vtunknown_unk(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_unk_state::vt_external_space_map_16mbyte); + vt369_vtunknown_unk(config); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_16mbyte); } -void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_unk_1mb(machine_config& config) +void vt369_vtunknown_unk_state::vt369_vtunknown_unk_1mb(machine_config& config) { - nes_vt369_vtunknown_unk(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_unk_state::vt_external_space_map_1mbyte); + vt369_vtunknown_unk(config); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_1mbyte); } -void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_unk_2mb(machine_config& config) +void vt369_vtunknown_unk_state::vt369_vtunknown_unk_2mb(machine_config& config) { - nes_vt369_vtunknown_unk(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_unk_state::vt_external_space_map_2mbyte); + vt369_vtunknown_unk(config); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_2mbyte); } -void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_unk_4mb(machine_config& config) +void vt369_vtunknown_unk_state::vt369_vtunknown_unk_4mb(machine_config& config) { - nes_vt369_vtunknown_unk(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_unk_state::vt_external_space_map_4mbyte); + vt369_vtunknown_unk(config); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_4mbyte); } // New mystery handheld architecture, VTxx derived -void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_hh(machine_config &config) +void vt369_vtunknown_unk_state::vt369_vtunknown_hh(machine_config &config) { - nes_vt369_vtunknown_4k_ram(config); + vt369_vtunknown_4k_ram(config); VT369_SOC_INTROM_NOSWAP(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); @@ -476,46 +476,46 @@ void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_hh(machine_config &confi m_soc->force_bad_dma(); } -void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_hh_swap_8mb(machine_config &config) +void vt369_vtunknown_unk_state::vt369_vtunknown_hh_swap_8mb(machine_config &config) { - nes_vt369_vtunknown_4k_ram(config); + vt369_vtunknown_4k_ram(config); VT369_SOC_INTROM_SWAP(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_default_palette_mode(PAL_MODE_NEW_RGB); m_soc->force_bad_dma(); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_unk_state::vt_external_space_map_8mbyte); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_8mbyte); } -void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_hh_1mb(machine_config& config) +void vt369_vtunknown_unk_state::vt369_vtunknown_hh_1mb(machine_config& config) { - nes_vt369_vtunknown_hh(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_unk_state::vt_external_space_map_1mbyte); + vt369_vtunknown_hh(config); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_1mbyte); } -void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_hh_4mb(machine_config& config) +void vt369_vtunknown_unk_state::vt369_vtunknown_hh_4mb(machine_config& config) { - nes_vt369_vtunknown_hh(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_unk_state::vt_external_space_map_4mbyte); + vt369_vtunknown_hh(config); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_4mbyte); } -void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_hh_8mb(machine_config& config) +void vt369_vtunknown_unk_state::vt369_vtunknown_hh_8mb(machine_config& config) { - nes_vt369_vtunknown_hh(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_unk_state::vt_external_space_map_8mbyte); + vt369_vtunknown_hh(config); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_8mbyte); } -void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_hh_16mb(machine_config& config) +void vt369_vtunknown_unk_state::vt369_vtunknown_hh_16mb(machine_config& config) { - nes_vt369_vtunknown_hh(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_unk_state::vt_external_space_map_16mbyte); + vt369_vtunknown_hh(config); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_16mbyte); } -static INPUT_PORTS_START( nes_vt369_vtunknown ) +static INPUT_PORTS_START( vt369_vtunknown ) PORT_START("IO0") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("A") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("B") @@ -538,9 +538,9 @@ static INPUT_PORTS_START( nes_vt369_vtunknown ) INPUT_PORTS_END -void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_fp(machine_config &config) +void vt369_vtunknown_unk_state::vt369_vtunknown_fp(machine_config &config) { - nes_vt369_vtunknown_4k_ram(config); + vt369_vtunknown_4k_ram(config); NES_VT32_SOC(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); @@ -550,16 +550,16 @@ void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_fp(machine_config &confi } -void nes_vt369_vtunknown_unk_state::nes_vt369_vtunknown_fp_16mb(machine_config& config) +void vt369_vtunknown_unk_state::vt369_vtunknown_fp_16mb(machine_config& config) { - nes_vt369_vtunknown_fp(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_unk_state::vt_external_space_map_16mbyte); + vt369_vtunknown_fp(config); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_16mbyte); } -uint8_t nes_vt369_vtunknown_dg_fapocket_state::fapocket_412c_r() +uint8_t vt369_vtunknown_dg_fapocket_state::fapocket_412c_r() { if (m_cartsel) return m_cartsel->read(); @@ -567,7 +567,7 @@ uint8_t nes_vt369_vtunknown_dg_fapocket_state::fapocket_412c_r() return 0; } -void nes_vt369_vtunknown_dg_fapocket_state::fapocket_412c_w(uint8_t data) +void vt369_vtunknown_dg_fapocket_state::fapocket_412c_w(uint8_t data) { // fapocket (ok?) (also uses bank from config switch for fake cartridge slot) logerror("%s: vtfa_412c_extbank_w %02x\n", machine().describe_context(), data); @@ -580,21 +580,21 @@ void nes_vt369_vtunknown_dg_fapocket_state::fapocket_412c_w(uint8_t data) -void nes_vt369_vtunknown_dg_fapocket_state::nes_vt369_vtunknown_fa_4x16mb(machine_config& config) // fapocket +void vt369_vtunknown_dg_fapocket_state::vt369_vtunknown_fa_4x16mb(machine_config& config) // fapocket { - nes_vt369_vtunknown_4k_ram(config); + vt369_vtunknown_4k_ram(config); VT3XX_SOC_UNK_FA(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt369_vtunknown_dg_fapocket_state::vt_external_space_map_fapocket_4x16mbyte); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_dg_fapocket_state::vt_external_space_map_fapocket_4x16mbyte); - dynamic_cast(*m_soc).upper_read_412c_callback().set(FUNC(nes_vt369_vtunknown_dg_fapocket_state::fapocket_412c_r)); - dynamic_cast(*m_soc).upper_write_412c_callback().set(FUNC(nes_vt369_vtunknown_dg_fapocket_state::fapocket_412c_w)); + dynamic_cast(*m_soc).upper_read_412c_callback().set(FUNC(vt369_vtunknown_dg_fapocket_state::fapocket_412c_r)); + dynamic_cast(*m_soc).upper_write_412c_callback().set(FUNC(vt369_vtunknown_dg_fapocket_state::fapocket_412c_w)); } -static INPUT_PORTS_START( nes_vt369_vtunknown_fa ) - PORT_INCLUDE(nes_vt369_vtunknown) +static INPUT_PORTS_START( vt369_vtunknown_fa ) + PORT_INCLUDE(vt369_vtunknown) PORT_START("CARTSEL") PORT_DIPNAME( 0x01, 0x00, "Cartridge Select" ) PORT_CODE(KEYCODE_3) PORT_TOGGLE @@ -789,7 +789,7 @@ ROM_START( lpgm240 ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "w25q64jv.u1", 0x00000, 0x800000, CRC(b973e65b) SHA1(36ff137068ea56b4679c2db386ac0067de0a9eaf) ) - ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) ROM_END @@ -797,7 +797,7 @@ ROM_START( tup240 ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "mini_arcade240.bin", 0x00000, 0x800000, CRC(d4b4bf6c) SHA1(9cf4557e27bc8659079c62abdd22a311e1843047) ) - ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) ROM_END @@ -867,7 +867,7 @@ ROM_START( hkb502a ) ROM_REGION( 0x400000, "mainrom", 0 ) ROM_LOAD( "hkb-502.bin", 0x00000, 0x400000, CRC(970f54d2) SHA1(b45df00d85a2e29fe9418563927584a048db94b3) ) - ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_END @@ -875,7 +875,7 @@ ROM_START( lxcap ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "lexibook_cyber_arcade_pocket.bin", 0x00000, 0x800000, CRC(245d0cd3) SHA1(d91cca2d0f99a6ca202fa9ba6d03587ea8af0cd9) ) - ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_REGION( 0x100, "extra", 0 ) // data from additional 8-pin chip for protection @@ -957,7 +957,7 @@ ROM_START( nesvt270 ) ROM_END -void nes_vt369_vtunknown_state::init_lxcmcypp() +void vt369_vtunknown_state::init_lxcmcypp() { int size = memregion("mainrom")->bytes()/2; uint16_t* ROM = (uint16_t*)memregion("mainrom")->base(); @@ -972,18 +972,18 @@ void nes_vt369_vtunknown_state::init_lxcmcypp() // Runs well, only issues in SMB3 which crashes -CONS( 2017, bittboy, 0, 0, nes_vt369_vtunknown_bt_2x16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "BittBoy", "BittBoy Mini FC 300 in 1", MACHINE_IMPERFECT_GRAPHICS ) // has external banking (2x 16mbyte banks) +CONS( 2017, bittboy, 0, 0, vt369_vtunknown_bt_2x16mb, vt369_vtunknown, vt369_vtunknown_cy_state, empty_init, "BittBoy", "BittBoy Mini FC 300 in 1", MACHINE_IMPERFECT_GRAPHICS ) // has external banking (2x 16mbyte banks) // No title screen, but press start and menu and games run fine. Makes odd // memory accesses which probably explain broken title screen -CONS( 201?, mc_hh210, 0, 0, nes_vt369_vtunknown_4k_ram_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_state, empty_init, "", "Handheld 210 in 1", MACHINE_NOT_WORKING ) +CONS( 201?, mc_hh210, 0, 0, vt369_vtunknown_4k_ram_16mb, vt369_vtunknown, vt369_vtunknown_state, empty_init, "", "Handheld 210 in 1", MACHINE_NOT_WORKING ) // First half of games don't work, probably bad dump -CONS( 201?, dvnimbus, 0, 0, nes_vt369_vtunknown_unk_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "DVTech Nimbus 176 in 1", MACHINE_NOT_WORKING ) +CONS( 201?, dvnimbus, 0, 0, vt369_vtunknown_unk_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "", "DVTech Nimbus 176 in 1", MACHINE_NOT_WORKING ) // is this vt09 or vt32? // Use DIP switch to select console or cartridge, as cartridge is fake and just toggles a ROM high address bit // (which can also be overriden by GPIO) -CONS( 2017, fapocket, 0, 0, nes_vt369_vtunknown_fa_4x16mb, nes_vt369_vtunknown_fa, nes_vt369_vtunknown_dg_fapocket_state, empty_init, "", "Family Pocket 638 in 1", MACHINE_IMPERFECT_GRAPHICS ) // has external banking (4x 16mbyte banks) +CONS( 2017, fapocket, 0, 0, vt369_vtunknown_fa_4x16mb, vt369_vtunknown_fa, vt369_vtunknown_dg_fapocket_state, empty_init, "", "Family Pocket 638 in 1", MACHINE_IMPERFECT_GRAPHICS ) // has external banking (4x 16mbyte banks) /**************************************************************************************************************** @@ -998,33 +998,33 @@ CONS( 2017, fapocket, 0, 0, nes_vt369_vtunknown_fa_4x16mb, nes_vt369_v ****************************************************************************************************************/ -CONS( 2012, lexi30, 0,0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Arcade Center (JL1800_01)", MACHINE_NOT_WORKING ) +CONS( 2012, lexi30, 0,0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Arcade Center (JL1800_01)", MACHINE_NOT_WORKING ) // don't even get to menu. very enhanced chipset, VT368/9? -CONS( 2012, dgun2561, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Portable Gaming System with 140 Games (DGUN-2561)", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme +CONS( 2012, dgun2561, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Portable Gaming System with 140 Games (DGUN-2561)", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme -CONS( 2012, lxccatv, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade TV - 120 in 1 (JL2370)", MACHINE_NOT_WORKING ) // 32MByte ROM, 2011 on case, 2012 on PCB +CONS( 2012, lxccatv, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade TV - 120 in 1 (JL2370)", MACHINE_NOT_WORKING ) // 32MByte ROM, 2011 on case, 2012 on PCB // All Lexibook units below have 64Mbyte ROMs, must be externally banked, or different addressing scheme -CONS( 200?, lxcmcy, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade", MACHINE_NOT_WORKING ) -CONS( 200?, lxcmc250, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - 250-in-1 (JL2375)", MACHINE_NOT_WORKING ) -CONS( 200?, lxcmcysw, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Star Wars Rebels", MACHINE_NOT_WORKING ) -CONS( 200?, lxcmcyfz, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Frozen", MACHINE_NOT_WORKING ) -CONS( 200?, lxcmcydp, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Disney Princess", MACHINE_NOT_WORKING ) -CONS( 200?, lxcmcysp, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Marvel Ultimate Spider-Man", MACHINE_NOT_WORKING ) // is this the low-resolution pocket version? ROM structure is quite different -CONS( 200?, lxcmcycr, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Cars", MACHINE_NOT_WORKING ) -CONS( 200?, lxcmcypj, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - PJ Masks", MACHINE_NOT_WORKING ) -CONS( 200?, lxcmcyba, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Barbie (JL2365BB)", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcy, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmc250, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - 250-in-1 (JL2375)", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcysw, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Star Wars Rebels", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcyfz, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Frozen", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcydp, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Disney Princess", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcysp, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Marvel Ultimate Spider-Man", MACHINE_NOT_WORKING ) // is this the low-resolution pocket version? ROM structure is quite different +CONS( 200?, lxcmcycr, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Cars", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcypj, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - PJ Masks", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcyba, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Compact Cyber Arcade - Barbie (JL2365BB)", MACHINE_NOT_WORKING ) // the data order is swapped for this one, maybe other internal differences? -CONS( 200?, lxcmcypp, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, init_lxcmcypp, "Lexibook", "Compact Cyber Arcade - Paw Patrol", MACHINE_NOT_WORKING ) +CONS( 200?, lxcmcypp, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, init_lxcmcypp, "Lexibook", "Compact Cyber Arcade - Paw Patrol", MACHINE_NOT_WORKING ) -CONS( 200?, lxccminn, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Console Colour - Minnie Mouse", MACHINE_NOT_WORKING ) -CONS( 200?, lxccplan, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Console Colour - Disney's Planes", MACHINE_NOT_WORKING ) +CONS( 200?, lxccminn, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Console Colour - Minnie Mouse", MACHINE_NOT_WORKING ) +CONS( 200?, lxccplan, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Console Colour - Disney's Planes", MACHINE_NOT_WORKING ) -CONS( 2020, lxpcsp, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Power Console - Marvel Spider-Man", MACHINE_NOT_WORKING ) +CONS( 2020, lxpcsp, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Power Console - Marvel Spider-Man", MACHINE_NOT_WORKING ) // GB-NO13-Main-VT389-2 on PCBs -CONS( 2016, rtvgc300, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Retro TV Game Console - 300 Games", MACHINE_NOT_WORKING ) -CONS( 2017, rtvgc300fz,0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Retro TV Game Console - Frozen - 300 Games", MACHINE_NOT_WORKING ) +CONS( 2016, rtvgc300, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Retro TV Game Console - 300 Games", MACHINE_NOT_WORKING ) +CONS( 2017, rtvgc300fz,0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Retro TV Game Console - Frozen - 300 Games", MACHINE_NOT_WORKING ) /* The following are also confirmed to be NES/VT derived units, most having a standard set of games with a handful of lazy graphic mods thrown in to fit the unit theme @@ -1064,25 +1064,25 @@ CONS( 2017, rtvgc300fz,0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, */ // uncertain, NOT SPI ROM -CONS( 200?, zonefusn, 0, 0, nes_vt369_vtunknown_fp_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Ultimate Products / Jungle's Soft", "Zone Fusion", MACHINE_NOT_WORKING ) +CONS( 200?, zonefusn, 0, 0, vt369_vtunknown_fp_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Ultimate Products / Jungle's Soft", "Zone Fusion", MACHINE_NOT_WORKING ) // same as above but without Jungle's Soft boot logo? model number taken from cover of manual -CONS( 200?, sealvt, zonefusn, 0, nes_vt369_vtunknown_fp_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook / Sit Up Limited / Jungle's Soft", "Seal 30-in-1 (VT based, Model FN098134)", MACHINE_NOT_WORKING ) +CONS( 200?, sealvt, zonefusn, 0, vt369_vtunknown_fp_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook / Sit Up Limited / Jungle's Soft", "Seal 30-in-1 (VT based, Model FN098134)", MACHINE_NOT_WORKING ) // NOT SPI roms, code start with '6a' (possibly encrypted opcode after jump from an internal bootstrap ROM?) // Uncertain, intial code isn't valid? scrambled? -CONS( 201?, red5mam, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Red5", "Mini Arcade Machine (Red5, 'Xtra Game')", MACHINE_NOT_WORKING ) // 128Mbyte ROM, must be externally banked or different addressing scheme +CONS( 201?, red5mam, 0, 0, vt369_vtunknown_cy_bigger, vt369_vtunknown, vt369_vtunknown_cy_state, empty_init, "Red5", "Mini Arcade Machine (Red5, 'Xtra Game')", MACHINE_NOT_WORKING ) // 128Mbyte ROM, must be externally banked or different addressing scheme // Uncertain, very similar to red5mam -CONS( 2016, dgun2593, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "dreamGEAR", "My Arcade Retro Arcade Machine - 300 Handheld Video Games (DGUN-2593)", MACHINE_NOT_WORKING ) // 128Mbyte ROM, must be externally banked or different addressing scheme +CONS( 2016, dgun2593, 0, 0, vt369_vtunknown_cy_bigger, vt369_vtunknown, vt369_vtunknown_cy_state, empty_init, "dreamGEAR", "My Arcade Retro Arcade Machine - 300 Handheld Video Games (DGUN-2593)", MACHINE_NOT_WORKING ) // 128Mbyte ROM, must be externally banked or different addressing scheme // Similar, starts with a '6a' ror a opcode which is presumably encrypted / extended, then normal looking code, then unknown instructions -CONS( 200?, gcs2mgp, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Jungle's Soft", "Mini Game Player 48-in-1", MACHINE_NOT_WORKING ) +CONS( 200?, gcs2mgp, 0, 0, vt369_vtunknown_cy_bigger, vt369_vtunknown, vt369_vtunknown_cy_state, empty_init, "Jungle's Soft", "Mini Game Player 48-in-1", MACHINE_NOT_WORKING ) // Not the same as the other 240-in-1 machine from Thumbs Up below (tup240) This one makes greater use of newer VT features with most games having sampled music, not APU sound. // Several of the games contained in here are buggy / broken on real hardware (see https://www.youtube.com/watch?v=-mgGNaDQ1HE ) -CONS( 201?, 240in1ar, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Thumbs Up", "Mini Arcade Machine (Thumbs Up, 240IN1ARC)", MACHINE_NOT_WORKING ) // 128Mbyte ROM, must be externally banked or different addressing scheme +CONS( 201?, 240in1ar, 0, 0, vt369_vtunknown_cy_bigger, vt369_vtunknown, vt369_vtunknown_cy_state, empty_init, "Thumbs Up", "Mini Arcade Machine (Thumbs Up, 240IN1ARC)", MACHINE_NOT_WORKING ) // 128Mbyte ROM, must be externally banked or different addressing scheme // is one of these bad? where do they fit? the former boots, but banking is wrong (incorrect games selected, gfx corruption) the 2nd looks encrypted or bad -CONS( 2019, unk2019hh, 0, 0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "unknown VTxx based GameBoy style handheld (2019 PCB)", MACHINE_NOT_WORKING ) -CONS( 2020, unk2020hh, unk2019hh,0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "unknown VTxx based GameBoy style handheld (2020 PCB)", MACHINE_NOT_WORKING ) +CONS( 2019, unk2019hh, 0, 0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "", "unknown VTxx based GameBoy style handheld (2019 PCB)", MACHINE_NOT_WORKING ) +CONS( 2020, unk2020hh, unk2019hh,0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "", "unknown VTxx based GameBoy style handheld (2020 PCB)", MACHINE_NOT_WORKING ) /***************************************************************************** @@ -1090,80 +1090,80 @@ CONS( 2020, unk2020hh, unk2019hh,0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtun *****************************************************************************/ // portable fan + famiclone combo handheld -CONS( 2020, nubsupmf, 0, 0, nes_vt369_vtunknown_hh_4mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "NubSup Mini Game Fan", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 2020, nubsupmf, 0, 0, vt369_vtunknown_hh_4mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "", "NubSup Mini Game Fan", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // unknown tech level, might be scrambled as default codebank/boot vectors don't seem valid -CONS( 201?, hhgc319, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "Handheld Game Console 319-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 201?, hhgc319, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "", "Handheld Game Console 319-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // unknown tech, probably from 2021, probably VT369, ROM wouldn't read consistently -CONS( 202?, vibes240, 0, 0, nes_vt369_vtunknown_unk_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "Vibes Retro Pocket Gamer 240-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 202?, vibes240, 0, 0, vt369_vtunknown_unk_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "", "Vibes Retro Pocket Gamer 240-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) /***************************************************************************** * below are VT369 games that use BGA on sub *****************************************************************************/ // doesn't use most features, M705-128A6 sub-board with BGA -CONS( 201?, retro400, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "Retro FC 400-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 201?, retro400, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "", "Retro FC 400-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) /***************************************************************************** * below are VT369 games that use SQI / SPI ROM *****************************************************************************/ // doesn't boot -CONS( 201?, q5_500in1, 0, 0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "Q5 500 in 1 Handheld", MACHINE_NOT_WORKING ) +CONS( 201?, q5_500in1, 0, 0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "", "Q5 500 in 1 Handheld", MACHINE_NOT_WORKING ) // Runs well, minor GFX issues in intro -CONS( 2017, sy889, 0, 0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "SY Corp", "SY-889 300 in 1 Handheld", MACHINE_IMPERFECT_GRAPHICS ) -CONS( 2016, sy888b, 0, 0, nes_vt369_vtunknown_hh_4mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "SY Corp", "SY-888B 288 in 1 Handheld", MACHINE_IMPERFECT_GRAPHICS ) +CONS( 2017, sy889, 0, 0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "SY Corp", "SY-889 300 in 1 Handheld", MACHINE_IMPERFECT_GRAPHICS ) +CONS( 2016, sy888b, 0, 0, vt369_vtunknown_hh_4mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "SY Corp", "SY-888B 288 in 1 Handheld", MACHINE_IMPERFECT_GRAPHICS ) // Same hardware as SY-889 -CONS( 201?, mc_cb280, 0, 0, nes_vt369_vtunknown_hh_4mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "CoolBoy", "Coolboy RS-18 (280 in 1)", MACHINE_IMPERFECT_GRAPHICS ) +CONS( 201?, mc_cb280, 0, 0, vt369_vtunknown_hh_4mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "CoolBoy", "Coolboy RS-18 (280 in 1)", MACHINE_IMPERFECT_GRAPHICS ) // Plays intro music but then crashes. same hardware as SY-88x but uses more features -CONS( 2016, mog_m320, 0, 0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "MOGIS", "MOGIS M320 246 in 1 Handheld", MACHINE_NOT_WORKING ) +CONS( 2016, mog_m320, 0, 0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "MOGIS", "MOGIS M320 246 in 1 Handheld", MACHINE_NOT_WORKING ) // VT369, but doesn't use most features -CONS( 200?, lpgm240, 0, 0, nes_vt369_vtunknown_hh_swap_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "Let's Play! Game Machine 240 in 1", MACHINE_NOT_WORKING ) // mini 'retro-arcade' style cabinet -CONS( 200?, tup240, lpgm240, 0, nes_vt369_vtunknown_hh_swap_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Thumbs Up", "Thumbs Up 240-in-1 Mini Arcade Machine", MACHINE_NOT_WORKING ) +CONS( 200?, lpgm240, 0, 0, vt369_vtunknown_hh_swap_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "", "Let's Play! Game Machine 240 in 1", MACHINE_NOT_WORKING ) // mini 'retro-arcade' style cabinet +CONS( 200?, tup240, lpgm240, 0, vt369_vtunknown_hh_swap_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Thumbs Up", "Thumbs Up 240-in-1 Mini Arcade Machine", MACHINE_NOT_WORKING ) // VT369, but doesn't use most features -CONS( 201?, unkra200, mc_tv200, 0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "200 in 1 Retro Arcade", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -CONS( 201?, dgun2577, mc_tv200, 0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "DreamGear", "My Arcade Retro Machine 200-in-1 (DGUN-2577)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -CONS( 201?, lxcyber, mc_tv200, 0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Cyber Arcade 200-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 201?, unkra200, mc_tv200, 0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "", "200 in 1 Retro Arcade", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 201?, dgun2577, mc_tv200, 0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "DreamGear", "My Arcade Retro Machine 200-in-1 (DGUN-2577)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 201?, lxcyber, mc_tv200, 0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Cyber Arcade 200-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // menu is protected with code from extra ROM -CONS( 201?, gtct885, mc_tv200, 0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Gaming Tech", "Gaming Tech CT-885", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 201?, gtct885, mc_tv200, 0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Gaming Tech", "Gaming Tech CT-885", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // similar to above, but with 40 extra games, menu is protected with code from extra ROM (although RTS opcodes seem to work) -CONS( 201?, rd5_240, 0, 0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Red5", "Mini Arcade Machine 240-in-1 (Red5)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 201?, rd5_240, 0, 0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Red5", "Mini Arcade Machine 240-in-1 (Red5)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -CONS( 201?, hkb502, 0, 0, nes_vt369_vtunknown_hh_4mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "HKB-502 268-in-1 (set 1)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -CONS( 201?, hkb502a, hkb502, 0, nes_vt369_vtunknown_hh_4mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "HKB-502 268-in-1 (set 2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 201?, hkb502, 0, 0, vt369_vtunknown_hh_4mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "", "HKB-502 268-in-1 (set 1)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 201?, hkb502a, hkb502, 0, vt369_vtunknown_hh_4mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "", "HKB-502 268-in-1 (set 2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // similar to above, fewer games in menu -CONS( 2021, unk128vt, 0, 0, nes_vt369_vtunknown_unk_4mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "unknown VT369 based 128-in-1 (GC31-369-20210702-V2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 2021, unk128vt, 0, 0, vt369_vtunknown_unk_4mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "", "unknown VT369 based 128-in-1 (GC31-369-20210702-V2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // uses a LCD with resolution of 160x128 (image scaled to fit for some games, others run natively at 160x128) // contains a protection chip, command 80 XX returns a byte -CONS( 201?, lxcap, 0, 0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Lexibook", "Cyber Arcade Pocket (JL1895)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 201?, lxcap, 0, 0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook", "Cyber Arcade Pocket (JL1895)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // 2022 date on 'BL-867 PCB03' PCB -CONS( 2022, nesvt270, 0, 0, nes_vt369_vtunknown_hh_16mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "", "unknown VT3xx based 270-in-1 (BL-867 PCB03)", MACHINE_NOT_WORKING ) +CONS( 2022, nesvt270, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "", "unknown VT3xx based 270-in-1 (BL-867 PCB03)", MACHINE_NOT_WORKING ) // VT369, but doesn't use most features -CONS( 201?, myarccn, 0, 0, nes_vt369_vtunknown_hh_1mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "DreamGear", "My Arcade Caveman Ninja", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 201?, myarccn, 0, 0, vt369_vtunknown_hh_1mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "DreamGear", "My Arcade Caveman Ninja", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // confirmed VT369, uses more features (including sound CPU) -CONS( 201?, denv150, 0, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "Denver", "Denver Game Console GMP-240C 150-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -CONS( 201?, egame150, denv150, 0, nes_vt369_vtunknown_cy_bigger, nes_vt369_vtunknown, nes_vt369_vtunknown_cy_state, empty_init, "", "E-Game! 150-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 201?, denv150, 0, 0, vt369_vtunknown_cy_bigger, vt369_vtunknown, vt369_vtunknown_cy_state, empty_init, "Denver", "Denver Game Console GMP-240C 150-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 201?, egame150, denv150, 0, vt369_vtunknown_cy_bigger, vt369_vtunknown, vt369_vtunknown_cy_state, empty_init, "", "E-Game! 150-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // uncertain, uses SPI ROM so probably VT369 -CONS( 2017, otrail, 0, 0, nes_vt369_vtunknown_unk_1mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Basic Fun", "The Oregon Trail", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 2017, otrail, 0, 0, vt369_vtunknown_unk_1mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Basic Fun", "The Oregon Trail", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // seems to be running the NES version of Pac-Man with some extra splash screens -CONS( 2021, pactin, 0, 0, nes_vt369_vtunknown_unk_1mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Fizz Creations", "Pac-Man Arcade in a Tin", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 2021, pactin, 0, 0, vt369_vtunknown_unk_1mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Fizz Creations", "Pac-Man Arcade in a Tin", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -CONS( 2021, tetrtin, 0, 0, nes_vt369_vtunknown_unk_1mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "Fizz Creations", "Tetris Arcade in a Tin", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 2021, tetrtin, 0, 0, vt369_vtunknown_unk_1mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Fizz Creations", "Tetris Arcade in a Tin", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // uses a low res display like the above -CONS( 2021, matet10, 0, 0, nes_vt369_vtunknown_unk_2mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (DGUNL-7083, Pixel Pocket, with 10 bonus games)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 2021, matet10, 0, 0, vt369_vtunknown_unk_2mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (DGUNL-7083, Pixel Pocket, with 10 bonus games)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // unknown tech level, scrambled opcodes -CONS( 2021, matet100, 0, 0, nes_vt369_vtunknown_hh_8mb, nes_vt369_vtunknown, nes_vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (DGUNL-7027, Pico Player, with 100+ bonus games)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // box says 100+ bonus games +CONS( 2021, matet100, 0, 0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (DGUNL-7027, Pico Player, with 100+ bonus games)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // box says 100+ bonus games diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index f02a279644988..df2ae5c60995b 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -6,15 +6,15 @@ // this has a new RGB555 mode -DEFINE_DEVICE_TYPE(VT369_SOC_INTROM_NOSWAP, vt369_soc_introm_noswap_device, "nes_vt369_soc", "VT369 series System on a Chip") -DEFINE_DEVICE_TYPE(VT369_SOC_INTROM_SWAP, vt369_soc_introm_swap_device, "nes_vt369_soc_swap", "VT369 series System on a Chip (with opcode swapping)") +DEFINE_DEVICE_TYPE(VT369_SOC_INTROM_NOSWAP, vt369_soc_introm_noswap_device, "vt369_soc", "VT369 series System on a Chip") +DEFINE_DEVICE_TYPE(VT369_SOC_INTROM_SWAP, vt369_soc_introm_swap_device, "vt369_soc_swap", "VT369 series System on a Chip (with opcode swapping)") // uncertain -DEFINE_DEVICE_TYPE(VT3XX_SOC, vt3xx_soc_base_device, "nes_vtunknown_soc_cy", "VT3xx series System on a Chip (CY)") -DEFINE_DEVICE_TYPE(VT3XX_SOC_UNK_BT, vt3xx_soc_unk_bt_device, "nes_vtunknown_soc_bt", "VT3xx series System on a Chip (BT)") +DEFINE_DEVICE_TYPE(VT3XX_SOC, vt3xx_soc_base_device, "vt3xx_unknown_soc_cy", "VT3xx series System on a Chip (CY)") +DEFINE_DEVICE_TYPE(VT3XX_SOC_UNK_BT, vt3xx_soc_unk_bt_device, "vt3xx_unknown_soc_bt", "VT3xx series System on a Chip (BT)") -DEFINE_DEVICE_TYPE(VT3XX_SOC_UNK_DG, vt3xx_soc_unk_dg_device, "nes_vtunknown_soc_dg", "VT3xx series System on a Chip (DG)") -DEFINE_DEVICE_TYPE(VT3XX_SOC_UNK_FA, vt3xx_soc_unk_fa_device, "nes_vtunknown_soc_fa", "VT3xx series System on a Chip (Family Pocket)") +DEFINE_DEVICE_TYPE(VT3XX_SOC_UNK_DG, vt3xx_soc_unk_dg_device, "vt3xx_unknown_soc_dg", "VT3xx series System on a Chip (DG)") +DEFINE_DEVICE_TYPE(VT3XX_SOC_UNK_FA, vt3xx_soc_unk_fa_device, "vt3xx_unknown_soc_fa", "VT3xx series System on a Chip (Family Pocket)") vt3xx_soc_base_device::vt3xx_soc_base_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : @@ -74,7 +74,7 @@ vt3xx_soc_unk_fa_device::vt3xx_soc_unk_fa_device(const machine_config& mconfig, void vt3xx_soc_base_device::device_add_mconfig(machine_config& config) { nes_vt02_vt03_soc_device::device_add_mconfig(config); - m_maincpu->set_addrmap(AS_PROGRAM, &vt3xx_soc_base_device::nes_vt369_map); + m_maincpu->set_addrmap(AS_PROGRAM, &vt3xx_soc_base_device::vt369_map); VT_VT1682_ALU(config, m_alu, 0); @@ -100,7 +100,7 @@ void vt3xx_soc_base_device::vt369_relative_w(offs_t offset, uint8_t data) } -void vt3xx_soc_base_device::nes_vt369_map(address_map &map) +void vt3xx_soc_base_device::vt369_map(address_map &map) { map(0x0000, 0x1fff).ram(); // 8k RAM? @@ -282,7 +282,7 @@ void vt369_soc_introm_noswap_device::device_add_mconfig(machine_config& config) vt3xx_soc_base_device::device_add_mconfig(config); RP2A03_CORE_SWAP_OP_D5_D6(config.replace(), m_maincpu, NTSC_APU_CLOCK); - m_maincpu->set_addrmap(AS_PROGRAM, &vt369_soc_introm_noswap_device::nes_vt369_introm_map); + m_maincpu->set_addrmap(AS_PROGRAM, &vt369_soc_introm_noswap_device::vt369_introm_map); } void vt369_soc_introm_noswap_device::device_start() @@ -323,9 +323,9 @@ uint8_t vt369_soc_introm_noswap_device::read_internal(offs_t offset) return m_internal_rom[offset]; } -void vt369_soc_introm_noswap_device::nes_vt369_introm_map(address_map &map) +void vt369_soc_introm_noswap_device::vt369_introm_map(address_map &map) { - vt3xx_soc_base_device::nes_vt369_map(map); + vt3xx_soc_base_device::vt369_map(map); map(0x0000, 0x0fff).ram(); map(0x1000, 0x1fff).r(FUNC(vt369_soc_introm_noswap_device::read_internal)); @@ -386,7 +386,7 @@ void vt3xx_soc_unk_dg_device::vt03_411c_w(uint8_t data) void vt3xx_soc_unk_dg_device::nes_vt_dg_map(address_map &map) { - vt3xx_soc_base_device::nes_vt369_map(map); + vt3xx_soc_base_device::vt369_map(map); map(0x411c, 0x411c).w(FUNC(vt3xx_soc_unk_dg_device::vt03_411c_w)); } @@ -402,7 +402,7 @@ void vt3xx_soc_unk_bt_device::device_add_mconfig(machine_config& config) void vt3xx_soc_unk_bt_device::nes_vt_bt_map(address_map &map) { - vt3xx_soc_base_device::nes_vt369_map(map); + vt3xx_soc_base_device::vt369_map(map); map(0x412c, 0x412c).w(FUNC(vt3xx_soc_unk_bt_device::vt03_412c_extbank_w)); } @@ -441,7 +441,7 @@ void vt3xx_soc_unk_fa_device::vtfp_4242_w(uint8_t data) void vt3xx_soc_unk_fa_device::nes_vt_fa_map(address_map &map) { - vt3xx_soc_base_device::nes_vt369_map(map); + vt3xx_soc_base_device::vt369_map(map); map(0x412c, 0x412c).r(FUNC(vt3xx_soc_unk_fa_device::vtfa_412c_r)).w(FUNC(vt3xx_soc_unk_fa_device::vtfa_412c_extbank_w)); map(0x4242, 0x4242).w(FUNC(vt3xx_soc_unk_fa_device::vtfp_4242_w)); } diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.h b/src/mame/nintendo/nes_vt369_vtunknown_soc.h index c96341c058254..28471975374ae 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.h +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.h @@ -27,7 +27,7 @@ class vt3xx_soc_base_device : public nes_vt09_soc_device void device_start() override ATTR_COLD; void device_reset() override ATTR_COLD; - void nes_vt369_map(address_map &map) ATTR_COLD; + void vt369_map(address_map &map) ATTR_COLD; uint8_t vt369_41bx_r(offs_t offset); void vt369_41bx_w(offs_t offset, uint8_t data); @@ -81,7 +81,7 @@ class vt369_soc_introm_noswap_device : public vt3xx_soc_base_device virtual void device_start() override; virtual void device_add_mconfig(machine_config& config) override; - void nes_vt369_introm_map(address_map &map) ATTR_COLD; + void vt369_introm_map(address_map &map) ATTR_COLD; uint8_t extra_rom_r(); uint8_t vthh_414a_r(); From 758e05b63dc25038ec71e5fd94038b03d26d7dc7 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 8 May 2025 23:52:35 +0100 Subject: [PATCH 16/35] use better finder --- src/mame/nintendo/nes_vt369_vtunknown.cpp | 12 ++++++------ src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mame/nintendo/nes_vt369_vtunknown.cpp b/src/mame/nintendo/nes_vt369_vtunknown.cpp index 3d388bdcea5cc..ca635d4c21a2d 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown.cpp @@ -789,7 +789,7 @@ ROM_START( lpgm240 ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "w25q64jv.u1", 0x00000, 0x800000, CRC(b973e65b) SHA1(36ff137068ea56b4679c2db386ac0067de0a9eaf) ) - ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) ROM_END @@ -797,7 +797,7 @@ ROM_START( tup240 ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "mini_arcade240.bin", 0x00000, 0x800000, CRC(d4b4bf6c) SHA1(9cf4557e27bc8659079c62abdd22a311e1843047) ) - ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) ROM_END @@ -851,7 +851,7 @@ ROM_START( myarccn ) ROM_REGION( 0x100000, "mainrom", 0 ) ROM_LOAD( "my_arcade_caveman_ninja.bin", 0x00000, 0x100000, CRC(dcc5590c) SHA1(a734cb9c81e58346ff5fa934347d7cb24a32cb39) ) - ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_END @@ -859,7 +859,7 @@ ROM_START( hkb502 ) ROM_REGION( 0x400000, "mainrom", 0 ) ROM_LOAD( "red console.bin", 0x00000, 0x400000, CRC(e4766383) SHA1(64b0c20592f38928b3a639fa42b468ff09664808) ) - ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_END @@ -867,7 +867,7 @@ ROM_START( hkb502a ) ROM_REGION( 0x400000, "mainrom", 0 ) ROM_LOAD( "hkb-502.bin", 0x00000, 0x400000, CRC(970f54d2) SHA1(b45df00d85a2e29fe9418563927584a048db94b3) ) - ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_END @@ -875,7 +875,7 @@ ROM_START( lxcap ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "lexibook_cyber_arcade_pocket.bin", 0x00000, 0x800000, CRC(245d0cd3) SHA1(d91cca2d0f99a6ca202fa9ba6d03587ea8af0cd9) ) - ROM_REGION( 0x1000, "internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_REGION( 0x100, "extra", 0 ) // data from additional 8-pin chip for protection diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index df2ae5c60995b..027906c28eb02 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -37,7 +37,7 @@ vt3xx_soc_unk_bt_device::vt3xx_soc_unk_bt_device(const machine_config& mconfig, vt369_soc_introm_noswap_device::vt369_soc_introm_noswap_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock) : vt3xx_soc_base_device(mconfig, type, tag, owner, clock), - m_internal_rom(*this, ":internal") + m_internal_rom(*this, "maincpu:internal") { } From 63b450947d39c682b0951e13ecde3932806a7d49 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Fri, 9 May 2025 01:15:27 +0100 Subject: [PATCH 17/35] seems like internal ROM can also be visible in sound CPU space at 0x4000 based on some lexibook sets --- src/mame/mame.lst | 2 +- src/mame/nintendo/nes_vt09.cpp | 7 --- src/mame/nintendo/nes_vt369_vtunknown.cpp | 50 ++++++++++++------- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 32 ++++++------ src/mame/nintendo/nes_vt369_vtunknown_soc.h | 6 ++- 5 files changed, 55 insertions(+), 42 deletions(-) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 2c3441fc434ea..bbc15511e6f5e 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -35172,7 +35172,6 @@ cybar120 dturbogt jl2050 joypad65 -matetsl msiwwe msiwwea msidd @@ -35239,6 +35238,7 @@ lxcyber lxpcsp matet10 matet100 +matetsl mc_cb280 mc_hh210 mog_m320 diff --git a/src/mame/nintendo/nes_vt09.cpp b/src/mame/nintendo/nes_vt09.cpp index 4d31e3b884c67..1dca8a52a68a6 100644 --- a/src/mame/nintendo/nes_vt09.cpp +++ b/src/mame/nintendo/nes_vt09.cpp @@ -542,11 +542,6 @@ ROM_START( wfmotor ) ROM_LOAD( "motorcycle.bin", 0x00000, 0x400000, CRC(978f12f0) SHA1(a0230cfe4398d3971d487ff5d4b7107341799424) ) ROM_END -ROM_START( matetsl ) - ROM_REGION( 0x100000, "mainrom", 0 ) - ROM_LOAD( "slurpeetetris_p25q40sh_856013.bin", 0x00000, 0x80300, CRC(d3b68de8) SHA1(97bcdfcd31bc536b626f9a369afe18de60a399da) ) -ROM_END - } // anonymous namespace @@ -596,5 +591,3 @@ CONS( 200?, jl2050, 0, 0, nes_vt09_16mb,nes_vt09, nes_vt09_state, empty_init, CONS( 2018, rbbrite, 0, 0, nes_vt09_1mb, nes_vt09, nes_vt09_state, empty_init, "Coleco", "Rainbow Brite (mini-arcade)", MACHINE_NOT_WORKING ) CONS( 200?, timetp25, 0, 0, nes_vt09_cart, nes_vt09, nes_vt09_cart_state, empty_init, "Timetop", "Super Game 25-in-1 (GM-228)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) - -CONS( 2021, matetsl, 0, 0, nes_vt09_1mb, nes_vt09, nes_vt09_state, empty_init, "dreamGEAR", "My Arcade Tetris (Slurpee)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // no bonus games on this model diff --git a/src/mame/nintendo/nes_vt369_vtunknown.cpp b/src/mame/nintendo/nes_vt369_vtunknown.cpp index ca635d4c21a2d..bd4bc86096dc9 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown.cpp @@ -100,7 +100,7 @@ class vt369_vtunknown_state : public vt369_vtunknown_base_state void vt_external_space_map_4mbyte(address_map &map) ATTR_COLD; [[maybe_unused]] void vt_external_space_map_2mbyte(address_map &map) ATTR_COLD; void vt_external_space_map_1mbyte(address_map &map) ATTR_COLD; - [[maybe_unused]] void vt_external_space_map_512kbyte(address_map &map) ATTR_COLD; + void vt_external_space_map_512kbyte(address_map &map) ATTR_COLD; void init_lxcmcypp(); @@ -167,10 +167,11 @@ class vt369_vtunknown_unk_state : public vt369_vtunknown_state void vt369_vtunknown_hh_16mb(machine_config& config); void vt369_vtunknown_hh_swap_8mb(machine_config& config); + void vt369_vtunknown_hh_swap_2mb(machine_config& config); + void vt369_vtunknown_hh_swap_512kb(machine_config& config); void vt369_vtunknown_unk(machine_config& config); void vt369_vtunknown_unk_1mb(machine_config& config); - void vt369_vtunknown_unk_2mb(machine_config& config); void vt369_vtunknown_unk_4mb(machine_config& config); void vt369_vtunknown_unk_16mb(machine_config& config); @@ -450,12 +451,6 @@ void vt369_vtunknown_unk_state::vt369_vtunknown_unk_1mb(machine_config& config) m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_1mbyte); } -void vt369_vtunknown_unk_state::vt369_vtunknown_unk_2mb(machine_config& config) -{ - vt369_vtunknown_unk(config); - m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_2mbyte); -} - void vt369_vtunknown_unk_state::vt369_vtunknown_unk_4mb(machine_config& config) { vt369_vtunknown_unk(config); @@ -488,6 +483,17 @@ void vt369_vtunknown_unk_state::vt369_vtunknown_hh_swap_8mb(machine_config &conf m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_8mbyte); } +void vt369_vtunknown_unk_state::vt369_vtunknown_hh_swap_2mb(machine_config &config) +{ + vt369_vtunknown_hh_swap_8mb(config); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_2mbyte); +} + +void vt369_vtunknown_unk_state::vt369_vtunknown_hh_swap_512kb(machine_config &config) +{ + vt369_vtunknown_hh_swap_8mb(config); + m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_512kbyte); +} void vt369_vtunknown_unk_state::vt369_vtunknown_hh_1mb(machine_config& config) { vt369_vtunknown_hh(config); @@ -682,6 +688,10 @@ ROM_END ROM_START( lxcmcyba ) ROM_REGION( 0x4000000, "mainrom", 0 ) ROM_LOAD( "barbie.bin", 0x00000, 0x4000000, CRC(e38af9d0) SHA1(a978a4da61f007c152c70233e9628dbebb427743) ) + + ROM_REGION( 0x1000, "soc:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + // not verified for this set, used for testing, seems to also map in sound CPU space at 0x4000 in this case, main CPU copies vectors from start of ROM? + ROM_LOAD( "internal.bin", 0x0000, 0x1000, BAD_DUMP CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_END ROM_START( lxcmcypp ) @@ -789,7 +799,7 @@ ROM_START( lpgm240 ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "w25q64jv.u1", 0x00000, 0x800000, CRC(b973e65b) SHA1(36ff137068ea56b4679c2db386ac0067de0a9eaf) ) - ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "soc:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) ROM_END @@ -797,7 +807,7 @@ ROM_START( tup240 ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "mini_arcade240.bin", 0x00000, 0x800000, CRC(d4b4bf6c) SHA1(9cf4557e27bc8659079c62abdd22a311e1843047) ) - ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "soc:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) ROM_END @@ -851,7 +861,7 @@ ROM_START( myarccn ) ROM_REGION( 0x100000, "mainrom", 0 ) ROM_LOAD( "my_arcade_caveman_ninja.bin", 0x00000, 0x100000, CRC(dcc5590c) SHA1(a734cb9c81e58346ff5fa934347d7cb24a32cb39) ) - ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "soc:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_END @@ -859,7 +869,7 @@ ROM_START( hkb502 ) ROM_REGION( 0x400000, "mainrom", 0 ) ROM_LOAD( "red console.bin", 0x00000, 0x400000, CRC(e4766383) SHA1(64b0c20592f38928b3a639fa42b468ff09664808) ) - ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "soc:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_END @@ -867,7 +877,7 @@ ROM_START( hkb502a ) ROM_REGION( 0x400000, "mainrom", 0 ) ROM_LOAD( "hkb-502.bin", 0x00000, 0x400000, CRC(970f54d2) SHA1(b45df00d85a2e29fe9418563927584a048db94b3) ) - ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "soc:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_END @@ -875,7 +885,7 @@ ROM_START( lxcap ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "lexibook_cyber_arcade_pocket.bin", 0x00000, 0x800000, CRC(245d0cd3) SHA1(d91cca2d0f99a6ca202fa9ba6d03587ea8af0cd9) ) - ROM_REGION( 0x1000, "soc:maincpu:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area + ROM_REGION( 0x1000, "soc:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) ROM_REGION( 0x100, "extra", 0 ) // data from additional 8-pin chip for protection @@ -940,11 +950,16 @@ ROM_START( lexi30 ) ROM_END ROM_START( matet10 ) - ROM_REGION( 0x200000, "mainrom", 0 ) + ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "tetriskeychain_p25q16sh_856015.bin", 0x00000, 0x200000, CRC(7a7251ea) SHA1(7ace8482a54f6b06982a90328779c21266d864fa) ) ROM_IGNORE(0x300) ROM_END +ROM_START( matetsl ) + ROM_REGION( 0x800000, "mainrom", 0 ) + ROM_LOAD( "slurpeetetris_p25q40sh_856013.bin", 0x00000, 0x80300, CRC(d3b68de8) SHA1(97bcdfcd31bc536b626f9a369afe18de60a399da) ) +ROM_END + ROM_START( matet100 ) ROM_REGION( 0x2000000, "mainrom", 0 ) ROM_LOAD( "picotetris_s29gl064n90tfi04_0001227e.bin", 0x00000, 0x800000, CRC(7d9296f2) SHA1(0db5883028d14783d0abff1f7672e59534b0e513) ) @@ -1162,8 +1177,9 @@ CONS( 2021, pactin, 0, 0, vt369_vtunknown_unk_1mb, vt369_vtunknown, CONS( 2021, tetrtin, 0, 0, vt369_vtunknown_unk_1mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Fizz Creations", "Tetris Arcade in a Tin", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -// uses a low res display like the above -CONS( 2021, matet10, 0, 0, vt369_vtunknown_unk_2mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (DGUNL-7083, Pixel Pocket, with 10 bonus games)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +// uses a low res display (so vt3xx?) +CONS( 2021, matet10, 0, 0, vt369_vtunknown_hh_swap_2mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (DGUNL-7083, Pixel Pocket, with 10 bonus games)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 2021, matetsl, 0, 0, vt369_vtunknown_hh_swap_512kb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (Slurpee)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // no bonus games on this model // unknown tech level, scrambled opcodes CONS( 2021, matet100, 0, 0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (DGUNL-7027, Pico Player, with 100+ bonus games)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // box says 100+ bonus games diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index 027906c28eb02..c5c34f52d0a55 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -25,7 +25,8 @@ vt3xx_soc_base_device::vt3xx_soc_base_device(const machine_config& mconfig, cons vt3xx_soc_base_device::vt3xx_soc_base_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock) : nes_vt09_soc_device(mconfig, type, tag, owner, clock), m_alu(*this, "alu"), - m_soundcpu(*this, "soundcpu") + m_soundcpu(*this, "soundcpu"), + m_internal_rom(*this, "internal") { } @@ -36,8 +37,7 @@ vt3xx_soc_unk_bt_device::vt3xx_soc_unk_bt_device(const machine_config& mconfig, vt369_soc_introm_noswap_device::vt369_soc_introm_noswap_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock) : - vt3xx_soc_base_device(mconfig, type, tag, owner, clock), - m_internal_rom(*this, "maincpu:internal") + vt3xx_soc_base_device(mconfig, type, tag, owner, clock) { } @@ -99,6 +99,17 @@ void vt3xx_soc_base_device::vt369_relative_w(offs_t offset, uint8_t data) m_relative[offset] = data; } +uint8_t vt3xx_soc_base_device::read_internal(offs_t offset) +{ + if (!m_internal_rom) + { + if (!machine().side_effects_disabled()) + logerror("%s: read from internal ROM (offset %04x), but no internal ROM loaded\n", machine().describe_context(), offset); + return 0x00; + } + + return m_internal_rom[offset]; +} void vt3xx_soc_base_device::vt369_map(address_map &map) { @@ -172,6 +183,9 @@ void vt3xx_soc_base_device::vt369_sound_map(address_map &map) //map(0x2402, 0x2403) // Multiplier Result (r) //map(0x2404, 0x2404) // Multiplier Status (r) //map(0x2800, 0x2803) // DAC (w) + + map(0x4000, 0x4fff).r(FUNC(vt369_soc_introm_noswap_device::read_internal)); // some lexibook sets suggest the internal ROM can also appear here? + map(0xf800, 0xffff).ram().share("soundram"); // doesn't actually map here, the CPU fetches vectors from lower addressse } @@ -311,18 +325,6 @@ uint8_t vt369_soc_introm_noswap_device::extra_rom_r() return machine().rand(); } -uint8_t vt369_soc_introm_noswap_device::read_internal(offs_t offset) -{ - if (!m_internal_rom) - { - if (!machine().side_effects_disabled()) - logerror("%s: read from internal ROM (offset %04x), but no internal ROM loaded\n", machine().describe_context(), offset); - return 0x00; - } - - return m_internal_rom[offset]; -} - void vt369_soc_introm_noswap_device::vt369_introm_map(address_map &map) { vt3xx_soc_base_device::vt369_map(map); diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.h b/src/mame/nintendo/nes_vt369_vtunknown_soc.h index 28471975374ae..462aa84269ce8 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.h +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.h @@ -43,6 +43,8 @@ class vt3xx_soc_base_device : public nes_vt09_soc_device void vt369_411c_bank6000_enable_w(offs_t offset, uint8_t data); void vt369_relative_w(offs_t offset, uint8_t data); + uint8_t read_internal(offs_t offset); + private: void vt369_sound_map(address_map &map) ATTR_COLD; void vt369_sound_external_map(address_map& map) ATTR_COLD; @@ -55,6 +57,8 @@ class vt3xx_soc_base_device : public nes_vt09_soc_device std::vector m_6000_ram; uint8_t m_bank6000 = 0; uint8_t m_bank6000_enable = 0; + + optional_region_ptr m_internal_rom; }; class vt3xx_soc_unk_bt_device : public vt3xx_soc_base_device @@ -87,9 +91,7 @@ class vt369_soc_introm_noswap_device : public vt3xx_soc_base_device uint8_t vthh_414a_r(); void vtfp_411d_w(uint8_t data); void encryption_4169_w(uint8_t data); - uint8_t read_internal(offs_t offset); - optional_region_ptr m_internal_rom; bool m_encryption_allowed; }; From 5592b99564e43372e64476c6ad363f21068165b0 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Fri, 9 May 2025 01:46:54 +0100 Subject: [PATCH 18/35] kill off some redundant / wrong configs --- src/mame/nintendo/nes_vt369_vtunknown.cpp | 30 +++-------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/src/mame/nintendo/nes_vt369_vtunknown.cpp b/src/mame/nintendo/nes_vt369_vtunknown.cpp index bd4bc86096dc9..56ecc33a64d59 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown.cpp @@ -175,9 +175,6 @@ class vt369_vtunknown_unk_state : public vt369_vtunknown_state void vt369_vtunknown_unk_4mb(machine_config& config); void vt369_vtunknown_unk_16mb(machine_config& config); - void vt369_vtunknown_fp(machine_config& config); - void vt369_vtunknown_fp_16mb(machine_config& config); - private: uint8_t vt_rom_banked_r(offs_t offset); [[maybe_unused]] void vt_external_space_map_fp_2x32mbyte(address_map &map) ATTR_COLD; @@ -544,27 +541,6 @@ static INPUT_PORTS_START( vt369_vtunknown ) INPUT_PORTS_END -void vt369_vtunknown_unk_state::vt369_vtunknown_fp(machine_config &config) -{ - vt369_vtunknown_4k_ram(config); - - NES_VT32_SOC(config.replace(), m_soc, NTSC_APU_CLOCK); - configure_soc(m_soc); - - m_soc->set_default_palette_mode(PAL_MODE_NEW_RGB12); - m_soc->force_bad_dma(); -} - - -void vt369_vtunknown_unk_state::vt369_vtunknown_fp_16mb(machine_config& config) -{ - vt369_vtunknown_fp(config); - m_soc->set_addrmap(AS_PROGRAM, &vt369_vtunknown_unk_state::vt_external_space_map_16mbyte); -} - - - - uint8_t vt369_vtunknown_dg_fapocket_state::fapocket_412c_r() { if (m_cartsel) @@ -1079,9 +1055,9 @@ CONS( 2017, rtvgc300fz,0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_v */ // uncertain, NOT SPI ROM -CONS( 200?, zonefusn, 0, 0, vt369_vtunknown_fp_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Ultimate Products / Jungle's Soft", "Zone Fusion", MACHINE_NOT_WORKING ) +CONS( 200?, zonefusn, 0, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Ultimate Products / Jungle's Soft", "Zone Fusion", MACHINE_NOT_WORKING ) // same as above but without Jungle's Soft boot logo? model number taken from cover of manual -CONS( 200?, sealvt, zonefusn, 0, vt369_vtunknown_fp_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook / Sit Up Limited / Jungle's Soft", "Seal 30-in-1 (VT based, Model FN098134)", MACHINE_NOT_WORKING ) +CONS( 200?, sealvt, zonefusn, 0, vt369_vtunknown_hh_16mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "Lexibook / Sit Up Limited / Jungle's Soft", "Seal 30-in-1 (VT based, Model FN098134)", MACHINE_NOT_WORKING ) // NOT SPI roms, code start with '6a' (possibly encrypted opcode after jump from an internal bootstrap ROM?) @@ -1181,5 +1157,5 @@ CONS( 2021, tetrtin, 0, 0, vt369_vtunknown_unk_1mb, vt369_vtunknown, CONS( 2021, matet10, 0, 0, vt369_vtunknown_hh_swap_2mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (DGUNL-7083, Pixel Pocket, with 10 bonus games)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) CONS( 2021, matetsl, 0, 0, vt369_vtunknown_hh_swap_512kb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (Slurpee)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // no bonus games on this model -// unknown tech level, scrambled opcodes +// unknown tech level, uses vt32 style scramble and palette, but seems to expect vt369 features? CONS( 2021, matet100, 0, 0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (DGUNL-7027, Pico Player, with 100+ bonus games)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // box says 100+ bonus games From 255b41e2eee41c3e84d80408fe95c436dd0cf389 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Fri, 9 May 2025 10:25:35 +0100 Subject: [PATCH 19/35] some logging stubs for the sound CPU --- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 54 ++++++++++++++++--- src/mame/nintendo/nes_vt369_vtunknown_soc.h | 9 ++++ 2 files changed, 56 insertions(+), 7 deletions(-) diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index c5c34f52d0a55..46639d5bdeb60 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -168,21 +168,61 @@ void vt3xx_soc_base_device::vt369_map(address_map &map) map(0x6000, 0x7fff).r(FUNC(vt3xx_soc_base_device::vt369_6000_r)).w(FUNC(vt3xx_soc_base_device::vt369_6000_w)); map(0x8000, 0xffff).rw(FUNC(vt3xx_soc_base_device::external_space_read), FUNC(vt3xx_soc_base_device::external_space_write)); +} + +void vt3xx_soc_base_device::vt369_soundcpu_timer_w(offs_t offset, uint8_t data) +{ + logerror("%s: vt369_soundcpu_timer_w %02x %02x\n", machine().describe_context(), offset, data); +} + +void vt3xx_soc_base_device::vt369_soundcpu_adder_data_address_w(offs_t offset, uint8_t data) +{ + logerror("%s: vt369_soundcpu_adder_data_address_w %02x %02x\n", machine().describe_context(), offset, data); +} + +uint8_t vt3xx_soc_base_device::vt369_soundcpu_adder_result_r(offs_t offset) +{ + logerror("%s: vt369_soundcpu_adder_result_r %02x\n", machine().describe_context(), offset); + return 0x00; +} +void vt3xx_soc_base_device::vt369_soundcpu_mult_data_address_w(offs_t offset, uint8_t data) +{ + logerror("%s: vt369_soundcpu_mult_data_address_w %02x %02x\n", machine().describe_context(), offset, data); +} + +uint8_t vt3xx_soc_base_device::vt369_soundcpu_mult_result_r(offs_t offset) +{ + logerror("%s: vt369_soundcpu_mult_result_r %02x\n", machine().describe_context(), offset); + return 0x00; +} + +uint8_t vt3xx_soc_base_device::vt369_soundcpu_mult_status_r() +{ + logerror("%s: vt369_soundcpu_mult_status_r\n", machine().describe_context()); + return 0x00; } +void vt3xx_soc_base_device::vt369_soundcpu_dac_w(offs_t offset, uint8_t data) +{ + // 2 16-bit channels? + logerror("%s: vt369_soundcpu_dac_w %02x %02x\n", machine().describe_context(), offset, data); +} void vt3xx_soc_base_device::vt369_sound_map(address_map &map) { map(0x0000, 0x17ff).ram(); map(0x1800, 0x1fff).ram().share("soundram"); - //map(0x2100, 0x2103) // Timer Control (w) - //map(0x2205, 0x2206) // Adder Data(RAM) Address (w) - //map(0x2210, 0x2211) // Adder Result (r) - //map(0x2400, 0x2401) // Multiplier Data(RAM) Address (w) - //map(0x2402, 0x2403) // Multiplier Result (r) - //map(0x2404, 0x2404) // Multiplier Status (r) - //map(0x2800, 0x2803) // DAC (w) + + map(0x2100, 0x2103).w(FUNC(vt3xx_soc_base_device::vt369_soundcpu_timer_w)); + // 0x2204 + map(0x2205, 0x2206).w(FUNC(vt3xx_soc_base_device::vt369_soundcpu_adder_data_address_w)); + // 0x2207 + map(0x2210, 0x2211).r(FUNC(vt3xx_soc_base_device::vt369_soundcpu_adder_result_r)); + map(0x2400, 0x2401).w(FUNC(vt3xx_soc_base_device::vt369_soundcpu_mult_data_address_w)); + map(0x2402, 0x2403).r(FUNC(vt3xx_soc_base_device::vt369_soundcpu_mult_result_r)); + map(0x2404, 0x2404).r(FUNC(vt3xx_soc_base_device::vt369_soundcpu_mult_status_r)); + map(0x2800, 0x2803).w(FUNC(vt3xx_soc_base_device::vt369_soundcpu_dac_w)); map(0x4000, 0x4fff).r(FUNC(vt369_soc_introm_noswap_device::read_internal)); // some lexibook sets suggest the internal ROM can also appear here? diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.h b/src/mame/nintendo/nes_vt369_vtunknown_soc.h index 462aa84269ce8..8b284dfe9c977 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.h +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.h @@ -51,6 +51,15 @@ class vt3xx_soc_base_device : public nes_vt09_soc_device uint8_t sound_read_external(offs_t offset) { return space(AS_PROGRAM).read_byte(offset); } + + void vt369_soundcpu_timer_w(offs_t offset, uint8_t data); + void vt369_soundcpu_adder_data_address_w(offs_t offset, uint8_t data); + uint8_t vt369_soundcpu_adder_result_r(offs_t offset); + void vt369_soundcpu_mult_data_address_w(offs_t offset, uint8_t data); + uint8_t vt369_soundcpu_mult_result_r(offs_t offset); + uint8_t vt369_soundcpu_mult_status_r(); + void vt369_soundcpu_dac_w(offs_t offset, uint8_t data); + required_device m_alu; required_device m_soundcpu; uint8_t m_relative[2]; From fd7b941f0f14ccd81cad8b909f8234c975eea5a0 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Fri, 9 May 2025 10:40:27 +0100 Subject: [PATCH 20/35] begin adding a timer --- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 21 +++++++++++++++++-- src/mame/nintendo/nes_vt369_vtunknown_soc.h | 6 ++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index 46639d5bdeb60..b8fc7e1a33980 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -26,7 +26,9 @@ vt3xx_soc_base_device::vt3xx_soc_base_device(const machine_config& mconfig, devi nes_vt09_soc_device(mconfig, type, tag, owner, clock), m_alu(*this, "alu"), m_soundcpu(*this, "soundcpu"), - m_internal_rom(*this, "internal") + m_sound_timer(nullptr), + m_internal_rom(*this, "internal"), + m_soundram(*this, "soundram") { } @@ -209,6 +211,15 @@ void vt3xx_soc_base_device::vt369_soundcpu_dac_w(offs_t offset, uint8_t data) logerror("%s: vt369_soundcpu_dac_w %02x %02x\n", machine().describe_context(), offset, data); } +uint8_t vt3xx_soc_base_device::vt369_soundcpu_vectors_r(offs_t offset) +{ + // timer IRQ (others are currently unused, point to rti, not clear what they're for or how they're enabled) + if ((offset == 0x04) || (offset == 0x05)) + return m_soundram[0x7f8 + (offset & 1)]; + + return m_soundram[0x7fa + offset]; +} + void vt3xx_soc_base_device::vt369_sound_map(address_map &map) { map(0x0000, 0x17ff).ram(); @@ -226,7 +237,7 @@ void vt3xx_soc_base_device::vt369_sound_map(address_map &map) map(0x4000, 0x4fff).r(FUNC(vt369_soc_introm_noswap_device::read_internal)); // some lexibook sets suggest the internal ROM can also appear here? - map(0xf800, 0xffff).ram().share("soundram"); // doesn't actually map here, the CPU fetches vectors from lower addressse + map(0xfffa, 0xffff).r(FUNC(vt3xx_soc_base_device::vt369_soundcpu_vectors_r)); } void vt3xx_soc_base_device::vt369_sound_external_map(address_map &map) @@ -277,6 +288,10 @@ void vt3xx_soc_base_device::vt369_6000_w(offs_t offset, uint8_t data) } } +TIMER_CALLBACK_MEMBER(vt3xx_soc_base_device::sound_timer_expired) +{ + +} void vt3xx_soc_base_device::device_start() { @@ -287,6 +302,8 @@ void vt3xx_soc_base_device::device_start() m_bank6000_enable = 0; m_relative[0] = m_relative[1] = 0x00; + m_sound_timer = timer_alloc(FUNC(vt3xx_soc_base_device::sound_timer_expired), this); + save_item(NAME(m_6000_ram)); save_item(NAME(m_bank6000)); save_item(NAME(m_bank6000_enable)); diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.h b/src/mame/nintendo/nes_vt369_vtunknown_soc.h index 8b284dfe9c977..3dc9e6af15ba1 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.h +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.h @@ -59,6 +59,9 @@ class vt3xx_soc_base_device : public nes_vt09_soc_device uint8_t vt369_soundcpu_mult_result_r(offs_t offset); uint8_t vt369_soundcpu_mult_status_r(); void vt369_soundcpu_dac_w(offs_t offset, uint8_t data); + uint8_t vt369_soundcpu_vectors_r(offs_t offset); + + TIMER_CALLBACK_MEMBER(sound_timer_expired); required_device m_alu; required_device m_soundcpu; @@ -67,7 +70,10 @@ class vt3xx_soc_base_device : public nes_vt09_soc_device uint8_t m_bank6000 = 0; uint8_t m_bank6000_enable = 0; + emu_timer *m_sound_timer; + optional_region_ptr m_internal_rom; + required_shared_ptr m_soundram; }; class vt3xx_soc_unk_bt_device : public vt3xx_soc_base_device From 1ad2d8a8854bf16c95ac15d8e7302d12f6076c00 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Fri, 9 May 2025 11:42:29 +0100 Subject: [PATCH 21/35] run a sound timer, allows denv150 to boot (with bad gfx due to missing extra screen modes, and without the extra menu sound as the rest hasn't been hooked up yet) --- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 64 +++++++++++++++++-- src/mame/nintendo/nes_vt369_vtunknown_soc.h | 4 ++ 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index b8fc7e1a33980..b55c722069e73 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -172,9 +172,58 @@ void vt3xx_soc_base_device::vt369_map(address_map &map) map(0x8000, 0xffff).rw(FUNC(vt3xx_soc_base_device::external_space_read), FUNC(vt3xx_soc_base_device::external_space_write)); } +void vt3xx_soc_base_device::update_timer() +{ + if (m_timercontrol & 0x01) + { + // TODO: use m_timerperiod + m_sound_timer->adjust(attotime::from_hz(400), 0); + } + else + { + m_sound_timer->adjust(attotime::never); + } +} + +TIMER_CALLBACK_MEMBER(vt3xx_soc_base_device::sound_timer_expired) +{ + if (m_timercontrol & 0x02) + { + m_soundcpu->set_input_line(M6502_IRQ_LINE, HOLD_LINE); + } + update_timer(); +} + void vt3xx_soc_base_device::vt369_soundcpu_timer_w(offs_t offset, uint8_t data) { - logerror("%s: vt369_soundcpu_timer_w %02x %02x\n", machine().describe_context(), offset, data); + switch (offset) + { + case 0x00: + m_timerperiod = (m_timerperiod & 0xff00) | data; + logerror("%s: vt369_soundcpu_timer_w %02x %02x (period low byte)\n", machine().describe_context(), offset, data); + break; + + case 0x01: + m_timerperiod = (m_timerperiod & 0x00ff) | data << 8; + logerror("%s: vt369_soundcpu_timer_w %02x %02x (period high byte)\n", machine().describe_context(), offset, data); + break; + + case 0x02: + // 0x01 - enable timer + // 0x02 - enable timer IRQ + logerror("%s: vt369_soundcpu_timer_w %02x %02x (control)\n", machine().describe_context(), offset, data); + m_timercontrol = data; + update_timer(); + break; + + case 0x03: + logerror("%s: vt369_soundcpu_timer_w %02x %02x (clear IRQ)\n", machine().describe_context(), offset, data); + break; + + default: + logerror("%s: vt369_soundcpu_timer_w %02x %02x\n", machine().describe_context(), offset, data); + break; + } } void vt3xx_soc_base_device::vt369_soundcpu_adder_data_address_w(offs_t offset, uint8_t data) @@ -288,11 +337,6 @@ void vt3xx_soc_base_device::vt369_6000_w(offs_t offset, uint8_t data) } } -TIMER_CALLBACK_MEMBER(vt3xx_soc_base_device::sound_timer_expired) -{ - -} - void vt3xx_soc_base_device::device_start() { nes_vt02_vt03_soc_device::device_start(); @@ -304,6 +348,8 @@ void vt3xx_soc_base_device::device_start() m_sound_timer = timer_alloc(FUNC(vt3xx_soc_base_device::sound_timer_expired), this); + save_item(NAME(m_timerperiod)); + save_item(NAME(m_timercontrol)); save_item(NAME(m_6000_ram)); save_item(NAME(m_bank6000)); save_item(NAME(m_bank6000_enable)); @@ -314,9 +360,15 @@ void vt3xx_soc_base_device::device_reset() { nes_vt02_vt03_soc_device::device_reset(); m_soundcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + + m_timerperiod = 0; + m_timercontrol = 0; + m_sound_timer->adjust(attotime::never); } + + uint8_t vt3xx_soc_base_device::vt369_41bx_r(offs_t offset) { switch (offset) diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.h b/src/mame/nintendo/nes_vt369_vtunknown_soc.h index 3dc9e6af15ba1..e3b50a958cca4 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.h +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.h @@ -62,6 +62,7 @@ class vt3xx_soc_base_device : public nes_vt09_soc_device uint8_t vt369_soundcpu_vectors_r(offs_t offset); TIMER_CALLBACK_MEMBER(sound_timer_expired); + void update_timer(); required_device m_alu; required_device m_soundcpu; @@ -70,6 +71,9 @@ class vt3xx_soc_base_device : public nes_vt09_soc_device uint8_t m_bank6000 = 0; uint8_t m_bank6000_enable = 0; + uint16_t m_timerperiod; + uint8_t m_timercontrol; + emu_timer *m_sound_timer; optional_region_ptr m_internal_rom; From 1e1aa8f4fba1e902113e7aefbeef60558f019772 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Fri, 9 May 2025 12:35:03 +0100 Subject: [PATCH 22/35] reoganize a little --- src/mame/nintendo/nes_vt369_vtunknown.cpp | 41 ++++++++++++------- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 9 ++++ src/mame/nintendo/nes_vt369_vtunknown_soc.h | 2 + 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/src/mame/nintendo/nes_vt369_vtunknown.cpp b/src/mame/nintendo/nes_vt369_vtunknown.cpp index 56ecc33a64d59..89f3e1d4be6a3 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown.cpp @@ -584,6 +584,21 @@ static INPUT_PORTS_START( vt369_vtunknown_fa ) PORT_DIPSETTING( 0x01, "130-in-1" ) INPUT_PORTS_END +// internal ROMs - these seem to be generic, but that isn't yet verified, if they are move them to device +// +// maps at 0x1000-0x1fff on main CPU, and can boot using vectors in 1ffx area +// can also be mapped at 0x4000-0x4fff on the sound CPU, typically when this is +// done the main CPU fetch the vectors from 0x4000 and writes them to the RAM +// shared with the sound CPU vector area before enabling the sound CPU + +#define VT3XX_INTERNAL_NO_SWAP \ + ROM_REGION( 0x1000, "soc:internal", 0 ) \ + ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) + +#define VT3XX_INTERNAL_OPCODE_SWAP \ + ROM_REGION( 0x1000, "soc:internal", 0 ) \ + ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) + // below use Flash ROMs ROM_START( dgun2561 ) @@ -665,9 +680,7 @@ ROM_START( lxcmcyba ) ROM_REGION( 0x4000000, "mainrom", 0 ) ROM_LOAD( "barbie.bin", 0x00000, 0x4000000, CRC(e38af9d0) SHA1(a978a4da61f007c152c70233e9628dbebb427743) ) - ROM_REGION( 0x1000, "soc:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - // not verified for this set, used for testing, seems to also map in sound CPU space at 0x4000 in this case, main CPU copies vectors from start of ROM? - ROM_LOAD( "internal.bin", 0x0000, 0x1000, BAD_DUMP CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) + VT3XX_INTERNAL_NO_SWAP // not verified for this set, used for testing ROM_END ROM_START( lxcmcypp ) @@ -750,11 +763,15 @@ ROM_END ROM_START( zonefusn ) ROM_REGION( 0x1000000, "mainrom", 0 ) ROM_LOAD( "fusion.bin", 0x00000, 0x1000000, CRC(240bf970) SHA1(1b82d95a252c08e52fb8da6320276574a30b60db) ) + + VT3XX_INTERNAL_NO_SWAP // not verified for this set, used for testing ROM_END ROM_START( sealvt ) ROM_REGION( 0x1000000, "mainrom", 0 ) ROM_LOAD( "l157-44 v02.u1", 0x00000, 0x1000000, CRC(0fabced0) SHA1(3f8cd85b12b125b01c831c9f2f2937e29c1b6205) ) + + VT3XX_INTERNAL_NO_SWAP // not verified for this set, used for testing ROM_END ROM_START( gcs2mgp ) @@ -775,16 +792,14 @@ ROM_START( lpgm240 ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "w25q64jv.u1", 0x00000, 0x800000, CRC(b973e65b) SHA1(36ff137068ea56b4679c2db386ac0067de0a9eaf) ) - ROM_REGION( 0x1000, "soc:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) + VT3XX_INTERNAL_OPCODE_SWAP ROM_END ROM_START( tup240 ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "mini_arcade240.bin", 0x00000, 0x800000, CRC(d4b4bf6c) SHA1(9cf4557e27bc8659079c62abdd22a311e1843047) ) - ROM_REGION( 0x1000, "soc:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(57c9cea9) SHA1(4f338e5ef87a66601014ad726cfefefbc20dc4be) ) + VT3XX_INTERNAL_OPCODE_SWAP ROM_END ROM_START( sy889 ) @@ -837,32 +852,28 @@ ROM_START( myarccn ) ROM_REGION( 0x100000, "mainrom", 0 ) ROM_LOAD( "my_arcade_caveman_ninja.bin", 0x00000, 0x100000, CRC(dcc5590c) SHA1(a734cb9c81e58346ff5fa934347d7cb24a32cb39) ) - ROM_REGION( 0x1000, "soc:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) + VT3XX_INTERNAL_NO_SWAP // verified for this set ROM_END ROM_START( hkb502 ) ROM_REGION( 0x400000, "mainrom", 0 ) ROM_LOAD( "red console.bin", 0x00000, 0x400000, CRC(e4766383) SHA1(64b0c20592f38928b3a639fa42b468ff09664808) ) - ROM_REGION( 0x1000, "soc:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) + VT3XX_INTERNAL_NO_SWAP // verified for this set ROM_END ROM_START( hkb502a ) ROM_REGION( 0x400000, "mainrom", 0 ) ROM_LOAD( "hkb-502.bin", 0x00000, 0x400000, CRC(970f54d2) SHA1(b45df00d85a2e29fe9418563927584a048db94b3) ) - ROM_REGION( 0x1000, "soc:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) + VT3XX_INTERNAL_NO_SWAP // verified for this set ROM_END ROM_START( lxcap ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "lexibook_cyber_arcade_pocket.bin", 0x00000, 0x800000, CRC(245d0cd3) SHA1(d91cca2d0f99a6ca202fa9ba6d03587ea8af0cd9) ) - ROM_REGION( 0x1000, "soc:internal", 0 ) // maps at 1000-1fff on main CPU, and it boots using vectors in 1ffx area - ROM_LOAD( "internal.bin", 0x0000, 0x1000, CRC(da5850f0) SHA1(39d674d965818922aad5993e9499170d3ebc43bf) ) + VT3XX_INTERNAL_NO_SWAP // verified for this set ROM_REGION( 0x100, "extra", 0 ) // data from additional 8-pin chip for protection ROM_LOAD( "mystery chip.bin", 0x00000, 0x100, CRC(491d206b) SHA1(a5411a7afe3b4df93b1b22e5533f5010bd3aaa93) ) diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index b55c722069e73..9e0ada2d19e87 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -163,6 +163,8 @@ void vt3xx_soc_base_device::vt369_map(address_map &map) map(0x4160, 0x4161).w(FUNC(vt3xx_soc_base_device::vt369_relative_w)); map(0x4162, 0x4162).w(FUNC(vt3xx_soc_base_device::vt369_soundcpu_control_w)); + map(0x418a, 0x418a).r(FUNC(vt3xx_soc_base_device::vt369_418a_r)); + map(0x41b0, 0x41bf).r(FUNC(vt3xx_soc_base_device::vt369_41bx_r)).w(FUNC(vt3xx_soc_base_device::vt369_41bx_w)); map(0x4800, 0x4fff).ram().share("soundram"); // sound program for 2nd CPU is uploaded here, but some sets aren't uploading anything, do they rely on an internal ROM? other DMA? possibility to map ROM? @@ -396,6 +398,12 @@ uint8_t vt3xx_soc_base_device::vt369_415c_r() return 0xff; } +uint8_t vt3xx_soc_base_device::vt369_418a_r() +{ + logerror("%s: vt369_418a_r\n", machine().describe_context()); + return machine().rand(); +} + /***********************************************************************************************************************************************************/ /* this might just be the same as vt369 but with the games not using all features */ /***********************************************************************************************************************************************************/ @@ -430,6 +438,7 @@ uint8_t vt369_soc_introm_noswap_device::vthh_414a_r() uint8_t vt369_soc_introm_noswap_device::extra_rom_r() { + logerror("%s: extra_rom_r (protection?)\n", machine().describe_context()); // this reads from the 'extra ROM' area (serial style protocol) and code is copied on gtct885 to e00 in RAM, jumps to it at EDF9: jsr $0e1c return machine().rand(); } diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.h b/src/mame/nintendo/nes_vt369_vtunknown_soc.h index e3b50a958cca4..5c59a97290bc6 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.h +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.h @@ -35,6 +35,8 @@ class vt3xx_soc_base_device : public nes_vt09_soc_device uint8_t vt369_414f_r(); uint8_t vt369_415c_r(); + uint8_t vt369_418a_r(); + uint8_t vt369_6000_r(offs_t offset); void vt369_6000_w(offs_t offset, uint8_t data); From 42b87c2b7be406c03c9503f9f52c44a85beffc1e Mon Sep 17 00:00:00 2001 From: David Haywood Date: Fri, 9 May 2025 13:00:47 +0100 Subject: [PATCH 23/35] a bit of tidy up --- src/mame/mame.lst | 2 +- src/mame/nintendo/nes_vt32.cpp | 11 +++++++++++ src/mame/nintendo/nes_vt369_vtunknown.cpp | 16 ++++------------ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index bbc15511e6f5e..f173b68c4bac8 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -35197,6 +35197,7 @@ dgun2573a dgunl3201 dgunl3202 fcpocket +matet100 matet220 matet300 myaasa @@ -35237,7 +35238,6 @@ lxcmcysw lxcyber lxpcsp matet10 -matet100 matetsl mc_cb280 mc_hh210 diff --git a/src/mame/nintendo/nes_vt32.cpp b/src/mame/nintendo/nes_vt32.cpp index d07fda9615c1e..127bf991c98c7 100644 --- a/src/mame/nintendo/nes_vt32.cpp +++ b/src/mame/nintendo/nes_vt32.cpp @@ -389,6 +389,13 @@ ROM_START( matet220 ) ROM_IGNORE(0x100) ROM_END +ROM_START( matet100 ) + ROM_REGION( 0x2000000, "mainrom", 0 ) + ROM_LOAD( "picotetris_s29gl064n90tfi04_0001227e.bin", 0x00000, 0x800000, CRC(7d9296f2) SHA1(0db5883028d14783d0abff1f7672e59534b0e513) ) + ROM_IGNORE(0x100) + ROM_FILL( 0x7f222, 3, 0x4b ) // prevent a jump to 6100 +ROM_END + } // anonymous namespace @@ -414,5 +421,9 @@ CONS( 2021, matet300, 0, 0, nes_vt32_32mb, nes_vt32, nes_vt32_unk_ // some games (eg F22) are scrambled like in myaass CONS( 2021, matet220, 0, 0, nes_vt32_32mb, nes_vt32, nes_vt32_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (DGUNL-7030, Gamer V, with 220 bonus games)", MACHINE_NOT_WORKING ) +// unknown tech level, uses vt32 style opcode scramble and palette, but seems to expect vt369 features? +// jumps to 6100 (ROM window on vt3xx?) +CONS( 2021, matet100, 0, 0, nes_vt32_32mb, nes_vt32, nes_vt32_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (DGUNL-7027, Pico Player, with 100+ bonus games)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // box says 100+ bonus games + // Use DIP switch to select console or cartridge, as cartridge is fake and just toggles a GPIO CONS( 2016, fcpocket, 0, 0, nes_vt32_4x16mb, nes_vt32_fp, nes_vt32_unk_state, empty_init, "", "FC Pocket 600 in 1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // has external banking (2x 32mbyte banks) diff --git a/src/mame/nintendo/nes_vt369_vtunknown.cpp b/src/mame/nintendo/nes_vt369_vtunknown.cpp index 89f3e1d4be6a3..8977f245c20cd 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown.cpp @@ -937,20 +937,15 @@ ROM_START( lexi30 ) ROM_END ROM_START( matet10 ) - ROM_REGION( 0x800000, "mainrom", 0 ) + ROM_REGION( 0x200000, "mainrom", 0 ) ROM_LOAD( "tetriskeychain_p25q16sh_856015.bin", 0x00000, 0x200000, CRC(7a7251ea) SHA1(7ace8482a54f6b06982a90328779c21266d864fa) ) ROM_IGNORE(0x300) ROM_END ROM_START( matetsl ) - ROM_REGION( 0x800000, "mainrom", 0 ) - ROM_LOAD( "slurpeetetris_p25q40sh_856013.bin", 0x00000, 0x80300, CRC(d3b68de8) SHA1(97bcdfcd31bc536b626f9a369afe18de60a399da) ) -ROM_END - -ROM_START( matet100 ) - ROM_REGION( 0x2000000, "mainrom", 0 ) - ROM_LOAD( "picotetris_s29gl064n90tfi04_0001227e.bin", 0x00000, 0x800000, CRC(7d9296f2) SHA1(0db5883028d14783d0abff1f7672e59534b0e513) ) - ROM_IGNORE(0x100) + ROM_REGION( 0x80000, "mainrom", 0 ) + ROM_LOAD( "slurpeetetris_p25q40sh_856013.bin", 0x00000, 0x80000, CRC(d3b68de8) SHA1(97bcdfcd31bc536b626f9a369afe18de60a399da) ) + ROM_IGNORE(0x300) ROM_END ROM_START( nesvt270 ) @@ -1167,6 +1162,3 @@ CONS( 2021, tetrtin, 0, 0, vt369_vtunknown_unk_1mb, vt369_vtunknown, // uses a low res display (so vt3xx?) CONS( 2021, matet10, 0, 0, vt369_vtunknown_hh_swap_2mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (DGUNL-7083, Pixel Pocket, with 10 bonus games)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) CONS( 2021, matetsl, 0, 0, vt369_vtunknown_hh_swap_512kb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (Slurpee)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // no bonus games on this model - -// unknown tech level, uses vt32 style scramble and palette, but seems to expect vt369 features? -CONS( 2021, matet100, 0, 0, vt369_vtunknown_hh_8mb, vt369_vtunknown, vt369_vtunknown_unk_state, empty_init, "dreamGEAR", "My Arcade Tetris (DGUNL-7027, Pico Player, with 100+ bonus games)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // box says 100+ bonus games From 4bb1774b3ba398fd4f8356329eb5412a8a0e08b2 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 13 May 2025 12:24:14 +0100 Subject: [PATCH 24/35] some prep for a derived PPU for VT3xx --- src/devices/video/ppu2c0x_vt.cpp | 205 +++++++----------- src/devices/video/ppu2c0x_vt.h | 59 ++++- src/mame/nintendo/nes_vt32_soc.cpp | 4 +- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 29 ++- src/mame/nintendo/nes_vt_soc.cpp | 19 +- 5 files changed, 177 insertions(+), 139 deletions(-) diff --git a/src/devices/video/ppu2c0x_vt.cpp b/src/devices/video/ppu2c0x_vt.cpp index 80616719ac136..ed9f6efbdbc63 100644 --- a/src/devices/video/ppu2c0x_vt.cpp +++ b/src/devices/video/ppu2c0x_vt.cpp @@ -20,6 +20,8 @@ DEFINE_DEVICE_TYPE(PPU_VT03, ppu_vt03_device, "ppu_vt03", "VT03 PPU (NTSC)") DEFINE_DEVICE_TYPE(PPU_VT03PAL, ppu_vt03pal_device, "ppu_vt03pal", "VT03 PPU (PAL)") +DEFINE_DEVICE_TYPE(PPU_VT3XX, ppu_vt3xx_device, "ppu_vt3xx", "VT3XX PPU (NTSC)") + ppu_vt03_device::ppu_vt03_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock) : ppu2c0x_device(mconfig, type, tag, owner, clock), m_is_pal(false), @@ -77,66 +79,22 @@ void ppu_vt03_device::palette_write(offs_t offset, uint8_t data) } } - -uint8_t ppu_vt03_device::read_extended(offs_t offset) -{ - offset += 0x10; - logerror("%s: read from extended PPU reg %02x\n", machine().describe_context(), offset); - - switch (offset) - { - case 0x10: - return m_201x_regs[0x0]; - - case 0x11: - return m_201x_regs[0x1]; - - case 0x12: - return m_201x_regs[m_2012_2017_descramble[0]]; - - case 0x13: - return m_201x_regs[m_2012_2017_descramble[1]]; - - case 0x14: - return m_201x_regs[m_2012_2017_descramble[2]]; - - case 0x15: - return m_201x_regs[m_2012_2017_descramble[3]]; - - case 0x16: - return m_201x_regs[m_2012_2017_descramble[4]]; - - case 0x17: - return m_201x_regs[m_2012_2017_descramble[5]]; - - case 0x18: - return m_201x_regs[0x8]; - - case 0x19: - return 0x00; - - case 0x1a: - return m_201x_regs[0xa]; - - case 0x1b: - return 0x00; - - case 0x1c: - return 0x00; - - case 0x1d: - return 0x00; - - case 0x1e: - return 0x00; - - case 0x1f: - return 0x00; - } - - return 0x00; -} - +uint8_t ppu_vt03_device::read_2010(offs_t offset) { return m_201x_regs[0x0]; } +uint8_t ppu_vt03_device::read_2011(offs_t offset) { return m_201x_regs[0x1]; } +uint8_t ppu_vt03_device::read_2012(offs_t offset) { return m_201x_regs[m_2012_2017_descramble[0]]; } +uint8_t ppu_vt03_device::read_2013(offs_t offset) { return m_201x_regs[m_2012_2017_descramble[1]]; } +uint8_t ppu_vt03_device::read_2014(offs_t offset) { return m_201x_regs[m_2012_2017_descramble[2]]; } +uint8_t ppu_vt03_device::read_2015(offs_t offset) { return m_201x_regs[m_2012_2017_descramble[3]]; } +uint8_t ppu_vt03_device::read_2016(offs_t offset) { return m_201x_regs[m_2012_2017_descramble[4]]; } +uint8_t ppu_vt03_device::read_2017(offs_t offset) { return m_201x_regs[m_2012_2017_descramble[5]]; } +uint8_t ppu_vt03_device::read_2018(offs_t offset) { return m_201x_regs[0x8]; } +uint8_t ppu_vt03_device::read_2019(offs_t offset) { return 0x00; } +uint8_t ppu_vt03_device::read_201a(offs_t offset) { return m_201x_regs[0xa]; } +uint8_t ppu_vt03_device::read_201b(offs_t offset) { return 0x00; } +uint8_t ppu_vt03_device::read_201c(offs_t offset) { return 0x00; } +uint8_t ppu_vt03_device::read_201d(offs_t offset) { return 0x00; } +uint8_t ppu_vt03_device::read_201e(offs_t offset) { return 0x00; } +uint8_t ppu_vt03_device::read_201f(offs_t offset) { return 0x00; } void ppu_vt03_device::init_vtxx_rgb555_palette_tables() @@ -553,6 +511,11 @@ uint8_t ppu_vt03_device::get_speva2_speva0() } void ppu_vt03_device::set_2010_reg(uint8_t data) +{ + +} + +void ppu_vt03_device::write_2010(offs_t offset, uint8_t data) { /* 7 : COLCOMP 6 : UNUSED (8bpp enable on VT09?) @@ -566,78 +529,58 @@ void ppu_vt03_device::set_2010_reg(uint8_t data) m_201x_regs[0x0] = data; } -void ppu_vt03_device::write_extended(offs_t offset, uint8_t data) +void ppu_vt03_device::write_2011(offs_t offset, uint8_t data) { m_201x_regs[0x1] = data; } +void ppu_vt03_device::write_2012(offs_t offset, uint8_t data) { m_201x_regs[m_2012_2017_descramble[0]] = data; } +void ppu_vt03_device::write_2013(offs_t offset, uint8_t data) { m_201x_regs[m_2012_2017_descramble[1]] = data; } +void ppu_vt03_device::write_2014(offs_t offset, uint8_t data) { m_201x_regs[m_2012_2017_descramble[2]] = data; } +void ppu_vt03_device::write_2015(offs_t offset, uint8_t data) { m_201x_regs[m_2012_2017_descramble[3]] = data; } +void ppu_vt03_device::write_2016(offs_t offset, uint8_t data) { m_201x_regs[m_2012_2017_descramble[4]] = data; } +void ppu_vt03_device::write_2017(offs_t offset, uint8_t data) { m_201x_regs[m_2012_2017_descramble[5]] = data; } +void ppu_vt03_device::write_2018(offs_t offset, uint8_t data) { m_201x_regs[0x8] = data; } +void ppu_vt03_device::write_2019(offs_t offset, uint8_t data) { logerror("%s: write_2019 %02x (gun reset?)\n", machine().describe_context(), data); } +void ppu_vt03_device::write_201a(offs_t offset, uint8_t data) { m_201x_regs[0xa] = data; } +/* 201b unused */ +/* 201c read gun read x (older VT chipsets) */ +/* 201d read gun read y (older VT chipsets) */ +/* 201e read gun 2 read x (older VT chipsets) */ +/* 201f read gun 2 read y (older VT chipsets) */ + + +ppu_vt3xx_device::ppu_vt3xx_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : + ppu_vt03_device(mconfig, PPU_VT3XX, tag, owner, clock) { - offset += 0x10; - logerror("%s: write to extended PPU reg 0x20%02x %02x\n", machine().describe_context(), offset, data); - switch (offset) - { - case 0x10: - set_2010_reg(data); - break; - - case 0x11: - m_201x_regs[0x1] = data; - break; - - case 0x12: - m_201x_regs[m_2012_2017_descramble[0]] = data; - break; - - case 0x13: - m_201x_regs[m_2012_2017_descramble[1]] = data; - break; - - case 0x14: - m_201x_regs[m_2012_2017_descramble[2]] = data; - break; - - case 0x15: - m_201x_regs[m_2012_2017_descramble[3]] = data; - break; - - case 0x16: - m_201x_regs[m_2012_2017_descramble[4]] = data; - break; - - case 0x17: - logerror("set reg 7 %02x\n", data); - m_201x_regs[m_2012_2017_descramble[5]] = data; - break; - - case 0x18: - logerror("set reg 8 %02x\n", data); - m_201x_regs[0x8] = data; - break; - - case 0x19: - // reset gun port (value doesn't matter) - break; - - case 0x1a: - m_201x_regs[0xa] = data; - break; - - case 0x1b: - // unused - break; - - case 0x1c: - // (READ) x-coordinate of gun - break; - - case 0x1d: - // (READ) y-coordinate of gun - break; - - case 0x1e: - // (READ) x-coordinate of gun 2 - break; - - case 0x1f: - // (READ) y-coordinate of gun 2 - break; - } } +void ppu_vt3xx_device::device_start() +{ + ppu_vt03_device::device_start(); + save_item(NAME(m_newvid_1c)); + save_item(NAME(m_newvid_1d)); + save_item(NAME(m_newvid_1e)); +} + +void ppu_vt3xx_device::device_reset() +{ + ppu_vt03_device::device_reset(); + m_newvid_1c = 0x00; + m_newvid_1d = 0x00; + m_newvid_1e = 0x00; +} +uint8_t ppu_vt3xx_device::read_201c_newvid(offs_t offset) { return m_newvid_1c; } +uint8_t ppu_vt3xx_device::read_201d_newvid(offs_t offset) { return m_newvid_1d; } +uint8_t ppu_vt3xx_device::read_201e_newvid(offs_t offset) { return m_newvid_1e; } + +void ppu_vt3xx_device::write_201c_newvid(offs_t offset, uint8_t data) { m_newvid_1c = data; logerror("%s: write_201c_newvid %02x\n", machine().describe_context(), data); } +void ppu_vt3xx_device::write_201d_newvid(offs_t offset, uint8_t data) { m_newvid_1d = data; logerror("%s: write_201d_newvid %02x\n", machine().describe_context(), data); } + +void ppu_vt3xx_device::write_201e_newvid(offs_t offset, uint8_t data) +{ + /* + extended mode feature enables + ---- -s-- + s = old/new sprite mode + */ + m_newvid_1e = data; + logerror("%s: write_201e_newvid %02x\n", machine().describe_context(), data); +} diff --git a/src/devices/video/ppu2c0x_vt.h b/src/devices/video/ppu2c0x_vt.h index ae1524dc8b27a..cb7a4ca34ade6 100644 --- a/src/devices/video/ppu2c0x_vt.h +++ b/src/devices/video/ppu2c0x_vt.h @@ -33,8 +33,34 @@ class ppu_vt03_device : public ppu2c0x_device { void set_palette_mode(vtxx_pal_mode pmode) { m_pal_mode = pmode; } void set_201x_descramble(uint8_t reg0, uint8_t reg1, uint8_t reg2, uint8_t reg3, uint8_t reg4, uint8_t reg5); - uint8_t read_extended(offs_t offset); - void write_extended(offs_t offset, uint8_t data); + uint8_t read_2010(offs_t offset); + uint8_t read_2011(offs_t offset); + uint8_t read_2012(offs_t offset); + uint8_t read_2013(offs_t offset); + uint8_t read_2014(offs_t offset); + uint8_t read_2015(offs_t offset); + uint8_t read_2016(offs_t offset); + uint8_t read_2017(offs_t offset); + uint8_t read_2018(offs_t offset); + uint8_t read_2019(offs_t offset); + uint8_t read_201a(offs_t offset); + uint8_t read_201b(offs_t offset); + uint8_t read_201c(offs_t offset); + uint8_t read_201d(offs_t offset); + uint8_t read_201e(offs_t offset); + uint8_t read_201f(offs_t offset); + + void write_2010(offs_t offset, uint8_t data); + void write_2011(offs_t offset, uint8_t data); + void write_2012(offs_t offset, uint8_t data); + void write_2013(offs_t offset, uint8_t data); + void write_2014(offs_t offset, uint8_t data); + void write_2015(offs_t offset, uint8_t data); + void write_2016(offs_t offset, uint8_t data); + void write_2017(offs_t offset, uint8_t data); + void write_2018(offs_t offset, uint8_t data); + void write_2019(offs_t offset, uint8_t data); + void write_201a(offs_t offset, uint8_t data); virtual uint8_t palette_read(offs_t offset) override; virtual void palette_write(offs_t offset, uint8_t data) override; @@ -72,6 +98,8 @@ class ppu_vt03_device : public ppu2c0x_device { uint32_t m_vtpens_rgb555[0x8000*8]; uint32_t m_vtpens_rgb444[0x1000*8]; + uint8_t m_201x_regs[0x20]; + private: devcb_read8 m_read_bg; devcb_read8 m_read_sp; @@ -82,7 +110,6 @@ class ppu_vt03_device : public ppu2c0x_device { uint8_t m_extplanebuf[2]; uint8_t m_extra_sprite_bits; - uint8_t m_201x_regs[0x20]; uint8_t m_2012_2017_descramble[0x6]; @@ -101,7 +128,33 @@ class ppu_vt03pal_device : public ppu_vt03_device { ppu_vt03pal_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); }; +class ppu_vt3xx_device : public ppu_vt03_device { +public: + ppu_vt3xx_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); + + uint8_t read_201c_newvid(offs_t offset); + uint8_t read_201d_newvid(offs_t offset); + uint8_t read_201e_newvid(offs_t offset); + + void write_201c_newvid(offs_t offset, uint8_t data); + void write_201d_newvid(offs_t offset, uint8_t data); + void write_201e_newvid(offs_t offset, uint8_t data); + +protected: + virtual void device_start() override ATTR_COLD; + virtual void device_reset() override ATTR_COLD; + +private: + uint8_t m_newvid_1c; + uint8_t m_newvid_1d; + uint8_t m_newvid_1e; +}; + + DECLARE_DEVICE_TYPE(PPU_VT03, ppu_vt03_device) DECLARE_DEVICE_TYPE(PPU_VT03PAL, ppu_vt03pal_device) +DECLARE_DEVICE_TYPE(PPU_VT3XX, ppu_vt3xx_device) + + #endif // MAME_VIDEO_PPU2C0X_VT_H diff --git a/src/mame/nintendo/nes_vt32_soc.cpp b/src/mame/nintendo/nes_vt32_soc.cpp index e76effb2b7fdf..e05abeadfd764 100644 --- a/src/mame/nintendo/nes_vt32_soc.cpp +++ b/src/mame/nintendo/nes_vt32_soc.cpp @@ -115,7 +115,7 @@ void nes_vt32_soc_device::vtfp_411d_w(uint8_t data) uint8_t nes_vt32_soc_device::vthh_414a_r() { - return 0x80; + return machine().rand(); } @@ -123,7 +123,7 @@ void nes_vt32_soc_device::nes_vt_fp_map(address_map &map) { nes_vt02_vt03_soc_device::nes_vt_map(map); - map(0x0000, 0x1fff).mask(0x0fff).ram(); + map(0x0000, 0x1fff);// .mask(0x0fff).ram(); map(0x414a, 0x414a).r(FUNC(nes_vt32_soc_device::vthh_414a_r)); map(0x411d, 0x411d).w(FUNC(nes_vt32_soc_device::vtfp_411d_w)); diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index 9e0ada2d19e87..28da731fc0b87 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -78,6 +78,13 @@ void vt3xx_soc_base_device::device_add_mconfig(machine_config& config) nes_vt02_vt03_soc_device::device_add_mconfig(config); m_maincpu->set_addrmap(AS_PROGRAM, &vt3xx_soc_base_device::vt369_map); + PPU_VT3XX(config.replace(), m_ppu, RP2A03_NTSC_XTAL); + m_ppu->set_cpu_tag(m_maincpu); + m_ppu->int_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); + m_ppu->read_bg().set(FUNC(vt3xx_soc_base_device::chr_r)); + m_ppu->read_sp().set(FUNC(vt3xx_soc_base_device::spr_r)); + m_ppu->set_screen(m_screen); + VT_VT1682_ALU(config, m_alu, 0); VT3XX_SPU(config, m_soundcpu, RP2A03_NTSC_XTAL); @@ -118,8 +125,24 @@ void vt3xx_soc_base_device::vt369_map(address_map &map) map(0x0000, 0x1fff).ram(); // 8k RAM? // ddrdismx relies on the mirroring, later SoCs have different mirroring? - map(0x2000, 0x2007).rw(m_ppu, FUNC(ppu2c0x_device::read), FUNC(ppu2c0x_device::write)); // standard PPU registers - map(0x2010, 0x201f).rw(m_ppu, FUNC(ppu_vt03_device::read_extended), FUNC(ppu_vt03_device::write_extended)); // extra VT PPU registers + map(0x2000, 0x2007).rw(m_ppu, FUNC(ppu_vt3xx_device::read), FUNC(ppu_vt3xx_device::write)); // standard PPU registers + + map(0x2010, 0x2010).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2010), FUNC(ppu_vt3xx_device::write_2010)); + map(0x2011, 0x2011).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2011), FUNC(ppu_vt3xx_device::write_2011)); + map(0x2012, 0x2012).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2012), FUNC(ppu_vt3xx_device::write_2012)); + map(0x2013, 0x2013).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2013), FUNC(ppu_vt3xx_device::write_2013)); + map(0x2014, 0x2014).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2014), FUNC(ppu_vt3xx_device::write_2014)); + map(0x2015, 0x2015).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2015), FUNC(ppu_vt3xx_device::write_2015)); + map(0x2016, 0x2016).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2016), FUNC(ppu_vt3xx_device::write_2016)); + map(0x2017, 0x2017).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2017), FUNC(ppu_vt3xx_device::write_2017)); + map(0x2018, 0x2018).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2018), FUNC(ppu_vt3xx_device::write_2018)); + map(0x2019, 0x2019).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2019), FUNC(ppu_vt3xx_device::write_2019)); + map(0x201a, 0x201a).rw(m_ppu, FUNC(ppu_vt3xx_device::read_201a), FUNC(ppu_vt3xx_device::write_201a)); + map(0x201b, 0x201b).r(m_ppu, FUNC(ppu_vt3xx_device::read_201b)); + map(0x201c, 0x201c).rw(m_ppu, FUNC(ppu_vt3xx_device::read_201c_newvid), FUNC(ppu_vt3xx_device::write_201c_newvid)); + map(0x201d, 0x201d).rw(m_ppu, FUNC(ppu_vt3xx_device::read_201d_newvid), FUNC(ppu_vt3xx_device::write_201d_newvid)); + map(0x201e, 0x201e).rw(m_ppu, FUNC(ppu_vt3xx_device::read_201e_newvid), FUNC(ppu_vt3xx_device::write_201e_newvid)); + map(0x201f, 0x201f).r(m_ppu, FUNC(ppu_vt3xx_device::read_201f)); map(0x4000, 0x4017).w(m_apu, FUNC(nes_apu_vt_device::write)); @@ -299,6 +322,8 @@ void vt3xx_soc_base_device::vt369_sound_external_map(address_map &map) void vt3xx_soc_base_device::vt369_411c_bank6000_enable_w(offs_t offset, uint8_t data) { + // and CPU clock scaling on bit 0x80? + logerror("enable bank at 0x6000 (%02x)\n", data); m_bank6000_enable = data; } diff --git a/src/mame/nintendo/nes_vt_soc.cpp b/src/mame/nintendo/nes_vt_soc.cpp index 099aabec25fbc..f64b5d541c026 100644 --- a/src/mame/nintendo/nes_vt_soc.cpp +++ b/src/mame/nintendo/nes_vt_soc.cpp @@ -1033,7 +1033,24 @@ void nes_vt02_vt03_soc_device::nes_vt_map(address_map &map) // ddrdismx relies on the mirroring map(0x2000, 0x2007).mirror(0x00e0).rw(m_ppu, FUNC(ppu2c0x_device::read), FUNC(ppu2c0x_device::write)); // standard PPU registers - map(0x2010, 0x201f).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_extended), FUNC(ppu_vt03_device::write_extended)); // extra VT PPU registers + + // 2010 - 201f are extended regs, and can differ between VT models + map(0x2010, 0x2010).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2010), FUNC(ppu_vt03_device::write_2010)); + map(0x2011, 0x2011).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2011), FUNC(ppu_vt03_device::write_2011)); + map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2012), FUNC(ppu_vt03_device::write_2012)); + map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2013), FUNC(ppu_vt03_device::write_2013)); + map(0x2014, 0x2014).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2014), FUNC(ppu_vt03_device::write_2014)); + map(0x2015, 0x2015).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2015), FUNC(ppu_vt03_device::write_2015)); + map(0x2016, 0x2016).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2016), FUNC(ppu_vt03_device::write_2016)); + map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2017), FUNC(ppu_vt03_device::write_2017)); + map(0x2018, 0x2018).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2018), FUNC(ppu_vt03_device::write_2018)); + map(0x2019, 0x2019).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2019), FUNC(ppu_vt03_device::write_2019)); + map(0x201a, 0x201a).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_201a), FUNC(ppu_vt03_device::write_201a)); + map(0x201b, 0x201b).mirror(0x00e0).r(m_ppu, FUNC(ppu_vt03_device::read_201b)); + map(0x201c, 0x201c).mirror(0x00e0).r(m_ppu, FUNC(ppu_vt03_device::read_201c)); + map(0x201d, 0x201d).mirror(0x00e0).r(m_ppu, FUNC(ppu_vt03_device::read_201d)); + map(0x201e, 0x201e).mirror(0x00e0).r(m_ppu, FUNC(ppu_vt03_device::read_201e)); + map(0x201f, 0x201f).mirror(0x00e0).r(m_ppu, FUNC(ppu_vt03_device::read_201f)); map(0x4000, 0x4017).w(m_apu, FUNC(nes_apu_vt_device::write)); map(0x4014, 0x4014).w(FUNC(nes_vt02_vt03_soc_device::vt_dma_w)); From 59b0f88e59919f5a863749ab171c10896a441442 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 13 May 2025 14:31:35 +0100 Subject: [PATCH 25/35] treat alt VT descrambles as different SoC types as this seems hardcoded, not really configurable --- src/devices/video/ppu2c0x_vt.cpp | 36 ++++------- src/devices/video/ppu2c0x_vt.h | 4 -- src/mame/nintendo/nes_vt02_vt03.cpp | 26 +++----- src/mame/nintendo/nes_vt_soc.cpp | 95 +++++++++++++++++++++++++---- src/mame/nintendo/nes_vt_soc.h | 59 ++++++++++++++---- 5 files changed, 152 insertions(+), 68 deletions(-) diff --git a/src/devices/video/ppu2c0x_vt.cpp b/src/devices/video/ppu2c0x_vt.cpp index ed9f6efbdbc63..58e0452f23ea8 100644 --- a/src/devices/video/ppu2c0x_vt.cpp +++ b/src/devices/video/ppu2c0x_vt.cpp @@ -55,18 +55,6 @@ uint8_t ppu_vt03_device::palette_read(offs_t offset) return m_palette_ram[offset]; } -void ppu_vt03_device::set_201x_descramble(uint8_t reg0, uint8_t reg1, uint8_t reg2, uint8_t reg3, uint8_t reg4, uint8_t reg5) -{ - m_2012_2017_descramble[0] = reg0; // TOOD: name regs - m_2012_2017_descramble[1] = reg1; - m_2012_2017_descramble[2] = reg2; - m_2012_2017_descramble[3] = reg3; - m_2012_2017_descramble[4] = reg4; - m_2012_2017_descramble[5] = reg5; -} - - - void ppu_vt03_device::palette_write(offs_t offset, uint8_t data) { if (offset < 0x20) @@ -81,12 +69,12 @@ void ppu_vt03_device::palette_write(offs_t offset, uint8_t data) uint8_t ppu_vt03_device::read_2010(offs_t offset) { return m_201x_regs[0x0]; } uint8_t ppu_vt03_device::read_2011(offs_t offset) { return m_201x_regs[0x1]; } -uint8_t ppu_vt03_device::read_2012(offs_t offset) { return m_201x_regs[m_2012_2017_descramble[0]]; } -uint8_t ppu_vt03_device::read_2013(offs_t offset) { return m_201x_regs[m_2012_2017_descramble[1]]; } -uint8_t ppu_vt03_device::read_2014(offs_t offset) { return m_201x_regs[m_2012_2017_descramble[2]]; } -uint8_t ppu_vt03_device::read_2015(offs_t offset) { return m_201x_regs[m_2012_2017_descramble[3]]; } -uint8_t ppu_vt03_device::read_2016(offs_t offset) { return m_201x_regs[m_2012_2017_descramble[4]]; } -uint8_t ppu_vt03_device::read_2017(offs_t offset) { return m_201x_regs[m_2012_2017_descramble[5]]; } +uint8_t ppu_vt03_device::read_2012(offs_t offset) { return m_201x_regs[0x2]; } +uint8_t ppu_vt03_device::read_2013(offs_t offset) { return m_201x_regs[0x3]; } +uint8_t ppu_vt03_device::read_2014(offs_t offset) { return m_201x_regs[0x4]; } +uint8_t ppu_vt03_device::read_2015(offs_t offset) { return m_201x_regs[0x5]; } +uint8_t ppu_vt03_device::read_2016(offs_t offset) { return m_201x_regs[0x6]; } +uint8_t ppu_vt03_device::read_2017(offs_t offset) { return m_201x_regs[0x7]; } uint8_t ppu_vt03_device::read_2018(offs_t offset) { return m_201x_regs[0x8]; } uint8_t ppu_vt03_device::read_2019(offs_t offset) { return 0x00; } uint8_t ppu_vt03_device::read_201a(offs_t offset) { return m_201x_regs[0xa]; } @@ -530,12 +518,12 @@ void ppu_vt03_device::write_2010(offs_t offset, uint8_t data) } void ppu_vt03_device::write_2011(offs_t offset, uint8_t data) { m_201x_regs[0x1] = data; } -void ppu_vt03_device::write_2012(offs_t offset, uint8_t data) { m_201x_regs[m_2012_2017_descramble[0]] = data; } -void ppu_vt03_device::write_2013(offs_t offset, uint8_t data) { m_201x_regs[m_2012_2017_descramble[1]] = data; } -void ppu_vt03_device::write_2014(offs_t offset, uint8_t data) { m_201x_regs[m_2012_2017_descramble[2]] = data; } -void ppu_vt03_device::write_2015(offs_t offset, uint8_t data) { m_201x_regs[m_2012_2017_descramble[3]] = data; } -void ppu_vt03_device::write_2016(offs_t offset, uint8_t data) { m_201x_regs[m_2012_2017_descramble[4]] = data; } -void ppu_vt03_device::write_2017(offs_t offset, uint8_t data) { m_201x_regs[m_2012_2017_descramble[5]] = data; } +void ppu_vt03_device::write_2012(offs_t offset, uint8_t data) { m_201x_regs[0x2] = data; } +void ppu_vt03_device::write_2013(offs_t offset, uint8_t data) { m_201x_regs[0x3] = data; } +void ppu_vt03_device::write_2014(offs_t offset, uint8_t data) { m_201x_regs[0x4] = data; } +void ppu_vt03_device::write_2015(offs_t offset, uint8_t data) { m_201x_regs[0x5] = data; } +void ppu_vt03_device::write_2016(offs_t offset, uint8_t data) { m_201x_regs[0x6] = data; } +void ppu_vt03_device::write_2017(offs_t offset, uint8_t data) { m_201x_regs[0x7] = data; } void ppu_vt03_device::write_2018(offs_t offset, uint8_t data) { m_201x_regs[0x8] = data; } void ppu_vt03_device::write_2019(offs_t offset, uint8_t data) { logerror("%s: write_2019 %02x (gun reset?)\n", machine().describe_context(), data); } void ppu_vt03_device::write_201a(offs_t offset, uint8_t data) { m_201x_regs[0xa] = data; } diff --git a/src/devices/video/ppu2c0x_vt.h b/src/devices/video/ppu2c0x_vt.h index cb7a4ca34ade6..49d8a9bdd9bfc 100644 --- a/src/devices/video/ppu2c0x_vt.h +++ b/src/devices/video/ppu2c0x_vt.h @@ -31,7 +31,6 @@ class ppu_vt03_device : public ppu2c0x_device { auto read_sp() { return m_read_sp.bind(); } void set_palette_mode(vtxx_pal_mode pmode) { m_pal_mode = pmode; } - void set_201x_descramble(uint8_t reg0, uint8_t reg1, uint8_t reg2, uint8_t reg3, uint8_t reg4, uint8_t reg5); uint8_t read_2010(offs_t offset); uint8_t read_2011(offs_t offset); @@ -110,9 +109,6 @@ class ppu_vt03_device : public ppu2c0x_device { uint8_t m_extplanebuf[2]; uint8_t m_extra_sprite_bits; - - uint8_t m_2012_2017_descramble[0x6]; - vtxx_pal_mode m_pal_mode = PAL_MODE_VT0x; void set_2010_reg(uint8_t data); diff --git a/src/mame/nintendo/nes_vt02_vt03.cpp b/src/mame/nintendo/nes_vt02_vt03.cpp index a6fec672b2741..2a6cc2213ff65 100644 --- a/src/mame/nintendo/nes_vt02_vt03.cpp +++ b/src/mame/nintendo/nes_vt02_vt03.cpp @@ -587,10 +587,9 @@ void nes_vt_state::nes_vt_pal_16mb(machine_config& config) void nes_vt_waixing_state::nes_vt_waixing_512kb(machine_config &config) { - NES_VT02_VT03_SOC(config, m_soc, NTSC_APU_CLOCK); + NES_VT02_VT03_SOC_WAIXING(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_waixing_state::vt_external_space_map_512kbyte); - m_soc->set_201x_descramble(0x3, 0x2, 0x7, 0x6, 0x5, 0x4); } void nes_vt_waixing_state::nes_vt_waixing_512kb_rasterhack(machine_config &config) @@ -602,37 +601,33 @@ void nes_vt_waixing_state::nes_vt_waixing_512kb_rasterhack(machine_config &confi void nes_vt_waixing_state::nes_vt_waixing_2mb(machine_config &config) { - NES_VT02_VT03_SOC(config, m_soc, NTSC_APU_CLOCK); + NES_VT02_VT03_SOC_WAIXING(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_waixing_state::vt_external_space_map_2mbyte); - m_soc->set_201x_descramble(0x3, 0x2, 0x7, 0x6, 0x5, 0x4); } void nes_vt_waixing_alt_state::nes_vt_waixing_alt_4mb(machine_config &config) { - NES_VT02_VT03_SOC(config, m_soc, NTSC_APU_CLOCK); + NES_VT02_VT03_SOC_WAIXING(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_waixing_state::vt_external_space_map_4mbyte); - m_soc->set_201x_descramble(0x3, 0x2, 0x7, 0x6, 0x5, 0x4); m_soc->set_8000_scramble(0x5, 0x4, 0x3, 0x2, 0x7, 0x6, 0x7, 0x8); } void nes_vt_waixing_alt_state::nes_vt_waixing_alt_pal_8mb(machine_config &config) { - NES_VT02_VT03_SOC_PAL(config, m_soc, PAL_APU_CLOCK); + NES_VT02_VT03_SOC_WAIXING_PAL(config, m_soc, PAL_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_waixing_alt_state::vt_external_space_map_8mbyte); - m_soc->set_201x_descramble(0x3, 0x2, 0x7, 0x6, 0x5, 0x4); m_soc->set_8000_scramble(0x5, 0x4, 0x3, 0x2, 0x7, 0x6, 0x7, 0x8); } void nes_vt_waixing_alt_sporzpp_state::nes_vt_waixing_alt_4mb_sporzpp(machine_config& config) { - NES_VT02_VT03_SOC(config, m_soc, NTSC_APU_CLOCK); + NES_VT02_VT03_SOC_WAIXING(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_ablping_state::vt_external_space_map_4mbyte); - m_soc->set_201x_descramble(0x3, 0x2, 0x7, 0x6, 0x5, 0x4); m_soc->set_8000_scramble(0x5, 0x4, 0x3, 0x2, 0x7, 0x6, 0x7, 0x8); } @@ -645,10 +640,9 @@ void nes_vt_waixing_alt_sporzpp_state::nes_vt_pal_4mb_sporzbxa(machine_config& c void nes_vt_hum_state::nes_vt_hummer_2mb(machine_config& config) { - NES_VT02_VT03_SOC(config, m_soc, NTSC_APU_CLOCK); + NES_VT02_VT03_SOC_HUMMER(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_sp69_state::vt_external_space_map_2mbyte); - m_soc->set_201x_descramble(0x7, 0x6, 0x5, 0x4, 0x2, 0x3); m_soc->set_8000_scramble(0x6, 0x7, 0x2, 0x3, 0x4, 0x5, 0x7, 0x8); } @@ -663,7 +657,6 @@ void nes_vt_pjoy_state::nes_vt_pjoy_4mb(machine_config &config) NES_VT02_VT03_SOC(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_sp69_state::vt_external_space_map_4mbyte); - m_soc->set_201x_descramble(0x2, 0x3, 0x4, 0x5, 0x6, 0x7); m_soc->set_8000_scramble(0x6, 0x7, 0x2, 0x3, 0x4, 0x5, 0x8, 0x7); m_soc->set_410x_scramble(0x8, 0x7); } @@ -671,20 +664,17 @@ void nes_vt_pjoy_state::nes_vt_pjoy_4mb(machine_config &config) void nes_vt_sp69_state::nes_vt_4mb_sp69(machine_config& config) { - NES_VT02_VT03_SOC(config, m_soc, NTSC_APU_CLOCK); + NES_VT02_VT03_SOC_SPORTS(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_sp69_state::vt_external_space_map_4mbyte); - m_soc->set_201x_descramble(0x4, 0x7, 0x2, 0x6, 0x5, 0x3); m_soc->set_8000_scramble(0x6, 0x7, 0x2, 0x3, 0x4, 0x5, 0x7, 0x8); } void nes_vt_ablping_state::nes_vt_2mb_ablping(machine_config &config) { - NES_VT02_VT03_SOC_PAL(config, m_soc, PAL_APU_CLOCK); + NES_VT02_VT03_SOC_SPORTS(config, m_soc, PAL_APU_CLOCK); // TODO: PAL configure_soc(m_soc); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt_ablping_state::vt_external_space_map_2mbyte); - m_soc->set_201x_descramble(0x4, 0x7, 0x2, 0x6, 0x5, 0x3); m_soc->set_8000_scramble(0x6, 0x7, 0x2, 0x3, 0x4, 0x5, 0x7, 0x8); m_soc->extra_read_2_callback().set(FUNC(nes_vt_ablping_state::ablping_extraio_r)); diff --git a/src/mame/nintendo/nes_vt_soc.cpp b/src/mame/nintendo/nes_vt_soc.cpp index f64b5d541c026..63a7c1f3d5a58 100644 --- a/src/mame/nintendo/nes_vt_soc.cpp +++ b/src/mame/nintendo/nes_vt_soc.cpp @@ -59,6 +59,13 @@ DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC, nes_vt02_vt03_soc_device, "nes_vt02_vt03_soc", "VT02/03 series System on a Chip (NTSC)") DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_PAL, nes_vt02_vt03_soc_pal_device, "nes_vt02_vt03_soc_pal", "VT02/03 series System on a Chip (PAL)") + +DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_WAIXING, nes_vt02_vt03_soc_waixing_device, "nes_vt02_vt03_soc_waixing", "VT02/03 series System on a Chip (Waixing, NTSC)") +DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_WAIXING_PAL, nes_vt02_vt03_soc_waixing_pal_device,"nes_vt02_vt03_soc_waixing_pal", "VT02/03 series System on a Chip (Waixing, PAL)") + +DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_HUMMER, nes_vt02_vt03_soc_hummer_device, "nes_vt02_vt03_soc_hummer", "VT02/03 series System on a Chip (Hummer, NTSC)") +DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SPORTS, nes_vt02_vt03_soc_sports_device, "nes_vt02_vt03_soc_sports", "VT02/03 series System on a Chip (Sports, NTSC)") + DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SCRAMBLE, nes_vt02_vt03_soc_scramble_device, "nes_vt02_vt03_soc_scram", "VT02/03 series System on a Chip (NTSC, with simple Opcode scrambling)") DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SCRAMBLE_PAL, nes_vt02_vt03_soc_scramble_pal_device, "nes_vt02_vt03_soc_pal_scram", "VT02/03 series System on a Chip (PAL, with simple Opcode scrambling)") @@ -89,10 +96,6 @@ nes_vt02_vt03_soc_device::nes_vt02_vt03_soc_device(const machine_config& mconfig m_extra_read_2_callback(*this, 0xff), m_extra_read_3_callback(*this, 0xff) { - // 'no scramble' configuration - for (int i = 0; i < 6; i++) - m_2012_2017_descramble[i] = 2 + i; - // 'no scramble' configuration m_8000_scramble[0x0] = 0x6; m_8000_scramble[0x1] = 0x7; @@ -123,6 +126,34 @@ nes_vt02_vt03_soc_pal_device::nes_vt02_vt03_soc_pal_device(const machine_config& } + +nes_vt02_vt03_soc_waixing_device::nes_vt02_vt03_soc_waixing_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock) : + nes_vt02_vt03_soc_device(mconfig, type, tag, owner, clock) +{ +} + +nes_vt02_vt03_soc_waixing_device::nes_vt02_vt03_soc_waixing_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : + nes_vt02_vt03_soc_waixing_device(mconfig, NES_VT02_VT03_SOC_WAIXING, tag, owner, clock) +{ +} + +nes_vt02_vt03_soc_waixing_pal_device::nes_vt02_vt03_soc_waixing_pal_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : + nes_vt02_vt03_soc_waixing_device(mconfig, NES_VT02_VT03_SOC_WAIXING_PAL, tag, owner, clock) +{ +} + + +nes_vt02_vt03_soc_hummer_device::nes_vt02_vt03_soc_hummer_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : + nes_vt02_vt03_soc_device(mconfig, NES_VT02_VT03_SOC_HUMMER, tag, owner, clock) +{ +} + +nes_vt02_vt03_soc_sports_device::nes_vt02_vt03_soc_sports_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : + nes_vt02_vt03_soc_device(mconfig, NES_VT02_VT03_SOC_SPORTS, tag, owner, clock) +{ +} + + nes_vt02_vt03_soc_scramble_device::nes_vt02_vt03_soc_scramble_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : nes_vt02_vt03_soc_device(mconfig, NES_VT02_VT03_SOC_SCRAMBLE, tag, owner, clock) { @@ -189,7 +220,6 @@ void nes_vt02_vt03_soc_device::device_reset() update_banks(); - m_ppu->set_201x_descramble(m_2012_2017_descramble[0], m_2012_2017_descramble[1], m_2012_2017_descramble[2], m_2012_2017_descramble[3], m_2012_2017_descramble[4], m_2012_2017_descramble[5]); m_ppu->set_palette_mode(m_default_palette_mode); } @@ -1037,12 +1067,7 @@ void nes_vt02_vt03_soc_device::nes_vt_map(address_map &map) // 2010 - 201f are extended regs, and can differ between VT models map(0x2010, 0x2010).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2010), FUNC(ppu_vt03_device::write_2010)); map(0x2011, 0x2011).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2011), FUNC(ppu_vt03_device::write_2011)); - map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2012), FUNC(ppu_vt03_device::write_2012)); - map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2013), FUNC(ppu_vt03_device::write_2013)); - map(0x2014, 0x2014).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2014), FUNC(ppu_vt03_device::write_2014)); - map(0x2015, 0x2015).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2015), FUNC(ppu_vt03_device::write_2015)); - map(0x2016, 0x2016).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2016), FUNC(ppu_vt03_device::write_2016)); - map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2017), FUNC(ppu_vt03_device::write_2017)); + nes_vt_2012_to_2017_regs(map);// 2012 - 2017 map differently on some SoC types (re-ordered) map(0x2018, 0x2018).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2018), FUNC(ppu_vt03_device::write_2018)); map(0x2019, 0x2019).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2019), FUNC(ppu_vt03_device::write_2019)); map(0x201a, 0x201a).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_201a), FUNC(ppu_vt03_device::write_201a)); @@ -1079,6 +1104,46 @@ void nes_vt02_vt03_soc_device::nes_vt_map(address_map &map) map(0x6000, 0x7fff).ram(); } +void nes_vt02_vt03_soc_device::nes_vt_2012_to_2017_regs(address_map &map) +{ + map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2012), FUNC(ppu_vt03_device::write_2012)); + map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2013), FUNC(ppu_vt03_device::write_2013)); + map(0x2014, 0x2014).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2014), FUNC(ppu_vt03_device::write_2014)); + map(0x2015, 0x2015).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2015), FUNC(ppu_vt03_device::write_2015)); + map(0x2016, 0x2016).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2016), FUNC(ppu_vt03_device::write_2016)); + map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2017), FUNC(ppu_vt03_device::write_2017)); +} + +void nes_vt02_vt03_soc_waixing_device::nes_vt_2012_to_2017_regs(address_map& map) +{ + map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2013), FUNC(ppu_vt03_device::write_2013)); + map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2012), FUNC(ppu_vt03_device::write_2012)); + map(0x2014, 0x2014).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2017), FUNC(ppu_vt03_device::write_2017)); + map(0x2015, 0x2015).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2016), FUNC(ppu_vt03_device::write_2016)); + map(0x2016, 0x2016).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2015), FUNC(ppu_vt03_device::write_2015)); + map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2014), FUNC(ppu_vt03_device::write_2014)); +} + +void nes_vt02_vt03_soc_hummer_device::nes_vt_2012_to_2017_regs(address_map& map) +{ + map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2017), FUNC(ppu_vt03_device::write_2017)); + map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2016), FUNC(ppu_vt03_device::write_2016)); + map(0x2014, 0x2014).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2015), FUNC(ppu_vt03_device::write_2015)); + map(0x2015, 0x2015).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2014), FUNC(ppu_vt03_device::write_2014)); + map(0x2016, 0x2016).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2012), FUNC(ppu_vt03_device::write_2012)); + map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2013), FUNC(ppu_vt03_device::write_2013)); +} + +void nes_vt02_vt03_soc_sports_device::nes_vt_2012_to_2017_regs(address_map& map) +{ + map(0x2012, 0x2012).rw(m_ppu, FUNC(ppu_vt03_device::read_2014), FUNC(ppu_vt03_device::write_2014)); + map(0x2013, 0x2013).rw(m_ppu, FUNC(ppu_vt03_device::read_2017), FUNC(ppu_vt03_device::write_2017)); + map(0x2014, 0x2014).rw(m_ppu, FUNC(ppu_vt03_device::read_2012), FUNC(ppu_vt03_device::write_2012)); + map(0x2015, 0x2015).rw(m_ppu, FUNC(ppu_vt03_device::read_2016), FUNC(ppu_vt03_device::write_2016)); + map(0x2016, 0x2016).rw(m_ppu, FUNC(ppu_vt03_device::read_2015), FUNC(ppu_vt03_device::write_2015)); + map(0x2017, 0x2017).rw(m_ppu, FUNC(ppu_vt03_device::read_2013), FUNC(ppu_vt03_device::write_2013)); +} + void nes_vt02_vt03_soc_device::apu_irq(int state) @@ -1161,6 +1226,14 @@ void nes_vt02_vt03_soc_pal_device::device_add_mconfig(machine_config& config) } +void nes_vt02_vt03_soc_waixing_pal_device::device_add_mconfig(machine_config& config) +{ + nes_vt02_vt03_soc_waixing_device::device_add_mconfig(config); + do_pal_timings_and_ppu_replacement(config); +} + + + /***********************************************************************************************************************************************************/ /* 'Scramble' specifics */ /***********************************************************************************************************************************************************/ diff --git a/src/mame/nintendo/nes_vt_soc.h b/src/mame/nintendo/nes_vt_soc.h index 5202619721966..d4efc2d754704 100644 --- a/src/mame/nintendo/nes_vt_soc.h +++ b/src/mame/nintendo/nes_vt_soc.h @@ -37,16 +37,6 @@ class nes_vt02_vt03_soc_device : public device_t, public device_memory_interface auto extra_write_2_callback() { return m_extra_write_2_callback.bind(); } auto extra_write_3_callback() { return m_extra_write_3_callback.bind(); } - void set_201x_descramble(uint8_t reg0, uint8_t reg1, uint8_t reg2, uint8_t reg3, uint8_t reg4, uint8_t reg5) - { - m_2012_2017_descramble[0] = reg0; // TOOD: name regs - m_2012_2017_descramble[1] = reg1; - m_2012_2017_descramble[2] = reg2; - m_2012_2017_descramble[3] = reg3; - m_2012_2017_descramble[4] = reg4; - m_2012_2017_descramble[5] = reg5; - }; - void set_8000_scramble(uint8_t reg0, uint8_t reg1, uint8_t reg2, uint8_t reg3, uint8_t reg4, uint8_t reg5, uint8_t reg6, uint8_t reg7); void set_410x_scramble(uint8_t reg0, uint8_t reg1); void force_bad_dma() { m_force_baddma = true; } @@ -69,6 +59,7 @@ class nes_vt02_vt03_soc_device : public device_t, public device_memory_interface required_device m_apu; void nes_vt_map(address_map &map) ATTR_COLD; + virtual void nes_vt_2012_to_2017_regs(address_map &map); uint32_t get_banks(uint8_t bnk); void update_banks(); @@ -152,7 +143,6 @@ class nes_vt02_vt03_soc_device : public device_t, public device_memory_interface devcb_read8 m_extra_read_2_callback; devcb_read8 m_extra_read_3_callback; - uint8_t m_2012_2017_descramble[0x6]; // passed to PPU in reset vtxx_pal_mode m_default_palette_mode; bool m_force_baddma = false; bool m_use_raster_timing_hack = false; @@ -167,6 +157,45 @@ class nes_vt02_vt03_soc_pal_device : public nes_vt02_vt03_soc_device virtual void device_add_mconfig(machine_config& config) override; }; + +class nes_vt02_vt03_soc_waixing_device : public nes_vt02_vt03_soc_device +{ +public: + nes_vt02_vt03_soc_waixing_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); + +protected: + nes_vt02_vt03_soc_waixing_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + virtual void nes_vt_2012_to_2017_regs(address_map &map) override; +}; + +class nes_vt02_vt03_soc_waixing_pal_device : public nes_vt02_vt03_soc_waixing_device +{ +public: + nes_vt02_vt03_soc_waixing_pal_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); + +protected: + virtual void device_add_mconfig(machine_config& config) override; +}; + +class nes_vt02_vt03_soc_hummer_device : public nes_vt02_vt03_soc_device +{ +public: + nes_vt02_vt03_soc_hummer_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); + +protected: + virtual void nes_vt_2012_to_2017_regs(address_map &map) override; +}; + +class nes_vt02_vt03_soc_sports_device : public nes_vt02_vt03_soc_device +{ +public: + nes_vt02_vt03_soc_sports_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); + +protected: + virtual void nes_vt_2012_to_2017_regs(address_map &map) override; +}; + class nes_vt02_vt03_soc_scramble_device : public nes_vt02_vt03_soc_device { public: @@ -187,6 +216,14 @@ class nes_vt02_vt03_soc_scramble_pal_device : public nes_vt02_vt03_soc_device DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC, nes_vt02_vt03_soc_device) DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_PAL, nes_vt02_vt03_soc_pal_device) + +DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_WAIXING, nes_vt02_vt03_soc_waixing_device) +DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_WAIXING_PAL, nes_vt02_vt03_soc_waixing_pal_device) + +DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_HUMMER, nes_vt02_vt03_soc_hummer_device) +DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_SPORTS, nes_vt02_vt03_soc_sports_device) + + DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_SCRAMBLE, nes_vt02_vt03_soc_scramble_device) DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_SCRAMBLE_PAL, nes_vt02_vt03_soc_scramble_pal_device) From 69e973bf3f4c0f52bdbfb74c495737c5b78641c2 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 13 May 2025 14:41:28 +0100 Subject: [PATCH 26/35] improve previous commit --- src/mame/nintendo/nes_vt02_vt03.cpp | 2 +- src/mame/nintendo/nes_vt_soc.cpp | 49 +++++++++++++++++++---------- src/mame/nintendo/nes_vt_soc.h | 15 ++++++++- 3 files changed, 47 insertions(+), 19 deletions(-) diff --git a/src/mame/nintendo/nes_vt02_vt03.cpp b/src/mame/nintendo/nes_vt02_vt03.cpp index 2a6cc2213ff65..a383d1e5cf34b 100644 --- a/src/mame/nintendo/nes_vt02_vt03.cpp +++ b/src/mame/nintendo/nes_vt02_vt03.cpp @@ -672,7 +672,7 @@ void nes_vt_sp69_state::nes_vt_4mb_sp69(machine_config& config) void nes_vt_ablping_state::nes_vt_2mb_ablping(machine_config &config) { - NES_VT02_VT03_SOC_SPORTS(config, m_soc, PAL_APU_CLOCK); // TODO: PAL + NES_VT02_VT03_SOC_SPORTS_PAL(config, m_soc, PAL_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_ablping_state::vt_external_space_map_2mbyte); m_soc->set_8000_scramble(0x6, 0x7, 0x2, 0x3, 0x4, 0x5, 0x7, 0x8); diff --git a/src/mame/nintendo/nes_vt_soc.cpp b/src/mame/nintendo/nes_vt_soc.cpp index 63a7c1f3d5a58..2373401d43226 100644 --- a/src/mame/nintendo/nes_vt_soc.cpp +++ b/src/mame/nintendo/nes_vt_soc.cpp @@ -57,17 +57,19 @@ #include "nes_vt_soc.h" -DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC, nes_vt02_vt03_soc_device, "nes_vt02_vt03_soc", "VT02/03 series System on a Chip (NTSC)") -DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_PAL, nes_vt02_vt03_soc_pal_device, "nes_vt02_vt03_soc_pal", "VT02/03 series System on a Chip (PAL)") +DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC, nes_vt02_vt03_soc_device, "nes_vt02_vt03_soc", "VT02/03 series System on a Chip (NTSC)") +DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_PAL, nes_vt02_vt03_soc_pal_device, "nes_vt02_vt03_soc_pal", "VT02/03 series System on a Chip (PAL)") -DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_WAIXING, nes_vt02_vt03_soc_waixing_device, "nes_vt02_vt03_soc_waixing", "VT02/03 series System on a Chip (Waixing, NTSC)") -DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_WAIXING_PAL, nes_vt02_vt03_soc_waixing_pal_device,"nes_vt02_vt03_soc_waixing_pal", "VT02/03 series System on a Chip (Waixing, PAL)") +DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_WAIXING, nes_vt02_vt03_soc_waixing_device, "nes_vt02_vt03_soc_waixing", "VT02/03 series System on a Chip (Waixing, NTSC)") +DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_WAIXING_PAL, nes_vt02_vt03_soc_waixing_pal_device, "nes_vt02_vt03_soc_waixing_pal", "VT02/03 series System on a Chip (Waixing, PAL)") -DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_HUMMER, nes_vt02_vt03_soc_hummer_device, "nes_vt02_vt03_soc_hummer", "VT02/03 series System on a Chip (Hummer, NTSC)") -DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SPORTS, nes_vt02_vt03_soc_sports_device, "nes_vt02_vt03_soc_sports", "VT02/03 series System on a Chip (Sports, NTSC)") +DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_HUMMER, nes_vt02_vt03_soc_hummer_device, "nes_vt02_vt03_soc_hummer", "VT02/03 series System on a Chip (Hummer, NTSC)") -DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SCRAMBLE, nes_vt02_vt03_soc_scramble_device, "nes_vt02_vt03_soc_scram", "VT02/03 series System on a Chip (NTSC, with simple Opcode scrambling)") -DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SCRAMBLE_PAL, nes_vt02_vt03_soc_scramble_pal_device, "nes_vt02_vt03_soc_pal_scram", "VT02/03 series System on a Chip (PAL, with simple Opcode scrambling)") +DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SPORTS, nes_vt02_vt03_soc_sports_device, "nes_vt02_vt03_soc_sports", "VT02/03 series System on a Chip (Sports, NTSC)") +DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SPORTS_PAL, nes_vt02_vt03_soc_sports_pal_device, "nes_vt02_vt03_soc_sports", "VT02/03 series System on a Chip (Sports, PAL)") + +DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SCRAMBLE, nes_vt02_vt03_soc_scramble_device, "nes_vt02_vt03_soc_scram", "VT02/03 series System on a Chip (NTSC, with simple Opcode scrambling)") +DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SCRAMBLE_PAL, nes_vt02_vt03_soc_scramble_pal_device, "nes_vt02_vt03_soc_pal_scram", "VT02/03 series System on a Chip (PAL, with simple Opcode scrambling)") void nes_vt02_vt03_soc_device::program_map(address_map &map) { @@ -148,8 +150,18 @@ nes_vt02_vt03_soc_hummer_device::nes_vt02_vt03_soc_hummer_device(const machine_c { } +nes_vt02_vt03_soc_sports_device::nes_vt02_vt03_soc_sports_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock) : + nes_vt02_vt03_soc_device(mconfig, type, tag, owner, clock) +{ +} + nes_vt02_vt03_soc_sports_device::nes_vt02_vt03_soc_sports_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : - nes_vt02_vt03_soc_device(mconfig, NES_VT02_VT03_SOC_SPORTS, tag, owner, clock) + nes_vt02_vt03_soc_sports_device(mconfig, NES_VT02_VT03_SOC_SPORTS, tag, owner, clock) +{ +} + +nes_vt02_vt03_soc_sports_pal_device::nes_vt02_vt03_soc_sports_pal_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : + nes_vt02_vt03_soc_sports_device(mconfig, NES_VT02_VT03_SOC_SPORTS_PAL, tag, owner, clock) { } @@ -1099,7 +1111,6 @@ void nes_vt02_vt03_soc_device::nes_vt_map(address_map &map) // 0x411a RS232 TX data // 0x411b RS232 RX data - map(0x8000, 0xffff).rw(FUNC(nes_vt02_vt03_soc_device::external_space_read), FUNC(nes_vt02_vt03_soc_device::external_space_write)); map(0x6000, 0x7fff).ram(); } @@ -1136,12 +1147,12 @@ void nes_vt02_vt03_soc_hummer_device::nes_vt_2012_to_2017_regs(address_map& map) void nes_vt02_vt03_soc_sports_device::nes_vt_2012_to_2017_regs(address_map& map) { - map(0x2012, 0x2012).rw(m_ppu, FUNC(ppu_vt03_device::read_2014), FUNC(ppu_vt03_device::write_2014)); - map(0x2013, 0x2013).rw(m_ppu, FUNC(ppu_vt03_device::read_2017), FUNC(ppu_vt03_device::write_2017)); - map(0x2014, 0x2014).rw(m_ppu, FUNC(ppu_vt03_device::read_2012), FUNC(ppu_vt03_device::write_2012)); - map(0x2015, 0x2015).rw(m_ppu, FUNC(ppu_vt03_device::read_2016), FUNC(ppu_vt03_device::write_2016)); - map(0x2016, 0x2016).rw(m_ppu, FUNC(ppu_vt03_device::read_2015), FUNC(ppu_vt03_device::write_2015)); - map(0x2017, 0x2017).rw(m_ppu, FUNC(ppu_vt03_device::read_2013), FUNC(ppu_vt03_device::write_2013)); + map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2014), FUNC(ppu_vt03_device::write_2014)); + map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2017), FUNC(ppu_vt03_device::write_2017)); + map(0x2014, 0x2014).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2012), FUNC(ppu_vt03_device::write_2012)); + map(0x2015, 0x2015).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2016), FUNC(ppu_vt03_device::write_2016)); + map(0x2016, 0x2016).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2015), FUNC(ppu_vt03_device::write_2015)); + map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2013), FUNC(ppu_vt03_device::write_2013)); } @@ -1232,7 +1243,11 @@ void nes_vt02_vt03_soc_waixing_pal_device::device_add_mconfig(machine_config& co do_pal_timings_and_ppu_replacement(config); } - +void nes_vt02_vt03_soc_sports_pal_device::device_add_mconfig(machine_config& config) +{ + nes_vt02_vt03_soc_sports_device::device_add_mconfig(config); + do_pal_timings_and_ppu_replacement(config); +} /***********************************************************************************************************************************************************/ /* 'Scramble' specifics */ diff --git a/src/mame/nintendo/nes_vt_soc.h b/src/mame/nintendo/nes_vt_soc.h index d4efc2d754704..5d3dc4cb86ec1 100644 --- a/src/mame/nintendo/nes_vt_soc.h +++ b/src/mame/nintendo/nes_vt_soc.h @@ -192,10 +192,22 @@ class nes_vt02_vt03_soc_sports_device : public nes_vt02_vt03_soc_device public: nes_vt02_vt03_soc_sports_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); +protected: + nes_vt02_vt03_soc_sports_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + protected: virtual void nes_vt_2012_to_2017_regs(address_map &map) override; }; +class nes_vt02_vt03_soc_sports_pal_device : public nes_vt02_vt03_soc_sports_device +{ +public: + nes_vt02_vt03_soc_sports_pal_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); + +protected: + virtual void device_add_mconfig(machine_config& config) override; +}; + class nes_vt02_vt03_soc_scramble_device : public nes_vt02_vt03_soc_device { public: @@ -221,8 +233,9 @@ DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_WAIXING, nes_vt02_vt03_soc_waixing_dev DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_WAIXING_PAL, nes_vt02_vt03_soc_waixing_pal_device) DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_HUMMER, nes_vt02_vt03_soc_hummer_device) -DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_SPORTS, nes_vt02_vt03_soc_sports_device) +DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_SPORTS, nes_vt02_vt03_soc_sports_device) +DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_SPORTS_PAL, nes_vt02_vt03_soc_sports_pal_device) DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_SCRAMBLE, nes_vt02_vt03_soc_scramble_device) DECLARE_DEVICE_TYPE(NES_VT02_VT03_SOC_SCRAMBLE_PAL, nes_vt02_vt03_soc_scramble_pal_device) From e61ffa794130585ccef84626b8f7ba05151d1d97 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 13 May 2025 14:54:54 +0100 Subject: [PATCH 27/35] change naming --- src/devices/video/ppu2c0x_vt.cpp | 24 ++++---- src/devices/video/ppu2c0x_vt.h | 24 ++++---- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 12 ++-- src/mame/nintendo/nes_vt_soc.cpp | 58 +++++++++---------- src/mame/nintendo/nes_vt_soc.h | 8 +-- 5 files changed, 63 insertions(+), 63 deletions(-) diff --git a/src/devices/video/ppu2c0x_vt.cpp b/src/devices/video/ppu2c0x_vt.cpp index 58e0452f23ea8..d8e8d00cbca4e 100644 --- a/src/devices/video/ppu2c0x_vt.cpp +++ b/src/devices/video/ppu2c0x_vt.cpp @@ -69,12 +69,12 @@ void ppu_vt03_device::palette_write(offs_t offset, uint8_t data) uint8_t ppu_vt03_device::read_2010(offs_t offset) { return m_201x_regs[0x0]; } uint8_t ppu_vt03_device::read_2011(offs_t offset) { return m_201x_regs[0x1]; } -uint8_t ppu_vt03_device::read_2012(offs_t offset) { return m_201x_regs[0x2]; } -uint8_t ppu_vt03_device::read_2013(offs_t offset) { return m_201x_regs[0x3]; } -uint8_t ppu_vt03_device::read_2014(offs_t offset) { return m_201x_regs[0x4]; } -uint8_t ppu_vt03_device::read_2015(offs_t offset) { return m_201x_regs[0x5]; } -uint8_t ppu_vt03_device::read_2016(offs_t offset) { return m_201x_regs[0x6]; } -uint8_t ppu_vt03_device::read_2017(offs_t offset) { return m_201x_regs[0x7]; } +uint8_t ppu_vt03_device::videobank0_0_r(offs_t offset) { return m_201x_regs[0x2]; } +uint8_t ppu_vt03_device::videobank0_1_r(offs_t offset) { return m_201x_regs[0x3]; } +uint8_t ppu_vt03_device::videobank0_2_r(offs_t offset) { return m_201x_regs[0x4]; } +uint8_t ppu_vt03_device::videobank0_3_r(offs_t offset) { return m_201x_regs[0x5]; } +uint8_t ppu_vt03_device::videobank0_4_r(offs_t offset) { return m_201x_regs[0x6]; } +uint8_t ppu_vt03_device::videobank0_5_r(offs_t offset) { return m_201x_regs[0x7]; } uint8_t ppu_vt03_device::read_2018(offs_t offset) { return m_201x_regs[0x8]; } uint8_t ppu_vt03_device::read_2019(offs_t offset) { return 0x00; } uint8_t ppu_vt03_device::read_201a(offs_t offset) { return m_201x_regs[0xa]; } @@ -518,12 +518,12 @@ void ppu_vt03_device::write_2010(offs_t offset, uint8_t data) } void ppu_vt03_device::write_2011(offs_t offset, uint8_t data) { m_201x_regs[0x1] = data; } -void ppu_vt03_device::write_2012(offs_t offset, uint8_t data) { m_201x_regs[0x2] = data; } -void ppu_vt03_device::write_2013(offs_t offset, uint8_t data) { m_201x_regs[0x3] = data; } -void ppu_vt03_device::write_2014(offs_t offset, uint8_t data) { m_201x_regs[0x4] = data; } -void ppu_vt03_device::write_2015(offs_t offset, uint8_t data) { m_201x_regs[0x5] = data; } -void ppu_vt03_device::write_2016(offs_t offset, uint8_t data) { m_201x_regs[0x6] = data; } -void ppu_vt03_device::write_2017(offs_t offset, uint8_t data) { m_201x_regs[0x7] = data; } +void ppu_vt03_device::videobank0_0_w(offs_t offset, uint8_t data) { m_201x_regs[0x2] = data; } +void ppu_vt03_device::videobank0_1_w(offs_t offset, uint8_t data) { m_201x_regs[0x3] = data; } +void ppu_vt03_device::videobank0_2_w(offs_t offset, uint8_t data) { m_201x_regs[0x4] = data; } +void ppu_vt03_device::videobank0_3_w(offs_t offset, uint8_t data) { m_201x_regs[0x5] = data; } +void ppu_vt03_device::videobank0_4_w(offs_t offset, uint8_t data) { m_201x_regs[0x6] = data; } +void ppu_vt03_device::videobank0_5_w(offs_t offset, uint8_t data) { m_201x_regs[0x7] = data; } void ppu_vt03_device::write_2018(offs_t offset, uint8_t data) { m_201x_regs[0x8] = data; } void ppu_vt03_device::write_2019(offs_t offset, uint8_t data) { logerror("%s: write_2019 %02x (gun reset?)\n", machine().describe_context(), data); } void ppu_vt03_device::write_201a(offs_t offset, uint8_t data) { m_201x_regs[0xa] = data; } diff --git a/src/devices/video/ppu2c0x_vt.h b/src/devices/video/ppu2c0x_vt.h index 49d8a9bdd9bfc..b86743bef49e6 100644 --- a/src/devices/video/ppu2c0x_vt.h +++ b/src/devices/video/ppu2c0x_vt.h @@ -34,12 +34,12 @@ class ppu_vt03_device : public ppu2c0x_device { uint8_t read_2010(offs_t offset); uint8_t read_2011(offs_t offset); - uint8_t read_2012(offs_t offset); - uint8_t read_2013(offs_t offset); - uint8_t read_2014(offs_t offset); - uint8_t read_2015(offs_t offset); - uint8_t read_2016(offs_t offset); - uint8_t read_2017(offs_t offset); + uint8_t videobank0_0_r(offs_t offset); + uint8_t videobank0_1_r(offs_t offset); + uint8_t videobank0_2_r(offs_t offset); + uint8_t videobank0_3_r(offs_t offset); + uint8_t videobank0_4_r(offs_t offset); + uint8_t videobank0_5_r(offs_t offset); uint8_t read_2018(offs_t offset); uint8_t read_2019(offs_t offset); uint8_t read_201a(offs_t offset); @@ -51,12 +51,12 @@ class ppu_vt03_device : public ppu2c0x_device { void write_2010(offs_t offset, uint8_t data); void write_2011(offs_t offset, uint8_t data); - void write_2012(offs_t offset, uint8_t data); - void write_2013(offs_t offset, uint8_t data); - void write_2014(offs_t offset, uint8_t data); - void write_2015(offs_t offset, uint8_t data); - void write_2016(offs_t offset, uint8_t data); - void write_2017(offs_t offset, uint8_t data); + void videobank0_0_w(offs_t offset, uint8_t data); + void videobank0_1_w(offs_t offset, uint8_t data); + void videobank0_2_w(offs_t offset, uint8_t data); + void videobank0_3_w(offs_t offset, uint8_t data); + void videobank0_4_w(offs_t offset, uint8_t data); + void videobank0_5_w(offs_t offset, uint8_t data); void write_2018(offs_t offset, uint8_t data); void write_2019(offs_t offset, uint8_t data); void write_201a(offs_t offset, uint8_t data); diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index 28da731fc0b87..3a84d434ef58e 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -129,12 +129,12 @@ void vt3xx_soc_base_device::vt369_map(address_map &map) map(0x2010, 0x2010).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2010), FUNC(ppu_vt3xx_device::write_2010)); map(0x2011, 0x2011).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2011), FUNC(ppu_vt3xx_device::write_2011)); - map(0x2012, 0x2012).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2012), FUNC(ppu_vt3xx_device::write_2012)); - map(0x2013, 0x2013).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2013), FUNC(ppu_vt3xx_device::write_2013)); - map(0x2014, 0x2014).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2014), FUNC(ppu_vt3xx_device::write_2014)); - map(0x2015, 0x2015).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2015), FUNC(ppu_vt3xx_device::write_2015)); - map(0x2016, 0x2016).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2016), FUNC(ppu_vt3xx_device::write_2016)); - map(0x2017, 0x2017).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2017), FUNC(ppu_vt3xx_device::write_2017)); + map(0x2012, 0x2012).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank0_0_r), FUNC(ppu_vt3xx_device::videobank0_0_w)); + map(0x2013, 0x2013).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank0_1_r), FUNC(ppu_vt3xx_device::videobank0_1_w)); + map(0x2014, 0x2014).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank0_2_r), FUNC(ppu_vt3xx_device::videobank0_2_w)); + map(0x2015, 0x2015).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank0_3_r), FUNC(ppu_vt3xx_device::videobank0_3_w)); + map(0x2016, 0x2016).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank0_4_r), FUNC(ppu_vt3xx_device::videobank0_4_w)); + map(0x2017, 0x2017).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank0_5_r), FUNC(ppu_vt3xx_device::videobank0_5_w)); map(0x2018, 0x2018).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2018), FUNC(ppu_vt3xx_device::write_2018)); map(0x2019, 0x2019).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2019), FUNC(ppu_vt3xx_device::write_2019)); map(0x201a, 0x201a).rw(m_ppu, FUNC(ppu_vt3xx_device::read_201a), FUNC(ppu_vt3xx_device::write_201a)); diff --git a/src/mame/nintendo/nes_vt_soc.cpp b/src/mame/nintendo/nes_vt_soc.cpp index 2373401d43226..ec0557351c63e 100644 --- a/src/mame/nintendo/nes_vt_soc.cpp +++ b/src/mame/nintendo/nes_vt_soc.cpp @@ -1079,7 +1079,7 @@ void nes_vt02_vt03_soc_device::nes_vt_map(address_map &map) // 2010 - 201f are extended regs, and can differ between VT models map(0x2010, 0x2010).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2010), FUNC(ppu_vt03_device::write_2010)); map(0x2011, 0x2011).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2011), FUNC(ppu_vt03_device::write_2011)); - nes_vt_2012_to_2017_regs(map);// 2012 - 2017 map differently on some SoC types (re-ordered) + nes_vt_2012_to_2017_videobank0_regs(map);// 2012 - 2017 map differently on some SoC types (re-ordered) map(0x2018, 0x2018).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2018), FUNC(ppu_vt03_device::write_2018)); map(0x2019, 0x2019).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2019), FUNC(ppu_vt03_device::write_2019)); map(0x201a, 0x201a).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_201a), FUNC(ppu_vt03_device::write_201a)); @@ -1115,44 +1115,44 @@ void nes_vt02_vt03_soc_device::nes_vt_map(address_map &map) map(0x6000, 0x7fff).ram(); } -void nes_vt02_vt03_soc_device::nes_vt_2012_to_2017_regs(address_map &map) +void nes_vt02_vt03_soc_device::nes_vt_2012_to_2017_videobank0_regs(address_map &map) { - map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2012), FUNC(ppu_vt03_device::write_2012)); - map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2013), FUNC(ppu_vt03_device::write_2013)); - map(0x2014, 0x2014).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2014), FUNC(ppu_vt03_device::write_2014)); - map(0x2015, 0x2015).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2015), FUNC(ppu_vt03_device::write_2015)); - map(0x2016, 0x2016).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2016), FUNC(ppu_vt03_device::write_2016)); - map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2017), FUNC(ppu_vt03_device::write_2017)); + map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_0_r), FUNC(ppu_vt03_device::videobank0_0_w)); + map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_1_r), FUNC(ppu_vt03_device::videobank0_1_w)); + map(0x2014, 0x2014).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_2_r), FUNC(ppu_vt03_device::videobank0_2_w)); + map(0x2015, 0x2015).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_3_r), FUNC(ppu_vt03_device::videobank0_3_w)); + map(0x2016, 0x2016).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_4_r), FUNC(ppu_vt03_device::videobank0_4_w)); + map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_5_r), FUNC(ppu_vt03_device::videobank0_5_w)); } -void nes_vt02_vt03_soc_waixing_device::nes_vt_2012_to_2017_regs(address_map& map) +void nes_vt02_vt03_soc_waixing_device::nes_vt_2012_to_2017_videobank0_regs(address_map& map) { - map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2013), FUNC(ppu_vt03_device::write_2013)); - map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2012), FUNC(ppu_vt03_device::write_2012)); - map(0x2014, 0x2014).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2017), FUNC(ppu_vt03_device::write_2017)); - map(0x2015, 0x2015).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2016), FUNC(ppu_vt03_device::write_2016)); - map(0x2016, 0x2016).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2015), FUNC(ppu_vt03_device::write_2015)); - map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2014), FUNC(ppu_vt03_device::write_2014)); + map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_1_r), FUNC(ppu_vt03_device::videobank0_1_w)); + map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_0_r), FUNC(ppu_vt03_device::videobank0_0_w)); + map(0x2014, 0x2014).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_5_r), FUNC(ppu_vt03_device::videobank0_5_w)); + map(0x2015, 0x2015).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_4_r), FUNC(ppu_vt03_device::videobank0_4_w)); + map(0x2016, 0x2016).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_3_r), FUNC(ppu_vt03_device::videobank0_3_w)); + map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_2_r), FUNC(ppu_vt03_device::videobank0_2_w)); } -void nes_vt02_vt03_soc_hummer_device::nes_vt_2012_to_2017_regs(address_map& map) +void nes_vt02_vt03_soc_hummer_device::nes_vt_2012_to_2017_videobank0_regs(address_map& map) { - map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2017), FUNC(ppu_vt03_device::write_2017)); - map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2016), FUNC(ppu_vt03_device::write_2016)); - map(0x2014, 0x2014).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2015), FUNC(ppu_vt03_device::write_2015)); - map(0x2015, 0x2015).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2014), FUNC(ppu_vt03_device::write_2014)); - map(0x2016, 0x2016).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2012), FUNC(ppu_vt03_device::write_2012)); - map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2013), FUNC(ppu_vt03_device::write_2013)); + map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_5_r), FUNC(ppu_vt03_device::videobank0_5_w)); + map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_4_r), FUNC(ppu_vt03_device::videobank0_4_w)); + map(0x2014, 0x2014).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_3_r), FUNC(ppu_vt03_device::videobank0_3_w)); + map(0x2015, 0x2015).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_2_r), FUNC(ppu_vt03_device::videobank0_2_w)); + map(0x2016, 0x2016).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_0_r), FUNC(ppu_vt03_device::videobank0_0_w)); + map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_1_r), FUNC(ppu_vt03_device::videobank0_1_w)); } -void nes_vt02_vt03_soc_sports_device::nes_vt_2012_to_2017_regs(address_map& map) +void nes_vt02_vt03_soc_sports_device::nes_vt_2012_to_2017_videobank0_regs(address_map& map) { - map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2014), FUNC(ppu_vt03_device::write_2014)); - map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2017), FUNC(ppu_vt03_device::write_2017)); - map(0x2014, 0x2014).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2012), FUNC(ppu_vt03_device::write_2012)); - map(0x2015, 0x2015).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2016), FUNC(ppu_vt03_device::write_2016)); - map(0x2016, 0x2016).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2015), FUNC(ppu_vt03_device::write_2015)); - map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2013), FUNC(ppu_vt03_device::write_2013)); + map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_2_r), FUNC(ppu_vt03_device::videobank0_2_w)); + map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_5_r), FUNC(ppu_vt03_device::videobank0_5_w)); + map(0x2014, 0x2014).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_0_r), FUNC(ppu_vt03_device::videobank0_0_w)); + map(0x2015, 0x2015).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_4_r), FUNC(ppu_vt03_device::videobank0_4_w)); + map(0x2016, 0x2016).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_3_r), FUNC(ppu_vt03_device::videobank0_3_w)); + map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_1_r), FUNC(ppu_vt03_device::videobank0_1_w)); } diff --git a/src/mame/nintendo/nes_vt_soc.h b/src/mame/nintendo/nes_vt_soc.h index 5d3dc4cb86ec1..51ff506898b2e 100644 --- a/src/mame/nintendo/nes_vt_soc.h +++ b/src/mame/nintendo/nes_vt_soc.h @@ -59,7 +59,7 @@ class nes_vt02_vt03_soc_device : public device_t, public device_memory_interface required_device m_apu; void nes_vt_map(address_map &map) ATTR_COLD; - virtual void nes_vt_2012_to_2017_regs(address_map &map); + virtual void nes_vt_2012_to_2017_videobank0_regs(address_map &map); uint32_t get_banks(uint8_t bnk); void update_banks(); @@ -166,7 +166,7 @@ class nes_vt02_vt03_soc_waixing_device : public nes_vt02_vt03_soc_device protected: nes_vt02_vt03_soc_waixing_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - virtual void nes_vt_2012_to_2017_regs(address_map &map) override; + virtual void nes_vt_2012_to_2017_videobank0_regs(address_map &map) override; }; class nes_vt02_vt03_soc_waixing_pal_device : public nes_vt02_vt03_soc_waixing_device @@ -184,7 +184,7 @@ class nes_vt02_vt03_soc_hummer_device : public nes_vt02_vt03_soc_device nes_vt02_vt03_soc_hummer_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); protected: - virtual void nes_vt_2012_to_2017_regs(address_map &map) override; + virtual void nes_vt_2012_to_2017_videobank0_regs(address_map &map) override; }; class nes_vt02_vt03_soc_sports_device : public nes_vt02_vt03_soc_device @@ -196,7 +196,7 @@ class nes_vt02_vt03_soc_sports_device : public nes_vt02_vt03_soc_device nes_vt02_vt03_soc_sports_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); protected: - virtual void nes_vt_2012_to_2017_regs(address_map &map) override; + virtual void nes_vt_2012_to_2017_videobank0_regs(address_map &map) override; }; class nes_vt02_vt03_soc_sports_pal_device : public nes_vt02_vt03_soc_sports_device From 6b6a7b9d29716c49beeffd229a1f557d1ad74855 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 13 May 2025 15:14:49 +0100 Subject: [PATCH 28/35] refactoring --- src/devices/video/ppu2c0x_vt.cpp | 35 +++++++++++++++---------------- src/devices/video/ppu2c0x_vt.h | 5 ++++- src/mame/nintendo/nes_vt_soc.cpp | 36 ++++++++++++++++---------------- src/mame/nintendo/nes_vt_soc.h | 8 +++---- 4 files changed, 43 insertions(+), 41 deletions(-) diff --git a/src/devices/video/ppu2c0x_vt.cpp b/src/devices/video/ppu2c0x_vt.cpp index d8e8d00cbca4e..27daaf2a6c6f7 100644 --- a/src/devices/video/ppu2c0x_vt.cpp +++ b/src/devices/video/ppu2c0x_vt.cpp @@ -67,7 +67,7 @@ void ppu_vt03_device::palette_write(offs_t offset, uint8_t data) } } -uint8_t ppu_vt03_device::read_2010(offs_t offset) { return m_201x_regs[0x0]; } +uint8_t ppu_vt03_device::read_2010(offs_t offset) { return m_extended_modes_enable; } uint8_t ppu_vt03_device::read_2011(offs_t offset) { return m_201x_regs[0x1]; } uint8_t ppu_vt03_device::videobank0_0_r(offs_t offset) { return m_201x_regs[0x2]; } uint8_t ppu_vt03_device::videobank0_1_r(offs_t offset) { return m_201x_regs[0x3]; } @@ -209,6 +209,7 @@ void ppu_vt03_device::device_start() save_item(NAME(m_extplanebuf)); save_item(NAME(m_extra_sprite_bits)); save_item(NAME(m_201x_regs)); + save_item(NAME(m_extended_modes_enable)); init_vt03_palette_tables(0); init_vtxx_rgb555_palette_tables(); @@ -238,6 +239,8 @@ void ppu_vt03_device::device_reset() for (int i = 0; i < 0x20; i++) set_201x_reg(i, 0x00); + m_extended_modes_enable = 0x00; + m_read_bg4_bg3 = 0; m_va34 = false; } @@ -260,7 +263,7 @@ void ppu_vt03_device::read_sprite_plane_data(int address) m_planebuf[0] = m_read_sp((address + 0) & 0x1fff); m_planebuf[1] = m_read_sp((address + 8) & 0x1fff); - const bool is4bpp = BIT(get_201x_reg(0x0), 2); + const bool is4bpp = BIT(m_extended_modes_enable, 2); if (is4bpp) { @@ -274,8 +277,8 @@ void ppu_vt03_device::make_sprite_pixel_data(uint8_t& pixel_data, bool flipx) { ppu2c0x_device::make_sprite_pixel_data(pixel_data, flipx); - const bool is4bpp = BIT(get_201x_reg(0x0), 2); - const bool is16pix = BIT(get_201x_reg(0x0), 0); + const bool is4bpp = BIT(m_extended_modes_enable, 2); + const bool is16pix = BIT(m_extended_modes_enable, 0); if (is4bpp) { @@ -304,8 +307,8 @@ void ppu_vt03_device::make_sprite_pixel_data(uint8_t& pixel_data, bool flipx) void ppu_vt03_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_rgb32& bitmap) { - const bool is4bpp = BIT(get_201x_reg(0x0), 2); - const bool is16pix = BIT(get_201x_reg(0x0), 0); + const bool is4bpp = BIT(m_extended_modes_enable, 2); + const bool is16pix = BIT(m_extended_modes_enable, 0); if (is4bpp) { @@ -342,9 +345,9 @@ void ppu_vt03_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, u void ppu_vt03_device::read_tile_plane_data(int address, int color) { - const bool is4bpp = BIT(get_201x_reg(0x0), 1); + const bool is4bpp = BIT(m_extended_modes_enable, 1); - if (m_201x_regs[0] & 0x10) // extended mode + if (m_extended_modes_enable & 0x10) // extended mode m_read_bg4_bg3 = color; else m_read_bg4_bg3 = 0; @@ -368,7 +371,7 @@ void ppu_vt03_device::read_tile_plane_data(int address, int color) void ppu_vt03_device::shift_tile_plane_data(uint8_t& pix) { - const bool is4bpp = BIT(get_201x_reg(0x0), 1); + const bool is4bpp = BIT(m_extended_modes_enable, 1); ppu2c0x_device::shift_tile_plane_data(pix); @@ -383,7 +386,7 @@ void ppu_vt03_device::shift_tile_plane_data(uint8_t& pix) void ppu_vt03_device::draw_back_pen(uint32_t* dst, int back_pen) { - if (m_201x_regs[0] & 0x80) + if (m_extended_modes_enable & 0x80) { // is the back_pen always just pen 0 in VT modes? (using last data written to a transparent pen as per NES logic doesn't work as writes are split across 2 bytes) draw_tile_pixel_inner(0, dst); @@ -398,7 +401,7 @@ void ppu_vt03_device::draw_back_pen(uint32_t* dst, int back_pen) void ppu_vt03_device::draw_tile_pixel_inner(uint8_t pen, uint32_t *dest) { - if (BIT(m_201x_regs[0], 7)) + if (BIT(m_extended_modes_enable, 7)) { if (m_pal_mode == PAL_MODE_NEW_RGB) // unknown newer VT mode { @@ -455,7 +458,7 @@ void ppu_vt03_device::draw_tile_pixel_inner(uint8_t pen, uint32_t *dest) } void ppu_vt03_device::draw_tile_pixel(uint8_t pix, int color, uint32_t back_pen, uint32_t*& dest) { - const bool is4bpp = BIT(get_201x_reg(0x0), 1); + const bool is4bpp = BIT(m_extended_modes_enable, 1); if (!is4bpp) { @@ -466,7 +469,7 @@ void ppu_vt03_device::draw_tile_pixel(uint8_t pix, int color, uint32_t back_pen, int basepen; int pen; - if (m_201x_regs[0] & 0x10) // extended mode + if (m_extended_modes_enable & 0x10) // extended mode { basepen = 0; } @@ -498,10 +501,6 @@ uint8_t ppu_vt03_device::get_speva2_speva0() return m_extra_sprite_bits; } -void ppu_vt03_device::set_2010_reg(uint8_t data) -{ - -} void ppu_vt03_device::write_2010(offs_t offset, uint8_t data) { @@ -514,7 +513,7 @@ void ppu_vt03_device::write_2010(offs_t offset, uint8_t data) 1 : BK16EN 0 : PIX16EN */ - m_201x_regs[0x0] = data; + m_extended_modes_enable = data; } void ppu_vt03_device::write_2011(offs_t offset, uint8_t data) { m_201x_regs[0x1] = data; } diff --git a/src/devices/video/ppu2c0x_vt.h b/src/devices/video/ppu2c0x_vt.h index b86743bef49e6..1a36b2d7eaca3 100644 --- a/src/devices/video/ppu2c0x_vt.h +++ b/src/devices/video/ppu2c0x_vt.h @@ -64,8 +64,11 @@ class ppu_vt03_device : public ppu2c0x_device { virtual uint8_t palette_read(offs_t offset) override; virtual void palette_write(offs_t offset, uint8_t data) override; + uint8_t get_extended_modes_enable() { return m_extended_modes_enable; } + void set_201x_reg(int reg, uint8_t data); uint8_t get_201x_reg(int reg); + uint8_t get_videobank0_reg(int reg) { return m_201x_regs[reg + 2]; } uint8_t get_va34(); uint8_t get_m_read_bg4_bg3(); @@ -98,6 +101,7 @@ class ppu_vt03_device : public ppu2c0x_device { uint32_t m_vtpens_rgb444[0x1000*8]; uint8_t m_201x_regs[0x20]; + uint8_t m_extended_modes_enable; private: devcb_read8 m_read_bg; @@ -111,7 +115,6 @@ class ppu_vt03_device : public ppu2c0x_device { vtxx_pal_mode m_pal_mode = PAL_MODE_VT0x; - void set_2010_reg(uint8_t data); void init_vt03_palette_tables(int palmode); void init_vtxx_rgb555_palette_tables(); void init_vtxx_rgb444_palette_tables(); diff --git a/src/mame/nintendo/nes_vt_soc.cpp b/src/mame/nintendo/nes_vt_soc.cpp index ec0557351c63e..73ac82612326b 100644 --- a/src/mame/nintendo/nes_vt_soc.cpp +++ b/src/mame/nintendo/nes_vt_soc.cpp @@ -521,11 +521,11 @@ void nes_vt02_vt03_soc_device::nt_w(offs_t offset, uint8_t data) int nes_vt02_vt03_soc_device::calculate_real_video_address(int addr, int extended, int readtype) { // might be a VT09 only feature (alt 4bpp mode?) - int alt_order = m_ppu->get_201x_reg(0x0) & 0x40; + int alt_order = m_ppu->get_extended_modes_enable() & 0x40; if (readtype == 0) { - if (m_ppu->get_201x_reg(0x0) & 0x10) + if (m_ppu->get_extended_modes_enable() & 0x10) { extended = 1; } @@ -536,7 +536,7 @@ int nes_vt02_vt03_soc_device::calculate_real_video_address(int addr, int extende } else if (readtype == 1) { - if (m_ppu->get_201x_reg(0x0) & 0x08) + if (m_ppu->get_extended_modes_enable() & 0x08) { extended = 1; } @@ -581,34 +581,34 @@ int nes_vt02_vt03_soc_device::calculate_real_video_address(int addr, int extende case 0x1: case 0xc: case 0xd: - vbank_tva17_tva10 = (m_ppu->get_201x_reg(0x6) & 0xfe) | ((addr & 0x0400) ? 1 : 0); + vbank_tva17_tva10 = (m_ppu->get_videobank0_reg(0x4) & 0xfe) | ((addr & 0x0400) ? 1 : 0); break; case 0x2: case 0x3: case 0xe: case 0xf: - vbank_tva17_tva10 = (m_ppu->get_201x_reg(0x7) & 0xfe) | ((addr & 0x0400) ? 1 : 0); + vbank_tva17_tva10 = (m_ppu->get_videobank0_reg(0x5) & 0xfe) | ((addr & 0x0400) ? 1 : 0); break; case 0x4: case 0x8: - vbank_tva17_tva10 = m_ppu->get_201x_reg(0x2); + vbank_tva17_tva10 = m_ppu->get_videobank0_reg(0x0); break; case 0x5: case 0x9: - vbank_tva17_tva10 = m_ppu->get_201x_reg(0x3); + vbank_tva17_tva10 = m_ppu->get_videobank0_reg(0x1); break; case 0x6: case 0xa: - vbank_tva17_tva10 = m_ppu->get_201x_reg(0x4); + vbank_tva17_tva10 = m_ppu->get_videobank0_reg(0x2); break; case 0x7: case 0xb: - vbank_tva17_tva10 = m_ppu->get_201x_reg(0x5); + vbank_tva17_tva10 = m_ppu->get_videobank0_reg(0x3); break; } @@ -655,8 +655,8 @@ int nes_vt02_vt03_soc_device::calculate_real_video_address(int addr, int extende if (!extended) { int is4bpp = 0; - if (readtype == 0) is4bpp = m_ppu->get_201x_reg(0x0) & 0x02; - else if (readtype == 1) is4bpp = m_ppu->get_201x_reg(0x0) & 0x04; + if (readtype == 0) is4bpp = m_ppu->get_extended_modes_enable() & 0x02; + else if (readtype == 1) is4bpp = m_ppu->get_extended_modes_enable() & 0x04; int va20_va18 = (m_ppu->get_201x_reg(0x8) & 0x70) >> 4; @@ -682,7 +682,7 @@ int nes_vt02_vt03_soc_device::calculate_real_video_address(int addr, int extende switch (readtype) { case 0: // background display - is4bpp = m_ppu->get_201x_reg(0x0) & 0x02; + is4bpp = m_ppu->get_extended_modes_enable() & 0x02; eva2_eva0 |= m_ppu->get_m_read_bg4_bg3(); @@ -697,7 +697,7 @@ int nes_vt02_vt03_soc_device::calculate_real_video_address(int addr, int extende break; case 1: // sprite display - is4bpp = m_ppu->get_201x_reg(0x0) & 0x04; // 16 colors or 16-pixel wide (both adjust the read) + is4bpp = m_ppu->get_extended_modes_enable() & 0x04; // 16 colors or 16-pixel wide (both adjust the read) eva2_eva0 |= m_ppu->get_speva2_speva0(); @@ -1079,7 +1079,7 @@ void nes_vt02_vt03_soc_device::nes_vt_map(address_map &map) // 2010 - 201f are extended regs, and can differ between VT models map(0x2010, 0x2010).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2010), FUNC(ppu_vt03_device::write_2010)); map(0x2011, 0x2011).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2011), FUNC(ppu_vt03_device::write_2011)); - nes_vt_2012_to_2017_videobank0_regs(map);// 2012 - 2017 map differently on some SoC types (re-ordered) + nes_vt_2012_to_2017_regs(map);// 2012 - 2017 map differently on some SoC types (re-ordered) map(0x2018, 0x2018).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2018), FUNC(ppu_vt03_device::write_2018)); map(0x2019, 0x2019).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2019), FUNC(ppu_vt03_device::write_2019)); map(0x201a, 0x201a).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_201a), FUNC(ppu_vt03_device::write_201a)); @@ -1115,7 +1115,7 @@ void nes_vt02_vt03_soc_device::nes_vt_map(address_map &map) map(0x6000, 0x7fff).ram(); } -void nes_vt02_vt03_soc_device::nes_vt_2012_to_2017_videobank0_regs(address_map &map) +void nes_vt02_vt03_soc_device::nes_vt_2012_to_2017_regs(address_map &map) { map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_0_r), FUNC(ppu_vt03_device::videobank0_0_w)); map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_1_r), FUNC(ppu_vt03_device::videobank0_1_w)); @@ -1125,7 +1125,7 @@ void nes_vt02_vt03_soc_device::nes_vt_2012_to_2017_videobank0_regs(address_map & map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_5_r), FUNC(ppu_vt03_device::videobank0_5_w)); } -void nes_vt02_vt03_soc_waixing_device::nes_vt_2012_to_2017_videobank0_regs(address_map& map) +void nes_vt02_vt03_soc_waixing_device::nes_vt_2012_to_2017_regs(address_map& map) { map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_1_r), FUNC(ppu_vt03_device::videobank0_1_w)); map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_0_r), FUNC(ppu_vt03_device::videobank0_0_w)); @@ -1135,7 +1135,7 @@ void nes_vt02_vt03_soc_waixing_device::nes_vt_2012_to_2017_videobank0_regs(addre map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_2_r), FUNC(ppu_vt03_device::videobank0_2_w)); } -void nes_vt02_vt03_soc_hummer_device::nes_vt_2012_to_2017_videobank0_regs(address_map& map) +void nes_vt02_vt03_soc_hummer_device::nes_vt_2012_to_2017_regs(address_map& map) { map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_5_r), FUNC(ppu_vt03_device::videobank0_5_w)); map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_4_r), FUNC(ppu_vt03_device::videobank0_4_w)); @@ -1145,7 +1145,7 @@ void nes_vt02_vt03_soc_hummer_device::nes_vt_2012_to_2017_videobank0_regs(addres map(0x2017, 0x2017).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_1_r), FUNC(ppu_vt03_device::videobank0_1_w)); } -void nes_vt02_vt03_soc_sports_device::nes_vt_2012_to_2017_videobank0_regs(address_map& map) +void nes_vt02_vt03_soc_sports_device::nes_vt_2012_to_2017_regs(address_map& map) { map(0x2012, 0x2012).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_2_r), FUNC(ppu_vt03_device::videobank0_2_w)); map(0x2013, 0x2013).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_5_r), FUNC(ppu_vt03_device::videobank0_5_w)); diff --git a/src/mame/nintendo/nes_vt_soc.h b/src/mame/nintendo/nes_vt_soc.h index 51ff506898b2e..5d3dc4cb86ec1 100644 --- a/src/mame/nintendo/nes_vt_soc.h +++ b/src/mame/nintendo/nes_vt_soc.h @@ -59,7 +59,7 @@ class nes_vt02_vt03_soc_device : public device_t, public device_memory_interface required_device m_apu; void nes_vt_map(address_map &map) ATTR_COLD; - virtual void nes_vt_2012_to_2017_videobank0_regs(address_map &map); + virtual void nes_vt_2012_to_2017_regs(address_map &map); uint32_t get_banks(uint8_t bnk); void update_banks(); @@ -166,7 +166,7 @@ class nes_vt02_vt03_soc_waixing_device : public nes_vt02_vt03_soc_device protected: nes_vt02_vt03_soc_waixing_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - virtual void nes_vt_2012_to_2017_videobank0_regs(address_map &map) override; + virtual void nes_vt_2012_to_2017_regs(address_map &map) override; }; class nes_vt02_vt03_soc_waixing_pal_device : public nes_vt02_vt03_soc_waixing_device @@ -184,7 +184,7 @@ class nes_vt02_vt03_soc_hummer_device : public nes_vt02_vt03_soc_device nes_vt02_vt03_soc_hummer_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); protected: - virtual void nes_vt_2012_to_2017_videobank0_regs(address_map &map) override; + virtual void nes_vt_2012_to_2017_regs(address_map &map) override; }; class nes_vt02_vt03_soc_sports_device : public nes_vt02_vt03_soc_device @@ -196,7 +196,7 @@ class nes_vt02_vt03_soc_sports_device : public nes_vt02_vt03_soc_device nes_vt02_vt03_soc_sports_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); protected: - virtual void nes_vt_2012_to_2017_videobank0_regs(address_map &map) override; + virtual void nes_vt_2012_to_2017_regs(address_map &map) override; }; class nes_vt02_vt03_soc_sports_pal_device : public nes_vt02_vt03_soc_sports_device From c1fbf86f48044015707e2be53d746782cc274528 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 13 May 2025 15:32:36 +0100 Subject: [PATCH 29/35] further refactoring --- src/devices/video/ppu2c0x_vt.cpp | 28 +++++++++++--------- src/devices/video/ppu2c0x_vt.h | 4 ++- src/mame/nintendo/nes_vt02_vt03.cpp | 14 +++++----- src/mame/nintendo/nes_vt_soc.cpp | 41 ++++++++++++++++------------- 4 files changed, 49 insertions(+), 38 deletions(-) diff --git a/src/devices/video/ppu2c0x_vt.cpp b/src/devices/video/ppu2c0x_vt.cpp index 27daaf2a6c6f7..4a7ea4e58bbde 100644 --- a/src/devices/video/ppu2c0x_vt.cpp +++ b/src/devices/video/ppu2c0x_vt.cpp @@ -69,12 +69,12 @@ void ppu_vt03_device::palette_write(offs_t offset, uint8_t data) uint8_t ppu_vt03_device::read_2010(offs_t offset) { return m_extended_modes_enable; } uint8_t ppu_vt03_device::read_2011(offs_t offset) { return m_201x_regs[0x1]; } -uint8_t ppu_vt03_device::videobank0_0_r(offs_t offset) { return m_201x_regs[0x2]; } -uint8_t ppu_vt03_device::videobank0_1_r(offs_t offset) { return m_201x_regs[0x3]; } -uint8_t ppu_vt03_device::videobank0_2_r(offs_t offset) { return m_201x_regs[0x4]; } -uint8_t ppu_vt03_device::videobank0_3_r(offs_t offset) { return m_201x_regs[0x5]; } -uint8_t ppu_vt03_device::videobank0_4_r(offs_t offset) { return m_201x_regs[0x6]; } -uint8_t ppu_vt03_device::videobank0_5_r(offs_t offset) { return m_201x_regs[0x7]; } +uint8_t ppu_vt03_device::videobank0_0_r(offs_t offset) { return m_videobank0[0x0]; } +uint8_t ppu_vt03_device::videobank0_1_r(offs_t offset) { return m_videobank0[0x1]; } +uint8_t ppu_vt03_device::videobank0_2_r(offs_t offset) { return m_videobank0[0x2]; } +uint8_t ppu_vt03_device::videobank0_3_r(offs_t offset) { return m_videobank0[0x3]; } +uint8_t ppu_vt03_device::videobank0_4_r(offs_t offset) { return m_videobank0[0x4]; } +uint8_t ppu_vt03_device::videobank0_5_r(offs_t offset) { return m_videobank0[0x5]; } uint8_t ppu_vt03_device::read_2018(offs_t offset) { return m_201x_regs[0x8]; } uint8_t ppu_vt03_device::read_2019(offs_t offset) { return 0x00; } uint8_t ppu_vt03_device::read_201a(offs_t offset) { return m_201x_regs[0xa]; } @@ -209,6 +209,7 @@ void ppu_vt03_device::device_start() save_item(NAME(m_extplanebuf)); save_item(NAME(m_extra_sprite_bits)); save_item(NAME(m_201x_regs)); + save_item(NAME(m_videobank0)); save_item(NAME(m_extended_modes_enable)); init_vt03_palette_tables(0); @@ -241,6 +242,9 @@ void ppu_vt03_device::device_reset() m_extended_modes_enable = 0x00; + for (int i = 0; i < 6; i++) + m_videobank0[i] = 0; + m_read_bg4_bg3 = 0; m_va34 = false; } @@ -517,12 +521,12 @@ void ppu_vt03_device::write_2010(offs_t offset, uint8_t data) } void ppu_vt03_device::write_2011(offs_t offset, uint8_t data) { m_201x_regs[0x1] = data; } -void ppu_vt03_device::videobank0_0_w(offs_t offset, uint8_t data) { m_201x_regs[0x2] = data; } -void ppu_vt03_device::videobank0_1_w(offs_t offset, uint8_t data) { m_201x_regs[0x3] = data; } -void ppu_vt03_device::videobank0_2_w(offs_t offset, uint8_t data) { m_201x_regs[0x4] = data; } -void ppu_vt03_device::videobank0_3_w(offs_t offset, uint8_t data) { m_201x_regs[0x5] = data; } -void ppu_vt03_device::videobank0_4_w(offs_t offset, uint8_t data) { m_201x_regs[0x6] = data; } -void ppu_vt03_device::videobank0_5_w(offs_t offset, uint8_t data) { m_201x_regs[0x7] = data; } +void ppu_vt03_device::videobank0_0_w(offs_t offset, uint8_t data) { m_videobank0[0x0] = data; } +void ppu_vt03_device::videobank0_1_w(offs_t offset, uint8_t data) { m_videobank0[0x1] = data; } +void ppu_vt03_device::videobank0_2_w(offs_t offset, uint8_t data) { m_videobank0[0x2] = data; } +void ppu_vt03_device::videobank0_3_w(offs_t offset, uint8_t data) { m_videobank0[0x3] = data; } +void ppu_vt03_device::videobank0_4_w(offs_t offset, uint8_t data) { m_videobank0[0x4] = data; } +void ppu_vt03_device::videobank0_5_w(offs_t offset, uint8_t data) { m_videobank0[0x5] = data; } void ppu_vt03_device::write_2018(offs_t offset, uint8_t data) { m_201x_regs[0x8] = data; } void ppu_vt03_device::write_2019(offs_t offset, uint8_t data) { logerror("%s: write_2019 %02x (gun reset?)\n", machine().describe_context(), data); } void ppu_vt03_device::write_201a(offs_t offset, uint8_t data) { m_201x_regs[0xa] = data; } diff --git a/src/devices/video/ppu2c0x_vt.h b/src/devices/video/ppu2c0x_vt.h index 1a36b2d7eaca3..462a11ee3404f 100644 --- a/src/devices/video/ppu2c0x_vt.h +++ b/src/devices/video/ppu2c0x_vt.h @@ -68,7 +68,8 @@ class ppu_vt03_device : public ppu2c0x_device { void set_201x_reg(int reg, uint8_t data); uint8_t get_201x_reg(int reg); - uint8_t get_videobank0_reg(int reg) { return m_201x_regs[reg + 2]; } + uint8_t get_videobank0_reg(int reg) { return m_videobank0[reg]; } + void set_videobank0_reg(int reg, uint8_t data) { m_videobank0[reg] = data; } uint8_t get_va34(); uint8_t get_m_read_bg4_bg3(); @@ -101,6 +102,7 @@ class ppu_vt03_device : public ppu2c0x_device { uint32_t m_vtpens_rgb444[0x1000*8]; uint8_t m_201x_regs[0x20]; + uint8_t m_videobank0[6]; uint8_t m_extended_modes_enable; private: diff --git a/src/mame/nintendo/nes_vt02_vt03.cpp b/src/mame/nintendo/nes_vt02_vt03.cpp index a383d1e5cf34b..8acd46c03319c 100644 --- a/src/mame/nintendo/nes_vt02_vt03.cpp +++ b/src/mame/nintendo/nes_vt02_vt03.cpp @@ -611,7 +611,7 @@ void nes_vt_waixing_alt_state::nes_vt_waixing_alt_4mb(machine_config &config) NES_VT02_VT03_SOC_WAIXING(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_waixing_state::vt_external_space_map_4mbyte); - m_soc->set_8000_scramble(0x5, 0x4, 0x3, 0x2, 0x7, 0x6, 0x7, 0x8); + m_soc->set_8000_scramble(0x3, 0x2, 0x1, 0x0, 0x5, 0x4, 0x7, 0x8); } void nes_vt_waixing_alt_state::nes_vt_waixing_alt_pal_8mb(machine_config &config) @@ -619,7 +619,7 @@ void nes_vt_waixing_alt_state::nes_vt_waixing_alt_pal_8mb(machine_config &config NES_VT02_VT03_SOC_WAIXING_PAL(config, m_soc, PAL_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_waixing_alt_state::vt_external_space_map_8mbyte); - m_soc->set_8000_scramble(0x5, 0x4, 0x3, 0x2, 0x7, 0x6, 0x7, 0x8); + m_soc->set_8000_scramble(0x3, 0x2, 0x1, 0x0, 0x5, 0x4, 0x7, 0x8); } void nes_vt_waixing_alt_sporzpp_state::nes_vt_waixing_alt_4mb_sporzpp(machine_config& config) @@ -628,7 +628,7 @@ void nes_vt_waixing_alt_sporzpp_state::nes_vt_waixing_alt_4mb_sporzpp(machine_co configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_ablping_state::vt_external_space_map_4mbyte); - m_soc->set_8000_scramble(0x5, 0x4, 0x3, 0x2, 0x7, 0x6, 0x7, 0x8); + m_soc->set_8000_scramble(0x3, 0x2, 0x1, 0x0, 0x5, 0x4, 0x7, 0x8); } void nes_vt_waixing_alt_sporzpp_state::nes_vt_pal_4mb_sporzbxa(machine_config& config) @@ -643,7 +643,7 @@ void nes_vt_hum_state::nes_vt_hummer_2mb(machine_config& config) NES_VT02_VT03_SOC_HUMMER(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_sp69_state::vt_external_space_map_2mbyte); - m_soc->set_8000_scramble(0x6, 0x7, 0x2, 0x3, 0x4, 0x5, 0x7, 0x8); + m_soc->set_8000_scramble(0x4, 0x5, 0x0, 0x1, 0x2, 0x3, 0x7, 0x8); } void nes_vt_hum_state::nes_vt_hummer_4mb(machine_config& config) @@ -657,7 +657,7 @@ void nes_vt_pjoy_state::nes_vt_pjoy_4mb(machine_config &config) NES_VT02_VT03_SOC(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_sp69_state::vt_external_space_map_4mbyte); - m_soc->set_8000_scramble(0x6, 0x7, 0x2, 0x3, 0x4, 0x5, 0x8, 0x7); + m_soc->set_8000_scramble(0x4, 0x5, 0x0, 0x1, 0x2, 0x3, 0x8, 0x7); m_soc->set_410x_scramble(0x8, 0x7); } @@ -667,7 +667,7 @@ void nes_vt_sp69_state::nes_vt_4mb_sp69(machine_config& config) NES_VT02_VT03_SOC_SPORTS(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_sp69_state::vt_external_space_map_4mbyte); - m_soc->set_8000_scramble(0x6, 0x7, 0x2, 0x3, 0x4, 0x5, 0x7, 0x8); + m_soc->set_8000_scramble(0x4, 0x5, 0x0, 0x1, 0x2, 0x3, 0x7, 0x8); } void nes_vt_ablping_state::nes_vt_2mb_ablping(machine_config &config) @@ -675,7 +675,7 @@ void nes_vt_ablping_state::nes_vt_2mb_ablping(machine_config &config) NES_VT02_VT03_SOC_SPORTS_PAL(config, m_soc, PAL_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_ablping_state::vt_external_space_map_2mbyte); - m_soc->set_8000_scramble(0x6, 0x7, 0x2, 0x3, 0x4, 0x5, 0x7, 0x8); + m_soc->set_8000_scramble(0x4, 0x5, 0x0, 0x1, 0x2, 0x3, 0x7, 0x8); m_soc->extra_read_2_callback().set(FUNC(nes_vt_ablping_state::ablping_extraio_r)); m_soc->extra_read_3_callback().set(FUNC(nes_vt_ablping_state::ablping_extraio_r)); diff --git a/src/mame/nintendo/nes_vt_soc.cpp b/src/mame/nintendo/nes_vt_soc.cpp index 73ac82612326b..6dde0f3779b12 100644 --- a/src/mame/nintendo/nes_vt_soc.cpp +++ b/src/mame/nintendo/nes_vt_soc.cpp @@ -99,12 +99,14 @@ nes_vt02_vt03_soc_device::nes_vt02_vt03_soc_device(const machine_config& mconfig m_extra_read_3_callback(*this, 0xff) { // 'no scramble' configuration - m_8000_scramble[0x0] = 0x6; - m_8000_scramble[0x1] = 0x7; - m_8000_scramble[0x2] = 0x2; - m_8000_scramble[0x3] = 0x3; - m_8000_scramble[0x4] = 0x4; - m_8000_scramble[0x5] = 0x5; + m_8000_scramble[0x0] = 0x4; + m_8000_scramble[0x1] = 0x5; + m_8000_scramble[0x2] = 0x0; + m_8000_scramble[0x3] = 0x1; + m_8000_scramble[0x4] = 0x2; + m_8000_scramble[0x5] = 0x3; + + // not for PPU? m_8000_scramble[0x6] = 0x7; m_8000_scramble[0x7] = 0x8; @@ -742,12 +744,12 @@ void nes_vt02_vt03_soc_device::scrambled_8000_w(uint16_t offset, uint8_t data) { //CNROM compat logerror("%s: vtxx_cnrom_8000_w real address: (%04x) translated address: (%04x) %02x\n", machine().describe_context(), addr, offset + 0x8000, data); - m_ppu->set_201x_reg(0x6, data * 8); - m_ppu->set_201x_reg(0x7, data * 8 + 2); - m_ppu->set_201x_reg(0x2, data * 8 + 4); - m_ppu->set_201x_reg(0x3, data * 8 + 5); - m_ppu->set_201x_reg(0x4, data * 8 + 6); - m_ppu->set_201x_reg(0x5, data * 8 + 7); + m_ppu->set_videobank0_reg(0x4, data * 8); + m_ppu->set_videobank0_reg(0x5, data * 8 + 2); + m_ppu->set_videobank0_reg(0x0, data * 8 + 4); + m_ppu->set_videobank0_reg(0x1, data * 8 + 5); + m_ppu->set_videobank0_reg(0x2, data * 8 + 6); + m_ppu->set_videobank0_reg(0x3, data * 8 + 7); } else if ((m_411d & 0x03) == 0x01) // (VT32 only, not VT03/09, split) @@ -786,28 +788,29 @@ void nes_vt02_vt03_soc_device::scrambled_8000_w(uint16_t offset, uint8_t data) switch (m_410x[0x05] & 0x07) { case 0x00: - m_ppu->set_201x_reg(m_8000_scramble[0], data); + m_ppu->set_videobank0_reg(m_8000_scramble[0], data); break; case 0x01: - m_ppu->set_201x_reg(m_8000_scramble[1], data); + m_ppu->set_videobank0_reg(m_8000_scramble[1], data); break; case 0x02: // hand? - m_ppu->set_201x_reg(m_8000_scramble[2], data); + m_ppu->set_videobank0_reg(m_8000_scramble[2], data); break; case 0x03: // dog? - m_ppu->set_201x_reg(m_8000_scramble[3], data); + m_ppu->set_videobank0_reg(m_8000_scramble[3], data); break; case 0x04: // ball thrown - m_ppu->set_201x_reg(m_8000_scramble[4], data); + m_ppu->set_videobank0_reg(m_8000_scramble[4], data); break; case 0x05: // ball thrown - m_ppu->set_201x_reg(m_8000_scramble[5], data); + m_ppu->set_videobank0_reg(m_8000_scramble[5], data); break; + case 0x06: m_410x[m_8000_scramble[6]] = data; //m_410x[0x9] = data; @@ -867,6 +870,8 @@ void nes_vt02_vt03_soc_device::set_8000_scramble(uint8_t reg0, uint8_t reg1, uin m_8000_scramble[3] = reg3; m_8000_scramble[4] = reg4; m_8000_scramble[5] = reg5; + + // not for PPU? m_8000_scramble[6] = reg6; m_8000_scramble[7] = reg7; } From 6c5af0f62d8d07274bc9e79d7d0341e2e43dcaff Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 13 May 2025 15:51:40 +0100 Subject: [PATCH 30/35] more refactoring --- src/devices/video/ppu2c0x_vt.cpp | 59 ++++++++----------- src/devices/video/ppu2c0x_vt.h | 44 +++++++------- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 18 +++--- src/mame/nintendo/nes_vt_soc.cpp | 38 ++++++------ 4 files changed, 76 insertions(+), 83 deletions(-) diff --git a/src/devices/video/ppu2c0x_vt.cpp b/src/devices/video/ppu2c0x_vt.cpp index 4a7ea4e58bbde..b952e010dbfdc 100644 --- a/src/devices/video/ppu2c0x_vt.cpp +++ b/src/devices/video/ppu2c0x_vt.cpp @@ -67,22 +67,22 @@ void ppu_vt03_device::palette_write(offs_t offset, uint8_t data) } } -uint8_t ppu_vt03_device::read_2010(offs_t offset) { return m_extended_modes_enable; } -uint8_t ppu_vt03_device::read_2011(offs_t offset) { return m_201x_regs[0x1]; } +uint8_t ppu_vt03_device::extended_modes_enable_r(offs_t offset) { return m_extended_modes_enable; } +uint8_t ppu_vt03_device::extended_modes2_enable_r(offs_t offset) { return m_extended_modes2_enable; } uint8_t ppu_vt03_device::videobank0_0_r(offs_t offset) { return m_videobank0[0x0]; } uint8_t ppu_vt03_device::videobank0_1_r(offs_t offset) { return m_videobank0[0x1]; } uint8_t ppu_vt03_device::videobank0_2_r(offs_t offset) { return m_videobank0[0x2]; } uint8_t ppu_vt03_device::videobank0_3_r(offs_t offset) { return m_videobank0[0x3]; } uint8_t ppu_vt03_device::videobank0_4_r(offs_t offset) { return m_videobank0[0x4]; } uint8_t ppu_vt03_device::videobank0_5_r(offs_t offset) { return m_videobank0[0x5]; } -uint8_t ppu_vt03_device::read_2018(offs_t offset) { return m_201x_regs[0x8]; } -uint8_t ppu_vt03_device::read_2019(offs_t offset) { return 0x00; } -uint8_t ppu_vt03_device::read_201a(offs_t offset) { return m_201x_regs[0xa]; } -uint8_t ppu_vt03_device::read_201b(offs_t offset) { return 0x00; } -uint8_t ppu_vt03_device::read_201c(offs_t offset) { return 0x00; } -uint8_t ppu_vt03_device::read_201d(offs_t offset) { return 0x00; } -uint8_t ppu_vt03_device::read_201e(offs_t offset) { return 0x00; } -uint8_t ppu_vt03_device::read_201f(offs_t offset) { return 0x00; } +uint8_t ppu_vt03_device::videobank1_r(offs_t offset) { return m_videobank1; } +uint8_t ppu_vt03_device::read_2019(offs_t offset) { return 0x00; } // unused? +uint8_t ppu_vt03_device::videobank0_extra_r(offs_t offset) { return m_videobank0_extra; } +uint8_t ppu_vt03_device::read_201b(offs_t offset) { return 0x00; } // unused? +uint8_t ppu_vt03_device::gun_x_r(offs_t offset) { return 0x00; } +uint8_t ppu_vt03_device::gun_y_r(offs_t offset) { return 0x00; } +uint8_t ppu_vt03_device::gun2_x_r(offs_t offset) { return 0x00; } +uint8_t ppu_vt03_device::gun2_y_r(offs_t offset) { return 0x00; } void ppu_vt03_device::init_vtxx_rgb555_palette_tables() @@ -208,27 +208,17 @@ void ppu_vt03_device::device_start() save_item(NAME(m_va34)); save_item(NAME(m_extplanebuf)); save_item(NAME(m_extra_sprite_bits)); - save_item(NAME(m_201x_regs)); save_item(NAME(m_videobank0)); + save_item(NAME(m_videobank1)); save_item(NAME(m_extended_modes_enable)); + save_item(NAME(m_extended_modes2_enable)); + save_item(NAME(m_videobank0_extra)); init_vt03_palette_tables(0); init_vtxx_rgb555_palette_tables(); init_vtxx_rgb444_palette_tables(); } -uint8_t ppu_vt03_device::get_201x_reg(int reg) -{ - //logerror(" getting reg %d is %02x ", reg, m_201x_regs[reg]); - - return m_201x_regs[reg]; -} - -void ppu_vt03_device::set_201x_reg(int reg, uint8_t data) -{ - m_201x_regs[reg] = data; -} - void ppu_vt03_device::device_reset() { ppu2c0x_device::device_reset(); @@ -237,14 +227,15 @@ void ppu_vt03_device::device_reset() m_palette_ram[i] = 0x0; // todo: what are the actual defaults for these? - for (int i = 0; i < 0x20; i++) - set_201x_reg(i, 0x00); - m_extended_modes_enable = 0x00; + m_extended_modes2_enable = 0x00; for (int i = 0; i < 6; i++) m_videobank0[i] = 0; + m_videobank0_extra = 0; + m_videobank1 = 0; + m_read_bg4_bg3 = 0; m_va34 = false; } @@ -506,7 +497,7 @@ uint8_t ppu_vt03_device::get_speva2_speva0() } -void ppu_vt03_device::write_2010(offs_t offset, uint8_t data) +void ppu_vt03_device::extended_modes_enable_w(offs_t offset, uint8_t data) { /* 7 : COLCOMP 6 : UNUSED (8bpp enable on VT09?) @@ -520,16 +511,16 @@ void ppu_vt03_device::write_2010(offs_t offset, uint8_t data) m_extended_modes_enable = data; } -void ppu_vt03_device::write_2011(offs_t offset, uint8_t data) { m_201x_regs[0x1] = data; } +void ppu_vt03_device::extended_modes2_enable_w(offs_t offset, uint8_t data) { m_extended_modes2_enable = data; } void ppu_vt03_device::videobank0_0_w(offs_t offset, uint8_t data) { m_videobank0[0x0] = data; } void ppu_vt03_device::videobank0_1_w(offs_t offset, uint8_t data) { m_videobank0[0x1] = data; } void ppu_vt03_device::videobank0_2_w(offs_t offset, uint8_t data) { m_videobank0[0x2] = data; } void ppu_vt03_device::videobank0_3_w(offs_t offset, uint8_t data) { m_videobank0[0x3] = data; } void ppu_vt03_device::videobank0_4_w(offs_t offset, uint8_t data) { m_videobank0[0x4] = data; } void ppu_vt03_device::videobank0_5_w(offs_t offset, uint8_t data) { m_videobank0[0x5] = data; } -void ppu_vt03_device::write_2018(offs_t offset, uint8_t data) { m_201x_regs[0x8] = data; } -void ppu_vt03_device::write_2019(offs_t offset, uint8_t data) { logerror("%s: write_2019 %02x (gun reset?)\n", machine().describe_context(), data); } -void ppu_vt03_device::write_201a(offs_t offset, uint8_t data) { m_201x_regs[0xa] = data; } +void ppu_vt03_device::videobank1_w(offs_t offset, uint8_t data) { m_videobank1 = data; } +void ppu_vt03_device::gun_reset_w(offs_t offset, uint8_t data) { logerror("%s: gun_reset_w %02x\n", machine().describe_context(), data); } +void ppu_vt03_device::videobank0_extra_w(offs_t offset, uint8_t data) { m_videobank0_extra = data; } /* 201b unused */ /* 201c read gun read x (older VT chipsets) */ /* 201d read gun read y (older VT chipsets) */ @@ -558,9 +549,9 @@ void ppu_vt3xx_device::device_reset() m_newvid_1e = 0x00; } -uint8_t ppu_vt3xx_device::read_201c_newvid(offs_t offset) { return m_newvid_1c; } -uint8_t ppu_vt3xx_device::read_201d_newvid(offs_t offset) { return m_newvid_1d; } -uint8_t ppu_vt3xx_device::read_201e_newvid(offs_t offset) { return m_newvid_1e; } +uint8_t ppu_vt3xx_device::gun_x_r_newvid(offs_t offset) { return m_newvid_1c; } +uint8_t ppu_vt3xx_device::gun_y_r_newvid(offs_t offset) { return m_newvid_1d; } +uint8_t ppu_vt3xx_device::gun2_x_r_newvid(offs_t offset) { return m_newvid_1e; } void ppu_vt3xx_device::write_201c_newvid(offs_t offset, uint8_t data) { m_newvid_1c = data; logerror("%s: write_201c_newvid %02x\n", machine().describe_context(), data); } void ppu_vt3xx_device::write_201d_newvid(offs_t offset, uint8_t data) { m_newvid_1d = data; logerror("%s: write_201d_newvid %02x\n", machine().describe_context(), data); } diff --git a/src/devices/video/ppu2c0x_vt.h b/src/devices/video/ppu2c0x_vt.h index 462a11ee3404f..41fec8d52b4b8 100644 --- a/src/devices/video/ppu2c0x_vt.h +++ b/src/devices/video/ppu2c0x_vt.h @@ -32,44 +32,44 @@ class ppu_vt03_device : public ppu2c0x_device { void set_palette_mode(vtxx_pal_mode pmode) { m_pal_mode = pmode; } - uint8_t read_2010(offs_t offset); - uint8_t read_2011(offs_t offset); + uint8_t extended_modes_enable_r(offs_t offset); + uint8_t extended_modes2_enable_r(offs_t offset); uint8_t videobank0_0_r(offs_t offset); uint8_t videobank0_1_r(offs_t offset); uint8_t videobank0_2_r(offs_t offset); uint8_t videobank0_3_r(offs_t offset); uint8_t videobank0_4_r(offs_t offset); uint8_t videobank0_5_r(offs_t offset); - uint8_t read_2018(offs_t offset); + uint8_t videobank1_r(offs_t offset); uint8_t read_2019(offs_t offset); - uint8_t read_201a(offs_t offset); + uint8_t videobank0_extra_r(offs_t offset); uint8_t read_201b(offs_t offset); - uint8_t read_201c(offs_t offset); - uint8_t read_201d(offs_t offset); - uint8_t read_201e(offs_t offset); - uint8_t read_201f(offs_t offset); + uint8_t gun_x_r(offs_t offset); + uint8_t gun_y_r(offs_t offset); + uint8_t gun2_x_r(offs_t offset); + uint8_t gun2_y_r(offs_t offset); - void write_2010(offs_t offset, uint8_t data); - void write_2011(offs_t offset, uint8_t data); + void extended_modes_enable_w(offs_t offset, uint8_t data); + void extended_modes2_enable_w(offs_t offset, uint8_t data); void videobank0_0_w(offs_t offset, uint8_t data); void videobank0_1_w(offs_t offset, uint8_t data); void videobank0_2_w(offs_t offset, uint8_t data); void videobank0_3_w(offs_t offset, uint8_t data); void videobank0_4_w(offs_t offset, uint8_t data); void videobank0_5_w(offs_t offset, uint8_t data); - void write_2018(offs_t offset, uint8_t data); - void write_2019(offs_t offset, uint8_t data); - void write_201a(offs_t offset, uint8_t data); + void videobank1_w(offs_t offset, uint8_t data); + void gun_reset_w(offs_t offset, uint8_t data); + void videobank0_extra_w(offs_t offset, uint8_t data); virtual uint8_t palette_read(offs_t offset) override; virtual void palette_write(offs_t offset, uint8_t data) override; - uint8_t get_extended_modes_enable() { return m_extended_modes_enable; } - - void set_201x_reg(int reg, uint8_t data); - uint8_t get_201x_reg(int reg); uint8_t get_videobank0_reg(int reg) { return m_videobank0[reg]; } void set_videobank0_reg(int reg, uint8_t data) { m_videobank0[reg] = data; } + uint8_t get_videobank1() { return m_videobank1; } + uint8_t get_videobank0_extra() { return m_videobank0_extra; } + uint8_t get_extended_modes_enable() { return m_extended_modes_enable; } + uint8_t get_extended_modes2_enable() { return m_extended_modes2_enable; } uint8_t get_va34(); uint8_t get_m_read_bg4_bg3(); @@ -101,9 +101,11 @@ class ppu_vt03_device : public ppu2c0x_device { uint32_t m_vtpens_rgb555[0x8000*8]; uint32_t m_vtpens_rgb444[0x1000*8]; - uint8_t m_201x_regs[0x20]; uint8_t m_videobank0[6]; + uint8_t m_videobank0_extra; + uint8_t m_videobank1; uint8_t m_extended_modes_enable; + uint8_t m_extended_modes2_enable; private: devcb_read8 m_read_bg; @@ -133,9 +135,9 @@ class ppu_vt3xx_device : public ppu_vt03_device { public: ppu_vt3xx_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); - uint8_t read_201c_newvid(offs_t offset); - uint8_t read_201d_newvid(offs_t offset); - uint8_t read_201e_newvid(offs_t offset); + uint8_t gun_x_r_newvid(offs_t offset); + uint8_t gun_y_r_newvid(offs_t offset); + uint8_t gun2_x_r_newvid(offs_t offset); void write_201c_newvid(offs_t offset, uint8_t data); void write_201d_newvid(offs_t offset, uint8_t data); diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index 3a84d434ef58e..3e022594ef60e 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -127,22 +127,22 @@ void vt3xx_soc_base_device::vt369_map(address_map &map) // ddrdismx relies on the mirroring, later SoCs have different mirroring? map(0x2000, 0x2007).rw(m_ppu, FUNC(ppu_vt3xx_device::read), FUNC(ppu_vt3xx_device::write)); // standard PPU registers - map(0x2010, 0x2010).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2010), FUNC(ppu_vt3xx_device::write_2010)); - map(0x2011, 0x2011).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2011), FUNC(ppu_vt3xx_device::write_2011)); + map(0x2010, 0x2010).rw(m_ppu, FUNC(ppu_vt3xx_device::extended_modes_enable_r), FUNC(ppu_vt3xx_device::extended_modes_enable_w)); + map(0x2011, 0x2011).rw(m_ppu, FUNC(ppu_vt3xx_device::extended_modes2_enable_r), FUNC(ppu_vt3xx_device::extended_modes2_enable_w)); map(0x2012, 0x2012).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank0_0_r), FUNC(ppu_vt3xx_device::videobank0_0_w)); map(0x2013, 0x2013).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank0_1_r), FUNC(ppu_vt3xx_device::videobank0_1_w)); map(0x2014, 0x2014).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank0_2_r), FUNC(ppu_vt3xx_device::videobank0_2_w)); map(0x2015, 0x2015).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank0_3_r), FUNC(ppu_vt3xx_device::videobank0_3_w)); map(0x2016, 0x2016).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank0_4_r), FUNC(ppu_vt3xx_device::videobank0_4_w)); map(0x2017, 0x2017).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank0_5_r), FUNC(ppu_vt3xx_device::videobank0_5_w)); - map(0x2018, 0x2018).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2018), FUNC(ppu_vt3xx_device::write_2018)); - map(0x2019, 0x2019).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2019), FUNC(ppu_vt3xx_device::write_2019)); - map(0x201a, 0x201a).rw(m_ppu, FUNC(ppu_vt3xx_device::read_201a), FUNC(ppu_vt3xx_device::write_201a)); + map(0x2018, 0x2018).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank1_r), FUNC(ppu_vt3xx_device::videobank1_w)); + map(0x2019, 0x2019).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2019), FUNC(ppu_vt3xx_device::gun_reset_w)); + map(0x201a, 0x201a).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank0_extra_r), FUNC(ppu_vt3xx_device::videobank0_extra_w)); map(0x201b, 0x201b).r(m_ppu, FUNC(ppu_vt3xx_device::read_201b)); - map(0x201c, 0x201c).rw(m_ppu, FUNC(ppu_vt3xx_device::read_201c_newvid), FUNC(ppu_vt3xx_device::write_201c_newvid)); - map(0x201d, 0x201d).rw(m_ppu, FUNC(ppu_vt3xx_device::read_201d_newvid), FUNC(ppu_vt3xx_device::write_201d_newvid)); - map(0x201e, 0x201e).rw(m_ppu, FUNC(ppu_vt3xx_device::read_201e_newvid), FUNC(ppu_vt3xx_device::write_201e_newvid)); - map(0x201f, 0x201f).r(m_ppu, FUNC(ppu_vt3xx_device::read_201f)); + map(0x201c, 0x201c).rw(m_ppu, FUNC(ppu_vt3xx_device::gun_x_r_newvid), FUNC(ppu_vt3xx_device::write_201c_newvid)); + map(0x201d, 0x201d).rw(m_ppu, FUNC(ppu_vt3xx_device::gun_y_r_newvid), FUNC(ppu_vt3xx_device::write_201d_newvid)); + map(0x201e, 0x201e).rw(m_ppu, FUNC(ppu_vt3xx_device::gun2_x_r_newvid), FUNC(ppu_vt3xx_device::write_201e_newvid)); + map(0x201f, 0x201f).r(m_ppu, FUNC(ppu_vt3xx_device::gun2_y_r)); map(0x4000, 0x4017).w(m_apu, FUNC(nes_apu_vt_device::write)); diff --git a/src/mame/nintendo/nes_vt_soc.cpp b/src/mame/nintendo/nes_vt_soc.cpp index 6dde0f3779b12..25d7fe0d1cd77 100644 --- a/src/mame/nintendo/nes_vt_soc.cpp +++ b/src/mame/nintendo/nes_vt_soc.cpp @@ -638,17 +638,17 @@ int nes_vt02_vt03_soc_device::calculate_real_video_address(int addr, int extende int va17_va10 = 0; - int swit = m_ppu->get_201x_reg(0xa); + int swit = m_ppu->get_videobank0_extra(); switch (swit & 0x07) { case 0x0: va17_va10 = vbank_tva17_tva10; break; - case 0x1: va17_va10 = (vbank_tva17_tva10 & 0x7f) | (m_ppu->get_201x_reg(0xa) & 0x80); break; - case 0x2: va17_va10 = (vbank_tva17_tva10 & 0x3f) | (m_ppu->get_201x_reg(0xa) & 0xc0); break; + case 0x1: va17_va10 = (vbank_tva17_tva10 & 0x7f) | (m_ppu->get_videobank0_extra() & 0x80); break; + case 0x2: va17_va10 = (vbank_tva17_tva10 & 0x3f) | (m_ppu->get_videobank0_extra() & 0xc0); break; case 0x3: return -1; - case 0x4: va17_va10 = (vbank_tva17_tva10 & 0x1f) | (m_ppu->get_201x_reg(0xa) & 0xe0); break; - case 0x5: va17_va10 = (vbank_tva17_tva10 & 0x0f) | (m_ppu->get_201x_reg(0xa) & 0xf0); break; - case 0x6: va17_va10 = (vbank_tva17_tva10 & 0x07) | (m_ppu->get_201x_reg(0xa) & 0xf8); break; + case 0x4: va17_va10 = (vbank_tva17_tva10 & 0x1f) | (m_ppu->get_videobank0_extra() & 0xe0); break; + case 0x5: va17_va10 = (vbank_tva17_tva10 & 0x0f) | (m_ppu->get_videobank0_extra() & 0xf0); break; + case 0x6: va17_va10 = (vbank_tva17_tva10 & 0x07) | (m_ppu->get_videobank0_extra() & 0xf8); break; case 0x7: return -1; } @@ -660,7 +660,7 @@ int nes_vt02_vt03_soc_device::calculate_real_video_address(int addr, int extende if (readtype == 0) is4bpp = m_ppu->get_extended_modes_enable() & 0x02; else if (readtype == 1) is4bpp = m_ppu->get_extended_modes_enable() & 0x04; - int va20_va18 = (m_ppu->get_201x_reg(0x8) & 0x70) >> 4; + int va20_va18 = (m_ppu->get_videobank1() & 0x70) >> 4; finaladdr = ((m_410x[0x0] & 0x0F) << 21) | (va20_va18 << 18) | (va17_va10 << 10) | (addr & 0x03ff); @@ -688,13 +688,13 @@ int nes_vt02_vt03_soc_device::calculate_real_video_address(int addr, int extende eva2_eva0 |= m_ppu->get_m_read_bg4_bg3(); - if (m_ppu->get_201x_reg(0x1) & 0x02) + if (m_ppu->get_extended_modes2_enable() & 0x02) { if (m_410x[0x6] & 0x1) eva2_eva0 |= 0x4; } else { - if (m_ppu->get_201x_reg(0x8) & 0x08) eva2_eva0 |= 0x4; + if (m_ppu->get_videobank1() & 0x08) eva2_eva0 |= 0x4; } break; @@ -927,7 +927,7 @@ void nes_vt02_vt03_soc_device::do_dma(uint8_t data, bool has_ntsc_bug) logerror("vdma dest %04x\n", m_ppu->get_vram_dest()); } - if (has_ntsc_bug && (dma_mode == 1) && ((m_ppu->get_vram_dest() & 0xFF00) == 0x3F00) && !(m_ppu->get_201x_reg(0x1) & 0x80)) + if (has_ntsc_bug && (dma_mode == 1) && ((m_ppu->get_vram_dest() & 0xFF00) == 0x3F00) && !(m_ppu->get_extended_modes2_enable() & 0x80)) { length -= 1; src_addr += 1; @@ -1082,17 +1082,17 @@ void nes_vt02_vt03_soc_device::nes_vt_map(address_map &map) map(0x2000, 0x2007).mirror(0x00e0).rw(m_ppu, FUNC(ppu2c0x_device::read), FUNC(ppu2c0x_device::write)); // standard PPU registers // 2010 - 201f are extended regs, and can differ between VT models - map(0x2010, 0x2010).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2010), FUNC(ppu_vt03_device::write_2010)); - map(0x2011, 0x2011).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2011), FUNC(ppu_vt03_device::write_2011)); + map(0x2010, 0x2010).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::extended_modes_enable_r), FUNC(ppu_vt03_device::extended_modes_enable_w)); + map(0x2011, 0x2011).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::extended_modes2_enable_r), FUNC(ppu_vt03_device::extended_modes2_enable_w)); nes_vt_2012_to_2017_regs(map);// 2012 - 2017 map differently on some SoC types (re-ordered) - map(0x2018, 0x2018).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2018), FUNC(ppu_vt03_device::write_2018)); - map(0x2019, 0x2019).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2019), FUNC(ppu_vt03_device::write_2019)); - map(0x201a, 0x201a).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_201a), FUNC(ppu_vt03_device::write_201a)); + map(0x2018, 0x2018).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank1_r), FUNC(ppu_vt03_device::videobank1_w)); + map(0x2019, 0x2019).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::read_2019), FUNC(ppu_vt03_device::gun_reset_w)); + map(0x201a, 0x201a).mirror(0x00e0).rw(m_ppu, FUNC(ppu_vt03_device::videobank0_extra_r), FUNC(ppu_vt03_device::videobank0_extra_w)); map(0x201b, 0x201b).mirror(0x00e0).r(m_ppu, FUNC(ppu_vt03_device::read_201b)); - map(0x201c, 0x201c).mirror(0x00e0).r(m_ppu, FUNC(ppu_vt03_device::read_201c)); - map(0x201d, 0x201d).mirror(0x00e0).r(m_ppu, FUNC(ppu_vt03_device::read_201d)); - map(0x201e, 0x201e).mirror(0x00e0).r(m_ppu, FUNC(ppu_vt03_device::read_201e)); - map(0x201f, 0x201f).mirror(0x00e0).r(m_ppu, FUNC(ppu_vt03_device::read_201f)); + map(0x201c, 0x201c).mirror(0x00e0).r(m_ppu, FUNC(ppu_vt03_device::gun_x_r)); + map(0x201d, 0x201d).mirror(0x00e0).r(m_ppu, FUNC(ppu_vt03_device::gun_y_r)); + map(0x201e, 0x201e).mirror(0x00e0).r(m_ppu, FUNC(ppu_vt03_device::gun2_x_r)); + map(0x201f, 0x201f).mirror(0x00e0).r(m_ppu, FUNC(ppu_vt03_device::gun2_y_r)); map(0x4000, 0x4017).w(m_apu, FUNC(nes_apu_vt_device::write)); map(0x4014, 0x4014).w(FUNC(nes_vt02_vt03_soc_device::vt_dma_w)); From 764a27c52e6c6f83e05560ae8e7611ae650903c7 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 13 May 2025 16:41:12 +0100 Subject: [PATCH 31/35] fix validation --- src/mame/nintendo/nes_vt_soc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/nintendo/nes_vt_soc.cpp b/src/mame/nintendo/nes_vt_soc.cpp index 25d7fe0d1cd77..ea6a16a04a982 100644 --- a/src/mame/nintendo/nes_vt_soc.cpp +++ b/src/mame/nintendo/nes_vt_soc.cpp @@ -66,7 +66,7 @@ DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_WAIXING_PAL, nes_vt02_vt03_soc_waixing_pal DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_HUMMER, nes_vt02_vt03_soc_hummer_device, "nes_vt02_vt03_soc_hummer", "VT02/03 series System on a Chip (Hummer, NTSC)") DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SPORTS, nes_vt02_vt03_soc_sports_device, "nes_vt02_vt03_soc_sports", "VT02/03 series System on a Chip (Sports, NTSC)") -DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SPORTS_PAL, nes_vt02_vt03_soc_sports_pal_device, "nes_vt02_vt03_soc_sports", "VT02/03 series System on a Chip (Sports, PAL)") +DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SPORTS_PAL, nes_vt02_vt03_soc_sports_pal_device, "nes_vt02_vt03_soc_sports_pal", "VT02/03 series System on a Chip (Sports, PAL)") DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SCRAMBLE, nes_vt02_vt03_soc_scramble_device, "nes_vt02_vt03_soc_scram", "VT02/03 series System on a Chip (NTSC, with simple Opcode scrambling)") DEFINE_DEVICE_TYPE(NES_VT02_VT03_SOC_SCRAMBLE_PAL, nes_vt02_vt03_soc_scramble_pal_device, "nes_vt02_vt03_soc_pal_scram", "VT02/03 series System on a Chip (PAL, with simple Opcode scrambling)") From ade314650abe6ce4a1375eb4bcc76793cc997647 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 13 May 2025 17:53:06 +0100 Subject: [PATCH 32/35] refactor --- src/mame/nintendo/nes_vt02_vt03.cpp | 21 ++++++++++++++------- src/mame/nintendo/nes_vt_soc.cpp | 19 ++++++++++++------- src/mame/nintendo/nes_vt_soc.h | 8 +++++--- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/mame/nintendo/nes_vt02_vt03.cpp b/src/mame/nintendo/nes_vt02_vt03.cpp index 8acd46c03319c..4e041e7789446 100644 --- a/src/mame/nintendo/nes_vt02_vt03.cpp +++ b/src/mame/nintendo/nes_vt02_vt03.cpp @@ -611,7 +611,8 @@ void nes_vt_waixing_alt_state::nes_vt_waixing_alt_4mb(machine_config &config) NES_VT02_VT03_SOC_WAIXING(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_waixing_state::vt_external_space_map_4mbyte); - m_soc->set_8000_scramble(0x3, 0x2, 0x1, 0x0, 0x5, 0x4, 0x7, 0x8); + m_soc->set_8000_scramble(0x3, 0x2, 0x1, 0x0, 0x5, 0x4); + //m_soc->set_8006_scramble(0x7, 0x8); // this is the default config in the SoC device } void nes_vt_waixing_alt_state::nes_vt_waixing_alt_pal_8mb(machine_config &config) @@ -619,7 +620,8 @@ void nes_vt_waixing_alt_state::nes_vt_waixing_alt_pal_8mb(machine_config &config NES_VT02_VT03_SOC_WAIXING_PAL(config, m_soc, PAL_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_waixing_alt_state::vt_external_space_map_8mbyte); - m_soc->set_8000_scramble(0x3, 0x2, 0x1, 0x0, 0x5, 0x4, 0x7, 0x8); + m_soc->set_8000_scramble(0x3, 0x2, 0x1, 0x0, 0x5, 0x4); + //m_soc->set_8006_scramble(0x7, 0x8); // this is the default config in the SoC device; } void nes_vt_waixing_alt_sporzpp_state::nes_vt_waixing_alt_4mb_sporzpp(machine_config& config) @@ -628,7 +630,8 @@ void nes_vt_waixing_alt_sporzpp_state::nes_vt_waixing_alt_4mb_sporzpp(machine_co configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_ablping_state::vt_external_space_map_4mbyte); - m_soc->set_8000_scramble(0x3, 0x2, 0x1, 0x0, 0x5, 0x4, 0x7, 0x8); + m_soc->set_8000_scramble(0x3, 0x2, 0x1, 0x0, 0x5, 0x4); + //m_soc->set_8006_scramble(0x7, 0x8); // this is the default config in the SoC device } void nes_vt_waixing_alt_sporzpp_state::nes_vt_pal_4mb_sporzbxa(machine_config& config) @@ -643,7 +646,8 @@ void nes_vt_hum_state::nes_vt_hummer_2mb(machine_config& config) NES_VT02_VT03_SOC_HUMMER(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_sp69_state::vt_external_space_map_2mbyte); - m_soc->set_8000_scramble(0x4, 0x5, 0x0, 0x1, 0x2, 0x3, 0x7, 0x8); + //m_soc->set_8000_scramble(0x4, 0x5, 0x0, 0x1, 0x2, 0x3); // this is the default config in the SoC device + //m_soc->set_8006_scramble(0x7, 0x8); // this is the default config in the SoC device } void nes_vt_hum_state::nes_vt_hummer_4mb(machine_config& config) @@ -657,7 +661,8 @@ void nes_vt_pjoy_state::nes_vt_pjoy_4mb(machine_config &config) NES_VT02_VT03_SOC(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_sp69_state::vt_external_space_map_4mbyte); - m_soc->set_8000_scramble(0x4, 0x5, 0x0, 0x1, 0x2, 0x3, 0x8, 0x7); + //m_soc->set_8000_scramble(0x4, 0x5, 0x0, 0x1, 0x2, 0x3); // this is the default config in the SoC device + m_soc->set_8006_scramble(0x8, 0x7); m_soc->set_410x_scramble(0x8, 0x7); } @@ -667,7 +672,8 @@ void nes_vt_sp69_state::nes_vt_4mb_sp69(machine_config& config) NES_VT02_VT03_SOC_SPORTS(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_sp69_state::vt_external_space_map_4mbyte); - m_soc->set_8000_scramble(0x4, 0x5, 0x0, 0x1, 0x2, 0x3, 0x7, 0x8); + //m_soc->set_8000_scramble(0x4, 0x5, 0x0, 0x1, 0x2, 0x3); // this is the default config in the SoC device + //m_soc->set_8006_scramble(0x7, 0x8); // this is the default config in the SoC device } void nes_vt_ablping_state::nes_vt_2mb_ablping(machine_config &config) @@ -675,7 +681,8 @@ void nes_vt_ablping_state::nes_vt_2mb_ablping(machine_config &config) NES_VT02_VT03_SOC_SPORTS_PAL(config, m_soc, PAL_APU_CLOCK); configure_soc(m_soc); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_ablping_state::vt_external_space_map_2mbyte); - m_soc->set_8000_scramble(0x4, 0x5, 0x0, 0x1, 0x2, 0x3, 0x7, 0x8); + //m_soc->set_8000_scramble(0x4, 0x5, 0x0, 0x1, 0x2, 0x3); // this is the default config in the SoC device + //m_soc->set_8006_scramble(0x7, 0x8); // this is the default config in the SoC device m_soc->extra_read_2_callback().set(FUNC(nes_vt_ablping_state::ablping_extraio_r)); m_soc->extra_read_3_callback().set(FUNC(nes_vt_ablping_state::ablping_extraio_r)); diff --git a/src/mame/nintendo/nes_vt_soc.cpp b/src/mame/nintendo/nes_vt_soc.cpp index ea6a16a04a982..15e6131ccbf58 100644 --- a/src/mame/nintendo/nes_vt_soc.cpp +++ b/src/mame/nintendo/nes_vt_soc.cpp @@ -107,8 +107,8 @@ nes_vt02_vt03_soc_device::nes_vt02_vt03_soc_device(const machine_config& mconfig m_8000_scramble[0x5] = 0x3; // not for PPU? - m_8000_scramble[0x6] = 0x7; - m_8000_scramble[0x7] = 0x8; + m_8006_scramble[0] = 0x7; + m_8006_scramble[1] = 0x8; // 'no scramble' configuration m_410x_scramble[0x0] = 0x7; @@ -812,13 +812,13 @@ void nes_vt02_vt03_soc_device::scrambled_8000_w(uint16_t offset, uint8_t data) break; case 0x06: - m_410x[m_8000_scramble[6]] = data; + m_410x[m_8006_scramble[0]] = data; //m_410x[0x9] = data; update_banks(); break; case 0x07: - m_410x[m_8000_scramble[7]] = data; + m_410x[m_8006_scramble[1]] = data; update_banks(); break; } @@ -862,7 +862,7 @@ void nes_vt02_vt03_soc_device::scrambled_8000_w(uint16_t offset, uint8_t data) // MMC3 compatibility mode -void nes_vt02_vt03_soc_device::set_8000_scramble(uint8_t reg0, uint8_t reg1, uint8_t reg2, uint8_t reg3, uint8_t reg4, uint8_t reg5, uint8_t reg6, uint8_t reg7) +void nes_vt02_vt03_soc_device::set_8000_scramble(uint8_t reg0, uint8_t reg1, uint8_t reg2, uint8_t reg3, uint8_t reg4, uint8_t reg5) { m_8000_scramble[0] = reg0; // TODO: name the regs m_8000_scramble[1] = reg1; @@ -871,11 +871,16 @@ void nes_vt02_vt03_soc_device::set_8000_scramble(uint8_t reg0, uint8_t reg1, uin m_8000_scramble[4] = reg4; m_8000_scramble[5] = reg5; +} + +void nes_vt02_vt03_soc_device::set_8006_scramble(uint8_t reg6, uint8_t reg7) +{ // not for PPU? - m_8000_scramble[6] = reg6; - m_8000_scramble[7] = reg7; + m_8006_scramble[0] = reg6; + m_8006_scramble[1] = reg7; } + void nes_vt02_vt03_soc_device::set_410x_scramble(uint8_t reg0, uint8_t reg1) { m_410x_scramble[0] = reg0; // TODO: name the regs diff --git a/src/mame/nintendo/nes_vt_soc.h b/src/mame/nintendo/nes_vt_soc.h index 5d3dc4cb86ec1..c8cd9f8b30599 100644 --- a/src/mame/nintendo/nes_vt_soc.h +++ b/src/mame/nintendo/nes_vt_soc.h @@ -37,7 +37,8 @@ class nes_vt02_vt03_soc_device : public device_t, public device_memory_interface auto extra_write_2_callback() { return m_extra_write_2_callback.bind(); } auto extra_write_3_callback() { return m_extra_write_3_callback.bind(); } - void set_8000_scramble(uint8_t reg0, uint8_t reg1, uint8_t reg2, uint8_t reg3, uint8_t reg4, uint8_t reg5, uint8_t reg6, uint8_t reg7); + void set_8000_scramble(uint8_t reg0, uint8_t reg1, uint8_t reg2, uint8_t reg3, uint8_t reg4, uint8_t reg5); + void set_8006_scramble(uint8_t reg6, uint8_t reg7); void set_410x_scramble(uint8_t reg0, uint8_t reg1); void force_bad_dma() { m_force_baddma = true; } void force_raster_timing_hack() { m_use_raster_timing_hack = true; } @@ -101,8 +102,9 @@ class nes_vt02_vt03_soc_device : public device_t, public device_memory_interface int m_timer_running = 0; int m_timer_val = 0; - uint8_t m_8000_scramble[8]{}; - uint8_t m_410x_scramble[2]{}; + uint8_t m_8000_scramble[6]; + uint8_t m_8006_scramble[2]; + uint8_t m_410x_scramble[2]; uint8_t m_8000_addr_latch = 0; From e00269663a4cb58feb95ec255f07a72596f89f10 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 13 May 2025 22:33:09 +0100 Subject: [PATCH 33/35] some stubs for adding extended rendering code --- src/devices/video/ppu2c0x_vt.cpp | 55 ++++++++++++++++++- src/devices/video/ppu2c0x_vt.h | 11 +++- src/mame/nintendo/nes_vt369_vtunknown_soc.cpp | 6 +- 3 files changed, 63 insertions(+), 9 deletions(-) diff --git a/src/devices/video/ppu2c0x_vt.cpp b/src/devices/video/ppu2c0x_vt.cpp index b952e010dbfdc..aae55b28c1f2a 100644 --- a/src/devices/video/ppu2c0x_vt.cpp +++ b/src/devices/video/ppu2c0x_vt.cpp @@ -549,9 +549,9 @@ void ppu_vt3xx_device::device_reset() m_newvid_1e = 0x00; } -uint8_t ppu_vt3xx_device::gun_x_r_newvid(offs_t offset) { return m_newvid_1c; } -uint8_t ppu_vt3xx_device::gun_y_r_newvid(offs_t offset) { return m_newvid_1d; } -uint8_t ppu_vt3xx_device::gun2_x_r_newvid(offs_t offset) { return m_newvid_1e; } +uint8_t ppu_vt3xx_device::read_201c_newvid(offs_t offset) { return m_newvid_1c; } +uint8_t ppu_vt3xx_device::read_201d_newvid(offs_t offset) { return m_newvid_1d; } +uint8_t ppu_vt3xx_device::read_201e_newvid(offs_t offset) { return m_newvid_1e; } void ppu_vt3xx_device::write_201c_newvid(offs_t offset, uint8_t data) { m_newvid_1c = data; logerror("%s: write_201c_newvid %02x\n", machine().describe_context(), data); } void ppu_vt3xx_device::write_201d_newvid(offs_t offset, uint8_t data) { m_newvid_1d = data; logerror("%s: write_201d_newvid %02x\n", machine().describe_context(), data); } @@ -566,3 +566,52 @@ void ppu_vt3xx_device::write_201e_newvid(offs_t offset, uint8_t data) m_newvid_1e = data; logerror("%s: write_201e_newvid %02x\n", machine().describe_context(), data); } + +void ppu_vt3xx_device::read_tile_plane_data(int address, int color) +{ + if (!m_newvid_1e) + { + ppu_vt03_device::read_tile_plane_data(address, color); + } + else + { + popmessage("extended mode %02x %02x %02x?\n", m_newvid_1c, m_newvid_1d, m_newvid_1e); + } +} + +void ppu_vt3xx_device::draw_tile_pixel(uint8_t pix, int color, uint32_t back_pen, uint32_t*& dest) +{ + if (!m_newvid_1e) + { + ppu_vt03_device::draw_tile_pixel(pix, color, back_pen, dest); + } + else + { + // extended modes + } +} + +void ppu_vt3xx_device::shift_tile_plane_data(uint8_t& pix) +{ + if (!m_newvid_1e) + { + ppu_vt03_device::shift_tile_plane_data(pix); + } + else + { + // extended modes + } +} + + +void ppu_vt3xx_device::draw_back_pen(uint32_t* dst, int back_pen) +{ + if (!m_newvid_1e) + { + ppu_vt03_device::draw_back_pen(dst, back_pen); + } + else + { + // extended modes + } +} diff --git a/src/devices/video/ppu2c0x_vt.h b/src/devices/video/ppu2c0x_vt.h index 41fec8d52b4b8..e540060c8f50f 100644 --- a/src/devices/video/ppu2c0x_vt.h +++ b/src/devices/video/ppu2c0x_vt.h @@ -135,9 +135,9 @@ class ppu_vt3xx_device : public ppu_vt03_device { public: ppu_vt3xx_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock); - uint8_t gun_x_r_newvid(offs_t offset); - uint8_t gun_y_r_newvid(offs_t offset); - uint8_t gun2_x_r_newvid(offs_t offset); + uint8_t read_201c_newvid(offs_t offset); + uint8_t read_201d_newvid(offs_t offset); + uint8_t read_201e_newvid(offs_t offset); void write_201c_newvid(offs_t offset, uint8_t data); void write_201d_newvid(offs_t offset, uint8_t data); @@ -148,6 +148,11 @@ class ppu_vt3xx_device : public ppu_vt03_device { virtual void device_reset() override ATTR_COLD; private: + virtual void read_tile_plane_data(int address, int color) override; + virtual void draw_tile_pixel(uint8_t pix, int color, uint32_t back_pen, uint32_t*& dest) override; + virtual void shift_tile_plane_data(uint8_t& pix) override; + virtual void draw_back_pen(uint32_t* dst, int back_pen) override; + uint8_t m_newvid_1c; uint8_t m_newvid_1d; uint8_t m_newvid_1e; diff --git a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp index 3e022594ef60e..e81978b22c2a7 100644 --- a/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp +++ b/src/mame/nintendo/nes_vt369_vtunknown_soc.cpp @@ -139,9 +139,9 @@ void vt3xx_soc_base_device::vt369_map(address_map &map) map(0x2019, 0x2019).rw(m_ppu, FUNC(ppu_vt3xx_device::read_2019), FUNC(ppu_vt3xx_device::gun_reset_w)); map(0x201a, 0x201a).rw(m_ppu, FUNC(ppu_vt3xx_device::videobank0_extra_r), FUNC(ppu_vt3xx_device::videobank0_extra_w)); map(0x201b, 0x201b).r(m_ppu, FUNC(ppu_vt3xx_device::read_201b)); - map(0x201c, 0x201c).rw(m_ppu, FUNC(ppu_vt3xx_device::gun_x_r_newvid), FUNC(ppu_vt3xx_device::write_201c_newvid)); - map(0x201d, 0x201d).rw(m_ppu, FUNC(ppu_vt3xx_device::gun_y_r_newvid), FUNC(ppu_vt3xx_device::write_201d_newvid)); - map(0x201e, 0x201e).rw(m_ppu, FUNC(ppu_vt3xx_device::gun2_x_r_newvid), FUNC(ppu_vt3xx_device::write_201e_newvid)); + map(0x201c, 0x201c).rw(m_ppu, FUNC(ppu_vt3xx_device::read_201c_newvid), FUNC(ppu_vt3xx_device::write_201c_newvid)); + map(0x201d, 0x201d).rw(m_ppu, FUNC(ppu_vt3xx_device::read_201d_newvid), FUNC(ppu_vt3xx_device::write_201d_newvid)); + map(0x201e, 0x201e).rw(m_ppu, FUNC(ppu_vt3xx_device::read_201e_newvid), FUNC(ppu_vt3xx_device::write_201e_newvid)); map(0x201f, 0x201f).r(m_ppu, FUNC(ppu_vt3xx_device::gun2_y_r)); map(0x4000, 0x4017).w(m_apu, FUNC(nes_apu_vt_device::write)); From ccfab9d04ecdf5a83e28b76715f8cf7bf9e05109 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Wed, 14 May 2025 13:52:29 +0100 Subject: [PATCH 34/35] prep for different drawing modes --- src/devices/video/ppu2c0x_vt.cpp | 85 +++++++++++++++++++++++--------- src/devices/video/ppu2c0x_vt.h | 8 ++- src/mame/nintendo/nes_vt_soc.cpp | 9 ++-- 3 files changed, 75 insertions(+), 27 deletions(-) diff --git a/src/devices/video/ppu2c0x_vt.cpp b/src/devices/video/ppu2c0x_vt.cpp index aae55b28c1f2a..08a66accfdf70 100644 --- a/src/devices/video/ppu2c0x_vt.cpp +++ b/src/devices/video/ppu2c0x_vt.cpp @@ -205,7 +205,6 @@ void ppu_vt03_device::device_start() save_item(NAME(m_palette_ram)); save_item(NAME(m_read_bg4_bg3)); - save_item(NAME(m_va34)); save_item(NAME(m_extplanebuf)); save_item(NAME(m_extra_sprite_bits)); save_item(NAME(m_videobank0)); @@ -237,7 +236,6 @@ void ppu_vt03_device::device_reset() m_videobank1 = 0; m_read_bg4_bg3 = 0; - m_va34 = false; } @@ -246,15 +244,10 @@ uint8_t ppu_vt03_device::get_m_read_bg4_bg3() return m_read_bg4_bg3; } -uint8_t ppu_vt03_device::get_va34() -{ - return m_va34; -} void ppu_vt03_device::read_sprite_plane_data(int address) { - m_va34 = false; m_planebuf[0] = m_read_sp((address + 0) & 0x1fff); m_planebuf[1] = m_read_sp((address + 8) & 0x1fff); @@ -262,9 +255,8 @@ void ppu_vt03_device::read_sprite_plane_data(int address) if (is4bpp) { - m_va34 = true; - m_extplanebuf[0] = m_read_sp((address + 0) & 0x1fff); - m_extplanebuf[1] = m_read_sp((address + 8) & 0x1fff); + m_extplanebuf[0] = m_read_sp(((address + 0) & 0x1fff)|0x2000); + m_extplanebuf[1] = m_read_sp(((address + 8) & 0x1fff)|0x2000); } } @@ -340,7 +332,16 @@ void ppu_vt03_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, u void ppu_vt03_device::read_tile_plane_data(int address, int color) { + // format is no longer planar + + // old format 8 bits (1 byte) = 8 pixels of 1 plane (one line) of tile + // +8 bytes = next tile + + // new format + // one byte = 4 planes, 2 pixels + const bool is4bpp = BIT(m_extended_modes_enable, 1); + m_whichpixel = 0; if (m_extended_modes_enable & 0x10) // extended mode m_read_bg4_bg3 = color; @@ -349,16 +350,13 @@ void ppu_vt03_device::read_tile_plane_data(int address, int color) if (is4bpp) { - m_va34 = false; - m_planebuf[0] = m_read_bg((address & 0x1fff)); - m_planebuf[1] = m_read_bg((address + 8) & 0x1fff); - m_va34 = true; - m_extplanebuf[0] = m_read_bg((address & 0x1fff)); - m_extplanebuf[1] = m_read_bg((address + 8) & 0x1fff); + m_planebuf[0] = m_read_bg( (address + 0) & 0x1fff ); + m_planebuf[1] = m_read_bg( (address + 8) & 0x1fff ); + m_extplanebuf[0] = m_read_bg( ((address + 0) & 0x1fff) | 0x2000 ); + m_extplanebuf[1] = m_read_bg( ((address + 8) & 0x1fff) | 0x2000 ); } else { - m_va34 = false; m_planebuf[0] = m_read_bg((address & 0x1fff)); m_planebuf[1] = m_read_bg((address + 8) & 0x1fff); } @@ -368,14 +366,38 @@ void ppu_vt03_device::shift_tile_plane_data(uint8_t& pix) { const bool is4bpp = BIT(m_extended_modes_enable, 1); - ppu2c0x_device::shift_tile_plane_data(pix); + pix = 0; if (is4bpp) { - pix |= (((m_extplanebuf[0] >> 7) & 1) << 5) | (((m_extplanebuf[1] >> 7) & 1) << 6); // yes, shift by 5 and 6 because of the way the palette is arranged in RAM - m_extplanebuf[0] = m_extplanebuf[0] << 1; - m_extplanebuf[1] = m_extplanebuf[1] << 1; + switch (m_whichpixel) + { + case 0: pix = (BIT(m_planebuf[0], 7) << 0) | (BIT(m_planebuf[1], 7) << 1) | (BIT(m_extplanebuf[0], 7) << 5) | (BIT(m_extplanebuf[1], 7) << 6); break; + case 1: pix = (BIT(m_planebuf[0], 6) << 0) | (BIT(m_planebuf[1], 6) << 1) | (BIT(m_extplanebuf[0], 6) << 5) | (BIT(m_extplanebuf[1], 6) << 6); break; + case 2: pix = (BIT(m_planebuf[0], 5) << 0) | (BIT(m_planebuf[1], 5) << 1) | (BIT(m_extplanebuf[0], 5) << 5) | (BIT(m_extplanebuf[1], 5) << 6); break; + case 3: pix = (BIT(m_planebuf[0], 4) << 0) | (BIT(m_planebuf[1], 4) << 1) | (BIT(m_extplanebuf[0], 4) << 5) | (BIT(m_extplanebuf[1], 4) << 6); break; + case 4: pix = (BIT(m_planebuf[0], 3) << 0) | (BIT(m_planebuf[1], 3) << 1) | (BIT(m_extplanebuf[0], 3) << 5) | (BIT(m_extplanebuf[1], 3) << 6); break;; + case 5: pix = (BIT(m_planebuf[0], 2) << 0) | (BIT(m_planebuf[1], 2) << 1) | (BIT(m_extplanebuf[0], 2) << 5) | (BIT(m_extplanebuf[1], 2) << 6); break; + case 6: pix = (BIT(m_planebuf[0], 1) << 0) | (BIT(m_planebuf[1], 1) << 1) | (BIT(m_extplanebuf[0], 1) << 5) | (BIT(m_extplanebuf[1], 1) << 6); break; + case 7: pix = (BIT(m_planebuf[0], 0) << 0) | (BIT(m_planebuf[1], 0) << 1) | (BIT(m_extplanebuf[0], 0) << 5) | (BIT(m_extplanebuf[1], 0) << 6); break; + } + } + else + { + switch (m_whichpixel) + { + case 0: pix = (BIT(m_planebuf[0], 7) << 0) | (BIT(m_planebuf[1], 7) << 1); break; + case 1: pix = (BIT(m_planebuf[0], 6) << 0) | (BIT(m_planebuf[1], 6) << 1); break; + case 2: pix = (BIT(m_planebuf[0], 5) << 0) | (BIT(m_planebuf[1], 5) << 1); break; + case 3: pix = (BIT(m_planebuf[0], 4) << 0) | (BIT(m_planebuf[1], 4) << 1); break; + case 4: pix = (BIT(m_planebuf[0], 3) << 0) | (BIT(m_planebuf[1], 3) << 1); break; + case 5: pix = (BIT(m_planebuf[0], 2) << 0) | (BIT(m_planebuf[1], 2) << 1); break; + case 6: pix = (BIT(m_planebuf[0], 1) << 0) | (BIT(m_planebuf[1], 1) << 1); break; + case 7: pix = (BIT(m_planebuf[0], 0) << 0) | (BIT(m_planebuf[1], 0) << 1); break; + } } + + m_whichpixel++; } @@ -575,7 +597,11 @@ void ppu_vt3xx_device::read_tile_plane_data(int address, int color) } else { - popmessage("extended mode %02x %02x %02x?\n", m_newvid_1c, m_newvid_1d, m_newvid_1e); + m_whichpixel = 0; + m_planebuf[0] = m_read_bg((address & 0x1fff)); + m_planebuf[1] = m_read_bg((address + 8) & 0x1fff); + m_extplanebuf[0] = m_read_bg( ((address + 0) & 0x1fff) | 0x2000 ); + m_extplanebuf[1] = m_read_bg( ((address + 8) & 0x1fff) | 0x2000 ); } } @@ -588,6 +614,7 @@ void ppu_vt3xx_device::draw_tile_pixel(uint8_t pix, int color, uint32_t back_pen else { // extended modes + ppu_vt03_device::draw_tile_pixel(pix, color, back_pen, dest); } } @@ -600,6 +627,19 @@ void ppu_vt3xx_device::shift_tile_plane_data(uint8_t& pix) else { // extended modes + switch (m_whichpixel) + { + case 0: pix = (BIT(m_planebuf[0], 7) << 0) | (BIT(m_planebuf[0], 6) << 1) | (BIT(m_planebuf[0], 5) << 5) | (BIT(m_planebuf[0], 4) << 6); break; + case 1: pix = (BIT(m_planebuf[0], 3) << 0) | (BIT(m_planebuf[0], 2) << 1) | (BIT(m_planebuf[0], 1) << 5) | (BIT(m_planebuf[0], 0) << 6); break; + case 2: pix = (BIT(m_planebuf[1], 7) << 0) | (BIT(m_planebuf[1], 6) << 1) | (BIT(m_planebuf[1], 5) << 5) | (BIT(m_planebuf[1], 4) << 6); break; + case 3: pix = (BIT(m_planebuf[1], 3) << 0) | (BIT(m_planebuf[1], 2) << 1) | (BIT(m_planebuf[1], 1) << 5) | (BIT(m_planebuf[1], 0) << 6); break; + case 4: pix = (BIT(m_extplanebuf[0], 7) << 0) | (BIT(m_extplanebuf[0], 6) << 1) | (BIT(m_extplanebuf[0], 5) << 5) | (BIT(m_extplanebuf[0], 4) << 6); break; + case 5: pix = (BIT(m_extplanebuf[0], 3) << 0) | (BIT(m_extplanebuf[0], 2) << 1) | (BIT(m_extplanebuf[0], 1) << 5) | (BIT(m_extplanebuf[0], 0) << 6); break; + case 6: pix = (BIT(m_extplanebuf[1], 7) << 0) | (BIT(m_extplanebuf[1], 6) << 1) | (BIT(m_extplanebuf[1], 5) << 5) | (BIT(m_extplanebuf[1], 4) << 6); break; + case 7: pix = (BIT(m_extplanebuf[1], 3) << 0) | (BIT(m_extplanebuf[1], 2) << 1) | (BIT(m_extplanebuf[1], 1) << 5) | (BIT(m_extplanebuf[1], 0) << 6); break; + } + + m_whichpixel++; } } @@ -613,5 +653,6 @@ void ppu_vt3xx_device::draw_back_pen(uint32_t* dst, int back_pen) else { // extended modes + ppu_vt03_device::draw_back_pen(dst, back_pen); } } diff --git a/src/devices/video/ppu2c0x_vt.h b/src/devices/video/ppu2c0x_vt.h index e540060c8f50f..1638dac2e0df4 100644 --- a/src/devices/video/ppu2c0x_vt.h +++ b/src/devices/video/ppu2c0x_vt.h @@ -107,14 +107,18 @@ class ppu_vt03_device : public ppu2c0x_device { uint8_t m_extended_modes_enable; uint8_t m_extended_modes2_enable; -private: devcb_read8 m_read_bg; devcb_read8 m_read_sp; int32_t m_read_bg4_bg3; - bool m_va34; uint8_t m_extplanebuf[2]; + uint32_t m_tiledata; + int m_whichpixel; + +private: + + uint8_t m_extra_sprite_bits; vtxx_pal_mode m_pal_mode = PAL_MODE_VT0x; diff --git a/src/mame/nintendo/nes_vt_soc.cpp b/src/mame/nintendo/nes_vt_soc.cpp index 15e6131ccbf58..d2d9fd3e1aa7c 100644 --- a/src/mame/nintendo/nes_vt_soc.cpp +++ b/src/mame/nintendo/nes_vt_soc.cpp @@ -418,7 +418,7 @@ uint8_t nes_vt02_vt03_soc_device::spr_r(offs_t offset) { if (m_4242 & 0x1 || m_411d & 0x04) { - return m_chrram[offset]; + return m_chrram[offset & 0x1fff]; } else { @@ -433,7 +433,7 @@ uint8_t nes_vt02_vt03_soc_device::chr_r(offs_t offset) { if (m_4242 & 0x1 || m_411d & 0x04) // newer VT platforms only (not VT03/09), split out { - return m_chrram[offset]; + return m_chrram[offset & 0x1fff]; } else { @@ -522,6 +522,9 @@ void nes_vt02_vt03_soc_device::nt_w(offs_t offset, uint8_t data) int nes_vt02_vt03_soc_device::calculate_real_video_address(int addr, int extended, int readtype) { + int va34 = (addr & 0x2000) >> 13; + addr &= 0x1fff; + // might be a VT09 only feature (alt 4bpp mode?) int alt_order = m_ppu->get_extended_modes_enable() & 0x40; @@ -652,7 +655,6 @@ int nes_vt02_vt03_soc_device::calculate_real_video_address(int addr, int extende case 0x7: return -1; } - int va34 = m_ppu->get_va34(); if (!extended) { @@ -712,6 +714,7 @@ int nes_vt02_vt03_soc_device::calculate_real_video_address(int addr, int extende finaladdr = ((m_410x[0x0] & 0x0f) << 21) | (va17_va10 << 13) | (eva2_eva0 << 10) | (addr & 0x03ff); + if (is4bpp) { if (!alt_order) From 685d829564bddc6ac0e432b0858eb54e7e6cff81 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Wed, 14 May 2025 13:55:15 +0100 Subject: [PATCH 35/35] note --- src/devices/video/ppu2c0x_vt.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/devices/video/ppu2c0x_vt.cpp b/src/devices/video/ppu2c0x_vt.cpp index 08a66accfdf70..e3685cd7e6471 100644 --- a/src/devices/video/ppu2c0x_vt.cpp +++ b/src/devices/video/ppu2c0x_vt.cpp @@ -332,14 +332,6 @@ void ppu_vt03_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, u void ppu_vt03_device::read_tile_plane_data(int address, int color) { - // format is no longer planar - - // old format 8 bits (1 byte) = 8 pixels of 1 plane (one line) of tile - // +8 bytes = next tile - - // new format - // one byte = 4 planes, 2 pixels - const bool is4bpp = BIT(m_extended_modes_enable, 1); m_whichpixel = 0; @@ -597,6 +589,16 @@ void ppu_vt3xx_device::read_tile_plane_data(int address, int color) } else { + // format is no longer planar + + // old format 8 bits (1 byte) = 8 pixels of 1 plane (one line) of tile + // +1 bytes = next row + // +8 bytes = next plane + // +16 byte = next tile (or +32 bytes in ROM in 4bpp mode, but we signal this by setting 0x2000) + + // new format + // one byte = 4 planes, 2 pixels + m_whichpixel = 0; m_planebuf[0] = m_read_bg((address & 0x1fff)); m_planebuf[1] = m_read_bg((address + 8) & 0x1fff);