diff options
author | 2022-02-10 21:28:28 +1100 | |
---|---|---|
committer | 2022-02-10 21:28:28 +1100 | |
commit | 138e7f152074ab6eb5828d9f0461ae55f16b3e55 (patch) | |
tree | f8a35d6e268496b9d4384f6346afd9eac834584a /src | |
parent | a8a0291f961d73637cfe9954a73456941ff98410 (diff) | |
parent | 553c2561089b59f2cb3918be337774e9392459e8 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src')
48 files changed, 1123 insertions, 352 deletions
diff --git a/src/devices/bus/isa/mach32.cpp b/src/devices/bus/isa/mach32.cpp index 178556918a8..064947d5c7c 100644 --- a/src/devices/bus/isa/mach32.cpp +++ b/src/devices/bus/isa/mach32.cpp @@ -115,9 +115,6 @@ void mach32_device::device_start() { ati_vga_device::device_start(); ati.vga_chip_id = 0x00; // correct? - vga.svga_intf.vram_size = 0x400000; - vga.memory.resize(vga.svga_intf.vram_size); - memset(&vga.memory[0], 0, vga.svga_intf.vram_size); } void mach32_device::device_reset() diff --git a/src/devices/bus/isa/s3virge.cpp b/src/devices/bus/isa/s3virge.cpp index 070bf320a42..0f6edd65976 100644 --- a/src/devices/bus/isa/s3virge.cpp +++ b/src/devices/bus/isa/s3virge.cpp @@ -75,10 +75,10 @@ void s3virge_vga_device::device_start() vga.read_dipswitch.set(nullptr); //read_dipswitch; vga.svga_intf.seq_regcount = 0x1c; vga.svga_intf.crtc_regcount = 0x19; - vga.svga_intf.vram_size = 0x400000; - vga.memory.resize(vga.svga_intf.vram_size); + vga.memory = std::make_unique<uint8_t []>(vga.svga_intf.vram_size); memset(&vga.memory[0], 0, vga.svga_intf.vram_size); - save_item(vga.memory,"Video RAM"); + + save_pointer(vga.memory, "Video RAM", vga.svga_intf.vram_size); save_item(vga.crtc.data,"CRTC Registers"); save_item(vga.sequencer.data,"Sequencer Registers"); save_item(vga.attribute.data,"Attribute Registers"); diff --git a/src/devices/bus/isa/svga_cirrus.cpp b/src/devices/bus/isa/svga_cirrus.cpp index 943606e9be4..750d0f41142 100644 --- a/src/devices/bus/isa/svga_cirrus.cpp +++ b/src/devices/bus/isa/svga_cirrus.cpp @@ -36,7 +36,9 @@ void isa16_svga_cirrus_device::device_add_mconfig(machine_config &config) screen.set_raw(25.175_MHz_XTAL, 800, 0, 640, 524, 0, 480); screen.set_screen_update("vga", FUNC(cirrus_gd5430_device::screen_update)); - CIRRUS_GD5430(config, m_vga, 0).set_screen("screen"); + CIRRUS_GD5430(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x200000); } //------------------------------------------------- @@ -114,7 +116,9 @@ void isa16_svga_cirrus_gd542x_device::device_add_mconfig(machine_config &config) screen.set_raw(25.175_MHz_XTAL, 800, 0, 640, 524, 0, 480); screen.set_screen_update("vga", FUNC(cirrus_gd5428_device::screen_update)); - CIRRUS_GD5428(config, m_vga, 0).set_screen("screen"); + CIRRUS_GD5428(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x200000); } //------------------------------------------------- diff --git a/src/devices/bus/isa/svga_s3.cpp b/src/devices/bus/isa/svga_s3.cpp index 9cbc72b078f..58984396d86 100644 --- a/src/devices/bus/isa/svga_s3.cpp +++ b/src/devices/bus/isa/svga_s3.cpp @@ -57,7 +57,9 @@ void isa16_svga_s3_device::device_add_mconfig(machine_config &config) screen.set_raw(25.175_MHz_XTAL, 800, 0, 640, 524, 0, 480); screen.set_screen_update(m_vga, FUNC(s3_vga_device::screen_update)); - S3_VGA(config, m_vga, 0).set_screen("screen"); + S3_VGA(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x100000); } //------------------------------------------------- @@ -160,7 +162,9 @@ void isa16_s3virge_device::device_add_mconfig(machine_config &config) screen.set_raw(25.175_MHz_XTAL, 800, 0, 640, 524, 0, 480); screen.set_screen_update(m_vga, FUNC(s3virge_vga_device::screen_update)); - S3VIRGE(config, m_vga, 0).set_screen("screen"); + S3VIRGE(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x400000); m_vga->linear_config_changed().set(FUNC(isa16_s3virge_device::linear_config_changed_w)); } @@ -250,7 +254,9 @@ void isa16_s3virgedx_device::device_add_mconfig(machine_config &config) screen.set_raw(25.175_MHz_XTAL, 800, 0, 640, 524, 0, 480); screen.set_screen_update(m_vga, FUNC(s3virgedx_vga_device::screen_update)); - S3VIRGEDX(config, m_vga, 0).set_screen("screen"); + S3VIRGEDX(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x400000); m_vga->linear_config_changed().set(FUNC(isa16_s3virgedx_device::linear_config_changed_w)); } @@ -364,7 +370,9 @@ void isa16_stealth3d2kpro_device::device_add_mconfig(machine_config &config) screen.set_raw(25.175_MHz_XTAL, 800, 0, 640, 524, 0, 480); screen.set_screen_update(m_vga, FUNC(s3virgedx_rev1_vga_device::screen_update)); - S3VIRGEDX1(config, m_vga, 0).set_screen("screen"); + S3VIRGEDX1(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x400000); m_vga->linear_config_changed().set(FUNC(isa16_stealth3d2kpro_device::linear_config_changed_w)); } diff --git a/src/devices/bus/isa/svga_trident.cpp b/src/devices/bus/isa/svga_trident.cpp index 7eda60d2446..f3b4e0f9a6f 100644 --- a/src/devices/bus/isa/svga_trident.cpp +++ b/src/devices/bus/isa/svga_trident.cpp @@ -36,7 +36,9 @@ void isa16_svga_tgui9680_device::device_add_mconfig(machine_config &config) screen.set_raw(25.175_MHz_XTAL, 800, 0, 640, 524, 0, 480); screen.set_screen_update(m_vga, FUNC(trident_vga_device::screen_update)); - TRIDENT_VGA(config, m_vga, 0).set_screen("screen"); + TRIDENT_VGA(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x200000); } //------------------------------------------------- diff --git a/src/devices/bus/isa/svga_tseng.cpp b/src/devices/bus/isa/svga_tseng.cpp index ab5bbb755f0..0d1485ad17d 100644 --- a/src/devices/bus/isa/svga_tseng.cpp +++ b/src/devices/bus/isa/svga_tseng.cpp @@ -35,7 +35,9 @@ void isa8_svga_et4k_device::device_add_mconfig(machine_config &config) screen.set_raw(25.175_MHz_XTAL, 800, 0, 640, 524, 0, 480); screen.set_screen_update(m_vga, FUNC(tseng_vga_device::screen_update)); - TSENG_VGA(config, m_vga, 0).set_screen("screen"); + TSENG_VGA(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x100000); } //------------------------------------------------- diff --git a/src/devices/bus/isa/trident.cpp b/src/devices/bus/isa/trident.cpp index 5fc2d2d6d19..693aaf5e991 100644 --- a/src/devices/bus/isa/trident.cpp +++ b/src/devices/bus/isa/trident.cpp @@ -160,8 +160,7 @@ void trident_vga_device::device_start() { zero(); - int i; - for (i = 0; i < 0x100; i++) + for (int i = 0; i < 0x100; i++) set_pen_color(i, 0, 0, 0); // Avoid an infinite loop when displaying. 0 is not possible anyway. @@ -170,11 +169,10 @@ void trident_vga_device::device_start() // copy over interfaces vga.read_dipswitch.set(nullptr); //read_dipswitch; - vga.svga_intf.vram_size = 0x200000; - - vga.memory.resize(vga.svga_intf.vram_size); + vga.memory = std::make_unique<uint8_t []>(vga.svga_intf.vram_size); memset(&vga.memory[0], 0, vga.svga_intf.vram_size); - save_item(NAME(vga.memory)); + + save_pointer(NAME(vga.memory), vga.svga_intf.vram_size); save_pointer(vga.crtc.data,"CRTC Registers",0x100); save_pointer(vga.sequencer.data,"Sequencer Registers",0x100); save_pointer(vga.attribute.data,"Attribute Registers", 0x15); diff --git a/src/devices/bus/isa/vga.cpp b/src/devices/bus/isa/vga.cpp index 11d94d7fbdd..b573f4c5701 100644 --- a/src/devices/bus/isa/vga.cpp +++ b/src/devices/bus/isa/vga.cpp @@ -33,7 +33,9 @@ void isa8_vga_device::device_add_mconfig(machine_config &config) screen.set_raw(25.175_MHz_XTAL, 800, 0, 640, 524, 0, 480); screen.set_screen_update(m_vga, FUNC(vga_device::screen_update)); - VGA(config, m_vga, 0).set_screen("screen"); + VGA(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x100000); } //------------------------------------------------- diff --git a/src/devices/bus/isa/vga_ati.cpp b/src/devices/bus/isa/vga_ati.cpp index d6ce586a9fd..aaebcf3969b 100644 --- a/src/devices/bus/isa/vga_ati.cpp +++ b/src/devices/bus/isa/vga_ati.cpp @@ -82,7 +82,9 @@ void isa16_vga_gfxultra_device::device_add_mconfig(machine_config &config) screen.set_raw(25.175_MHz_XTAL, 800, 0, 640, 524, 0, 480); screen.set_screen_update(m_vga, FUNC(ati_vga_device::screen_update)); - ATI_VGA(config, m_vga, 0).set_screen("screen"); + ATI_VGA(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x100000); } void isa16_vga_gfxultrapro_device::device_add_mconfig(machine_config &config) @@ -91,7 +93,9 @@ void isa16_vga_gfxultrapro_device::device_add_mconfig(machine_config &config) screen.set_raw(25.175_MHz_XTAL, 800, 0, 640, 524, 0, 480); screen.set_screen_update(m_vga, FUNC(mach32_device::screen_update)); - ATIMACH32(config, m_vga, 0).set_screen("screen"); + ATIMACH32(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x400000); } void isa16_vga_mach64_device::device_add_mconfig(machine_config &config) @@ -100,7 +104,9 @@ void isa16_vga_mach64_device::device_add_mconfig(machine_config &config) screen.set_raw(25.175_MHz_XTAL, 800, 0, 640, 524, 0, 480); screen.set_screen_update(m_vga, FUNC(mach64_device::screen_update)); - ATIMACH64(config, m_vga, 0).set_screen("screen"); + ATIMACH64(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x400000); } diff --git a/src/devices/bus/nes/event.cpp b/src/devices/bus/nes/event.cpp index 182a4e76a86..f3db7a615ff 100644 --- a/src/devices/bus/nes/event.cpp +++ b/src/devices/bus/nes/event.cpp @@ -1,14 +1,15 @@ // license:BSD-3-Clause -// copyright-holders:Fabio Priuli +// copyright-holders:Fabio Priuli,kmg /*********************************************************************************************************** - NES/Famicom cartridge emulation for Nintendo NES-EVENT PCB + NES/Famicom cartridge emulation for Nintendo NES-EVENT PCBs Here we emulate the following PCBs * Nintendo NES-EVENT [mapper 105] + * Nintendo NES-EVENT2 [mapper 555] ***********************************************************************************************************/ @@ -30,7 +31,8 @@ // constructor //------------------------------------------------- -DEFINE_DEVICE_TYPE(NES_EVENT, nes_event_device, "nes_event", "NES Cart Event PCB") +DEFINE_DEVICE_TYPE(NES_EVENT, nes_event_device, "nes_event", "NES Cart EVENT PCB") +DEFINE_DEVICE_TYPE(NES_EVENT2, nes_event2_device, "nes_event2", "NES Cart EVENT2 PCB") nes_event_device::nes_event_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) @@ -44,6 +46,16 @@ nes_event_device::nes_event_device(const machine_config &mconfig, const char *ta { } +nes_event2_device::nes_event2_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_tqrom_device(mconfig, NES_EVENT2, tag, owner, clock) + , m_dsw(*this, "DIPSW") + , m_tqrom_mode(false) + , event_timer(nullptr) + , m_timer_count(0) + , m_timer_enabled(0) +{ +} + void nes_event_device::device_start() { @@ -71,6 +83,30 @@ void nes_event_device::pcb_reset() m_timer_on = 0; } +void nes_event2_device::device_start() +{ + mmc3_start(); + + event_timer = timer_alloc(TIMER_EVENT); + event_timer->adjust(attotime::zero, 0, clocks_to_attotime(1)); + + save_item(NAME(m_tqrom_mode)); + + save_item(NAME(m_timer_count)); + save_item(NAME(m_timer_enabled)); +} + +void nes_event2_device::pcb_reset() +{ + m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; + + m_tqrom_mode = false; + mmc3_common_initialize(0x07, 0x7f, 0); + + m_timer_count = 0; + m_timer_enabled = 0; +} + /*------------------------------------------------- @@ -79,9 +115,9 @@ void nes_event_device::pcb_reset() /*------------------------------------------------- - Event PCB + EVENT PCB - Games: Nintento World Championships + Games: Nintento World Championships 1990 MMC1 variant with repurposed register at $a000 and a lot of discrete components @@ -135,6 +171,93 @@ void nes_event_device::set_prg() } } +/*------------------------------------------------- + + EVENT2 PCB + + Games: Nintento Campus Challenge 1991 + + Similar to the previous EVENT PCB, but based around + the MMC3. Onboard 8K VRAM and 8K WRAM support Pinbot + and SMB3, respectively, and an additional 2K WRAM at + $5000 is used by the control routine. The board also + featured an RJ11, used to transmit player names and + scores to a display at the staged events. + + The present emulation is based on what is known via + the reproduction board by RetroZone. That board is + missing the RJ11, two DIP switches, and...? + + NES 2.0: mapper 555 + + In MAME: Supported. + + -------------------------------------------------*/ + +u8 nes_event2_device::read_l(offs_t offset) +{ +// LOG_MMC(("event2 read_l, offset: %04x\n", offset)); + offset += 0x100; + if (offset >= 0x1800) + return (m_timer_count >= (0x10 | m_dsw->read()) << 25) ? 0x80 : 0; + else if (offset < 0x1000 || m_prgram.empty()) + return get_open_bus(); + else + return m_prgram[(0x2000 + (offset & 0x7ff)) % m_prgram.size()]; +} + +u8 nes_event2_device::read_m(offs_t offset) +{ +// LOG_MMC(("event2 read_m, offset: %04x\n", offset)); + if (m_prgram.empty()) + return get_open_bus(); + else + return m_prgram[offset % m_prgram.size()]; +} + +void nes_event2_device::write_l(offs_t offset, u8 data) +{ + LOG_MMC(("event2 write_l, offset: %04x, data: %02x\n", offset, data)); + + offset += 0x100; + switch (offset & 0x1c00) + { + case 0x1000: + case 0x1400: + m_prgram[(0x2000 + (offset & 0x7ff)) % m_prgram.size()] = data; + break; + case 0x1800: + m_tqrom_mode = (data & 0x06) == 0x02; + + m_prg_base = (data & 0x04) << 3; + m_prg_mask = (data & 0x03) << 3 | 0x07; + set_prg(m_prg_base, m_prg_mask); + + m_chr_base = m_prg_base << 2; + set_chr(m_chr_source, m_chr_base, m_chr_mask); + + m_timer_enabled = BIT(data, 3); + if (!m_timer_enabled) + m_timer_count = 0; + break; + } +} + +void nes_event2_device::write_m(offs_t offset, u8 data) +{ +// LOG_MMC(("event2 write_m, offset: %04x, data: %02x\n", offset, data)); + if (!m_prgram.empty()) + m_prgram[offset % m_prgram.size()] = data; +} + +void nes_event2_device::set_chr(u8 chr, int chr_base, int chr_mask) +{ + if (m_tqrom_mode) + nes_tqrom_device::set_chr(chr, chr_base, chr_mask); + else + nes_txrom_device::set_chr(chr, chr_base, chr_mask); +} + //------------------------------------------------- // Dipswitch @@ -168,6 +291,11 @@ ioport_constructor nes_event_device::device_input_ports() const return INPUT_PORTS_NAME( nwc_dsw ); } +ioport_constructor nes_event2_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( nwc_dsw ); +} + //------------------------------------------------- // device_timer - handler timer events @@ -184,3 +312,9 @@ void nes_event_device::device_timer(emu_timer &timer, device_timer_id id, int pa } } } + +void nes_event2_device::device_timer(emu_timer &timer, device_timer_id id, int param) +{ + if (id == TIMER_EVENT && m_timer_enabled) + m_timer_count++; +} diff --git a/src/devices/bus/nes/event.h b/src/devices/bus/nes/event.h index 5fdd6b88303..75f4e026c8b 100644 --- a/src/devices/bus/nes/event.h +++ b/src/devices/bus/nes/event.h @@ -1,11 +1,12 @@ // license:BSD-3-Clause -// copyright-holders:Fabio Priuli +// copyright-holders:Fabio Priuli,kmg #ifndef MAME_BUS_NES_EVENT_H #define MAME_BUS_NES_EVENT_H #pragma once #include "mmc1.h" +#include "mmc3.h" // ======================> nes_event_device @@ -38,8 +39,43 @@ protected: int m_timer_on, m_timer_enabled; }; +// ======================> nes_event2_device + +class nes_event2_device : public nes_tqrom_device +{ +public: + // construction/destruction + nes_event2_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual u8 read_l(offs_t offset) override; + virtual void write_l(offs_t offset, u8 data) override; + virtual u8 read_m(offs_t offset) override; + virtual void write_m(offs_t offset, u8 data) override; + + virtual void pcb_reset() override; + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override; + virtual ioport_constructor device_input_ports() const override; + + virtual void set_chr(u8 chr, int chr_base, int chr_mask) override; + + required_ioport m_dsw; + + bool m_tqrom_mode; + + static constexpr device_timer_id TIMER_EVENT = 0; + emu_timer *event_timer; + + u32 m_timer_count; + int m_timer_enabled; +}; + // device type definition -DECLARE_DEVICE_TYPE(NES_EVENT, nes_event_device) +DECLARE_DEVICE_TYPE(NES_EVENT, nes_event_device) +DECLARE_DEVICE_TYPE(NES_EVENT2, nes_event2_device) #endif // MAME_BUS_NES_EVENT_H diff --git a/src/devices/bus/nes/mmc3.cpp b/src/devices/bus/nes/mmc3.cpp index 3ecbc024a96..ded4c21db0e 100644 --- a/src/devices/bus/nes/mmc3.cpp +++ b/src/devices/bus/nes/mmc3.cpp @@ -79,8 +79,13 @@ nes_txsrom_device::nes_txsrom_device(const machine_config &mconfig, const char * { } -nes_tqrom_device::nes_tqrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_txrom_device(mconfig, NES_TQROM, tag, owner, clock) +nes_tqrom_device::nes_tqrom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) + : nes_txrom_device(mconfig, type, tag, owner, clock) +{ +} + +nes_tqrom_device::nes_tqrom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_tqrom_device(mconfig, NES_TQROM, tag, owner, clock) { } diff --git a/src/devices/bus/nes/mmc3.h b/src/devices/bus/nes/mmc3.h index c0c60d52375..244863d6fe7 100644 --- a/src/devices/bus/nes/mmc3.h +++ b/src/devices/bus/nes/mmc3.h @@ -87,10 +87,9 @@ class nes_txsrom_device : public nes_txrom_device { public: // construction/destruction - nes_txsrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_txsrom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - // device-level overrides - virtual void write_h(offs_t offset, uint8_t data) override; + virtual void write_h(offs_t offset, u8 data) override; virtual void chr_cb(int start, int bank, int source) override; protected: @@ -107,10 +106,13 @@ class nes_tqrom_device : public nes_txrom_device { public: // construction/destruction - nes_tqrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_tqrom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - virtual void set_chr( uint8_t chr, int chr_base, int chr_mask ) override; + // construction/destruction + nes_tqrom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); + + virtual void set_chr(u8 chr, int chr_base, int chr_mask) override; }; @@ -122,7 +124,6 @@ public: // construction/destruction nes_qj_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // device-level overrides virtual void write_m(offs_t offset, uint8_t data) override; virtual void pcb_reset() override; }; @@ -136,7 +137,6 @@ public: // construction/destruction nes_zz_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // device-level overrides virtual void write_m(offs_t offset, uint8_t data) override; virtual void pcb_reset() override; }; diff --git a/src/devices/bus/nes/multigame.cpp b/src/devices/bus/nes/multigame.cpp index 33aff6df695..d2b91f8f177 100644 --- a/src/devices/bus/nes/multigame.cpp +++ b/src/devices/bus/nes/multigame.cpp @@ -97,6 +97,7 @@ DEFINE_DEVICE_TYPE(NES_BMC_1200IN1, nes_bmc_1200in1_device, "nes_bmc_1200i DEFINE_DEVICE_TYPE(NES_BMC_GOLD150, nes_bmc_gold150_device, "nes_bmc_gold150", "NES Cart BMC Golden 150 in 1 PCB") DEFINE_DEVICE_TYPE(NES_BMC_GOLD260, nes_bmc_gold260_device, "nes_bmc_gold260", "NES Cart BMC Golden 260 in 1 PCB") DEFINE_DEVICE_TYPE(NES_BMC_TH22913, nes_bmc_th22913_device, "nes_bmc_th22913", "NES Cart BMC TH2291-3 PCB") +DEFINE_DEVICE_TYPE(NES_BMC_82AB, nes_bmc_82ab_device, "nes_bmc_82ab", "NES Cart BMC 82AB PCB") DEFINE_DEVICE_TYPE(NES_BMC_4IN1RESET, nes_bmc_4in1reset_device, "nes_bmc_4in1reset", "NES Cart BMC 4 in 1 (Reset Based) PCB") DEFINE_DEVICE_TYPE(NES_BMC_42IN1RESET, nes_bmc_42in1reset_device, "nes_bmc_42in1reset", "NES Cart BMC 42 in 1 (Reset Based) PCB") DEFINE_DEVICE_TYPE(NES_BMC_NC20MB, nes_bmc_nc20mb_device, "nes_bmc_nc20mb", "NES Cart BMC NC-20MB PCB") @@ -498,8 +499,18 @@ nes_n625092_device::nes_n625092_device(const machine_config &mconfig, const char { } +nes_bmc_th22913_device::nes_bmc_th22913_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) + : nes_vram_protect_device(mconfig, type, tag, owner, clock), m_vram_prot_bit(type == NES_BMC_TH22913 ? 10 : 9) +{ +} + nes_bmc_th22913_device::nes_bmc_th22913_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : nes_vram_protect_device(mconfig, NES_BMC_TH22913, tag, owner, clock) + : nes_bmc_th22913_device(mconfig, NES_BMC_TH22913, tag, owner, clock) +{ +} + +nes_bmc_82ab_device::nes_bmc_82ab_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_bmc_th22913_device(mconfig, NES_BMC_82AB, tag, owner, clock) { } @@ -3481,9 +3492,9 @@ void nes_n625092_device::write_h(offs_t offset, u8 data) /*------------------------------------------------- - BMC-TH2291-3, BMC-CH-011 + BMC-TH2291-3, BMC-CH-011, BMC-82AB - Games: Powerful 250 in 1, Powerful 255 in 1 + Games: Powerful 250 in 1, Powerful 255 in 1, 82 in 1 iNES: mapper 63 @@ -3501,5 +3512,5 @@ void nes_bmc_th22913_device::write_h(offs_t offset, u8 data) prg16_cdef(bank | mode); set_nt_mirroring(BIT(offset, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); - m_vram_protect = BIT(offset, 10); + m_vram_protect = BIT(offset, m_vram_prot_bit); } diff --git a/src/devices/bus/nes/multigame.h b/src/devices/bus/nes/multigame.h index 1214710ea66..4ce70450a56 100644 --- a/src/devices/bus/nes/multigame.h +++ b/src/devices/bus/nes/multigame.h @@ -1280,6 +1280,23 @@ public: virtual void write_h(offs_t offset, u8 data) override; virtual void pcb_reset() override; + +protected: + // construction/destruction + nes_bmc_th22913_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); + +private: + u8 m_vram_prot_bit; +}; + + +// ======================> nes_bmc_82ab_device + +class nes_bmc_82ab_device : public nes_bmc_th22913_device +{ +public: + // construction/destruction + nes_bmc_82ab_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; @@ -1353,5 +1370,6 @@ DECLARE_DEVICE_TYPE(NES_BMC_42IN1RESET, nes_bmc_42in1reset_device) DECLARE_DEVICE_TYPE(NES_BMC_NC20MB, nes_bmc_nc20mb_device) DECLARE_DEVICE_TYPE(NES_BMC_LC160, nes_bmc_lc160_device) DECLARE_DEVICE_TYPE(NES_BMC_TH22913, nes_bmc_th22913_device) +DECLARE_DEVICE_TYPE(NES_BMC_82AB, nes_bmc_82ab_device) #endif // MAME_BUS_NES_MULTIGAME_H diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp index 16307334349..35cac97f6fb 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -119,6 +119,7 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("pal_zz", NES_ZZ_PCB); device.option_add_internal("nes_qj", NES_QJ_PCB); device.option_add_internal("nes_event", NES_EVENT); + device.option_add_internal("nes_event2", NES_EVENT2); // Discrete Components boards // IC_74x139x74 device.option_add_internal("discrete_74x139", NES_74X139X74); @@ -383,6 +384,7 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("bmc_60311c", NES_BMC_60311C); device.option_add_internal("bmc_80013b", NES_BMC_80013B); device.option_add_internal("bmc_810544c", NES_BMC_810544C); + device.option_add_internal("bmc_82ab", NES_BMC_82AB); device.option_add_internal("bmc_830425c", NES_BMC_830425C); device.option_add_internal("bmc_830506c", NES_BMC_830506C); device.option_add_internal("bmc_830928c", NES_BMC_830928C); diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index ac7454bb347..4512d02dede 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -516,7 +516,7 @@ static const nes_mmc mmc_list[] = // 552 TAITO_X1_017, this is a correction of mapper 82. We should drop 82 and only support the accurate dumps of 552? { 553, SACHEN_3013 }, // Dong Dong Nao 1 { 554, KAISER_KS7010 }, // Akumajo Dracula FDS conversion - // 555 retroUSB re-release of 1991 Nintendo Campus Challenge + { 555, STD_EVENT2 }, // 556 JY-215 multicart { 557, UNL_LG25 }, // Moero TwinBee FDS conversion // 558 some games on YC-03-09 board (related to mappers 162-164) diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index 3da6f033067..9a1dd1d99f6 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -42,6 +42,7 @@ static const nes_pcb pcb_list[] = { "pal_zz", PAL_ZZ }, { "nes_qj", NES_QJ }, { "nes_event", STD_EVENT }, + { "nes_event2", STD_EVENT2 }, { "discrete_74x139", DIS_74X139X74 }, { "discrete_74x377", DIS_74X377 }, { "discrete_74x161", DIS_74X161X161X32 }, @@ -263,6 +264,7 @@ static const nes_pcb pcb_list[] = { "bmc_60311c", BMC_60311C }, { "bmc_80013b", BMC_80013B }, { "bmc_810544c", BMC_810544C }, + { "bmc_82ab", BMC_82AB }, { "bmc_830425c", BMC_830425C }, { "bmc_830506c", BMC_830506C }, { "bmc_830928c", BMC_830928C }, diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index 970390547af..e397d102fed 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -26,7 +26,7 @@ enum STD_SXROM, STD_SOROM, STD_SZROM, STD_TXROM, STD_TXSROM, STD_TKROM, STD_TQROM, STD_UXROM, STD_UN1ROM, UXROM_CC, - HVC_FAMBASIC, NES_QJ, PAL_ZZ, STD_EVENT, + HVC_FAMBASIC, NES_QJ, PAL_ZZ, STD_EVENT, STD_EVENT2, STD_DISKSYS, STD_NROM368,//homebrew extension of NROM! // Discrete components boards (by various manufacturer) @@ -97,7 +97,7 @@ enum BMC_70IN1, BMC_500IN1, BMC_800IN1, BMC_1200IN1, BMC_GKA, BMC_GKB, BMC_GKCXIN1, BMC_GN91B, BMC_HP898F, BMC_VT5201, BMC_BENSHIENG, - BMC_CTC09, BMC_CTC_12IN1, BMC_60311C, BMC_80013B, BMC_810544C, + BMC_CTC09, BMC_CTC_12IN1, BMC_60311C, BMC_80013B, BMC_810544C, BMC_82AB, BMC_830425C, BMC_830506C, BMC_830928C, BMC_850437C, BMC_891227, BMC_970630C, BMC_N32_4IN1, BMC_NC20MB, BMC_NT639, BMC_NTD_03, BMC_SRPG_5IN1, BMC_EL860947C, BMC_EL861121C, BMC_FAM250, BMC_FK23C, BMC_FK23CA, diff --git a/src/devices/bus/nes_ctrl/arkpaddle.cpp b/src/devices/bus/nes_ctrl/arkpaddle.cpp index e322d10eeed..c529070bc12 100644 --- a/src/devices/bus/nes_ctrl/arkpaddle.cpp +++ b/src/devices/bus/nes_ctrl/arkpaddle.cpp @@ -33,9 +33,9 @@ DEFINE_DEVICE_TYPE(NES_ARKPADDLE_FC, nes_vausfc_device, "nes_vausfc", "FC Arkano static INPUT_PORTS_START( arkanoid_paddle ) PORT_START("PADDLE") - PORT_BIT( 0xff, 0x7f, IPT_PADDLE) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_CENTERDELTA(0) PORT_MINMAX(0x4e,0xf2) // this minmax is from what Arkanoid 2 clamps values to, so an actual paddle's range may be greater + PORT_BIT( 0xff, 0x7f, IPT_PADDLE ) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_CENTERDELTA(0) PORT_MINMAX(0x4e, 0xf2) // this minmax is from what Arkanoid 2 clamps values to, so an actual paddle's range may be greater PORT_START("BUTTON") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Paddle button") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Paddle button") INPUT_PORTS_END diff --git a/src/devices/bus/nes_ctrl/zapper.cpp b/src/devices/bus/nes_ctrl/zapper.cpp index e19c63fa2d2..4a1a2dd9408 100644 --- a/src/devices/bus/nes_ctrl/zapper.cpp +++ b/src/devices/bus/nes_ctrl/zapper.cpp @@ -21,11 +21,11 @@ DEFINE_DEVICE_TYPE(NES_BANDAIHS, nes_bandaihs_device, "nes_bandaihs", "Bandai Hy static INPUT_PORTS_START( nes_zapper ) PORT_START("ZAPPER_X") - PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_MINMAX(0,255) + PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_MINMAX(0, 255) PORT_START("ZAPPER_Y") - PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) PORT_MINMAX(0,255) + PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) PORT_MINMAX(0, 239) PORT_START("ZAPPER_T") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Lightgun Trigger") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Lightgun Trigger") INPUT_PORTS_END @@ -116,25 +116,40 @@ u8 nes_zapper_device::read_bit34() int x = m_lightx->read(); int y = m_lighty->read(); + // effective range picked up by photodiode, i.e. gun position +- radius + constexpr int xrad = 0; + constexpr int yrad = 0; + // brightness threshold + constexpr int bright = 0x70; + // # of CRT scanlines that sustain brightness + constexpr int sustain = 20; + + int vpos = m_port->m_screen->vpos(); + int hpos = m_port->m_screen->hpos(); + // update the screen if necessary if (!m_port->m_screen->vblank()) - { - int vpos = m_port->m_screen->vpos(); - int hpos = m_port->m_screen->hpos(); - - if (vpos > y || (vpos == y && hpos >= x)) + if (vpos > y - yrad || (vpos == y - yrad && hpos >= x - xrad)) m_port->m_screen->update_now(); - } - - // get the pixel at the gun position - rgb_t pix = m_port->m_screen->pixel(x, y); - // check if the cursor is over a bright pixel - // FIXME: still a gross hack - if (pix.r() == 0xff && pix.b() == 0xff && pix.g() > 0x90) - ret &= ~0x08; // sprite hit - else - ret |= 0x08; // no sprite hit + // default to no light detected + ret |= 0x08; + + // check brightness of pixels nearby the gun position + for (int i = x - xrad; i <= x + xrad; i++) + for (int j = y - yrad; j <= y + yrad; j++) + { + rgb_t pix = m_port->m_screen->pixel(i, j); + + // only detect light if gun position is near, and behind, where the PPU is drawing on the CRT, from NesDev wiki: + // "Zap Ruder test ROM show that the photodiode stays on for about 26 scanlines with pure white, 24 scanlines with light gray, or 19 lines with dark gray." + if (j <= vpos && j > vpos - sustain && (j != vpos || i <= hpos) && pix.brightness() >= bright) + { + ret &= ~0x08; // light detected + i = x + xrad; + break; + } + } return ret; } diff --git a/src/devices/video/clgd542x.cpp b/src/devices/video/clgd542x.cpp index eff9f5473c8..d7e20f1cd2d 100644 --- a/src/devices/video/clgd542x.cpp +++ b/src/devices/video/clgd542x.cpp @@ -70,8 +70,7 @@ void cirrus_gd5428_device::device_start() { zero(); - int i; - for (i = 0; i < 0x100; i++) + for (int i = 0; i < 0x100; i++) set_pen_color(i, 0, 0, 0); // Avoid an infinite loop when displaying. 0 is not possible anyway. @@ -81,11 +80,10 @@ void cirrus_gd5428_device::device_start() vga.read_dipswitch.set(nullptr); //read_dipswitch; vga.svga_intf.seq_regcount = 0x1f; vga.svga_intf.crtc_regcount = 0x2d; - vga.svga_intf.vram_size = 0x200000; - - vga.memory.resize(vga.svga_intf.vram_size); + vga.memory = std::make_unique<uint8_t []>(vga.svga_intf.vram_size); memset(&vga.memory[0], 0, vga.svga_intf.vram_size); - save_item(NAME(vga.memory)); + + save_pointer(NAME(vga.memory), vga.svga_intf.vram_size); save_pointer(vga.crtc.data,"CRTC Registers",0x100); save_pointer(vga.sequencer.data,"Sequencer Registers",0x100); save_pointer(vga.attribute.data,"Attribute Registers", 0x15); diff --git a/src/devices/video/pc_vga.cpp b/src/devices/video/pc_vga.cpp index 67746edd407..d1d20c70c14 100644 --- a/src/devices/video/pc_vga.cpp +++ b/src/devices/video/pc_vga.cpp @@ -204,8 +204,8 @@ mach8_device::mach8_device(const machine_config &mconfig, const char *tag, devic // zero everything, keep vtbls void vga_device::zero() { - memset(&vga.svga_intf, 0, sizeof(vga.svga_intf)); - vga.memory.resize(0); + vga.svga_intf.seq_regcount = 0; + vga.svga_intf.crtc_regcount = 0; memset(vga.pens, 0, sizeof(vga.pens)); vga.miscellaneous_output = 0; vga.feature_control = 0; @@ -246,8 +246,7 @@ void vga_device::device_start() { zero(); - int i; - for (i = 0; i < 0x100; i++) + for (int i = 0; i < 0x100; i++) set_pen_color(i, 0, 0, 0); // Avoid an infinite loop when displaying. 0 is not possible anyway. @@ -258,11 +257,10 @@ void vga_device::device_start() vga.read_dipswitch.set(nullptr); //read_dipswitch; vga.svga_intf.seq_regcount = 0x05; vga.svga_intf.crtc_regcount = 0x19; - vga.svga_intf.vram_size = 0x100000; - vga.memory.resize(vga.svga_intf.vram_size); + vga.memory = std::make_unique<uint8_t []>(vga.svga_intf.vram_size); memset(&vga.memory[0], 0, vga.svga_intf.vram_size); - save_item(NAME(vga.memory)); + save_pointer(NAME(vga.memory), vga.svga_intf.vram_size); save_item(NAME(vga.pens)); save_item(NAME(vga.miscellaneous_output)); @@ -6621,7 +6619,6 @@ void oak_oti111_vga_device::xga_write(offs_t offset, u8 data) void oak_oti111_vga_device::device_start() { svga_device::device_start(); - vga.svga_intf.vram_size = 0x100000; std::fill(std::begin(m_oak_regs), std::end(m_oak_regs), 0); } diff --git a/src/devices/video/pc_vga.h b/src/devices/video/pc_vga.h index 4a31ed76224..717d965330f 100644 --- a/src/devices/video/pc_vga.h +++ b/src/devices/video/pc_vga.h @@ -39,6 +39,7 @@ public: virtual TIMER_CALLBACK_MEMBER(vblank_timer_cb); void set_offset(uint16_t val) { vga.crtc.offset = val; } + void set_vram_size(size_t vram_size) { vga.svga_intf.vram_size = vram_size; } protected: enum @@ -122,7 +123,7 @@ protected: int crtc_regcount; } svga_intf; - std::vector<uint8_t> memory; + std::unique_ptr<uint8_t []> memory; uint32_t pens[16]; /* the current 16 pens */ uint8_t miscellaneous_output; diff --git a/src/devices/video/virge_pci.cpp b/src/devices/video/virge_pci.cpp index e5371dd786b..a76fc33966b 100644 --- a/src/devices/video/virge_pci.cpp +++ b/src/devices/video/virge_pci.cpp @@ -272,7 +272,9 @@ void virge_pci_device::device_add_mconfig(machine_config &config) screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480); screen.set_screen_update("vga", FUNC(s3virge_vga_device::screen_update)); - S3VIRGE(config, m_vga, 0).set_screen("screen"); + S3VIRGE(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x400000); } void virgedx_pci_device::device_add_mconfig(machine_config &config) @@ -281,7 +283,9 @@ void virgedx_pci_device::device_add_mconfig(machine_config &config) screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480); screen.set_screen_update("vga", FUNC(s3virge_vga_device::screen_update)); - S3VIRGEDX(config, m_vga, 0).set_screen("screen"); + S3VIRGEDX(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x400000); } diff --git a/src/emu/debug/points.cpp b/src/emu/debug/points.cpp index c44bc3f7563..d4c1ebb3045 100644 --- a/src/emu/debug/points.cpp +++ b/src/emu/debug/points.cpp @@ -22,18 +22,19 @@ // debug_breakpoint - constructor //------------------------------------------------- -debug_breakpoint::debug_breakpoint(device_debug* debugInterface, - symbol_table &symbols, - int index, - offs_t address, - const char *condition, - const char *action) - : m_debugInterface(debugInterface), - m_index(index), - m_enabled(true), - m_address(address), - m_condition(symbols, (condition != nullptr) ? condition : "1"), - m_action((action != nullptr) ? action : "") +debug_breakpoint::debug_breakpoint( + device_debug *debugInterface, + symbol_table &symbols, + int index, + offs_t address, + const char *condition, + const char *action) : + m_debugInterface(debugInterface), + m_index(index), + m_enabled(true), + m_address(address), + m_condition(symbols, condition ? condition : "1"), + m_action(action ? action : "") { } @@ -59,7 +60,7 @@ bool debug_breakpoint::hit(offs_t pc) { return (m_condition.execute() != 0); } - catch (expression_error &) + catch (expression_error const &) { return false; } @@ -78,27 +79,28 @@ bool debug_breakpoint::hit(offs_t pc) // debug_watchpoint - constructor //------------------------------------------------- -debug_watchpoint::debug_watchpoint(device_debug* debugInterface, - symbol_table &symbols, - int index, - address_space &space, - read_or_write type, - offs_t address, - offs_t length, - const char *condition, - const char *action) - : m_debugInterface(debugInterface), - m_phr(nullptr), - m_phw(nullptr), - m_space(space), - m_index(index), - m_enabled(true), - m_type(type), - m_address(address & space.addrmask()), - m_length(length), - m_condition(symbols, (condition != nullptr) ? condition : "1"), - m_action((action != nullptr) ? action : ""), - m_installing(false) +debug_watchpoint::debug_watchpoint( + device_debug* debugInterface, + symbol_table &symbols, + int index, + address_space &space, + read_or_write type, + offs_t address, + offs_t length, + const char *condition, + const char *action) : + m_debugInterface(debugInterface), + m_phr(nullptr), + m_phw(nullptr), + m_space(space), + m_index(index), + m_enabled(true), + m_type(type), + m_address(address & space.addrmask()), + m_length(length), + m_condition(symbols, condition ? condition : "1"), + m_action(action ? action : ""), + m_installing(false) { std::fill(std::begin(m_start_address), std::end(m_start_address), 0); std::fill(std::begin(m_end_address), std::end(m_end_address), 0); @@ -170,12 +172,14 @@ debug_watchpoint::debug_watchpoint(device_debug* debugInterface, } install(read_or_write::READWRITE); - m_notifier = m_space.add_change_notifier([this](read_or_write mode) { - if (m_enabled) - { - install(mode); - } - }); + m_notifier = m_space.add_change_notifier( + [this] (read_or_write mode) + { + if (m_enabled) + { + install(mode); + } + }); } debug_watchpoint::~debug_watchpoint() diff --git a/src/frontend/mame/luaengine.h b/src/frontend/mame/luaengine.h index bb16aea6a43..1aaa83bbf0b 100644 --- a/src/frontend/mame/luaengine.h +++ b/src/frontend/mame/luaengine.h @@ -121,6 +121,8 @@ private: template<typename T, size_t SIZE> class enum_parser; struct addr_space; + class tap_helper; + class addr_space_change_notif; struct save_item { void *base; diff --git a/src/frontend/mame/luaengine_mem.cpp b/src/frontend/mame/luaengine_mem.cpp index f95ebdb37c2..26518931e9e 100644 --- a/src/frontend/mame/luaengine_mem.cpp +++ b/src/frontend/mame/luaengine_mem.cpp @@ -184,6 +184,220 @@ int sol_lua_push(sol::types<endianness_t>, lua_State *L, endianness_t &&value) //------------------------------------------------- +// tap_helper - class for managing address space +// taps +//------------------------------------------------- + +class lua_engine::tap_helper +{ +public: + tap_helper(tap_helper const &) = delete; + tap_helper(tap_helper &&) = delete; + + tap_helper( + lua_engine &engine, + address_space &space, + read_or_write mode, + offs_t start, + offs_t end, + std::string &&name, + sol::protected_function &&callback) + : m_callback(std::move(callback)) + , m_engine(engine) + , m_space(space) + , m_handler(nullptr) + , m_name(std::move(name)) + , m_start(start) + , m_end(end) + , m_mode(mode) + , m_installing(false) + , m_installed(false) + { + reinstall(); + } + + ~tap_helper() + { + if (m_handler && m_installed) + m_handler->remove(); + } + + offs_t start() const noexcept { return m_start; } + offs_t end() const noexcept { return m_end; } + std::string const &name() const noexcept { return m_name; } + + void reinstall() + { + switch (m_space.data_width()) + { + case 8: do_install<u8>(); break; + case 16: do_install<u16>(); break; + case 32: do_install<u32>(); break; + case 64: do_install<u64>(); break; + } + } + + void remove() + { + if (m_handler) + { + m_handler->remove(); + m_installed = false; + } + } + +private: + template <typename T> + void do_install() + { + if (m_installing) + return; + m_installing = true; + if (m_handler) + m_handler->remove(); + + switch (m_mode) + { + case read_or_write::READ: + m_handler = m_space.install_read_tap( + m_start, + m_end, + m_name, + [this] (offs_t offset, T &data, T mem_mask) + { + auto result = m_engine.invoke(m_callback, offset, data, mem_mask).template get<sol::optional<T> >(); + if (result) + data = *result; + }, + m_handler); + break; + case read_or_write::WRITE: + m_handler = m_space.install_write_tap( + m_start, + m_end, + m_name, + [this] (offs_t offset, T &data, T mem_mask) + { + auto result = m_engine.invoke(m_callback, offset, data, mem_mask).template get<sol::optional<T> >(); + if (result) + data = *result; + }, + m_handler); + break; + case read_or_write::READWRITE: + // won't ever get here, but compilers complain about unhandled enum value + break; + } + + m_installed = true; + m_installing = false; + }; + + sol::protected_function m_callback; + lua_engine &m_engine; + address_space &m_space; + memory_passthrough_handler *m_handler; + std::string m_name; + offs_t const m_start; + offs_t const m_end; + read_or_write const m_mode; + bool m_installing; + bool m_installed; +}; + + +//------------------------------------------------- +// addr_space_change_notif - helper for hanging +// on to an address space change notification +// subscription +//------------------------------------------------- + +class lua_engine::addr_space_change_notif +{ +public: + addr_space_change_notif(addr_space_change_notif const &) = delete; + + addr_space_change_notif(addr_space_change_notif &&that) + : m_callback(std::move(that.m_callback)) + , m_engine(that.m_engine) + , m_space(that.m_space) + , m_id(-1) + { + that.remove(); + install(); + } + + addr_space_change_notif &operator=(addr_space_change_notif &&that) + { + if (&that != this) + { + remove(); + m_callback = std::move(that.m_callback); + m_engine = that.m_engine; + m_space = that.m_space; + that.remove(); + install(); + } + return *this; + } + + addr_space_change_notif(lua_engine &engine, address_space &space, sol::protected_function &&callback) + : m_callback(std::move(callback)) + , m_engine(&engine) + , m_space(&space) + , m_id(-1) + { + install(); + } + + ~addr_space_change_notif() + { + if (m_space) + m_space->remove_change_notifier(m_id); + } + + void remove() + { + if (m_space) + { + m_space->remove_change_notifier(m_id); + m_space = nullptr; + m_id = -1; + } + } + +private: + void install() + { + if (m_space) + { + m_id = m_space->add_change_notifier( + [this] (read_or_write mode) + { + char const *modestr = ""; + switch (mode) + { + case read_or_write::READ: modestr = "r"; break; + case read_or_write::WRITE: modestr = "w"; break; + case read_or_write::READWRITE: modestr = "rw"; break; + } + m_engine->invoke(m_callback, modestr); + }); + } + else + { + m_id = -1; + } + } + + sol::protected_function m_callback; + lua_engine *m_engine; + address_space *m_space; + int m_id; +}; + + +//------------------------------------------------- // mem_read - templated memory readers for <sign>,<size> // -> manager:machine().devices[":maincpu"].spaces["program"]:read_i8(0xC000) //------------------------------------------------- @@ -449,64 +663,79 @@ void lua_engine::initialize_memory(sol::table &emu) addr_space_type["write_direct_i64"] = &addr_space::direct_mem_write<s64>; addr_space_type["write_direct_u64"] = &addr_space::direct_mem_write<u64>; addr_space_type["read_range"] = - [] (addr_space &sp, sol::this_state s, u64 first, u64 last, int width, sol::object opt_step) -> sol::object - { - lua_State *L = s; - luaL_Buffer buff; - offs_t space_size = sp.space.addrmask(); - u64 step = 1; - if (opt_step.is<u64>()) - { - step = opt_step.as<u64>(); - if (step < 1 || step > last - first) - { - luaL_error(L, "Invalid step"); - return sol::lua_nil; - } - } - if (first > space_size || last > space_size || last < first) + [] (addr_space &sp, sol::this_state s, u64 first, u64 last, int width, sol::object opt_step) -> sol::object { - luaL_error(L, "Invalid offset"); - return sol::lua_nil; - } - int byte_count = width / 8 * (last - first + 1) / step; - switch (width) - { - case 8: + lua_State *L = s; + luaL_Buffer buff; + offs_t space_size = sp.space.addrmask(); + u64 step = 1; + if (opt_step.is<u64>()) { - u8 *dest = (u8 *)luaL_buffinitsize(L, &buff, byte_count); - for ( ; first <= last; first += step) - *dest++ = sp.mem_read<u8>(first); - break; + step = opt_step.as<u64>(); + if (step < 1 || step > last - first) + { + luaL_error(L, "Invalid step"); + return sol::lua_nil; + } } - case 16: + if (first > space_size || last > space_size || last < first) { - u16 *dest = (u16 *)luaL_buffinitsize(L, &buff, byte_count); - for ( ; first <= last; first += step) - *dest++ = sp.mem_read<u16>(first); - break; - } - case 32: - { - u32 *dest = (u32 *)luaL_buffinitsize(L, &buff, byte_count); - for(; first <= last; first += step) - *dest++ = sp.mem_read<u32>(first); - break; + luaL_error(L, "Invalid offset"); + return sol::lua_nil; } - case 64: + int byte_count = width / 8 * (last - first + 1) / step; + switch (width) { - u64 *dest = (u64 *)luaL_buffinitsize(L, &buff, byte_count); - for(; first <= last; first += step) - *dest++ = sp.mem_read<u64>(first); - break; + case 8: + { + u8 *dest = (u8 *)luaL_buffinitsize(L, &buff, byte_count); + for ( ; first <= last; first += step) + *dest++ = sp.mem_read<u8>(first); + break; + } + case 16: + { + u16 *dest = (u16 *)luaL_buffinitsize(L, &buff, byte_count); + for ( ; first <= last; first += step) + *dest++ = sp.mem_read<u16>(first); + break; + } + case 32: + { + u32 *dest = (u32 *)luaL_buffinitsize(L, &buff, byte_count); + for( ; first <= last; first += step) + *dest++ = sp.mem_read<u32>(first); + break; + } + case 64: + { + u64 *dest = (u64 *)luaL_buffinitsize(L, &buff, byte_count); + for( ; first <= last; first += step) + *dest++ = sp.mem_read<u64>(first); + break; + } + default: + luaL_error(L, "Invalid width. Must be 8/16/32/64"); + return sol::lua_nil; } - default: - luaL_error(L, "Invalid width. Must be 8/16/32/64"); - return sol::lua_nil; - } - luaL_pushresultsize(&buff, byte_count); - return sol::make_reference(L, sol::stack_reference(L, -1)); - }; + luaL_pushresultsize(&buff, byte_count); + return sol::make_reference(L, sol::stack_reference(L, -1)); + }; + addr_space_type["add_change_notifier"] = + [this] (addr_space &sp, sol::protected_function &&cb) + { + return addr_space_change_notif(*this, sp.space, std::move(cb)); + }; + addr_space_type["install_read_tap"] = + [this] (addr_space &sp, offs_t start, offs_t end, std::string &&name, sol::protected_function &&cb) + { + return std::make_unique<tap_helper>(*this, sp.space, read_or_write::READ, start, end, std::move(name), std::move(cb)); + }; + addr_space_type["install_write_tap"] = + [this] (addr_space &sp, offs_t start, offs_t end, std::string &&name, sol::protected_function &&cb) + { + return std::make_unique<tap_helper>(*this, sp.space, read_or_write::WRITE, start, end, std::move(name), std::move(cb)); + }; addr_space_type["name"] = sol::property([] (addr_space &sp) { return sp.space.name(); }); addr_space_type["shift"] = sol::property([] (addr_space &sp) { return sp.space.addr_shift(); }); addr_space_type["index"] = sol::property([] (addr_space &sp) { return sp.space.spacenum(); }); @@ -516,6 +745,17 @@ void lua_engine::initialize_memory(sol::table &emu) addr_space_type["map"] = sol::property([] (addr_space &sp) { return sp.space.map(); }); + auto change_notif_type = sol().registry().new_usertype<addr_space_change_notif>("addr_space_change", sol::no_constructor); + change_notif_type["remove"] = &addr_space_change_notif::remove; + + auto tap_type = sol().registry().new_usertype<tap_helper>("mempassthrough", sol::no_constructor); + tap_type["reinstall"] = &tap_helper::reinstall; + tap_type["remove"] = &tap_helper::remove; + tap_type["addrstart"] = sol::property(&tap_helper::start); + tap_type["addrend"] = sol::property(&tap_helper::end); + tap_type["name"] = sol::property(&tap_helper::name); + + auto addrmap_type = sol().registry().new_usertype<address_map>("addrmap", sol::no_constructor); addrmap_type["spacenum"] = sol::readonly(&address_map::m_spacenum); addrmap_type["device"] = sol::readonly(&address_map::m_device); diff --git a/src/mame/drivers/bebox.cpp b/src/mame/drivers/bebox.cpp index b618a4b1b38..8f3a53d2ae3 100644 --- a/src/mame/drivers/bebox.cpp +++ b/src/mame/drivers/bebox.cpp @@ -190,8 +190,9 @@ void bebox_state::bebox_peripherals(machine_config &config) screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480); screen.set_screen_update(m_vga, FUNC(cirrus_gd5428_device::screen_update)); - cirrus_gd5428_device &vga(CIRRUS_GD5428(config, m_vga, 0)); - vga.set_screen("screen"); + CIRRUS_GD5428(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x200000); speaker_device &speaker(SPEAKER(config, "mono")); speaker.front_center(); diff --git a/src/mame/drivers/by6803.cpp b/src/mame/drivers/by6803.cpp index 433fcde79f6..6bffb0abaa5 100644 --- a/src/mame/drivers/by6803.cpp +++ b/src/mame/drivers/by6803.cpp @@ -5,28 +5,43 @@ PINBALL Bally MPU A084-91786-AH06 (6803) -The characteristic 6803 pinball has 4x 7-digit displays lined up along the bottom of the - backbox. They show scores, moving messages, and anything else that's needed. +First generation 6803 has 4x 7-digit displays, and a 6-digit display for the credits/balls (only + 4 digits are visible). +Then, the 2nd generation replaced all that with 2x 14-letter alphanumeric displays lined up along + the bottom of the backbox. They show scores, moving messages, and anything else that's needed. + This also meant a more informative setup mode. Schematic has a number of mistakes. -Here are the key codes to enable play: (to do) +Setting Up: +- The default settings don't work on most machines. Use the number pad for all inputs. + After starting or restarting, wait for flashing scores before pressing anything. + Each number pair is entered as: first number, Enter, 2nd number, Enter, Enter. + See the manual for more details. +- 0B38: F1, 16 40, 17 1, 23 3, 24 3, 25 3, 26 3, 27 3, 29 1, 30 1, 47 1, esc. +- 0C70: Press F1, 62 1, esc. Start again. F1, 62 0, 16 40, 17 1, 24 3, 25 3, + 26 3, 27 3, 29 1, 30 1, esc. Start again. +- 0E34: Press F1, 44 65, esc. Start again. +- 0H05, 0H07, 2001, 2006: no setup necessary. +- Others: Press F1, press / to choose Feature Options, Enter, 65, Enter, Enter, esc. + +Here are the key codes to enable play: Game NUM Start game End ball -------------------------------------------------------------------------------------------------- -Eight Ball Champ 0B38 (not working) -Beat the Clock 0C70 (not working) -Motordome 0E14 (can't insert coin) -Lady Luck 0E34 (not working) -Strange Science 0E35 (can't insert coin) -Special Force / Special Force Girls 0E47 (can't insert coin) -Black Belt / Karate Fight 0E52 (can't insert coin) -City Slicker 0E79 (can't insert coin) +Eight Ball Champ 0B38 1 X +Beat the Clock 0C70 1 X (timed game, no ball display) +Motordome 0E14 1 X +Lady Luck 0E34 1 X +Strange Science 0E35 (unknown) +Special Force / Special Force Girls 0E47 Hold TUV, hit 1 TUV +Black Belt / Karate Fight 0E52 1 X +City Slicker 0E79 Hold U and ; hit 1 U; Hardbody / Super Sport 0E94 (stuck switch) -Party Animal 0H01 (can't insert coin) -Heavy Metal Meltdown 0H03 (can't insert coin) +Party Animal 0H01 Hold Left Down Right, hit 1 Down Left Right +Heavy Metal Meltdown 0H03 Hold ;'/. and hit 1 Hold ;'/. and hit X twice Escape from the Lost World 0H05 Hold DX, hit 1 DX -Dungeons and Dragons 0H06 (can't insert coin) +Dungeons and Dragons 0H06 Hold Left Down Right, hit 1 Down Left Right Blackwater 100 0H07 Hold Enter ][, hit 1 Jiggle ]X[ Hot Shotz (unemulated prototype) **** After merge with Williams **** @@ -35,16 +50,14 @@ Atlantis 2006 Hold Left Down Right, hit 1 Do Status: -- 2nd gen games boot up and display. See above table for individual status. +- Most games are playable. See above table for individual status. ToDo: - Sound - Mechanical sounds - Outputs -- 1st gen display needs credits/balls -- Commas are missing from the display. +- Gen 2 games: Commas - Code has provision for a round LED, to be added to layout. -- Operator keypad - Various sound boards - Inputs, Solenoids vary per game @@ -63,6 +76,7 @@ ToDo: #include "speaker.h" #include "by6803.lh" +#include "by6803a.lh" namespace { @@ -84,7 +98,7 @@ public: { } void by6803(machine_config &config); - void digit6(machine_config &config); + void gen1(machine_config &config); void s11(machine_config &config); DECLARE_INPUT_CHANGED_MEMBER(activity_test); @@ -106,9 +120,9 @@ private: u8 pia1a_r(); void pia1a_w(u8 data); void pia1b_w(u8 data); - void pia0a_6w(u8 data); - void pia1a_6w(u8 data); - DECLARE_WRITE_LINE_MEMBER(pia0_ca2_6w); + void pia0a_g1w(u8 data); + void pia1a_g1w(u8 data); + DECLARE_WRITE_LINE_MEMBER(pia0_ca2_g1w); DECLARE_WRITE_LINE_MEMBER(pia0_ca2_w); DECLARE_WRITE_LINE_MEMBER(pia0_cb2_w); DECLARE_WRITE_LINE_MEMBER(pia1_cb2_w); @@ -124,14 +138,14 @@ private: bool m_pia0_timer = 0; u8 m_port1 = 0U, m_port2 = 0U; u8 m_digit = 0U; - u8 m_segment[4]{}; + u8 m_segment[5]{}; required_device<m6803_cpu_device> m_maincpu; //optional_device<williams_s11b_sound_device> m_s11sound; required_device<pia6821_device> m_pia0; required_device<pia6821_device> m_pia1; required_ioport m_io_test; required_ioport_array<6> m_io_keyboard; - output_finder<40> m_digits; + output_finder<50> m_digits; output_finder<1> m_leds; output_finder<112> m_io_outputs; // 16 solenoids + 96 lamps }; @@ -147,24 +161,24 @@ void by6803_state::by6803_map(address_map &map) static INPUT_PORTS_START( by6803 ) PORT_START("TEST") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Self Test") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, by6803_state, self_test, 0) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Activity") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, by6803_state, activity_test, 0) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_F1) PORT_NAME("Self Test") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, by6803_state, self_test, 0) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_F2) PORT_NAME("Activity") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, by6803_state, activity_test, 0) PORT_START("X0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("INP01") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("INP02") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("INP03") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("INP04") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("INP01") // PAD ENTER + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("INP02") // PAD 0 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("INP03") // PAD KBD/CLR + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("INP04") // PAD GAME PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("Left Flipper") PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1 ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("Right Flipper") PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Outhole") PORT_START("X1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN1 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN3 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("INP12") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_3_PAD) // PAD 3 + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_2_PAD) // PAD 2 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN3 ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_1_PAD) // PAD 1 + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CODE(KEYCODE_E) PORT_NAME("INP12") // PAD A PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("INP13") PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_NAME("Slam Tilt") PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_NAME("Tilt") @@ -172,20 +186,20 @@ static INPUT_PORTS_START( by6803 ) // from here, vary per game PORT_START("X2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_NAME("INP17") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_NAME("INP18") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("INP19") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("INP20") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("INP17") // PAD 6 + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("INP18") // PAD 5 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("INP19") // PAD 4 + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME("INP20") // PAD B PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("INP21") PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_L) PORT_NAME("INP22") PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("INP23") PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_NAME("INP24") PORT_START("X3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_O) PORT_NAME("INP25") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_P) PORT_NAME("INP26") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("INP27") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("INP28") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_O) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("INP25") // PAD 9 + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_P) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("INP26") // PAD 8 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("INP27") // PAD 7 + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("INP28") // PAD C PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("INP29") PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("INP30") PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("INP31") @@ -255,9 +269,11 @@ WRITE_LINE_MEMBER( by6803_state::pia0_ca2_w ) { if (state) { - // comma info is available in m_pia1_a at this time. - m_digits[m_digit] = m_segment[0]; - m_digits[m_digit+16] = m_segment[1]; + for (u8 i = 0; i < 2; i++) + { + u16 t = bitswap<10>(u16(m_segment[i]), 0, 0, 7, 7, 6, 5, 4, 3, 2, 1); + m_digits[m_digit+i*20] = t; + } } } @@ -289,12 +305,12 @@ void by6803_state::pia0a_w(u8 data) if ((data & 15)==14) { m_digit = data >> 4; - m_segment[0] = bitswap<8>(m_pia1_a, 0, 7, 6, 5, 4, 3, 2, 1) ^ 0x80; + m_segment[0] = m_pia1_a ^ 1; } else if ((data & 15)==13) { - m_segment[1] = bitswap<8>(m_pia1_a, 0, 7, 6, 5, 4, 3, 2, 1) ^ 0x80; + m_segment[1] = m_pia1_a ^ 1; } } @@ -382,30 +398,38 @@ void by6803_state::pia1b_w(u8 data) } } -void by6803_state::pia0a_6w(u8 data) +void by6803_state::pia0a_g1w(u8 data) { + m_pia0_a = data; for (u8 i = 0; i < 4; i++) if (!BIT(data, i)) m_segment[i] = BIT(data, 4, 4); } -void by6803_state::pia1a_6w(u8 data) +void by6803_state::pia1a_g1w(u8 data) { + m_pia1_a = data; if (!BIT(data, 0)) for (u8 i = 1; i < 8; i++) if (BIT(data, i)) - m_digit = 7 - i; + m_digit = i; + if (!BIT(m_pia1_a, 0)) + m_segment[4] = BIT(m_pia0_a, 4, 4); } -WRITE_LINE_MEMBER( by6803_state::pia0_ca2_6w ) +WRITE_LINE_MEMBER( by6803_state::pia0_ca2_g1w ) { - static const u8 patterns[16] = { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0,0,0,0,0,0 }; // MC14543 + static const u8 patterns[16] = { 0x3f,0x06,0xdb,0xcf,0xe6,0xed,0xfd,0x07,0xff,0xef,0,0,0,0,0,0 }; // MC14543 if (state) { - m_digits[m_digit] = patterns[m_segment[0]]; - m_digits[m_digit+7] = patterns[m_segment[1]]; - m_digits[m_digit+16] = patterns[m_segment[2]]; - m_digits[m_digit+23] = patterns[m_segment[3]]; + for (u8 i = 0; i < 4; i++) + { + u16 t = patterns[m_segment[i]]; + if (t && ((m_digit == 1) || (m_digit == 4))) + t |= 0xc000; // Add comma + m_digits[m_digit+i*10] = t; + } + m_digits[m_digit+40] = patterns[m_segment[4]]; } } @@ -507,12 +531,13 @@ void by6803_state::s11(machine_config &config) //WILLIAMS_S11B_SOUND(config, m_s11sound, 0).add_route(ALL_OUTPUTS, "mono", 1.0); } -void by6803_state::digit6(machine_config &config) +void by6803_state::gen1(machine_config &config) { by6803(config); - m_pia0->writepa_handler().set(FUNC(by6803_state::pia0a_6w)); - m_pia1->writepa_handler().set(FUNC(by6803_state::pia1a_6w)); - m_pia0->ca2_handler().set(FUNC(by6803_state::pia0_ca2_6w)); + m_pia0->writepa_handler().set(FUNC(by6803_state::pia0a_g1w)); + m_pia1->writepa_handler().set(FUNC(by6803_state::pia1a_g1w)); + m_pia0->ca2_handler().set(FUNC(by6803_state::pia0_ca2_g1w)); + config.set_default_layout(layout_by6803a); } @@ -851,10 +876,10 @@ ROM_END // 1st gen -GAME( 1985, eballchp, 0, digit6, by6803, by6803_state, empty_init, ROT0, "Bally", "Eight Ball Champ", MACHINE_IS_SKELETON_MECHANICAL ) -GAME( 1985, beatclck, 0, digit6, by6803, by6803_state, empty_init, ROT0, "Bally", "Beat the Clock", MACHINE_IS_SKELETON_MECHANICAL ) -GAME( 1985, beatclck2, beatclck, digit6, by6803, by6803_state, empty_init, ROT0, "Bally", "Beat the Clock (with flasher support)", MACHINE_IS_SKELETON_MECHANICAL ) -GAME( 1986, ladyluck, 0, digit6, by6803, by6803_state, empty_init, ROT0, "Bally", "Lady Luck", MACHINE_IS_SKELETON_MECHANICAL ) +GAME( 1985, eballchp, 0, gen1, by6803, by6803_state, empty_init, ROT0, "Bally", "Eight Ball Champ", MACHINE_IS_SKELETON_MECHANICAL ) +GAME( 1985, beatclck, 0, gen1, by6803, by6803_state, empty_init, ROT0, "Bally", "Beat the Clock", MACHINE_IS_SKELETON_MECHANICAL ) +GAME( 1985, beatclck2, beatclck, gen1, by6803, by6803_state, empty_init, ROT0, "Bally", "Beat the Clock (with flasher support)", MACHINE_IS_SKELETON_MECHANICAL ) +GAME( 1986, ladyluck, 0, gen1, by6803, by6803_state, empty_init, ROT0, "Bally", "Lady Luck", MACHINE_IS_SKELETON_MECHANICAL ) // 2nd gen GAME( 1986, motrdome, 0, by6803, by6803, by6803_state, empty_init, ROT0, "Bally", "MotorDome (rev. D)", MACHINE_IS_SKELETON_MECHANICAL ) diff --git a/src/mame/drivers/ctk551.cpp b/src/mame/drivers/ctk551.cpp index 674424c4394..0b6f0bd90e8 100644 --- a/src/mame/drivers/ctk551.cpp +++ b/src/mame/drivers/ctk551.cpp @@ -6,11 +6,11 @@ Casio released several keyboard models with the same main board. As usual, some of them were also rebranded by Radio Shack. - - CTK-531, CTK-533 + - CTK-531, CTK-533 (1999) Basic 61-key model - - CTK-541, Optimus MD-1150 + - CTK-541, Optimus MD-1150 (1999) Adds velocity-sensitive keys - - CTK-551, CTK-558, Radio Shack MD-1160 + - CTK-551, CTK-558, Radio Shack MD-1160 (2000) Adds pitch wheel and different selection of demo songs Main board (JCM456-MA1M): @@ -358,7 +358,7 @@ INPUT_PORTS_END ROM_START(ctk551) ROM_REGION(0x100000, "maincpu", 0) - ROM_LOAD16_WORD_SWAP("ctk551.lsi2", 0x000000, 0x100000, CRC(66fc34cd) SHA1(47e9559edc106132f8a83462ed17a6c5c3872157)) + ROM_LOAD16_WORD_SWAP("ctk551.lsi2", 0x000000, 0x100000, CRC(66fc34cd) SHA1(47e9559edc106132f8a83462ed17a6c5c3872157)) // MSM538002E-T6 ROM_REGION(285279, "screen", 0) ROM_LOAD("ctk551lcd.svg", 0, 285279, CRC(1bb5da03) SHA1(a0cf22c6577c4ff0119ee7bb4ba8b487e23872d4)) @@ -368,4 +368,4 @@ ROM_END } // anonymous namespace // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -SYST( 1999, ctk551, 0, 0, ctk551, ctk551, ctk551_state, empty_init, "Casio", "CTK-551", MACHINE_SUPPORTS_SAVE ) +SYST( 2000, ctk551, 0, 0, ctk551, ctk551, ctk551_state, empty_init, "Casio", "CTK-551", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/gambl186.cpp b/src/mame/drivers/gambl186.cpp index a829e067946..e8817604696 100644 --- a/src/mame/drivers/gambl186.cpp +++ b/src/mame/drivers/gambl186.cpp @@ -513,7 +513,9 @@ void gambl186_state::gambl186(machine_config &config) screen.set_raw(XTAL(25'174'800),900,0,640,526,0,480); screen.set_screen_update("vga", FUNC(cirrus_gd5428_device::screen_update)); - CIRRUS_GD5428(config, "vga", 0).set_screen("screen"); + cirrus_gd5428_device &vga(CIRRUS_GD5428(config, "vga", 0)); + vga.set_screen("screen"); + vga.set_vram_size(0x200000); // sound hardware SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/gamtor.cpp b/src/mame/drivers/gamtor.cpp index 8f3373301e4..4f8dd926606 100644 --- a/src/mame/drivers/gamtor.cpp +++ b/src/mame/drivers/gamtor.cpp @@ -96,7 +96,9 @@ void gaminator_state::gaminator(machine_config &config) screen.set_raw(XTAL(25'174'800),900,0,640,526,0,480); screen.set_screen_update("vga", FUNC(gamtor_vga_device::screen_update)); - GAMTOR_VGA(config, "vga", 0).set_screen("screen"); + gamtor_vga_device &vga(GAMTOR_VGA(config, "vga", 0)); + vga.set_screen("screen"); + vga.set_vram_size(0x100000); SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); diff --git a/src/mame/drivers/konmedal020.cpp b/src/mame/drivers/konmedal020.cpp index a7188fe2d2d..578eee996f9 100644 --- a/src/mame/drivers/konmedal020.cpp +++ b/src/mame/drivers/konmedal020.cpp @@ -103,7 +103,9 @@ void konmedal020_state::gs471(machine_config &config) screen.set_screen_update(m_vga, FUNC(vga_device::screen_update)); screen.screen_vblank().set_inputline(m_maincpu, M68K_IRQ_3); - OTI111(config, m_vga, 0).set_screen("screen"); + OTI111(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x100000); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); diff --git a/src/mame/drivers/magtouch.cpp b/src/mame/drivers/magtouch.cpp index 513a29fb1a9..fa84a43752e 100644 --- a/src/mame/drivers/magtouch.cpp +++ b/src/mame/drivers/magtouch.cpp @@ -211,7 +211,9 @@ void magtouch_state::magtouch(machine_config &config) /* video hardware */ pcvideo_trident_vga(config); - TVGA9000_VGA(config.replace(), "vga", 0); + tvga9000_device &vga(TVGA9000_VGA(config.replace(), "vga", 0)); + vga.set_screen("screen"); + vga.set_vram_size(0x200000); pcat_common(config); diff --git a/src/mame/drivers/pcat_dyn.cpp b/src/mame/drivers/pcat_dyn.cpp index 222f9a77e71..7ad95522319 100644 --- a/src/mame/drivers/pcat_dyn.cpp +++ b/src/mame/drivers/pcat_dyn.cpp @@ -173,7 +173,9 @@ void pcat_dyn_state::pcat_dyn(machine_config &config) /* video hardware */ pcvideo_trident_vga(config); subdevice<screen_device>("screen")->set_refresh_hz(60); - TVGA9000_VGA(config.replace(), "vga", 0); + tvga9000_device &vga(TVGA9000_VGA(config.replace(), "vga", 0)); + vga.set_screen("screen"); + vga.set_vram_size(0x200000); pcat_common(config); diff --git a/src/mame/drivers/photoply.cpp b/src/mame/drivers/photoply.cpp index 635e02f51da..a3be62e9958 100644 --- a/src/mame/drivers/photoply.cpp +++ b/src/mame/drivers/photoply.cpp @@ -280,7 +280,10 @@ void photoply_state::photoply(machine_config &config) screen.set_raw(XTAL(25'174'800),900,0,640,526,0,480); screen.set_screen_update("vga", FUNC(cirrus_gd5446_device::screen_update)); - CIRRUS_GD5446(config, "vga", 0).set_screen("screen"); + cirrus_gd5446_device &vga(CIRRUS_GD5446(config, "vga", 0)); + vga.set_screen("screen"); + vga.set_vram_size(0x200000); + EEPROM_93C46_16BIT(config, "eeprom") .write_time(attotime::from_usec(1)) diff --git a/src/mame/drivers/playch10.cpp b/src/mame/drivers/playch10.cpp index 4184b48c54c..da5754a9bf4 100644 --- a/src/mame/drivers/playch10.cpp +++ b/src/mame/drivers/playch10.cpp @@ -711,15 +711,15 @@ static INPUT_PORTS_START( playch10 ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) INPUT_PORTS_END -/*Input Ports for gun games*/ +// Input Ports for gun games static INPUT_PORTS_START( playc10g ) PORT_INCLUDE(playch10) - PORT_START("GUNX") /* IN2 - FAKE - Gun X pos */ - PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) + PORT_START("GUNX") // IN2 - FAKE - Gun X pos + PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_MINMAX(0, 255) - PORT_START("GUNY") /* IN3 - FAKE - Gun Y pos */ - PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) + PORT_START("GUNY") // IN3 - FAKE - Gun Y pos + PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) PORT_MINMAX(0, 239) INPUT_PORTS_END diff --git a/src/mame/drivers/tmnt.cpp b/src/mame/drivers/tmnt.cpp index a42f0bbfb8c..8759aa3e7ba 100644 --- a/src/mame/drivers/tmnt.cpp +++ b/src/mame/drivers/tmnt.cpp @@ -61,6 +61,7 @@ Updates: #include "includes/konamipt.h" #include "cpu/m68000/m68000.h" +#include "cpu/m6805/m68705.h" #include "cpu/z80/z80.h" #include "machine/adc0804.h" #include "machine/eepromser.h" @@ -70,6 +71,7 @@ Updates: #include "machine/rescap.h" #include "machine/watchdog.h" #include "sound/k054539.h" +#include "sound/msm5205.h" #include "sound/okim6295.h" #include "sound/samples.h" #include "sound/ymopm.h" @@ -1020,6 +1022,20 @@ void tmnt_state::tmnt_audio_map(address_map &map) } +void tmnt_state::tmntucbl_audio_map(address_map &map) +{ + map(0x0000, 0x7fff).rom(); + map(0x8000, 0x87ff).ram(); + map(0x9000, 0x9000).rw(FUNC(tmnt_state::tmnt_sres_r), FUNC(tmnt_state::tmnt_sres_w)); /* title music & UPD7759C reset */ + map(0xa000, 0xa000).r("soundlatch", FUNC(generic_latch_8_device::read)); + // TODO: MC68705R3P + Oki M5205 + map(0xc000, 0xc001).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write)); + map(0xd000, 0xd000).w(m_upd7759, FUNC(upd7759_device::port_w)); + map(0xe000, 0xe000).w(FUNC(tmnt_state::tmnt_upd_start_w)); + map(0xf000, 0xf000).r(FUNC(tmnt_state::tmnt_upd_busy_r)); +} + + void tmnt_state::punkshot_audio_map(address_map &map) { map(0x0000, 0x7fff).rom(); @@ -2086,6 +2102,19 @@ void tmnt_state::tmnt(machine_config &config) m_samples->add_route(ALL_OUTPUTS, "mono", 0.5); } +void tmnt_state::tmntucbl(machine_config &config) +{ + tmnt(config); + + m_audiocpu->set_addrmap(AS_PROGRAM, &tmnt_state::tmntucbl_audio_map); + + M68705R3(config, "mcu", XTAL(4'000'000)).set_disable(); // not dumped + + MSM5205(config, "msm", 384'000).add_route(ALL_OUTPUTS, "mono", 0.5); // TODO: hook up, frequency unknown + + config.device_remove("k007232"); +} + void tmnt_state::punkshot(machine_config &config) { /* basic machine hardware */ @@ -2850,6 +2879,63 @@ ROM_START( tmntuc ) ROM_LOAD( "963a25.d5", 0x00000, 0x80000, CRC(fca078c7) SHA1(3e1124d72c9db4cb11d8de6c44b7aeca967f44e1) ) ROM_END +ROM_START( tmntucbl ) // bootleg board with Konami customs. Only the K007232 is substituted by an Oki M5205. There`s also an MC68705R3P lodged between the title song ROMs and the Oki ROMs. Function unknown (possibly driving the Oki?). + ROM_REGION( 0x60000, "maincpu", 0 ) // same as the original version H + ROM_LOAD16_BYTE( "ic215", 0x00000, 0x20000, CRC(718086e1) SHA1(6fd07a36195521be101782a05a9ecbcc5aaebbbd) ) + ROM_LOAD16_BYTE( "ic216", 0x00001, 0x20000, CRC(2f7d66e1) SHA1(53bd51458609662066b696f3edd19075e883bcde) ) + ROM_LOAD16_BYTE( "ic217", 0x40000, 0x10000, CRC(1944641e) SHA1(6664dbd9856d3d579a63c6537feef9a6e9bd09c5) ) + ROM_LOAD16_BYTE( "ic218", 0x40001, 0x10000, CRC(50ce5512) SHA1(641bf4d60a64f23cd3b52af983565dc6b38037c1) ) + + ROM_REGION( 0x8000, "audiocpu", 0 ) + ROM_LOAD( "ic233", 0x0000, 0x8000, CRC(de119176) SHA1(afd5c25b9c606132263d90c705d6d4c71e28776c) ) // very slightly adapted to run the Oki (or MC68705R3P?) instead of the K007232 + + ROM_REGION( 0x1000, "mcu", 0 ) + ROM_LOAD( "mc68705r3p", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x100000, "k052109", 0 ) // same as the original, just smaller ROMs on a daughter board + ROM_LOAD32_BYTE( "9", 0x00000, 0x20000, CRC(bd5df35c) SHA1(b0db3be16f3e18487834b0c877780cc440ca5292) ) + ROM_LOAD32_BYTE( "11", 0x00001, 0x20000, CRC(e26301ce) SHA1(fe34a9ee19d0e15b9d804d75117bcf12853070c4) ) + ROM_LOAD32_BYTE( "21", 0x00002, 0x20000, CRC(db335bb4) SHA1(ae222df7a1b31821f3ee0288ed6f5d9ebd99ba44) ) + ROM_LOAD32_BYTE( "23", 0x00003, 0x20000, CRC(d1d5efae) SHA1(c14429ebbbb356df3164df41763aa9f52e67a01a) ) + ROM_LOAD32_BYTE( "10", 0x80000, 0x20000, CRC(b9d026fe) SHA1(6b6b9c531042a25d152754a807ee822bdc4c35cd) ) + ROM_LOAD32_BYTE( "12", 0x80001, 0x20000, CRC(82eb6dae) SHA1(4d1e97be2d811bbbd8ec2ec5e6464f1e3208d97e) ) + ROM_LOAD32_BYTE( "22", 0x80002, 0x20000, CRC(f8f59c01) SHA1(afd16b355271c350e2b75b7f48c0dad5b7d4fd34) ) + ROM_LOAD32_BYTE( "24", 0x80003, 0x20000, CRC(e7068b0d) SHA1(4efe28768adb80e03fe1edd667822fa739e9437e) ) + + ROM_REGION( 0x200000, "k051960", 0 ) // same as the original, just smaller ROMs on a daughter board + ROM_LOAD32_BYTE( "1", 0x000000, 0x20000, CRC(eabb0238) SHA1(396ca9192e1d7921109897ef7906b93467473f62) ) + ROM_LOAD32_BYTE( "5", 0x000001, 0x20000, CRC(9330c763) SHA1(38b4808736d37bfb139add8746aabc6da83e6cc6) ) + ROM_LOAD32_BYTE( "13", 0x000002, 0x20000, CRC(9ab1eede) SHA1(9d1720e0cce374a390a38d00d54d35d3c80d1d8d) ) + ROM_LOAD32_BYTE( "17", 0x000003, 0x20000, CRC(9592f27f) SHA1(a19edef177f0feae8c29748d94d878ae4f172a9d) ) + ROM_LOAD32_BYTE( "2", 0x080000, 0x20000, CRC(4ba802e3) SHA1(5a5286087559846d06ed38e2fa93f64c1050787f) ) + ROM_LOAD32_BYTE( "6", 0x080001, 0x20000, CRC(641ea298) SHA1(f5ded36fd4779d987d9ef7c171191856813664b5) ) + ROM_LOAD32_BYTE( "14", 0x080002, 0x20000, CRC(777235a5) SHA1(8cd75c55b283a19c54b2007633b7d16878dd2773) ) + ROM_LOAD32_BYTE( "18", 0x080003, 0x20000, CRC(41c0c28c) SHA1(b5464024ba63eac1150542ea888ce3bea2932769) ) + ROM_LOAD32_BYTE( "3", 0x100000, 0x20000, CRC(159b5858) SHA1(e431f9d945ec0c21385ba9390ce350437f022191) ) + ROM_LOAD32_BYTE( "7", 0x100001, 0x20000, CRC(45a1bea8) SHA1(d90824afbda6af5cc86ca74aadd275c07d28f5e1) ) + ROM_LOAD32_BYTE( "15", 0x100002, 0x20000, CRC(748e66f9) SHA1(109cde6be2a25dae898092bca13b680d1665fc85) ) + ROM_LOAD32_BYTE( "19", 0x100003, 0x20000, CRC(9e6dd23b) SHA1(7c7080a9435a35f62b8203167b8d514e8a47b5b4) ) + ROM_LOAD32_BYTE( "4", 0x180000, 0x20000, CRC(7dde75ee) SHA1(1e4a85dd108218a8f7761724aecd6ef2f2af0a6e) ) + ROM_LOAD32_BYTE( "8", 0x180001, 0x20000, CRC(6337e146) SHA1(938aafbb60fd390b5c5c1bc93e9233b90a723e1b) ) + ROM_LOAD32_BYTE( "16", 0x180002, 0x20000, CRC(287f8d80) SHA1(7ea7b83662c0ef2af65f6c6b474ae4176ff6d71e) ) + ROM_LOAD32_BYTE( "20", 0x180003, 0x20000, CRC(bb675176) SHA1(8a106b1778101dbd900c287712cd53826791f0db) ) + + ROM_REGION( 0x200, "proms", 0 ) // not dumped for this set, but probably identical + ROM_LOAD( "963a30.g7", 0x000, 0x100, CRC(abd82680) SHA1(945a71e6ec65202f13209b45d45b616372d6c0f5) ) + ROM_LOAD( "963a31.g19", 0x100, 0x100, CRC(f8004a1c) SHA1(ed6694b8eebfe0238b50ebd05007d519f6e57b1b) ) + + ROM_REGION( 0x20000, "msm", 0 ) + ROM_LOAD( "ic252", 0x00000, 0x10000, CRC(cb916429) SHA1(41eff6e15890b45b5ea3b8cc3367891d87c3bf09) ) + ROM_LOAD( "ic253", 0x10000, 0x10000, CRC(c2d3b2c1) SHA1(d4d66cbfbbf5d3396aafedda99bfa2b06fafbf24) ) + + ROM_REGION( 0x20000, "upd", 0 ) + ROM_LOAD( "ic285", 0x00000, 0x20000, CRC(2dfd674b) SHA1(bbec5896c70056964fbc972a84bd5b0dfc6af257) ) // same as the original + + ROM_REGION( 0x80000, "title", 0 ) // why only the odd bytes? though the song seems to play fine as is.. + ROM_LOAD16_BYTE( "ic275", 0x00001, 0x20000, CRC(a021c0be) SHA1(f44ea6c56b8fae7aeff120ee6c2ca924086654be) ) // ic275 963a25.d5 [odd 1/2] IDENTICAL + ROM_LOAD16_BYTE( "ic274", 0x40001, 0x20000, CRC(9ff5f250) SHA1(53b75ca910c645ebb55002d70e3e1abd15db6d41) ) // ic274 963a25.d5 [odd 2/2] IDENTICAL +ROM_END + ROM_START( tmht ) ROM_REGION( 0x60000, "maincpu", 0 ) /* 2*128k and 2*64k for 68000 code */ ROM_LOAD16_BYTE( "963-f23.j17", 0x00000, 0x20000, CRC(9cb5e461) SHA1(b693e61070d6ce7ac59ff3f0a824cfefb37b33eb) ) @@ -4316,20 +4402,21 @@ GAME( 1989, cuebrick, 0, cuebrick, cuebrick, tmnt_state, init_cuebric GAME( 1989, mia, 0, mia, mia, tmnt_state, init_mia, ROT0, "Konami", "M.I.A. - Missing in Action (version T)", MACHINE_SUPPORTS_SAVE ) GAME( 1989, mia2, mia, mia, mia, tmnt_state, init_mia, ROT0, "Konami", "M.I.A. - Missing in Action (version S)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, tmnt, 0, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (World 4 Players, version X)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, tmntu, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (US 4 Players, version R)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, tmntua, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (US 4 Players, version N)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, tmntub, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (US 4 Players, version J)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, tmntuc, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (US 4 Players, version H)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, tmht, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Hero Turtles (UK 4 Players, version F)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, tmhta, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Hero Turtles (UK 4 Players, version S)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, tmhtb, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Hero Turtles (UK 4 Players, version ?)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, tmntj, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (Japan 4 Players, version 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, tmnta, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (Asia 4 Players, version ?)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, tmht2p, tmnt, tmnt, tmnt2p, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Hero Turtles (UK 2 Players, version U)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, tmht2pa, tmnt, tmnt, tmnt2p, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Hero Turtles (UK 2 Players, version ?)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, tmnt2pj, tmnt, tmnt, tmnt2p, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (Japan 2 Players, version 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, tmnt2po, tmnt, tmnt, tmnt2p, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (Oceania 2 Players, version ?)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, tmnt, 0, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (World 4 Players, version X)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, tmntu, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (US 4 Players, version R)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, tmntua, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (US 4 Players, version N)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, tmntub, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (US 4 Players, version J)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, tmntuc, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (US 4 Players, version H)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, tmntucbl, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "bootleg", "Teenage Mutant Ninja Turtles (bootleg, US 4 Players, version H)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // Needs MC68705R3P / Oki M5205 hook up +GAME( 1989, tmht, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Hero Turtles (UK 4 Players, version F)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, tmhta, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Hero Turtles (UK 4 Players, version S)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, tmhtb, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Hero Turtles (UK 4 Players, version ?)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, tmntj, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (Japan 4 Players, version 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, tmnta, tmnt, tmnt, tmnt, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (Asia 4 Players, version ?)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, tmht2p, tmnt, tmnt, tmnt2p, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Hero Turtles (UK 2 Players, version U)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, tmht2pa, tmnt, tmnt, tmnt2p, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Hero Turtles (UK 2 Players, version ?)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, tmnt2pj, tmnt, tmnt, tmnt2p, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (Japan 2 Players, version 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, tmnt2po, tmnt, tmnt, tmnt2p, tmnt_state, init_tmnt, ROT0, "Konami", "Teenage Mutant Ninja Turtles (Oceania 2 Players, version ?)", MACHINE_SUPPORTS_SAVE ) GAME( 1990, punkshot, 0, punkshot, punkshot, tmnt_state, empty_init, ROT0, "Konami", "Punk Shot (US 4 Players)", MACHINE_SUPPORTS_SAVE ) GAME( 1990, punkshot2, punkshot, punkshot, punksht2, tmnt_state, empty_init, ROT0, "Konami", "Punk Shot (US 2 Players)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/vis.cpp b/src/mame/drivers/vis.cpp index a87c984c563..d28f31bf162 100644 --- a/src/mame/drivers/vis.cpp +++ b/src/mame/drivers/vis.cpp @@ -264,6 +264,7 @@ vis_vga_device::vis_vga_device(const machine_config &mconfig, const char *tag, d device_isa16_card_interface(mconfig, *this) { set_screen(*this, "screen"); + set_vram_size(0x100000); } void vis_vga_device::device_add_mconfig(machine_config &config) diff --git a/src/mame/drivers/vsnes.cpp b/src/mame/drivers/vsnes.cpp index 66f8498a6ab..e5352b3c1a3 100644 --- a/src/mame/drivers/vsnes.cpp +++ b/src/mame/drivers/vsnes.cpp @@ -496,11 +496,11 @@ static INPUT_PORTS_START( vsnes_zapper ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_START("GUNX") /* FAKE - Gun X pos */ - PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) + PORT_START("GUNX") // FAKE - Gun X pos + PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_MINMAX(0, 255) - PORT_START("GUNY") /* FAKE - Gun Y pos */ - PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) + PORT_START("GUNY") // FAKE - Gun Y pos + PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) PORT_MINMAX(0, 239) INPUT_PORTS_END diff --git a/src/mame/includes/tmnt.h b/src/mame/includes/tmnt.h index f83dcad1491..81a1ba5ee3b 100644 --- a/src/mame/includes/tmnt.h +++ b/src/mame/includes/tmnt.h @@ -54,6 +54,7 @@ public: void thndrx2(machine_config &config); void sunsetbl(machine_config &config); void tmnt(machine_config &config); + void tmntucbl(machine_config &config); void mia(machine_config &config); void punkshot(machine_config &config); @@ -200,6 +201,7 @@ protected: void thndrx2_main_map(address_map &map); void tmnt2_main_map(address_map &map); void tmnt_audio_map(address_map &map); + void tmntucbl_audio_map(address_map &map); void tmnt_main_map(address_map &map); virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override; diff --git a/src/mame/layout/by6803.lay b/src/mame/layout/by6803.lay index 2dc42c17311..1782e7fff44 100644 --- a/src/mame/layout/by6803.lay +++ b/src/mame/layout/by6803.lay @@ -7,9 +7,9 @@ copyright-holders:Robbbert <mamelayout version="2"> <element name="digit" defstate="0"> - <led8seg_gts1> + <led14segsc> <color red="1.0" green="0.0" blue="0.0" /> - </led8seg_gts1> + </led14segsc> </element> <group name="score"> @@ -38,13 +38,13 @@ copyright-holders:Robbbert </group> <!-- Player 3 Score --> - <param name="s" value="22" /> + <param name="s" value="26" /> <group ref="score"> <bounds left="10" top="165" right="308" bottom="204" /> </group> <!-- Player 4 Score --> - <param name="s" value="29" /> + <param name="s" value="33" /> <group ref="score"> <bounds left="10" top="225" right="308" bottom="264" /> </group> diff --git a/src/mame/layout/by6803a.lay b/src/mame/layout/by6803a.lay new file mode 100644 index 00000000000..0b100f8ca6c --- /dev/null +++ b/src/mame/layout/by6803a.lay @@ -0,0 +1,144 @@ +<?xml version="1.0"?> +<!-- +license:CC0 +copyright-holders:Robbbert +--> + +<mamelayout version="2"> + + <element name="digit" defstate="0"> + <led14segsc> + <color red="1.0" green="0.0" blue="0.0" /> + </led14segsc> + </element> + <element name="diag" defstate="0"> + <led7seg> + <color red="1.0" green="0.0" blue="1.0" /> + </led7seg> + </element> + <element name="P0"><text string="Ball / Match"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <element name="P3"><text string="Player 1"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <element name="P4"><text string="Player 2"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + + <view name="Default Layout"> + <bounds left="0" top="20" right="318" bottom="394" /> + + <!-- LEDs --> + + <!-- Player 1 Score --> + + <element name="digit1" ref="digit"> + <bounds left="10" top="45" right="44" bottom="84" /> + </element> + <element name="digit2" ref="digit"> + <bounds left="54" top="45" right="88" bottom="84" /> + </element> + <element name="digit3" ref="digit"> + <bounds left="98" top="45" right="132" bottom="84" /> + </element> + <element name="digit4" ref="digit"> + <bounds left="142" top="45" right="176" bottom="84" /> + </element> + <element name="digit5" ref="digit"> + <bounds left="186" top="45" right="220" bottom="84" /> + </element> + <element name="digit6" ref="digit"> + <bounds left="230" top="45" right="264" bottom="84" /> + </element> + <element name="digit7" ref="digit"> + <bounds left="274" top="45" right="308" bottom="84" /> + </element> + + <!-- Player 2 Score --> + <element name="digit11" ref="digit"> + <bounds left="10" top="105" right="44" bottom="144" /> + </element> + <element name="digit12" ref="digit"> + <bounds left="54" top="105" right="88" bottom="144" /> + </element> + <element name="digit13" ref="digit"> + <bounds left="98" top="105" right="132" bottom="144" /> + </element> + <element name="digit14" ref="digit"> + <bounds left="142" top="105" right="176" bottom="144" /> + </element> + <element name="digit15" ref="digit"> + <bounds left="186" top="105" right="220" bottom="144" /> + </element> + <element name="digit16" ref="digit"> + <bounds left="230" top="105" right="264" bottom="144" /> + </element> + <element name="digit17" ref="digit"> + <bounds left="274" top="105" right="308" bottom="144" /> + </element> + + <!-- Player 3 Score --> + <element name="digit21" ref="digit"> + <bounds left="10" top="165" right="44" bottom="204" /> + </element> + <element name="digit22" ref="digit"> + <bounds left="54" top="165" right="88" bottom="204" /> + </element> + <element name="digit23" ref="digit"> + <bounds left="98" top="165" right="132" bottom="204" /> + </element> + <element name="digit24" ref="digit"> + <bounds left="142" top="165" right="176" bottom="204" /> + </element> + <element name="digit25" ref="digit"> + <bounds left="186" top="165" right="220" bottom="204" /> + </element> + <element name="digit26" ref="digit"> + <bounds left="230" top="165" right="264" bottom="204" /> + </element> + <element name="digit27" ref="digit"> + <bounds left="274" top="165" right="308" bottom="204" /> + </element> + + <!-- Player 4 Score --> + <element name="digit31" ref="digit"> + <bounds left="10" top="225" right="44" bottom="264" /> + </element> + <element name="digit32" ref="digit"> + <bounds left="54" top="225" right="88" bottom="264" /> + </element> + <element name="digit33" ref="digit"> + <bounds left="98" top="225" right="132" bottom="264" /> + </element> + <element name="digit34" ref="digit"> + <bounds left="142" top="225" right="176" bottom="264" /> + </element> + <element name="digit35" ref="digit"> + <bounds left="186" top="225" right="220" bottom="264" /> + </element> + <element name="digit36" ref="digit"> + <bounds left="230" top="225" right="264" bottom="264" /> + </element> + <element name="digit37" ref="digit"> + <bounds left="274" top="225" right="308" bottom="264" /> + </element> + + <!-- Credits and Balls --> + <element name="digit43" ref="digit"> + <bounds left="10" top="345" right="44" bottom="384" /> + </element> + <element name="digit44" ref="digit"> + <bounds left="54" top="345" right="88" bottom="384" /> + </element> + <element name="digit46" ref="digit"> + <bounds left="186" top="345" right="220" bottom="384" /> + </element> + <element name="digit47" ref="digit"> + <bounds left="230" top="345" right="264" bottom="384" /> + </element> + <element ref="P0"><bounds left="200" right="258" top="330" bottom="342" /></element> + <element ref="P1"><bounds left="30" right="88" top="330" bottom="342" /></element> + <element ref="P3"><bounds left="100" right="180" top="30" bottom="42" /></element> + <element ref="P4"><bounds left="100" right="180" top="90" bottom="102" /></element> + <element ref="P5"><bounds left="100" right="180" top="150" bottom="162" /></element> + <element ref="P6"><bounds left="100" right="180" top="210" bottom="222" /></element> + </view> +</mamelayout> diff --git a/src/mame/machine/pcshare.cpp b/src/mame/machine/pcshare.cpp index 899db29ee52..281c1ead46c 100644 --- a/src/mame/machine/pcshare.cpp +++ b/src/mame/machine/pcshare.cpp @@ -147,7 +147,9 @@ void pcat_base_state::pcvideo_vga(machine_config &config) screen.set_raw(25.1748_MHz_XTAL, 900, 0, 640, 526, 0, 480); screen.set_screen_update("vga", FUNC(vga_device::screen_update)); - VGA(config, "vga", 0).set_screen("screen"); + vga_device &vga(VGA(config, "vga", 0)); + vga.set_screen("screen"); + vga.set_vram_size(0x100000); } void pcat_base_state::pcvideo_trident_vga(machine_config &config) @@ -156,7 +158,9 @@ void pcat_base_state::pcvideo_trident_vga(machine_config &config) screen.set_raw(25.1748_MHz_XTAL, 900, 0, 640, 526, 0, 480); screen.set_screen_update("vga", FUNC(trident_vga_device::screen_update)); - TRIDENT_VGA(config, "vga", 0).set_screen("screen"); + trident_vga_device &vga(TRIDENT_VGA(config, "vga", 0)); + vga.set_screen("screen"); + vga.set_vram_size(0x200000); } void pcat_base_state::pcvideo_s3_vga(machine_config &config) @@ -165,7 +169,9 @@ void pcat_base_state::pcvideo_s3_vga(machine_config &config) screen.set_raw(25.1748_MHz_XTAL, 900, 0, 640, 526, 0, 480); screen.set_screen_update("vga", FUNC(s3_vga_device::screen_update)); - S3_VGA(config, "vga", 0).set_screen("screen"); + s3_vga_device &vga(S3_VGA(config, "vga", 0)); + vga.set_screen("screen"); + vga.set_vram_size(0x100000); } @@ -175,7 +181,10 @@ void pcat_base_state::pcvideo_cirrus_gd5428(machine_config &config) screen.set_raw(25.1748_MHz_XTAL, 900, 0, 640, 526, 0, 480); screen.set_screen_update("vga", FUNC(cirrus_gd5428_device::screen_update)); - CIRRUS_GD5428(config, "vga", 0).set_screen("screen"); + cirrus_gd5428_device &vga(CIRRUS_GD5428(config, "vga", 0)); + vga.set_screen("screen"); + vga.set_vram_size(0x200000); + } void pcat_base_state::pcvideo_cirrus_gd5430(machine_config &config) @@ -184,7 +193,10 @@ void pcat_base_state::pcvideo_cirrus_gd5430(machine_config &config) screen.set_raw(25.1748_MHz_XTAL, 900, 0, 640, 526, 0, 480); screen.set_screen_update("vga", FUNC(cirrus_gd5430_device::screen_update)); - CIRRUS_GD5430(config, "vga", 0).set_screen("screen"); + cirrus_gd5430_device &vga(CIRRUS_GD5430(config, "vga", 0)); + vga.set_screen("screen"); + vga.set_vram_size(0x200000); + } void pcat_base_state::pcat_common(machine_config &config) diff --git a/src/mame/machine/playch10.cpp b/src/mame/machine/playch10.cpp index 37708486976..ff3215ab4a5 100644 --- a/src/mame/machine/playch10.cpp +++ b/src/mame/machine/playch10.cpp @@ -212,50 +212,60 @@ uint8_t playch10_state::pc10_in0_r() uint8_t playch10_state::pc10_in1_r() { - int ret = (m_input_latch[1]) & 1; + int ret = m_input_latch[1] & 1; - /* shift */ + // shift m_input_latch[1] >>= 1; - /* do the gun thing */ + // do the gun thing if (m_pc10_gun_controller) { int trigger = ioport("P1")->read(); int x = ioport("GUNX")->read(); int y = ioport("GUNY")->read(); - /* no sprite hit (yet) */ - ret |= 0x08; + // effective range picked up by photodiode, i.e. gun position +- radius + constexpr int xrad = 0; + constexpr int yrad = 0; + // brightness threshold + constexpr int bright = 0x70; + // # of CRT scanlines that sustain brightness + constexpr int sustain = 20; + + int vpos = m_ppu->screen().vpos(); + int hpos = m_ppu->screen().hpos(); // update the screen if necessary if (!m_ppu->screen().vblank()) - { - int vpos = m_ppu->screen().vpos(); - int hpos = m_ppu->screen().hpos(); - - if (vpos > y || (vpos == y && hpos >= x)) + if (vpos > y - yrad || (vpos == y - yrad && hpos >= x - xrad)) m_ppu->screen().update_now(); - } - /* get the pixel at the gun position */ - rgb_t pix = m_ppu->screen().pixel(x, y); + // default to no light detected + ret |= 0x08; - /* look at the screen and see if the cursor is over a bright pixel */ - // FIXME: still a gross hack - if (pix.r() == 0xff && pix.b() == 0xff && pix.g() > 0x90) - { - ret &= ~0x08; /* sprite hit */ - } + // check brightness of pixels nearby the gun position + for (int i = x - xrad; i <= x + xrad; i++) + for (int j = y - yrad; j <= y + yrad; j++) + { + rgb_t pix = m_ppu->screen().pixel(i, j); - /* now, add the trigger if not masked */ + // only detect light if gun position is near, and behind, where the PPU is drawing on the CRT, from NesDev wiki: + // "Zap Ruder test ROM show that the photodiode stays on for about 26 scanlines with pure white, 24 scanlines with light gray, or 19 lines with dark gray." + if (j <= vpos && j > vpos - sustain && (j != vpos || i <= hpos) && pix.brightness() >= bright) + { + ret &= ~0x08; // light detected + i = x + xrad; + break; + } + } + + // now, add the trigger if not masked if (!m_cntrl_mask) - { ret |= (trigger & 2) << 3; - } } - /* some games expect bit 6 to be set because the last entry on the data bus shows up */ - /* in the unused upper 3 bits, so typically a read from $4016 leaves 0x40 there. */ + // some games expect bit 6 to be set because the last entry on the data bus shows up + // in the unused upper 3 bits, so typically a read from $4016 leaves 0x40 there. ret |= 0x40; return ret; diff --git a/src/mame/machine/vsnes.cpp b/src/mame/machine/vsnes.cpp index 3a22c4795c3..855dc5d9b27 100644 --- a/src/mame/machine/vsnes.cpp +++ b/src/mame/machine/vsnes.cpp @@ -259,71 +259,58 @@ void vsnes_state::init_vsnormal() } /**********************************************************************************/ -/* Gun games: VROM Banking in controller 0 write */ +// Gun games: VROM Banking in controller 0 write void vsnes_state::gun_in0_w(uint8_t data) { if (m_do_vrom_bank) { - /* switch vrom */ + // switch vrom v_set_videorom_bank(0, 8, (data & 4) ? 8 : 0); } - /* here we do things a little different */ + // here we do things a little different if (m_input_strobe[0] & ~data & 1) { - /* load up the latches */ + // load up the latches m_input_latch[0] = ioport("IN0")->read(); + m_input_latch[1] = ioport("IN1")->read(); - /* do the gun thing */ + // do the gun thing int x = ioport("GUNX")->read(); - float y = ioport("GUNY")->read(); + int y = ioport("GUNY")->read(); - y = y * 0.9375f; // scale 256 (our gun input range is 0 - 255) to 240 (screen visible area / bitmap we're using is 0 - 239) + // effective range picked up by photodiode, i.e. gun position +- radius + constexpr int xrad = 0; + constexpr int yrad = 0; + // brightness threshold + constexpr int bright = 0x70; + // # of CRT scanlines that sustain brightness + constexpr int sustain = 20; - uint8_t realy = (int)y; + int vpos = m_ppu1->screen().vpos(); + int hpos = m_ppu1->screen().hpos(); // update the screen if necessary if (!m_ppu1->screen().vblank()) - { - int vpos = m_ppu1->screen().vpos(); - int hpos = m_ppu1->screen().hpos(); - - if (vpos > realy || (vpos == realy && hpos >= x)) + if (vpos > y - yrad || (vpos == y - yrad && hpos >= x - xrad)) m_ppu1->screen().update_now(); - } - - /* get the pixel at the gun position */ - rgb_t col = m_ppu1->screen().pixel(x, realy); - uint8_t bright = col.brightness(); - // todo, calculate how bright it is with pix.r * 0.3 + pix.g * 0.59 + pix.b * 0.11 ? - // the mame calc above is uint8_t brightness() const { return (r() * 222 + g() * 707 + b() * 71) / 1000; } (from lib/util/palette.h) -#if 0 - uint8_t r = col.r(); - uint8_t g = col.g(); - uint8_t b = col.b(); - printf("pix is %02x %02x %02x | %02x\n", r,g,b,bright); -#endif - if (bright == 0xff) - { - m_input_latch[0] |= 0x40; - } - - -#if 0 // this is junk code, only works for NES palette.. - /* get the color base from the ppu */ - uint32_t color_base = 0; - - /* look at the screen and see if the cursor is over a bright pixel */ - if ((pix == color_base + 0x20 ) || (pix == color_base + 0x30) || - (pix == color_base + 0x33 ) || (pix == color_base + 0x34)) - { - m_input_latch[0] |= 0x40; - } -#endif + // check brightness of pixels nearby the gun position + for (int i = x - xrad; i <= x + xrad; i++) + for (int j = y - yrad; j <= y + yrad; j++) + { + rgb_t pix = m_ppu1->screen().pixel(i, j); - m_input_latch[1] = ioport("IN1")->read(); + // only detect light if gun position is near, and behind, where the PPU is drawing on the CRT, from NesDev wiki: + // "Zap Ruder test ROM show that the photodiode stays on for about 26 scanlines with pure white, 24 scanlines with light gray, or 19 lines with dark gray." + if (j <= vpos && j > vpos - sustain && (j != vpos || i <= hpos) && pix.brightness() >= bright) + { + m_input_latch[0] |= 0x40; + i = x + xrad; + break; + } + } } m_input_strobe[0] = data; diff --git a/src/mame/mame.lst b/src/mame/mame.lst index b67d977eab0..647532c2572 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -41563,6 +41563,7 @@ tmntu // GX963 (c) 1989 (US) tmntua // GX963 (c) 1989 (US) tmntub // GX963 (c) 1989 (US) tmntuc // GX963 (c) 1989 (US) +tmntucbl // bootleg trigon // GX939 (c) 1990 (Japan) @source:tmspoker.cpp |