From f154a9bf728a5d47fcbd350e4fb0ea000f19b2d6 Mon Sep 17 00:00:00 2001 From: mooglyguy Date: Sat, 6 Oct 2018 23:16:54 +0200 Subject: spg2xx: Split into SPG24x and SPG28x variants to handle different sprite limit in rad_crik, nw --- src/devices/machine/spg2xx.cpp | 19 +++++++++++---- src/devices/machine/spg2xx.h | 48 +++++++++++++++++++++++++++++-------- src/mame/drivers/vii.cpp | 54 ++++++++++++++++++++++++++++++++++-------- 3 files changed, 97 insertions(+), 24 deletions(-) diff --git a/src/devices/machine/spg2xx.cpp b/src/devices/machine/spg2xx.cpp index d703ffcf98d..d14d28a3d18 100644 --- a/src/devices/machine/spg2xx.cpp +++ b/src/devices/machine/spg2xx.cpp @@ -13,7 +13,8 @@ #include "spg2xx.h" -DEFINE_DEVICE_TYPE(SPG2XX, spg2xx_device, "spg2xx", "SPG200-series System-on-a-Chip") +DEFINE_DEVICE_TYPE(SPG24X, spg24x_device, "spg24x", "SPG240-series System-on-a-Chip") +DEFINE_DEVICE_TYPE(SPG28X, spg28x_device, "spg28x", "SPG280-series System-on-a-Chip") #define VERBOSE_LEVEL (4) @@ -41,8 +42,8 @@ inline void spg2xx_device::verboselog(int n_level, const char *s_fmt, ...) #define VIDEO_IRQ_ENABLE m_video_regs[0x62] #define VIDEO_IRQ_STATUS m_video_regs[0x63] -spg2xx_device::spg2xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, SPG2XX, tag, owner, clock) +spg2xx_device::spg2xx_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, type, tag, owner, clock) , m_porta_out(*this) , m_portb_out(*this) , m_portc_out(*this) @@ -61,6 +62,16 @@ spg2xx_device::spg2xx_device(const machine_config &mconfig, const char *tag, dev { } +spg24x_device::spg24x_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : spg2xx_device(mconfig, SPG24X, tag, owner, clock, 256) +{ +} + +spg28x_device::spg28x_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : spg2xx_device(mconfig, SPG28X, tag, owner, clock, 64) +{ +} + void spg2xx_device::map(address_map &map) { map(0x000000, 0x0027ff).ram(); @@ -362,7 +373,7 @@ void spg2xx_device::blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect if (!m_debug_sprites) { #endif - for (uint32_t n = 0; n < 256; n++) + for (uint32_t n = 0; n < m_sprite_limit; n++) { blit_sprite(bitmap, cliprect, depth, 0x2c00 + 4 * n); } diff --git a/src/devices/machine/spg2xx.h b/src/devices/machine/spg2xx.h index e5cc86d6ca3..61b564df2fb 100644 --- a/src/devices/machine/spg2xx.h +++ b/src/devices/machine/spg2xx.h @@ -23,15 +23,7 @@ class spg2xx_device : public device_t { public: - template - spg2xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu_tag, U &&screen_tag) - : spg2xx_device(mconfig, tag, owner, clock) - { - m_cpu.set_tag(std::forward(cpu_tag)); - m_screen.set_tag(std::forward(screen_tag)); - } - - spg2xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + spg2xx_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); void map(address_map &map); @@ -52,6 +44,12 @@ public: DECLARE_WRITE_LINE_MEMBER(vblank); protected: + spg2xx_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const size_t sprite_limit) + : spg2xx_device(mconfig, type, tag, owner, clock) + { + m_sprite_limit = sprite_limit; + } + enum { PAGE_ENABLE_MASK = 0x0008, @@ -121,6 +119,7 @@ protected: uint16_t m_video_regs[0x100]; uint16_t m_io_regs[0x200]; + size_t m_sprite_limit; devcb_write16 m_porta_out; devcb_write16 m_portb_out; @@ -146,6 +145,35 @@ protected: required_shared_ptr m_spriteram; }; -DECLARE_DEVICE_TYPE(SPG2XX, spg2xx_device) +class spg24x_device : public spg2xx_device +{ +public: + template + spg24x_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu_tag, U &&screen_tag) + : spg24x_device(mconfig, tag, owner, clock) + { + m_cpu.set_tag(std::forward(cpu_tag)); + m_screen.set_tag(std::forward(screen_tag)); + } + + spg24x_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + +class spg28x_device : public spg2xx_device +{ +public: + template + spg28x_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu_tag, U &&screen_tag) + : spg28x_device(mconfig, tag, owner, clock) + { + m_cpu.set_tag(std::forward(cpu_tag)); + m_screen.set_tag(std::forward(screen_tag)); + } + + spg28x_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + +DECLARE_DEVICE_TYPE(SPG24X, spg24x_device) +DECLARE_DEVICE_TYPE(SPG28X, spg28x_device) #endif // DEVICES_MACHINE_SPG2XX_H diff --git a/src/mame/drivers/vii.cpp b/src/mame/drivers/vii.cpp index 65f9d34f06f..677be8bccbe 100644 --- a/src/mame/drivers/vii.cpp +++ b/src/mame/drivers/vii.cpp @@ -79,10 +79,10 @@ public: spg2xx_game_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , device_nvram_interface(mconfig, *this) - , m_spg(*this, "spg") - , m_bank(*this, "cart") , m_maincpu(*this, "maincpu") , m_screen(*this, "screen") + , m_spg(*this, "spg") + , m_bank(*this, "cart") , m_io_p1(*this, "P1") , m_io_p2(*this, "P2") , m_io_p3(*this, "P3") @@ -96,6 +96,8 @@ public: void jakks(machine_config &config); void wireless60(machine_config &config); void rad_skat(machine_config &config); + void rad_crik(machine_config &config); + void non_spg_base(machine_config &config); void init_rad_crik(); @@ -116,6 +118,8 @@ protected: DECLARE_WRITE_LINE_MEMBER(poll_controls); + required_device m_maincpu; + required_device m_screen; required_device m_spg; required_memory_bank m_bank; @@ -139,8 +143,6 @@ private: inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3, 4); - required_device m_maincpu; - required_device m_screen; required_ioport m_io_p1; optional_ioport m_io_p2; optional_ioport m_io_p3; @@ -625,9 +627,13 @@ void spg2xx_game_state::spg2xx_base(machine_config &config) m_screen->set_screen_update("spg", FUNC(spg2xx_device::screen_update)); m_screen->screen_vblank().set(m_spg, FUNC(spg2xx_device::vblank)); m_screen->screen_vblank().append(FUNC(spg2xx_game_state::poll_controls)); +} - SPG2XX(config, m_spg, XTAL(27'000'000), m_maincpu, m_screen); - m_spg->uart_rx().set(FUNC(spg2xx_game_state::uart_rx)); +void spg2xx_game_state::non_spg_base(machine_config &config) +{ + spg2xx_base(config); + + SPG24X(config, m_spg, XTAL(27'000'000), m_maincpu, m_screen); } void spg2xx_game_state::spg2xx_basep(machine_config &config) @@ -642,6 +648,8 @@ void spg2xx_cart_state::vii(machine_config &config) { spg2xx_base(config); + SPG24X(config, m_spg, XTAL(27'000'000), m_maincpu, m_screen); + m_spg->uart_rx().set(FUNC(spg2xx_cart_state::uart_rx)); m_spg->portb_out().set(FUNC(spg2xx_cart_state::vii_portb_w)); GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "vii_cart"); @@ -655,6 +663,9 @@ void spg2xx_cart_state::vsmile(machine_config &config) { spg2xx_base(config); + SPG24X(config, m_spg, XTAL(27'000'000), m_maincpu, m_screen); + m_spg->uart_rx().set(FUNC(spg2xx_cart_state::uart_rx)); + GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "vsmile_cart"); m_cart->set_width(GENERIC_ROM16_WIDTH); m_cart->set_device_load(device_image_load_delegate(&spg2xx_cart_state::device_image_load_vsmile_cart, this)); @@ -666,6 +677,9 @@ void spg2xx_game_state::wireless60(machine_config &config) { spg2xx_base(config); + SPG24X(config, m_spg, XTAL(27'000'000), m_maincpu, m_screen); + m_spg->uart_rx().set(FUNC(spg2xx_game_state::uart_rx)); + m_spg->porta_out().set(FUNC(spg2xx_game_state::wireless60_porta_w)); m_spg->portb_out().set(FUNC(spg2xx_game_state::wireless60_portb_w)); m_spg->porta_in().set(FUNC(spg2xx_game_state::wireless60_porta_r)); @@ -674,13 +688,33 @@ void spg2xx_game_state::wireless60(machine_config &config) void spg2xx_game_state::jakks(machine_config &config) { spg2xx_base(config); + + SPG24X(config, m_spg, XTAL(27'000'000), m_maincpu, m_screen); + m_spg->uart_rx().set(FUNC(spg2xx_game_state::uart_rx)); m_spg->porta_in().set(FUNC(spg2xx_cart_state::jakks_porta_r)); + I2CMEM(config, "i2cmem", 0).set_data_size(0x200); } void spg2xx_game_state::rad_skat(machine_config &config) { spg2xx_base(config); + + SPG24X(config, m_spg, XTAL(27'000'000), m_maincpu, m_screen); + m_spg->uart_rx().set(FUNC(spg2xx_game_state::uart_rx)); + m_spg->porta_in().set_ioport("P1"); + m_spg->portb_in().set_ioport("P2"); + m_spg->portc_in().set_ioport("P3"); + m_spg->eeprom_w().set(FUNC(spg2xx_game_state::eeprom_w)); + m_spg->eeprom_r().set(FUNC(spg2xx_game_state::eeprom_r)); +} + +void spg2xx_game_state::rad_crik(machine_config &config) +{ + spg2xx_base(config); + + SPG28X(config, m_spg, XTAL(27'000'000), m_maincpu, m_screen); + m_spg->uart_rx().set(FUNC(spg2xx_game_state::uart_rx)); m_spg->porta_in().set_ioport("P1"); m_spg->portb_in().set_ioport("P2"); m_spg->portc_in().set_ioport("P3"); @@ -910,12 +944,12 @@ CONS( 2008, walle, 0, 0, jakks, walle, spg2xx_game_state, empty_init, "JAKKS // Radica TV games CONS( 2006, rad_skat, 0, 0, rad_skat, rad_skat, spg2xx_game_state, empty_init, "Radica", "Play TV Skateboarder (NTSC)", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS ) CONS( 2006, rad_skatp, rad_skat, 0, rad_skat, rad_skatp, spg2xx_game_state, empty_init, "Radica", "Connectv Skateboarder (PAL)", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS ) -CONS( 2006, rad_crik, 0, 0, rad_skat, rad_crik, spg2xx_game_state, empty_init, "Radica", "Connectv Cricket (PAL)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) // Version 3.00 20/03/06 is listed in INTERNAL TEST +CONS( 2006, rad_crik, 0, 0, rad_crik, rad_crik, spg2xx_game_state, empty_init, "Radica", "Connectv Cricket (PAL)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) // Version 3.00 20/03/06 is listed in INTERNAL TEST CONS( 2007, rad_sktv, 0, 0, rad_skat, rad_sktv, spg2xx_game_state, empty_init, "Radica", "Skannerz TV", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) // might not fit here. First 0x8000 bytes are blank (not too uncommon for these) then rest of rom looks like it's probably encrypted at least -CONS( 2009, zone40, 0, 0, spg2xx_base, wirels60, spg2xx_game_state, empty_init, "Jungle Soft / Ultimate Products (HK) Ltd", "Zone 40", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) +CONS( 2009, zone40, 0, 0, non_spg_base, wirels60, spg2xx_game_state, empty_init, "Jungle Soft / Ultimate Products (HK) Ltd", "Zone 40", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) // NAND dumps w/ internal bootstrap. Almost certainly do not fit in this driver, as the SPG2xx can only address up to 4Mwords. -CONS( 2010, wlsair60, 0, 0, spg2xx_base, wirels60, spg2xx_game_state, empty_init, "Jungle Soft / Kids Station Toys Inc", "Wireless Air 60", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) -CONS( 2011, wrlshunt, 0, 0, spg2xx_base, wirels60, spg2xx_game_state, empty_init, "Hamy / Kids Station Toys Inc", "Wireless: Hunting Video Game System", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) +CONS( 2010, wlsair60, 0, 0, non_spg_base, wirels60, spg2xx_game_state, empty_init, "Jungle Soft / Kids Station Toys Inc", "Wireless Air 60", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) +CONS( 2011, wrlshunt, 0, 0, non_spg_base, wirels60, spg2xx_game_state, empty_init, "Hamy / Kids Station Toys Inc", "Wireless: Hunting Video Game System", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) -- cgit v1.2.3