From 5041861672ebf0bf11220ec4c76f02b0fbfe28e5 Mon Sep 17 00:00:00 2001 From: David Haywood <28625134+DavidHaywood@users.noreply.github.com> Date: Fri, 22 May 2020 13:07:53 +0100 Subject: [PATCH] some small GPL16250 tweaks / hacks so that tkmag220 and lazertag (after a long time) show some sprites with expected colours, which might help with further debugging (nw) (#6725) --- .../machine/generalplus_gpl16250soc.cpp | 32 ++++++++++++++++--- src/devices/machine/generalplus_gpl16250soc.h | 4 +++ .../machine/generalplus_gpl16250soc_video.cpp | 11 +++++-- .../machine/generalplus_gpl16250soc_video.h | 2 ++ src/mame/drivers/generalplus_gpl16250.cpp | 11 +++---- src/mame/drivers/generalplus_gpl16250_rom.cpp | 27 ++++++++++++++++ .../drivers/generalplus_gpl16250_romram.cpp | 7 +++- src/mame/includes/generalplus_gpl16250.h | 9 +++--- .../includes/generalplus_gpl16250_romram.h | 17 ++++++++++ 9 files changed, 101 insertions(+), 19 deletions(-) diff --git a/src/devices/machine/generalplus_gpl16250soc.cpp b/src/devices/machine/generalplus_gpl16250soc.cpp index c464ee28323..a58e838f27d 100644 --- a/src/devices/machine/generalplus_gpl16250soc.cpp +++ b/src/devices/machine/generalplus_gpl16250soc.cpp @@ -148,7 +148,7 @@ void sunplus_gcm394_base_device::trigger_systemm_dma(address_space &space, int c else if ((mode & 0x50) == 0x10) destdelta = -1; - LOGMASKED(LOG_GCM394_SYSDMA, "%s:possible DMA operation (7abf) with params mode:%04x source:%08x (word offset) dest:%08x (word offset) length:%08x (words) while csbank is %02x\n", machine().describe_context().c_str(), mode, source, dest, length, m_membankswitch_7810 ); + LOGMASKED(LOG_GCM394_SYSDMA, "%s:possible DMA operation with params mode:%04x source:%08x (word offset) dest:%08x (word offset) length:%08x (words) while csbank is %02x\n", machine().describe_context().c_str(), mode, source, dest, length, m_membankswitch_7810 ); // wrlshunt transfers ROM to RAM, all RAM write addresses have 0x800000 in the destination set @@ -560,11 +560,33 @@ READ16_MEMBER(sunplus_gcm394_base_device::unkarea_78d8_r) // **************************************** 793x uknown region stubs ************************************************* -READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7934_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7934_r\n", machine().describe_context()); return 0x0000; } -WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7934_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7934_w %04x\n", machine().describe_context(), data); m_7934 = data; } +READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7904_r) +{ + LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7904_r\n", machine().describe_context()); + return machine().rand(); // lazertag waits on a bit, status flag for something? + +} + +READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7934_r) +{ + // does this return data written, or is it a status flag? + LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7934_r\n", machine().describe_context()); + return m_7934; +} + +WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7934_w) +{ + LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7934_w %04x\n", machine().describe_context(), data); + m_7934 = data; +} // value of 7935 is read then written in irq6, nothing happens unless bit 0x0100 was set, which could be some kind of irq source being acked? -READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7935_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7935_r\n", machine().describe_context()); return m_7935; } +READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7935_r) +{ + LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7935_r\n", machine().describe_context()); + return m_7935; +} + WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7935_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7935_w %04x\n", machine().describe_context(), data); @@ -836,6 +858,8 @@ void sunplus_gcm394_base_device::base_internal_map(address_map &map) // 793x - misc? // ###################################################################################################################################################################################### + map(0x007904, 0x007904).r(FUNC(sunplus_gcm394_base_device::unkarea_7904_r)); // lazertag after a while + // possible rtc? map(0x007934, 0x007934).rw(FUNC(sunplus_gcm394_base_device::unkarea_7934_r), FUNC(sunplus_gcm394_base_device::unkarea_7934_w)); map(0x007935, 0x007935).rw(FUNC(sunplus_gcm394_base_device::unkarea_7935_r), FUNC(sunplus_gcm394_base_device::unkarea_7935_w)); diff --git a/src/devices/machine/generalplus_gpl16250soc.h b/src/devices/machine/generalplus_gpl16250soc.h index 56bcfb6db7d..65d2cefe627 100644 --- a/src/devices/machine/generalplus_gpl16250soc.h +++ b/src/devices/machine/generalplus_gpl16250soc.h @@ -75,6 +75,8 @@ public: void set_paldisplaybank_high_hack(int pal_displaybank_high) { m_spg_video->set_paldisplaybank_high(pal_displaybank_high); } void set_alt_tile_addressing_hack(int alt_tile_addressing) { m_spg_video->set_alt_tile_addressing(alt_tile_addressing); } + void set_pal_sprites_hack(int pal_sprites) { m_spg_video->set_pal_sprites(pal_sprites); } + void set_romtype(int romtype) { m_romtype = romtype; } protected: @@ -291,6 +293,8 @@ private: DECLARE_WRITE16_MEMBER(unkarea_78f0_w); + DECLARE_READ16_MEMBER(unkarea_7904_r); + DECLARE_READ16_MEMBER(unkarea_7934_r); DECLARE_WRITE16_MEMBER(unkarea_7934_w); diff --git a/src/devices/machine/generalplus_gpl16250soc_video.cpp b/src/devices/machine/generalplus_gpl16250soc_video.cpp index bc084dbd877..bd0d46524d2 100644 --- a/src/devices/machine/generalplus_gpl16250soc_video.cpp +++ b/src/devices/machine/generalplus_gpl16250soc_video.cpp @@ -111,7 +111,7 @@ DEFINE_DEVICE_TYPE(GCM394_VIDEO, gcm394_video_device, "gcm394_video", "GeneralPl #define LOG_GCM394_TMAP (1U << 2) #define LOG_GCM394_VIDEO (1U << 1) -#define VERBOSE (LOG_GCM394_TMAP | LOG_GCM394_VIDEO_DMA | LOG_GCM394_VIDEO) +#define VERBOSE (LOG_GCM394_TMAP | LOG_GCM394_VIDEO_DMA | LOG_GCM394_VIDEO |LOG_GCM394_VIDEO_PALETTE) #include "logmacro.h" @@ -130,6 +130,7 @@ gcm394_base_video_device::gcm394_base_video_device(const machine_config &mconfig m_rowscroll(*this, "^rowscroll"), m_rowzoom(*this, "^rowzoom"), m_pal_displaybank_high(0), + m_pal_sprites(0x500), m_alt_tile_addressing(0) { } @@ -392,7 +393,7 @@ void gcm394_base_video_device::device_reset() m_spriteram[i] = 0x0000; } - for (int i=0;i<0x100;i++) + for (int i=0;i<0x100 * 0x10;i++) m_paletteram[i] = machine().rand()&0x7fff; @@ -504,6 +505,7 @@ void gcm394_base_video_device::draw(const rectangle &cliprect, uint32_t line, ui int current_palette_offset = palette_offset; + // for planes above 4bpp palette ends up being pulled from different places? if (nc_bpp < 6) { @@ -883,7 +885,7 @@ void gcm394_base_video_device::draw_sprite(const rectangle& cliprect, uint32_t s } //palette_offset |= 0x0d00; - palette_offset |= 0x0500; + palette_offset |= m_pal_sprites; if (blend) { @@ -1412,6 +1414,9 @@ READ16_MEMBER(gcm394_base_video_device::video_703a_palettebank_r) WRITE16_MEMBER(gcm394_base_video_device::video_703a_palettebank_w) { + // I don't think bit 1 is a bank select, it might be a 'mode select' for how the palette operates. + // neither lazertag or tkmag220 set it, and they only use 2 banks (0 and 8) + LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_703a_palettebank_w %04x\n", machine().describe_context(), data); m_703a_palettebank = data; } diff --git a/src/devices/machine/generalplus_gpl16250soc_video.h b/src/devices/machine/generalplus_gpl16250soc_video.h index 09c23484fde..26103217c8b 100644 --- a/src/devices/machine/generalplus_gpl16250soc_video.h +++ b/src/devices/machine/generalplus_gpl16250soc_video.h @@ -32,6 +32,7 @@ public: void set_paldisplaybank_high(int pal_displaybank_high) { m_pal_displaybank_high = pal_displaybank_high; } void set_alt_tile_addressing(int alt_tile_addressing) { m_alt_tile_addressing = alt_tile_addressing; } + void set_pal_sprites(int pal_sprites) { m_pal_sprites = pal_sprites; } DECLARE_READ16_MEMBER(tmap0_regs_r); DECLARE_WRITE16_MEMBER(tmap0_regs_w); @@ -269,6 +270,7 @@ protected: void decodegfx(const char* tag); int m_pal_displaybank_high; + int m_pal_sprites; int m_alt_tile_addressing; }; diff --git a/src/mame/drivers/generalplus_gpl16250.cpp b/src/mame/drivers/generalplus_gpl16250.cpp index 92ee049bc92..f444f958735 100644 --- a/src/mame/drivers/generalplus_gpl16250.cpp +++ b/src/mame/drivers/generalplus_gpl16250.cpp @@ -61,6 +61,10 @@ jak_hmhsm : uses the standard JAKKS code (on first screen - Hold Up, Hold A, Release Up, Down) the High School Musical part has its own test mode which tests a different part of the ROM, use the same code but after selecting the game from menu + + --- the individual CS spaces could (and probably should?) be done with a bunch of extra memory spaces rather than the cs0_r / cs0_w etc. but that would mean yet + another trip through the memory system for almost everything and at ~100Mhz that is slow. + */ #include "emu.h" @@ -159,14 +163,7 @@ void gcm394_game_state::base(machine_config &config) } -void tkmag220_game_state::tkmag220(machine_config &config) -{ - gcm394_game_state::base(config); - m_maincpu->porta_in().set_ioport("IN0"); - m_maincpu->portb_in().set_ioport("IN1"); - m_maincpu->portc_in().set_ioport("IN2"); -} void gcm394_game_state::machine_start() { diff --git a/src/mame/drivers/generalplus_gpl16250_rom.cpp b/src/mame/drivers/generalplus_gpl16250_rom.cpp index 718d83a3e13..26b93427143 100644 --- a/src/mame/drivers/generalplus_gpl16250_rom.cpp +++ b/src/mame/drivers/generalplus_gpl16250_rom.cpp @@ -415,6 +415,33 @@ ROM_END +void tkmag220_game_state::tkmag220(machine_config &config) +{ + gcm394_game_state::base(config); + + m_maincpu->porta_in().set_ioport("IN0"); + m_maincpu->portb_in().set_ioport("IN1"); + m_maincpu->portc_in().set_ioport("IN2"); +} + +READ16_MEMBER(tkmag220_game_state::cs0_r) +{ + // [:] installing cs0 handler start_address 00000000 end_address 007fffff + return m_romregion[(offset & 0x07fffff) + m_upperbase]; +} + + +void tkmag220_game_state::machine_reset() +{ + // as with the Family Sport multi-game versions on spg2xx hardware, there are actually 8 programs in here, externally banked + // each of those programs is 16MBytes, so is either going to have the upper half banked externally like the older hardware types, os possibly using the CS registers on this hardware type + m_upperbase = 0 * (0x1000000 / 2); + gcm394_game_state::machine_reset(); + + m_maincpu->set_paldisplaybank_high_hack(0); + m_maincpu->set_pal_sprites_hack(0x000); +} + // the JAKKS ones of these seem to be known as 'Generalplus GPAC500' hardware? CONS(2009, smartfp, 0, 0, base, smartfp, gcm394_game_state, empty_init, "Fisher-Price", "Fun 2 Learn Smart Fit Park (UK)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) diff --git a/src/mame/drivers/generalplus_gpl16250_romram.cpp b/src/mame/drivers/generalplus_gpl16250_romram.cpp index 2bf72b718fd..0c2ef2d3adc 100644 --- a/src/mame/drivers/generalplus_gpl16250_romram.cpp +++ b/src/mame/drivers/generalplus_gpl16250_romram.cpp @@ -314,6 +314,11 @@ void jak_s500_game_state::machine_reset() } +void lazertag_game_state::machine_reset() +{ + jak_s500_game_state::machine_reset(); + m_maincpu->set_pal_sprites_hack(0x800); +} @@ -485,7 +490,7 @@ which is also found in the Wireless Air 60 ROM. // also sold as "Pac-Man Connect & Play 35th Anniversary" (same ROM?) CONS(2012, paccon, 0, 0, paccon, paccon, jak_s500_game_state, init_wrlshunt, "Bandai", "Pac-Man Connect & Play (Feb 14 2012 10:46:23)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) -CONS(2008, lazertag, 0, 0, wrlshunt, jak_s500, jak_s500_game_state, init_wrlshunt, "Tiger Electronics", "Lazer Tag Video Game Module", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) +CONS(2008, lazertag, 0, 0, wrlshunt, jak_s500, lazertag_game_state, init_wrlshunt, "Tiger Electronics", "Lazer Tag Video Game Module", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) CONS(2009, jak_s500, 0, 0, wrlshunt, jak_s500, jak_s500_game_state, init_wrlshunt, "JAKKS Pacific Inc / HotGen Ltd", "SpongeBob SquarePants Bikini Bottom 500 (JAKKS Pacific TV Motion Game)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) CONS(2009, jak_smwm, 0, 0, wrlshunt, jak_s500, jak_s500_game_state, init_wrlshunt, "JAKKS Pacific Inc / HotGen Ltd", "Spider-Man Web Master (JAKKS Pacific TV Motion Game)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) diff --git a/src/mame/includes/generalplus_gpl16250.h b/src/mame/includes/generalplus_gpl16250.h index 61a49161036..dbbc1076c48 100644 --- a/src/mame/includes/generalplus_gpl16250.h +++ b/src/mame/includes/generalplus_gpl16250.h @@ -86,6 +86,8 @@ public: protected: + virtual void machine_reset() override; + /* virtual DECLARE_READ16_MEMBER(porta_r) override { @@ -103,11 +105,10 @@ protected: */ private: + int m_upperbase; + + virtual DECLARE_READ16_MEMBER(cs0_r) override; - virtual DECLARE_READ16_MEMBER(cs0_r) override - { - return m_romregion[offset & 0x3ffffff]; - } }; diff --git a/src/mame/includes/generalplus_gpl16250_romram.h b/src/mame/includes/generalplus_gpl16250_romram.h index 59c7ed11747..1f1b25c96ba 100644 --- a/src/mame/includes/generalplus_gpl16250_romram.h +++ b/src/mame/includes/generalplus_gpl16250_romram.h @@ -69,6 +69,23 @@ protected: private: }; +class lazertag_game_state : public jak_s500_game_state +{ +public: + lazertag_game_state(const machine_config& mconfig, device_type type, const char* tag) : + jak_s500_game_state(mconfig, type, tag) + { + } + +protected: + //virtual void machine_start() override; + virtual void machine_reset() override; + +private: +}; + + + #endif // MAME_INCLUDES_GENERALPLUS_GPL16250_ROMRAM_H