From a3941f4d551dbb95a213d4f4237866f407b33eca Mon Sep 17 00:00:00 2001 From: cam900 Date: Wed, 1 Jan 2025 02:03:58 +0900 Subject: namco/namco_cus4xtmap.cpp: Converted CUS42 + CUS43 tilemap hardware to a device. (#13095) * namco/baraduke.cpp: - Use video/resnet.h for palette initialization. and simplified graphics decoding layout. - Corrected order of address map entries. * namco/namcos86.cpp: - Use video/resnet.h for palette initialization, and use the palette device's indirection features. - Simplified graphics decoding layout and reduced tun-time tag lookups. - Corrected order of address map entries. - Cleaned up code. --- src/mame/namco/baraduke.cpp | 223 +++++++++------------- src/mame/namco/namco_cus4xtmap.cpp | 119 ++++++++++++ src/mame/namco/namco_cus4xtmap.h | 73 ++++++++ src/mame/namco/namcos86.cpp | 373 ++++++++++++++++++------------------- src/mame/namco/namcos86.h | 66 +++---- src/mame/namco/namcos86_v.cpp | 263 +++++++++----------------- 6 files changed, 572 insertions(+), 545 deletions(-) create mode 100644 src/mame/namco/namco_cus4xtmap.cpp create mode 100644 src/mame/namco/namco_cus4xtmap.h diff --git a/src/mame/namco/baraduke.cpp b/src/mame/namco/baraduke.cpp index 8500cd479fb..ce8c717ce0f 100644 --- a/src/mame/namco/baraduke.cpp +++ b/src/mame/namco/baraduke.cpp @@ -107,10 +107,13 @@ DIP locations verified for: #include "emu.h" +#include "namco_cus4xtmap.h" + #include "cpu/m6800/m6801.h" #include "cpu/m6809/m6809.h" #include "machine/watchdog.h" #include "sound/namco.h" +#include "video/resnet.h" #include "emupal.h" #include "screen.h" @@ -126,11 +129,11 @@ public: baraduke_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_spriteram(*this, "spriteram"), - m_videoram(*this, "videoram"), m_textram(*this, "textram"), m_maincpu(*this, "maincpu"), m_mcu(*this, "mcu"), m_cus30(*this, "namco"), + m_tilegen(*this, "tilegen"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_in(*this, "IN%u", 0U), @@ -139,8 +142,8 @@ public: m_lamps(*this, "lamp%u", 0U) { } - void init_baraduke(); - void baraduke(machine_config &config); + void init_baraduke() ATTR_COLD; + void baraduke(machine_config &config) ATTR_COLD; protected: virtual void machine_start() override ATTR_COLD; @@ -151,29 +154,25 @@ private: uint8_t inputport_r(); void lamps_w(uint8_t data); void irq_ack_w(uint8_t data); - void videoram_w(offs_t offset, uint8_t data); void textram_w(offs_t offset, uint8_t data); - template void scroll_w(offs_t offset, uint8_t data); void spriteram_w(offs_t offset, uint8_t data); TILEMAP_MAPPER_MEMBER(tx_tilemap_scan); TILE_GET_INFO_MEMBER(tx_get_tile_info); - TILE_GET_INFO_MEMBER(get_tile_info0); - TILE_GET_INFO_MEMBER(get_tile_info1); - void palette(palette_device &palette) const; + void tile_cb(u8 layer, u8 &gfxno, u32 &code); + void palette(palette_device &palette) const ATTR_COLD; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_vblank(int state); void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void set_scroll(int layer); void main_map(address_map &map) ATTR_COLD; void mcu_map(address_map &map) ATTR_COLD; required_shared_ptr m_spriteram; - required_shared_ptr m_videoram; required_shared_ptr m_textram; required_device m_maincpu; required_device m_mcu; required_device m_cus30; + required_device m_tilegen; required_device m_gfxdecode; required_device m_palette; @@ -184,9 +183,6 @@ private: uint8_t m_inputport_selected = 0; tilemap_t *m_tx_tilemap = nullptr; - tilemap_t *m_bg_tilemap[2]{}; - uint16_t m_xscroll[2]{}; - uint8_t m_yscroll[2]{}; bool m_copy_sprites = false; }; @@ -197,44 +193,60 @@ private: The palette PROMs are connected to the RGB output this way: - bit 3 -- 220 ohm resistor -- RED/GREEN/BLUE - -- 470 ohm resistor -- RED/GREEN/BLUE - -- 1 kohm resistor -- RED/GREEN/BLUE - bit 0 -- 2.2kohm resistor -- RED/GREEN/BLUE + bit 7 -- 220 ohm resistor -- BLUE + -- 470 ohm resistor -- BLUE + -- 1 kohm resistor -- BLUE + -- 2.2kohm resistor -- BLUE + -- 220 ohm resistor -- GREEN + -- 470 ohm resistor -- GREEN + -- 1 kohm resistor -- GREEN + bit 0 -- 2.2kohm resistor -- GREEN + + bit 3 -- 220 ohm resistor -- RED + -- 470 ohm resistor -- RED + -- 1 kohm resistor -- RED + bit 0 -- 2.2kohm resistor -- RED ***************************************************************************/ void baraduke_state::palette(palette_device &palette) const { - const uint8_t *color_prom = memregion("proms")->base(); + uint8_t const *const color_prom = memregion("proms")->base(); + static constexpr int resistances[4] = { 2200, 1000, 470, 220 }; + + // compute the color output resistor weights + double rweights[4], gweights[4], bweights[4]; + compute_resistor_weights(0, 255, -1.0, + 4, &resistances[0], rweights, 0, 0, + 4, &resistances[0], gweights, 0, 0, + 4, &resistances[0], bweights, 0, 0); for (int i = 0; i < 2048; i++) { int bit0, bit1, bit2, bit3; // red component - bit0 = BIT(color_prom[2048], 0); - bit1 = BIT(color_prom[2048], 1); - bit2 = BIT(color_prom[2048], 2); - bit3 = BIT(color_prom[2048], 3); - int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + bit0 = BIT(color_prom[i | 0x800], 0); + bit1 = BIT(color_prom[i | 0x800], 1); + bit2 = BIT(color_prom[i | 0x800], 2); + bit3 = BIT(color_prom[i | 0x800], 3); + int const r = combine_weights(rweights, bit0, bit1, bit2, bit3); // green component - bit0 = BIT(color_prom[0], 0); - bit1 = BIT(color_prom[0], 1); - bit2 = BIT(color_prom[0], 2); - bit3 = BIT(color_prom[0], 3); - int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + bit0 = BIT(color_prom[i], 0); + bit1 = BIT(color_prom[i], 1); + bit2 = BIT(color_prom[i], 2); + bit3 = BIT(color_prom[i], 3); + int const g = combine_weights(gweights, bit0, bit1, bit2, bit3); // blue component - bit0 = BIT(color_prom[0], 4); - bit1 = BIT(color_prom[0], 5); - bit2 = BIT(color_prom[0], 6); - bit3 = BIT(color_prom[0], 7); - int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + bit0 = BIT(color_prom[i], 4); + bit1 = BIT(color_prom[i], 5); + bit2 = BIT(color_prom[i], 6); + bit3 = BIT(color_prom[i], 7); + int const b = combine_weights(bweights, bit0, bit1, bit2, bit3); palette.set_pen_color(i, rgb_t(r, g, b)); - color_prom++; } } @@ -266,30 +278,12 @@ TILE_GET_INFO_MEMBER(baraduke_state::tx_get_tile_info) 0); } -TILE_GET_INFO_MEMBER(baraduke_state::get_tile_info0) -{ - int const code = m_videoram[2 * tile_index]; - int const attr = m_videoram[2 * tile_index + 1]; - - tileinfo.set(1, - code + ((attr & 0x03) << 8), - attr, - 0); -} - -TILE_GET_INFO_MEMBER(baraduke_state::get_tile_info1) +void baraduke_state::tile_cb(u8 layer, u8& gfxno, u32& code) { - int const code = m_videoram[0x1000 + 2 * tile_index]; - int const attr = m_videoram[0x1000 + 2 * tile_index + 1]; - - tileinfo.set(2, - code + ((attr & 0x03) << 8), - attr, - 0); + gfxno = layer & 1; } - /*************************************************************************** Start the video hardware emulation. @@ -299,21 +293,9 @@ TILE_GET_INFO_MEMBER(baraduke_state::get_tile_info1) void baraduke_state::video_start() { m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(baraduke_state::tx_get_tile_info)), tilemap_mapper_delegate(*this, FUNC(baraduke_state::tx_tilemap_scan)), 8, 8, 36, 28); - m_bg_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(baraduke_state::get_tile_info0)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - m_bg_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(baraduke_state::get_tile_info1)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - m_tx_tilemap->set_transparent_pen(3); - m_bg_tilemap[0]->set_transparent_pen(7); - m_bg_tilemap[1]->set_transparent_pen(7); - - m_bg_tilemap[0]->set_scrolldx(-26, -227 + 26); - m_bg_tilemap[1]->set_scrolldx(-24, -227 + 24); - m_bg_tilemap[0]->set_scrolldy(-9, 9); - m_bg_tilemap[1]->set_scrolldy(-9, 9); m_tx_tilemap->set_scrolldy(16, 16); - save_item(NAME(m_xscroll)); - save_item(NAME(m_yscroll)); save_item(NAME(m_copy_sprites)); } @@ -325,35 +307,12 @@ void baraduke_state::video_start() ***************************************************************************/ -void baraduke_state::videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap[offset / 0x1000]->mark_tile_dirty((offset & 0xfff) / 2); -} - void baraduke_state::textram_w(offs_t offset, uint8_t data) { m_textram[offset] = data; m_tx_tilemap->mark_tile_dirty(offset & 0x3ff); } -template -void baraduke_state::scroll_w(offs_t offset, uint8_t data) -{ - switch (offset) - { - case 0: // high scroll x - m_xscroll[Which] = (m_xscroll[Which] & 0xff) | (data << 8); - break; - case 1: // low scroll x - m_xscroll[Which] = (m_xscroll[Which] & 0xff00) | data; - break; - case 2: // scroll y - m_yscroll[Which] = data; - break; - } -} - void baraduke_state::spriteram_w(offs_t offset, uint8_t data) { m_spriteram[offset] = data; @@ -373,12 +332,11 @@ void baraduke_state::spriteram_w(offs_t offset, uint8_t data) void baraduke_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *spriteram = m_spriteram + 0x1800; - const uint8_t *source = &spriteram[0x0800 - 32]; // the last is NOT a sprite - const uint8_t *finish = &spriteram[0x0000]; + const uint8_t *source = &m_spriteram[0x2000 - 32]; // the last is NOT a sprite + const uint8_t *finish = &m_spriteram[0x1800]; - int const sprite_xoffs = spriteram[0x07f5] - 256 * (spriteram[0x07f4] & 1); - int const sprite_yoffs = spriteram[0x07f7]; + int const sprite_xoffs = m_spriteram[0x1ff5] - 256 * (m_spriteram[0x1ff4] & 1); + int const sprite_yoffs = m_spriteram[0x1ff7]; static constexpr int gfx_offs[2][2] = { @@ -430,7 +388,7 @@ void baraduke_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c { for (int x = 0; x <= sizex; x++) { - m_gfxdecode->gfx(3)->prio_transpen(bitmap, cliprect, + m_gfxdecode->gfx(1)->prio_transpen(bitmap, cliprect, sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)], color, flipx, flipy, @@ -445,40 +403,18 @@ void baraduke_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c } -void baraduke_state::set_scroll(int layer) -{ - int scrollx = m_xscroll[layer]; - int scrolly = m_yscroll[layer]; - - if (flip_screen()) - { - scrollx = -scrollx; - scrolly = -scrolly; - } - - m_bg_tilemap[layer]->set_scrollx(0, scrollx); - m_bg_tilemap[layer]->set_scrolly(0, scrolly); -} - - uint32_t baraduke_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { screen.priority().fill(0, cliprect); // flip screen is embedded in the sprite control registers - flip_screen_set(m_spriteram[0x1ff6] & 0x01); - set_scroll(0); - set_scroll(1); - - int back; + flip_screen_set(BIT(m_spriteram[0x1ff6], 0)); + m_tilegen->init_scroll(flip_screen()); - if (((m_xscroll[0] & 0x0e00) >> 9) == 6) - back = 1; - else - back = 0; + int const back = (((m_tilegen->xscroll_r(0) & 0x0e00) >> 9) == 6) ? 1 : 0; - m_bg_tilemap[back]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1); - m_bg_tilemap[back ^ 1]->draw(screen, bitmap, cliprect, 0, 2); + m_tilegen->draw(screen, bitmap, cliprect, back, TILEMAP_DRAW_OPAQUE, 1); + m_tilegen->draw(screen, bitmap, cliprect, back ^ 1, 0, 2); draw_sprites(screen, bitmap, cliprect); m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); @@ -514,9 +450,9 @@ void baraduke_state::inputport_select_w(uint8_t data) m_inputport_selected = data & 0x07; else if ((data & 0xe0) == 0xc0) { - machine().bookkeeping().coin_lockout_global_w(~data & 1); - machine().bookkeeping().coin_counter_w(0, data & 2); - machine().bookkeeping().coin_counter_w(1, data & 4); + machine().bookkeeping().coin_lockout_global_w(BIT(~data, 0)); + machine().bookkeeping().coin_counter_w(0, BIT(data, 1)); + machine().bookkeeping().coin_counter_w(1, BIT(data, 2)); } } @@ -559,14 +495,14 @@ void baraduke_state::irq_ack_w(uint8_t data) void baraduke_state::main_map(address_map &map) { map(0x0000, 0x1fff).ram().w(FUNC(baraduke_state::spriteram_w)).share(m_spriteram); - map(0x2000, 0x3fff).ram().w(FUNC(baraduke_state::videoram_w)).share(m_videoram); + map(0x2000, 0x3fff).rw(m_tilegen, FUNC(namco_cus4xtmap_device::vram_r), FUNC(namco_cus4xtmap_device::vram_w)); map(0x4000, 0x43ff).rw(m_cus30, FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w)); // PSG device, shared RAM map(0x4800, 0x4fff).ram().w(FUNC(baraduke_state::textram_w)).share(m_textram); + map(0x6000, 0xffff).rom(); map(0x8000, 0x8000).w("watchdog", FUNC(watchdog_timer_device::reset_w)); map(0x8800, 0x8800).w(FUNC(baraduke_state::irq_ack_w)); - map(0xb000, 0xb002).w(FUNC(baraduke_state::scroll_w<0>)); - map(0xb004, 0xb006).w(FUNC(baraduke_state::scroll_w<1>)); - map(0x6000, 0xffff).rom(); + map(0xb000, 0xb002).w(m_tilegen, FUNC(namco_cus4xtmap_device::scroll_w<0>)); + map(0xb004, 0xb006).w(m_tilegen, FUNC(namco_cus4xtmap_device::scroll_w<1>)); } void baraduke_state::mcu_map(address_map &map) @@ -702,10 +638,10 @@ static const gfx_layout text_layout = 8,8, RGN_FRAC(1,1), 2, - { 0, 4 }, - { 8*8, 8*8+1, 8*8+2, 8*8+3, 0, 1, 2, 3 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 16*8 + { STEP2(0, 4) }, + { STEP4(8*8, 1), STEP4(0, 1) }, + { STEP8(0, 8) }, + 8*8*2 }; static const gfx_layout tile_layout = @@ -713,17 +649,20 @@ static const gfx_layout tile_layout = 8,8, 1024, 3, - { 0x8000*8, 0, 4 }, - { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3 }, - { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8 }, + { 0x8000*8, STEP2(0, 4) }, + { STEP4(0, 1), STEP4(8, 1) }, + { STEP8(0, 8*2) }, 16*8 }; static GFXDECODE_START( gfx_baraduke ) - GFXDECODE_ENTRY( "chars", 0, text_layout, 0, 512 ) - GFXDECODE_ENTRY( "tiles", 0x0000, tile_layout, 0, 256 ) - GFXDECODE_ENTRY( "tiles", 0x4000, tile_layout, 0, 256 ) - GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_msb, 0, 128 ) + GFXDECODE_ENTRY( "chars", 0, text_layout, 0, 512 ) + GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_msb, 0, 128 ) +GFXDECODE_END + +static GFXDECODE_START( gfx_baraduke_tile ) + GFXDECODE_ENTRY( "tiles", 0x0000, tile_layout, 0, 256 ) + GFXDECODE_ENTRY( "tiles", 0x4000, tile_layout, 0, 256 ) GFXDECODE_END @@ -759,6 +698,10 @@ void baraduke_state::baraduke(machine_config &config) screen.screen_vblank().set(FUNC(baraduke_state::screen_vblank)); screen.set_palette(m_palette); + NAMCO_CUS4XTMAP(config, m_tilegen, 0, m_palette, gfx_baraduke_tile); + m_tilegen->set_offset(-26, -227, -9, 9); + m_tilegen->set_tile_callback(FUNC(baraduke_state::tile_cb)); + GFXDECODE(config, m_gfxdecode, m_palette, gfx_baraduke); PALETTE(config, m_palette, FUNC(baraduke_state::palette), 2048); diff --git a/src/mame/namco/namco_cus4xtmap.cpp b/src/mame/namco/namco_cus4xtmap.cpp new file mode 100644 index 00000000000..fe36b4599bd --- /dev/null +++ b/src/mame/namco/namco_cus4xtmap.cpp @@ -0,0 +1,119 @@ +// license:BSD-3-Clause +// copyright-holders:Manuel Abadia, Nicola Salmoria + +/* + CUS42 + CUS43 Tilemaps + used by + baraduke.cpp (all games) + namcos86.cpp (all games) +*/ + +#include "emu.h" +#include "namco_cus4xtmap.h" + +DEFINE_DEVICE_TYPE(NAMCO_CUS4XTMAP, namco_cus4xtmap_device, "namco_cus4xtmap", "Namco CUS42 + CUS43 (dual tilemaps)") + +namco_cus4xtmap_device::namco_cus4xtmap_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, NAMCO_CUS4XTMAP, tag, owner, clock) + , device_gfx_interface(mconfig, *this) + , m_tile_cb(*this) + , m_vram(*this, "videoram", 0x2000, ENDIANNESS_BIG) + , m_tilemap{nullptr, nullptr} + , m_xscroll{0, 0} + , m_yscroll{0, 0} + , m_xoffs(0) + , m_yoffs(0) + , m_flipped_xoffs(0) + , m_flipped_yoffs(0) +{ +} + +void namco_cus4xtmap_device::device_start() +{ + m_tile_cb.resolve(); + + // two scrolling tilemaps + m_tilemap[0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(*this, FUNC(namco_cus4xtmap_device::get_tile_info<0>)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + m_tilemap[1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(*this, FUNC(namco_cus4xtmap_device::get_tile_info<1>)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + + // define offsets for scrolling + static const int adj[2] = { 0,2 }; + for (int i = 0; i < 2; i++) + { + const int dx = m_xoffs + adj[i]; + m_tilemap[i]->set_scrolldx(dx, m_flipped_xoffs - dx); + m_tilemap[i]->set_scrolldy(m_yoffs, m_flipped_yoffs); + m_tilemap[i]->set_transparent_pen(7); + } + + save_item(NAME(m_xscroll)); + save_item(NAME(m_yscroll)); +} + +/**************************************************************************************/ + +void namco_cus4xtmap_device::mark_all_dirty(void) +{ + for (auto &tilemap : m_tilemaps) + tilemap->mark_all_dirty(); +} + +template +TILE_GET_INFO_MEMBER(namco_cus4xtmap_device::get_tile_info) +{ + u16 const attr = m_vram[(Layer << 12) + (2 * tile_index + 1)]; + u8 gfxno = 0; + u32 code = m_vram[(Layer << 12) + (2 * tile_index)] + ((attr & 0x03) << 8); + if (!m_tile_cb.isnull()) + m_tile_cb(Layer, gfxno, code); + tileinfo.set(gfxno, code, attr, 0); +} + +void namco_cus4xtmap_device::init_scroll(bool flip) +{ + for (int i = 0; i < 2; i++) + { + int scrollx = m_xscroll[i]; + int scrolly = m_yscroll[i]; + if (flip) + { + scrollx = -scrollx; + scrolly = -scrolly; + } + m_tilemap[i]->set_scrollx(0, scrollx); + m_tilemap[i]->set_scrolly(0, scrolly); + } +} + +void namco_cus4xtmap_device::draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u8 layer, u32 flags, u8 prival, u8 primask) +{ + m_tilemap[layer]->draw(screen, bitmap, cliprect, flags, prival, primask); +} + +// 8 bit handlers +void namco_cus4xtmap_device::vram_w(offs_t offset, u8 data, u8 mem_mask) +{ + COMBINE_DATA(&m_vram[offset]); + m_tilemap[BIT(offset, 12)]->mark_tile_dirty((offset & 0xfff) >> 1); +} + +u8 namco_cus4xtmap_device::vram_r(offs_t offset) +{ + return m_vram[offset]; +} + +void namco_cus4xtmap_device::scroll_set(int layer, u8 offset, u8 data) +{ + switch (offset) + { + case 0: // high scroll x + m_xscroll[layer] = (m_xscroll[layer] & 0xff) | (data << 8); + break; + case 1: // low scroll x + m_xscroll[layer] = (m_xscroll[layer] & 0xff00) | data; + break; + case 2: // scroll y + m_yscroll[layer] = data; + break; + } +} diff --git a/src/mame/namco/namco_cus4xtmap.h b/src/mame/namco/namco_cus4xtmap.h new file mode 100644 index 00000000000..57728fd94e8 --- /dev/null +++ b/src/mame/namco/namco_cus4xtmap.h @@ -0,0 +1,73 @@ +// license:BSD-3-Clause +// copyright-holders:Manuel Abadia, Nicola Salmoria + +#ifndef MAME_NAMCO_NAMCO_CUS4XTMAP_H +#define MAME_NAMCO_NAMCO_CUS4XTMAP_H + +#pragma once + +#include "screen.h" +#include "tilemap.h" + +class namco_cus4xtmap_device : public device_t, public device_gfx_interface +{ +public: + using tile_delegate = device_delegate; + + // construction/destruction + namco_cus4xtmap_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + template namco_cus4xtmap_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&palette_tag, const gfx_decode_entry *gfxinfo) + : namco_cus4xtmap_device(mconfig, tag, owner, clock) + { + set_info(gfxinfo); + set_palette(std::forward(palette_tag)); + } + + void set_offset(int xoffs, int flipped_xoffs, int yoffs, int flipped_yoffs) + { + m_xoffs = xoffs; + m_yoffs = yoffs; + m_flipped_xoffs = flipped_xoffs; + m_flipped_yoffs = flipped_yoffs; + } + + template void set_tile_callback(T &&... args) { m_tile_cb.set(std::forward(args)...); } + + // handlers + void vram_w(offs_t offset, u8 data, u8 mem_mask = ~0); + u8 vram_r(offs_t offset); + template void scroll_w(offs_t offset, u8 data) + { + scroll_set(Layer, offset, data); + } + u16 xscroll_r(offs_t layer) { return m_xscroll[layer]; } + + void mark_all_dirty(); + void init_scroll(bool flip); + void draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u8 layer, u32 flags, u8 prival = 0, u8 primask = 0xff); + +protected: + // device-level overrides + virtual void device_start() override ATTR_COLD; + +private: + template TILE_GET_INFO_MEMBER(get_tile_info); + void set_tilemap_videoram(int offset, u16 newword); + void scroll_set(int layer, u8 offset, u8 data); + + tile_delegate m_tile_cb; + memory_share_creator m_vram; + + tilemap_t *m_tilemap[2]; + u16 m_xscroll[2]; + u8 m_yscroll[2]; + + int m_xoffs, m_yoffs; + int m_flipped_xoffs, m_flipped_yoffs; +}; + +// device type definition +DECLARE_DEVICE_TYPE(NAMCO_CUS4XTMAP, namco_cus4xtmap_device) + +#endif // MAME_NAMCO_NAMCO_CUS4XTMAP_H + diff --git a/src/mame/namco/namcos86.cpp b/src/mame/namco/namcos86.cpp index 831b8edabd7..d232a76cf17 100644 --- a/src/mame/namco/namcos86.cpp +++ b/src/mame/namco/namcos86.cpp @@ -185,41 +185,41 @@ TODO: void namcos86_state::bankswitch1_w(uint8_t data) { - /* if the ROM expansion module is available, don't do anything. This avoids conflict */ - /* with bankswitch1_ext_w() in wndrmomo */ - if (m_user1_ptr) + // if the ROM expansion module is available, don't do anything. This avoids conflict + // with bankswitch1_ext_w() in wndrmomo + if (m_bankeddata_ptr) return; - membank("bank1")->set_entry(data & 0x03); + m_mainbank->set_entry(data & 0x03); } void namcos86_state::bankswitch1_ext_w(uint8_t data) { - if (!m_user1_ptr) + if (!m_bankeddata_ptr) return; - membank("bank1")->set_entry(data & 0x1f); + m_mainbank->set_entry(data & 0x1f); } void namcos86_state::bankswitch2_w(uint8_t data) { - membank("bank2")->set_entry(data & 0x03); + m_subbank->set_entry(data & 0x03); } -/* Stubs to pass the correct Dip Switch setup to the MCU */ +// Stubs to pass the correct Dip Switch setup to the MCU uint8_t namcos86_state::dsw0_r() { int rhi, rlo; - rhi = ( ioport("DSWA")->read() & 0x01 ) << 4; - rhi |= ( ioport("DSWA")->read() & 0x04 ) << 3; - rhi |= ( ioport("DSWA")->read() & 0x10 ) << 2; - rhi |= ( ioport("DSWA")->read() & 0x40 ) << 1; + rhi = (m_io_dsw[0]->read() & 0x01) << 4; + rhi |= (m_io_dsw[0]->read() & 0x04) << 3; + rhi |= (m_io_dsw[0]->read() & 0x10) << 2; + rhi |= (m_io_dsw[0]->read() & 0x40) << 1; - rlo = ( ioport("DSWB")->read() & 0x01 ); - rlo |= ( ioport("DSWB")->read() & 0x04 ) >> 1; - rlo |= ( ioport("DSWB")->read() & 0x10 ) >> 2; - rlo |= ( ioport("DSWB")->read() & 0x40 ) >> 3; + rlo = (m_io_dsw[1]->read() & 0x01); + rlo |= (m_io_dsw[1]->read() & 0x04) >> 1; + rlo |= (m_io_dsw[1]->read() & 0x10) >> 2; + rlo |= (m_io_dsw[1]->read() & 0x40) >> 3; return rhi | rlo; } @@ -227,15 +227,15 @@ uint8_t namcos86_state::dsw1_r() { int rhi, rlo; - rhi = ( ioport("DSWA")->read() & 0x02 ) << 3; - rhi |= ( ioport("DSWA")->read() & 0x08 ) << 2; - rhi |= ( ioport("DSWA")->read() & 0x20 ) << 1; - rhi |= ( ioport("DSWA")->read() & 0x80 ); + rhi = (m_io_dsw[0]->read() & 0x02) << 3; + rhi |= (m_io_dsw[0]->read() & 0x08) << 2; + rhi |= (m_io_dsw[0]->read() & 0x20) << 1; + rhi |= (m_io_dsw[0]->read() & 0x80); - rlo = ( ioport("DSWB")->read() & 0x02 ) >> 1; - rlo |= ( ioport("DSWB")->read() & 0x08 ) >> 2; - rlo |= ( ioport("DSWB")->read() & 0x20 ) >> 3; - rlo |= ( ioport("DSWB")->read() & 0x80 ) >> 4; + rlo = (m_io_dsw[1]->read() & 0x02) >> 1; + rlo |= (m_io_dsw[1]->read() & 0x08) >> 2; + rlo |= (m_io_dsw[1]->read() & 0x20) >> 3; + rlo |= (m_io_dsw[1]->read() & 0x80) >> 4; return rhi | rlo; } @@ -251,21 +251,11 @@ void namcos86_state::int_ack2_w(uint8_t data) m_cpu2->set_input_line(0, CLEAR_LINE); } - -void namcos86_state::watchdog1_w(uint8_t data) +template +void namcos86_state::watchdog_w(uint8_t data) { - m_wdog |= 1; - if (m_wdog == 3) - { - m_wdog = 0; - m_watchdog->watchdog_reset(); - } -} - -void namcos86_state::watchdog2_w(uint8_t data) -{ - m_wdog |= 2; - if (m_wdog == 3) + m_wdog |= 1 << Bit; + if (m_wdog == 0b11) { m_wdog = 0; m_watchdog->watchdog_reset(); @@ -275,9 +265,9 @@ void namcos86_state::watchdog2_w(uint8_t data) void namcos86_state::coin_w(uint8_t data) { - machine().bookkeeping().coin_lockout_global_w(data & 1); - machine().bookkeeping().coin_counter_w(0,~data & 2); - machine().bookkeeping().coin_counter_w(1,~data & 4); + machine().bookkeeping().coin_lockout_global_w(BIT(data, 0)); + machine().bookkeeping().coin_counter_w(0, BIT(~data, 1)); + machine().bookkeeping().coin_counter_w(1, BIT(~data, 2)); } void namcos86_state::led_w(uint8_t data) @@ -289,8 +279,8 @@ void namcos86_state::led_w(uint8_t data) void namcos86_state::cus115_w(offs_t offset, uint8_t data) { - /* make sure the expansion board is present */ - if (!m_user1_ptr) + // make sure the expansion board is present + if (!m_bankeddata_ptr) { popmessage("expansion board not present"); return; @@ -319,13 +309,13 @@ void namcos86_state::cus115_w(offs_t offset, uint8_t data) void namcos86_state::machine_start() { - if (m_user1_ptr) - membank("bank1")->configure_entries(0, 32, m_user1_ptr, 0x2000); + if (m_bankeddata_ptr) + m_mainbank->configure_entries(0, 32, m_bankeddata_ptr, 0x2000); else - membank("bank1")->configure_entries(0, 4, memregion("cpu1")->base(), 0x2000); + m_mainbank->configure_entries(0, 4, memregion("cpu1")->base(), 0x2000); - if (membank("bank2")) - membank("bank2")->configure_entries(0, 4, memregion("cpu2")->base(), 0x2000); + if (m_subbank) + m_subbank->configure_entries(0, 4, memregion("cpu2")->base(), 0x2000); m_leds.resolve(); @@ -335,30 +325,29 @@ void namcos86_state::machine_start() void namcos86_state::cpu1_map(address_map &map) { - map(0x0000, 0x1fff).ram().w(FUNC(namcos86_state::videoram1_w)).share("videoram1"); - map(0x2000, 0x3fff).ram().w(FUNC(namcos86_state::videoram2_w)).share("videoram2"); + map(0x0000, 0x1fff).rw(m_tilegen[0], FUNC(namco_cus4xtmap_device::vram_r), FUNC(namco_cus4xtmap_device::vram_w)); + map(0x2000, 0x3fff).rw(m_tilegen[1], FUNC(namco_cus4xtmap_device::vram_r), FUNC(namco_cus4xtmap_device::vram_w)); - map(0x4000, 0x5fff).ram().w(FUNC(namcos86_state::spriteram_w)).share("spriteram"); + map(0x4000, 0x5fff).ram().w(FUNC(namcos86_state::spriteram_w)).share(m_spriteram); - map(0x4000, 0x43ff).rw(m_cus30, FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w)); /* PSG device, shared RAM */ + map(0x4000, 0x43ff).rw(m_cus30, FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w)); // PSG device, shared RAM - map(0x6000, 0x7fff).bankr("bank1"); - map(0x8000, 0xffff).rom(); + // ROM & Voice expansion board - only some games have it + map(0x6000, 0x7fff).bankr(m_mainbank); + map(0x6000, 0x7fff).w(FUNC(namcos86_state::cus115_w)); // ROM bank select and 63701X sample player control - /* ROM & Voice expansion board - only some games have it */ - map(0x6000, 0x7fff).w(FUNC(namcos86_state::cus115_w)); /* ROM bank select and 63701X sample player control */ - - map(0x8000, 0x8000).w(FUNC(namcos86_state::watchdog1_w)); - map(0x8400, 0x8400).w(FUNC(namcos86_state::int_ack1_w)); /* IRQ acknowledge */ + map(0x8000, 0xffff).rom(); + map(0x8000, 0x8000).w(FUNC(namcos86_state::watchdog_w<0>)); + map(0x8400, 0x8400).w(FUNC(namcos86_state::int_ack1_w)); // IRQ acknowledge map(0x8800, 0x8fff).w(FUNC(namcos86_state::tilebank_select_w)); - map(0x9000, 0x9002).w(FUNC(namcos86_state::scroll0_w)); /* scroll + priority */ + map(0x9000, 0x9002).w(m_tilegen[0], FUNC(namco_cus4xtmap_device::scroll_w<0>)); // scroll + priority map(0x9003, 0x9003).w(FUNC(namcos86_state::bankswitch1_w)); - map(0x9004, 0x9006).w(FUNC(namcos86_state::scroll1_w)); /* scroll + priority */ + map(0x9004, 0x9006).w(m_tilegen[0], FUNC(namco_cus4xtmap_device::scroll_w<1>)); // scroll + priority - map(0x9400, 0x9402).w(FUNC(namcos86_state::scroll2_w)); /* scroll + priority */ -// { 0x9403, 0x9403 } sub CPU rom bank select would be here - map(0x9404, 0x9406).w(FUNC(namcos86_state::scroll3_w)); /* scroll + priority */ + map(0x9400, 0x9402).w(m_tilegen[1], FUNC(namco_cus4xtmap_device::scroll_w<0>)); // scroll + priority +// map(0x9403, 0x9403) sub CPU rom bank select would be here + map(0x9404, 0x9406).w(m_tilegen[1], FUNC(namco_cus4xtmap_device::scroll_w<1>)); // scroll + priority map(0xa000, 0xa000).w(FUNC(namcos86_state::backcolor_w)); } @@ -369,38 +358,38 @@ void namcos86_state::cpu1_map(address_map &map) void namcos86_state::hopmappy_cpu2_map(address_map &map) { map(0x8000, 0xffff).rom(); - map(0x9000, 0x9000).w(FUNC(namcos86_state::watchdog2_w)); + map(0x9000, 0x9000).w(FUNC(namcos86_state::watchdog_w<1>)); map(0x9400, 0x9400).w(FUNC(namcos86_state::int_ack2_w)); } void namcos86_state::roishtar_cpu2_map(address_map &map) { - map(0x0000, 0x1fff).ram().w(FUNC(namcos86_state::spriteram_w)).share("spriteram"); - map(0x4000, 0x5fff).ram().w(FUNC(namcos86_state::videoram2_w)).share("videoram2"); - map(0x6000, 0x7fff).ram().w(FUNC(namcos86_state::videoram1_w)).share("videoram1"); + map(0x0000, 0x1fff).ram().w(FUNC(namcos86_state::spriteram_w)).share(m_spriteram); + map(0x4000, 0x5fff).rw(m_tilegen[1], FUNC(namco_cus4xtmap_device::vram_r), FUNC(namco_cus4xtmap_device::vram_w)); + map(0x6000, 0x7fff).rw(m_tilegen[0], FUNC(namco_cus4xtmap_device::vram_r), FUNC(namco_cus4xtmap_device::vram_w)); map(0x8000, 0xffff).rom(); - map(0xa000, 0xa000).w(FUNC(namcos86_state::watchdog2_w)); + map(0xa000, 0xa000).w(FUNC(namcos86_state::watchdog_w<1>)); map(0xb000, 0xb000).w(FUNC(namcos86_state::int_ack2_w)); // IRQ acknowledge } void namcos86_state::genpeitd_cpu2_map(address_map &map) { - map(0x0000, 0x1fff).ram().w(FUNC(namcos86_state::videoram1_w)).share("videoram1"); - map(0x2000, 0x3fff).ram().w(FUNC(namcos86_state::videoram2_w)).share("videoram2"); - map(0x4000, 0x5fff).ram().w(FUNC(namcos86_state::spriteram_w)).share("spriteram"); + map(0x0000, 0x1fff).rw(m_tilegen[0], FUNC(namco_cus4xtmap_device::vram_r), FUNC(namco_cus4xtmap_device::vram_w)); + map(0x2000, 0x3fff).rw(m_tilegen[1], FUNC(namco_cus4xtmap_device::vram_r), FUNC(namco_cus4xtmap_device::vram_w)); + map(0x4000, 0x5fff).ram().w(FUNC(namcos86_state::spriteram_w)).share(m_spriteram); map(0x8000, 0xffff).rom(); - map(0xb000, 0xb000).w(FUNC(namcos86_state::watchdog2_w)); map(0x8800, 0x8800).w(FUNC(namcos86_state::int_ack2_w)); // IRQ acknowledge + map(0xb000, 0xb000).w(FUNC(namcos86_state::watchdog_w<1>)); } void namcos86_state::rthunder_cpu2_map(address_map &map) { - map(0x0000, 0x1fff).ram().w(FUNC(namcos86_state::spriteram_w)).share("spriteram"); - map(0x2000, 0x3fff).ram().w(FUNC(namcos86_state::videoram1_w)).share("videoram1"); - map(0x4000, 0x5fff).ram().w(FUNC(namcos86_state::videoram2_w)).share("videoram2"); - map(0x6000, 0x7fff).bankr("bank2"); + map(0x0000, 0x1fff).ram().w(FUNC(namcos86_state::spriteram_w)).share(m_spriteram); + map(0x2000, 0x3fff).rw(m_tilegen[0], FUNC(namco_cus4xtmap_device::vram_r), FUNC(namco_cus4xtmap_device::vram_w)); + map(0x4000, 0x5fff).rw(m_tilegen[1], FUNC(namco_cus4xtmap_device::vram_r), FUNC(namco_cus4xtmap_device::vram_w)); + map(0x6000, 0x7fff).bankr(m_subbank); map(0x8000, 0xffff).rom(); - map(0x8000, 0x8000).w(FUNC(namcos86_state::watchdog2_w)); + map(0x8000, 0x8000).w(FUNC(namcos86_state::watchdog_w<1>)); map(0x8800, 0x8800).w(FUNC(namcos86_state::int_ack2_w)); // IRQ acknowledge // { 0xd800, 0xd802 } layer 2 scroll registers would be here map(0xd803, 0xd803).w(FUNC(namcos86_state::bankswitch2_w)); @@ -409,11 +398,11 @@ void namcos86_state::rthunder_cpu2_map(address_map &map) void namcos86_state::wndrmomo_cpu2_map(address_map &map) { - map(0x2000, 0x3fff).ram().w(FUNC(namcos86_state::spriteram_w)).share("spriteram"); - map(0x4000, 0x5fff).ram().w(FUNC(namcos86_state::videoram1_w)).share("videoram1"); - map(0x6000, 0x7fff).ram().w(FUNC(namcos86_state::videoram2_w)).share("videoram2"); + map(0x2000, 0x3fff).ram().w(FUNC(namcos86_state::spriteram_w)).share(m_spriteram); + map(0x4000, 0x5fff).rw(m_tilegen[0], FUNC(namco_cus4xtmap_device::vram_r), FUNC(namco_cus4xtmap_device::vram_w)); + map(0x6000, 0x7fff).rw(m_tilegen[1], FUNC(namco_cus4xtmap_device::vram_r), FUNC(namco_cus4xtmap_device::vram_w)); map(0x8000, 0xffff).rom(); - map(0xc000, 0xc000).w(FUNC(namcos86_state::watchdog2_w)); + map(0xc000, 0xc000).w(FUNC(namcos86_state::watchdog_w<1>)); map(0xc800, 0xc800).w(FUNC(namcos86_state::int_ack2_w)); // IRQ acknowledge } @@ -496,18 +485,18 @@ void namcos86_state::wndrmomo_mcu_map(address_map &map) static INPUT_PORTS_START( hopmappy ) PORT_START("IN0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 3 player 2 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 2 player 1 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 3 player 2 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 2 player 1 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) /* service switch from the edge connector */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) // service switch from the edge connector PORT_START("IN1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 3 player 1 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 2 player 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 3 player 1 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 2 player 2 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) @@ -516,9 +505,9 @@ static INPUT_PORTS_START( hopmappy ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin lockout */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin counter 1 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin counter 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin lockout + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin counter 1 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin counter 2 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY @@ -569,17 +558,17 @@ INPUT_PORTS_END static INPUT_PORTS_START( skykiddx ) PORT_START("IN0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 3 player 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 3 player 2 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) /* service switch from the edge connector */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) // service switch from the edge connector PORT_START("IN1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 3 player 1 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 3 player 1 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL @@ -589,9 +578,9 @@ static INPUT_PORTS_START( skykiddx ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin lockout */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin counter 1 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin counter 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin lockout + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin counter 1 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin counter 2 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY @@ -641,17 +630,17 @@ INPUT_PORTS_END static INPUT_PORTS_START( roishtar ) PORT_START("IN0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 3 player 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 3 player 2 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_8WAY PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_8WAY PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) /* service switch from the edge connector */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) // service switch from the edge connector PORT_START("IN1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 3 player 1 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 3 player 1 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_8WAY @@ -661,9 +650,9 @@ static INPUT_PORTS_START( roishtar ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin lockout */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin counter 1 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin counter 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin lockout + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin counter 1 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin counter 2 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_8WAY PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_8WAY @@ -711,17 +700,17 @@ INPUT_PORTS_END static INPUT_PORTS_START( genpeitd ) PORT_START("IN0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 3 player 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 3 player 2 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) /* service switch from the edge connector */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) // service switch from the edge connector PORT_START("IN1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 3 player 1 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 3 player 1 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) @@ -731,9 +720,9 @@ static INPUT_PORTS_START( genpeitd ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin lockout */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin counter 1 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin counter 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin lockout + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin counter 1 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin counter 2 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY @@ -785,17 +774,17 @@ INPUT_PORTS_END static INPUT_PORTS_START( rthunder ) PORT_START("IN0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 3 player 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 3 player 2 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) /* service switch from the edge connector */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) // service switch from the edge connector PORT_START("IN1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 3 player 1 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 3 player 1 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) @@ -805,9 +794,9 @@ static INPUT_PORTS_START( rthunder ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin lockout */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin counter 1 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin counter 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin lockout + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin counter 1 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin counter 2 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY @@ -864,17 +853,17 @@ INPUT_PORTS_END static INPUT_PORTS_START( rthunder1 ) PORT_START("IN0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 3 player 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 3 player 2 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) /* service switch from the edge connector */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) // service switch from the edge connector PORT_START("IN1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 3 player 1 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 3 player 1 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) @@ -884,9 +873,9 @@ static INPUT_PORTS_START( rthunder1 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin lockout */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin counter 1 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin counter 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin lockout + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin counter 1 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin counter 2 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY @@ -938,17 +927,17 @@ INPUT_PORTS_END static INPUT_PORTS_START( wndrmomo ) PORT_START("IN0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 3 player 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 3 player 2 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) /* service switch from the edge connector */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) // service switch from the edge connector PORT_START("IN1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* button 3 player 1 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button 3 player 1 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) @@ -958,9 +947,9 @@ static INPUT_PORTS_START( wndrmomo ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin lockout */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin counter 1 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) /* OUT:coin counter 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin lockout + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin counter 1 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) // OUT:coin counter 2 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY @@ -1013,22 +1002,22 @@ static const gfx_layout spritelayout = 32,32, RGN_FRAC(1,1), 4, - { 0, 1, 2, 3 }, - { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4, - 8*4, 9*4, 10*4, 11*4, 12*4, 13*4, 14*4, 15*4, - 16*64+0*4, 16*64+1*4, 16*64+2*4, 16*64+3*4, 16*64+4*4, 16*64+5*4, 16*64+6*4, 16*64+7*4, - 16*64+8*4, 16*64+9*4, 16*64+10*4, 16*64+11*4, 16*64+12*4, 16*64+13*4, 16*64+14*4, 16*64+15*4 }, - { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, - 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64, - 32*64, 33*64, 34*64, 35*64, 36*64, 37*64, 38*64, 39*64, - 40*64, 41*64, 42*64, 43*64, 44*64, 45*64, 46*64, 47*64 }, - 64*64 + { STEP4(0, 1) }, + { STEP16(0, 4), STEP16(4*16*16, 4) }, + { STEP16(0, 4*16), STEP16(4*16*16*2, 4*16) }, + 32*32*4 }; static GFXDECODE_START( gfx_namcos86 ) - GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x3_planar, 2048*0, 256 ) - GFXDECODE_ENTRY( "gfx2", 0, gfx_8x8x3_planar, 2048*0, 256 ) - GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 2048*1, 128 ) + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 2048*1, 128 ) +GFXDECODE_END + +static GFXDECODE_START( gfx_namcos86_tile_0 ) + GFXDECODE_ENTRY( "tiles_0", 0, gfx_8x8x3_planar, 2048*0, 256 ) +GFXDECODE_END + +static GFXDECODE_START( gfx_namcos86_tile_1 ) + GFXDECODE_ENTRY( "tiles_1", 0, gfx_8x8x3_planar, 2048*0, 256 ) GFXDECODE_END /*******************************************************************/ @@ -1063,8 +1052,16 @@ void namcos86_state::hopmappy(machine_config &config) screen.screen_vblank().set(FUNC(namcos86_state::screen_vblank)); screen.set_palette(m_palette); + NAMCO_CUS4XTMAP(config, m_tilegen[0], 0, m_palette, gfx_namcos86_tile_0); + m_tilegen[0]->set_offset(47, 422, -9, 9); + m_tilegen[0]->set_tile_callback(FUNC(namcos86_state::tile_cb_0)); + + NAMCO_CUS4XTMAP(config, m_tilegen[1], 0, m_palette, gfx_namcos86_tile_1); + m_tilegen[1]->set_offset(46, 422, -9, 9); + m_tilegen[1]->set_tile_callback(FUNC(namcos86_state::tile_cb_1)); + GFXDECODE(config, m_gfxdecode, m_palette, gfx_namcos86); - PALETTE(config, m_palette, FUNC(namcos86_state::namcos86_palette), 4096); + PALETTE(config, m_palette, FUNC(namcos86_state::namcos86_palette), 4096, 512); // sound hardware SPEAKER(config, "mono").front_center(); @@ -1141,15 +1138,15 @@ ROM_START( skykiddx ) // 12d empty ROM_LOAD( "sk3_3.12c", 0x8000, 0x8000, CRC(6d1084c4) SHA1(0045e01cbeb750c50a561420f1577de8cd881894) ) - ROM_REGION( 0x0c000, "gfx1", 0 ) + ROM_REGION( 0x0c000, "tiles_0", 0 ) ROM_LOAD( "sk3_9.7r", 0x00000, 0x08000, CRC(48675b17) SHA1(434babcf5454364a17e529daae16e6f623ca75dd) ) // plane 1,2 ROM_LOAD( "sk3_10.7s", 0x08000, 0x04000, CRC(7418465a) SHA1(e8236c3d077af147a7d5f8f9cd519d030c073aaf) ) // plane 3 - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "tiles_1", 0 ) ROM_LOAD( "sk3_7.4r", 0x00000, 0x08000, CRC(4036b735) SHA1(4177f3f37feb83fab63a1160a939c8d566bbe16c) ) // plane 1,2 ROM_LOAD( "sk3_8.4s", 0x08000, 0x04000, CRC(044bfd21) SHA1(4fbb72fbf041cb256377952d860147376fc1d05b) ) // plane 3 - ROM_REGION( 0x40000, "gfx3", 0 ) + ROM_REGION( 0x40000, "sprites", 0 ) ROM_LOAD( "sk3_5.12h", 0x00000, 0x8000, CRC(5c7d4399) SHA1(9c57e2510b1a01f618364ddaa9b9fa0ce9ae7340) ) ROM_LOAD( "sk3_6.12k", 0x08000, 0x8000, CRC(c908a3b2) SHA1(5fd5304c314443fb3351e7a2d50a72a0fede7e6d) ) // 12l/m/p/r/t/u empty @@ -1179,15 +1176,15 @@ ROM_START( skykiddxo ) // 12d empty ROM_LOAD( "sk3_3.12c", 0x8000, 0x8000, CRC(6d1084c4) SHA1(0045e01cbeb750c50a561420f1577de8cd881894) ) - ROM_REGION( 0x0c000, "gfx1", 0 ) + ROM_REGION( 0x0c000, "tiles_0", 0 ) ROM_LOAD( "sk3_9.7r", 0x00000, 0x08000, CRC(48675b17) SHA1(434babcf5454364a17e529daae16e6f623ca75dd) ) // plane 1,2 ROM_LOAD( "sk3_10.7s", 0x08000, 0x04000, CRC(7418465a) SHA1(e8236c3d077af147a7d5f8f9cd519d030c073aaf) ) // plane 3 - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "tiles_1", 0 ) ROM_LOAD( "sk3_7.4r", 0x00000, 0x08000, CRC(4036b735) SHA1(4177f3f37feb83fab63a1160a939c8d566bbe16c) ) // plane 1,2 ROM_LOAD( "sk3_8.4s", 0x08000, 0x04000, CRC(044bfd21) SHA1(4fbb72fbf041cb256377952d860147376fc1d05b) ) // plane 3 - ROM_REGION( 0x40000, "gfx3", 0 ) + ROM_REGION( 0x40000, "sprites", 0 ) ROM_LOAD( "sk3_5.12h", 0x00000, 0x8000, CRC(5c7d4399) SHA1(9c57e2510b1a01f618364ddaa9b9fa0ce9ae7340) ) ROM_LOAD( "sk3_6.12k", 0x08000, 0x8000, CRC(c908a3b2) SHA1(5fd5304c314443fb3351e7a2d50a72a0fede7e6d) ) // 12l/m/p/r/t/u empty @@ -1217,15 +1214,15 @@ ROM_START( hopmappy ) // 12d empty ROM_LOAD( "hm1_2.12c", 0xc000, 0x4000, CRC(c46cda65) SHA1(1131b4aa0a446569e1eb9f59964548058c7993e2) ) - ROM_REGION( 0x06000, "gfx1", 0 ) + ROM_REGION( 0x06000, "tiles_0", 0 ) ROM_LOAD( "hm1_6.7r", 0x00000, 0x04000, CRC(fd0e8887) SHA1(b76737d22bb1c1ae4d700ea6796e8d91f6ffa275) ) // plane 1,2 ROM_FILL( 0x04000, 0x02000, 0x00 ) // no plane 3 - ROM_REGION( 0x06000, "gfx2", 0 ) + ROM_REGION( 0x06000, "tiles_1", 0 ) ROM_LOAD( "hm1_5.4r", 0x00000, 0x04000, CRC(9c4f31ae) SHA1(1c7072355d6f98b8e8554da19eab0512fdd9e2e1) ) // plane 1,2 ROM_FILL( 0x04000, 0x02000, 0x00 ) // no plane 3 - ROM_REGION( 0x40000, "gfx3", 0 ) + ROM_REGION( 0x40000, "sprites", 0 ) ROM_LOAD( "hm1_4.12h", 0x00000, 0x8000, CRC(78719c52) SHA1(06d7bb9f29ccdbf563b3bf13c0290510b26e186f) ) // 12k/l/m/p/r/t/u empty @@ -1254,15 +1251,15 @@ ROM_START( roishtar ) // 12d empty ROM_LOAD( "ri1_3.12c", 0x8000, 0x8000, CRC(a39829f7) SHA1(e08114d5154367a3cc36f1485253f18044a1888d) ) - ROM_REGION( 0x06000, "gfx1", 0 ) + ROM_REGION( 0x06000, "tiles_0", 0 ) ROM_LOAD( "ri1_14.7r", 0x00000, 0x04000, CRC(de8154b4) SHA1(70a65e4656cf9fcf5c54e84c628ec95393e856fb) ) // plane 1,2 ROM_LOAD( "ri1_15.7s", 0x04000, 0x02000, CRC(4298822b) SHA1(5aad41fd719c2f310ae485caaacda129c9f2ac94) ) // plane 3 - ROM_REGION( 0x06000, "gfx2", 0 ) + ROM_REGION( 0x06000, "tiles_1", 0 ) ROM_LOAD( "ri1_12.4r", 0x00000, 0x04000, CRC(557e54d3) SHA1(d22969deefcb3c3443d08a215f1ec2e874650b19) ) // plane 1,2 ROM_LOAD( "ri1_13.4s", 0x04000, 0x02000, CRC(9ebe8e32) SHA1(5990a86bfbf2669e512e8ca875c69b4c60c4d108) ) // plane 3 - ROM_REGION( 0x40000, "gfx3", 0 ) + ROM_REGION( 0x40000, "sprites", 0 ) ROM_LOAD( "ri1_5.12h", 0x00000, 0x8000, CRC(46b59239) SHA1(bb08e57cd5864f41e27a07dcf449896570d2203d) ) ROM_LOAD( "ri1_6.12k", 0x08000, 0x8000, CRC(94d9ef48) SHA1(a13b345b8fe30dea8e85698782674859c385e79a) ) ROM_LOAD( "ri1_7.12l", 0x10000, 0x8000, CRC(da802b59) SHA1(b6551db5cd9c3d674cdf1dc59f581ee435a7eeb7) ) @@ -1297,15 +1294,15 @@ ROM_START( genpeitd ) // 12d empty ROM_LOAD( "gt1_2.12c", 0xc000, 0x4000, CRC(302f2cb6) SHA1(19c39afb7d49d80aeaaf67a837cd02bfd3d64fbd) ) - ROM_REGION( 0x18000, "gfx1", 0 ) + ROM_REGION( 0x18000, "tiles_0", 0 ) ROM_LOAD( "gt1_7.7r", 0x00000, 0x10000, CRC(ea77a211) SHA1(32b8ae11723b6223b42225805acd0dcab65516a5) ) // plane 1,2 ROM_LOAD( "gt1_6.7s", 0x10000, 0x08000, CRC(1b128a2e) SHA1(6d7b95326919420538b509a119c26e9109e5539e) ) // plane 3 - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "tiles_1", 0 ) ROM_LOAD( "gt1_5.4r", 0x00000, 0x08000, CRC(44d58b06) SHA1(9663f026092484a4041e486bad23e8e58a4dbf95) ) // plane 1,2 ROM_LOAD( "gt1_4.4s", 0x08000, 0x04000, CRC(db8d45b0) SHA1(fd4ebdf442e8b9ccc026079c29a975b1fa6e8dd6) ) // plane 3 - ROM_REGION( 0x100000, "gfx3", 0 ) + ROM_REGION( 0x100000, "sprites", 0 ) ROM_LOAD( "gt1_11.12h", 0x00000, 0x20000, CRC(3181a5fe) SHA1(a98b8609afe3a41ed7b1432b3c2850e8de2c428b) ) ROM_LOAD( "gt1_12.12k", 0x20000, 0x20000, CRC(76b729ab) SHA1(d75aeca1ddbb690ff7442dee3b1d44331d220758) ) ROM_LOAD( "gt1_13.12l", 0x40000, 0x20000, CRC(e332a36e) SHA1(fa06da1e4f7ef3adf8e87d8d4d95aa7e0eb2d7b2) ) @@ -1328,7 +1325,7 @@ ROM_START( genpeitd ) ROM_REGION( 0x8000, "mcusub", 0 ) ROM_LOAD( "gt1_3.6b", 0x0000, 0x8000, CRC(315cd988) SHA1(87b1a90b2a53571f7d8f9a475125f3f31ed3cb5d) ) // subprogram for the MCU - ROM_REGION( 0x40000, "user1", 0 ) // bank switched data for CPU1 + ROM_REGION( 0x40000, "bankeddata", 0 ) // bank switched data for CPU1 ROM_LOAD( "gt1_10b.f1", 0x00000, 0x10000, CRC(5721ad0d) SHA1(f16afb3f468957a9de270366605592e14837b8c2) ) // h1 empty // k1 empty @@ -1353,15 +1350,15 @@ ROM_START( rthunder ) // program and mcu updated to rt3 ROM_LOAD( "rt3_3.12d", 0x00000, 0x8000, CRC(a13f601c) SHA1(8987174e364d20eeab706c3e0d4e0d3c2b96723c) ) ROM_LOAD( "rt3_2b.12c", 0x08000, 0x8000, CRC(a7ea46ee) SHA1(52e8757aacb4e01f8432125729e2323c48ebc4f5) ) - ROM_REGION( 0x18000, "gfx1", 0 ) + ROM_REGION( 0x18000, "tiles_0", 0 ) ROM_LOAD( "rt1_7.7r", 0x00000, 0x10000, CRC(a85efa39) SHA1(1ed63b421a93960668cb4558c1ca1b3c86b1f6be) ) // plane 1,2 ROM_LOAD( "rt1_8.7s", 0x10000, 0x08000, CRC(f7a95820) SHA1(82fe0adf6c5b3abef19031646e1eca1585dcc481) ) // plane 3 - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "tiles_1", 0 ) ROM_LOAD( "rt1_5.4r", 0x00000, 0x08000, CRC(d0fc470b) SHA1(70f7f1e29527044eae405f58af08bad3097990bd) ) // plane 1,2 ROM_LOAD( "rt1_6.4s", 0x08000, 0x04000, CRC(6b57edb2) SHA1(4a8f1e024e5be4d76f2c99d506ae7da86af3d1f5) ) // plane 3 - ROM_REGION( 0x80000, "gfx3", 0 ) + ROM_REGION( 0x80000, "sprites", 0 ) ROM_LOAD( "rt1_9.12h", 0x00000, 0x10000, CRC(8e070561) SHA1(483b4de79f2429236f45c32ec56b97a9a90574a3) ) ROM_LOAD( "rt1_10.12k", 0x10000, 0x10000, CRC(cb8fb607) SHA1(ba9400fb19d29a285897cc3a2d4d739ce845f897) ) ROM_LOAD( "rt1_11.12l", 0x20000, 0x10000, CRC(2bdf5ed9) SHA1(a771e922ad868ca1e008d08a8ff5fdf28aa315fc) ) @@ -1384,7 +1381,7 @@ ROM_START( rthunder ) // program and mcu updated to rt3 ROM_REGION( 0x8000, "mcusub", 0 ) ROM_LOAD( "rt3_4.6b", 0x0000, 0x8000, CRC(00cf293f) SHA1(bc441d21bb4c54a01d2393fbe99201714cd4439d) ) // subprogram for the MCU - ROM_REGION( 0x40000, "user1", 0 ) // bank switched data for CPU1 + ROM_REGION( 0x40000, "bankeddata", 0 ) // bank switched data for CPU1 ROM_LOAD( "rt1_17.f1", 0x00000, 0x10000, CRC(766af455) SHA1(8c71772795e783d6c4b88af9a311d55e363c298a) ) ROM_LOAD( "rt1_18.h1", 0x10000, 0x10000, CRC(3f9f2f5d) SHA1(541b8f80800cb55e4b81ac48771d00fe10c90743) ) ROM_LOAD( "rt3_19.k1", 0x20000, 0x10000, CRC(c16675e9) SHA1(e31c28cb95ffa85392c74e1d81bfa89acbaefeb9) ) @@ -1410,15 +1407,15 @@ ROM_START( rthundera ) ROM_LOAD( "rt3_3.12d", 0x00000, 0x8000, CRC(a13f601c) SHA1(8987174e364d20eeab706c3e0d4e0d3c2b96723c) ) ROM_LOAD( "rt3_2b.12c", 0x08000, 0x8000, CRC(a7ea46ee) SHA1(52e8757aacb4e01f8432125729e2323c48ebc4f5) ) - ROM_REGION( 0x18000, "gfx1", 0 ) + ROM_REGION( 0x18000, "tiles_0", 0 ) ROM_LOAD( "rt1_7.7r", 0x00000, 0x10000, CRC(a85efa39) SHA1(1ed63b421a93960668cb4558c1ca1b3c86b1f6be) ) // plane 1,2 ROM_LOAD( "rt1_8.7s", 0x10000, 0x08000, CRC(f7a95820) SHA1(82fe0adf6c5b3abef19031646e1eca1585dcc481) ) // plane 3 - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "tiles_1", 0 ) ROM_LOAD( "rt1_5.4r", 0x00000, 0x08000, CRC(d0fc470b) SHA1(70f7f1e29527044eae405f58af08bad3097990bd) ) // plane 1,2 ROM_LOAD( "rt1_6.4s", 0x08000, 0x04000, CRC(6b57edb2) SHA1(4a8f1e024e5be4d76f2c99d506ae7da86af3d1f5) ) // plane 3 - ROM_REGION( 0x80000, "gfx3", 0 ) + ROM_REGION( 0x80000, "sprites", 0 ) ROM_LOAD( "rt1_9.12h", 0x00000, 0x10000, CRC(8e070561) SHA1(483b4de79f2429236f45c32ec56b97a9a90574a3) ) ROM_LOAD( "rt1_10.12k", 0x10000, 0x10000, CRC(cb8fb607) SHA1(ba9400fb19d29a285897cc3a2d4d739ce845f897) ) ROM_LOAD( "rt1_11.12l", 0x20000, 0x10000, CRC(2bdf5ed9) SHA1(a771e922ad868ca1e008d08a8ff5fdf28aa315fc) ) @@ -1441,7 +1438,7 @@ ROM_START( rthundera ) ROM_REGION( 0x8000, "mcusub", 0 ) ROM_LOAD( "rt3_4.6b", 0x0000, 0x8000, CRC(00cf293f) SHA1(bc441d21bb4c54a01d2393fbe99201714cd4439d) ) // subprogram for the MCU - ROM_REGION( 0x40000, "user1", 0 ) // bank switched data for CPU1 + ROM_REGION( 0x40000, "bankeddata", 0 ) // bank switched data for CPU1 ROM_LOAD( "rt1_17.f1", 0x00000, 0x10000, CRC(766af455) SHA1(8c71772795e783d6c4b88af9a311d55e363c298a) ) ROM_LOAD( "rt1_18.h1", 0x10000, 0x10000, CRC(3f9f2f5d) SHA1(541b8f80800cb55e4b81ac48771d00fe10c90743) ) ROM_LOAD( "rt3_19.k1", 0x20000, 0x10000, CRC(c16675e9) SHA1(e31c28cb95ffa85392c74e1d81bfa89acbaefeb9) ) @@ -1466,15 +1463,15 @@ ROM_START( rthunder2 ) // program updated to rt2, 19/20 banked CPU code updated ROM_LOAD( "rt2_3.12d", 0x00000, 0x8000, CRC(f5d439d8) SHA1(87c610913e86c2dca5ec64f7a96ef3a0ddfe5968) ) ROM_LOAD( "rt2_2.12c", 0x08000, 0x8000, CRC(1c0e29e0) SHA1(17f6981d10414d14535835919bb05413498421f1) ) - ROM_REGION( 0x18000, "gfx1", 0 ) + ROM_REGION( 0x18000, "tiles_0", 0 ) ROM_LOAD( "rt1_7.7r", 0x00000, 0x10000, CRC(a85efa39) SHA1(1ed63b421a93960668cb4558c1ca1b3c86b1f6be) ) // plane 1,2 ROM_LOAD( "rt1_8.7s", 0x10000, 0x08000, CRC(f7a95820) SHA1(82fe0adf6c5b3abef19031646e1eca1585dcc481) ) // plane 3 - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "tiles_1", 0 ) ROM_LOAD( "rt1_5.4r", 0x00000, 0x08000, CRC(d0fc470b) SHA1(70f7f1e29527044eae405f58af08bad3097990bd) ) // plane 1,2 ROM_LOAD( "rt1_6.4s", 0x08000, 0x04000, CRC(6b57edb2) SHA1(4a8f1e024e5be4d76f2c99d506ae7da86af3d1f5) ) // plane 3 - ROM_REGION( 0x80000, "gfx3", 0 ) + ROM_REGION( 0x80000, "sprites", 0 ) ROM_LOAD( "rt1_9.12h", 0x00000, 0x10000, CRC(8e070561) SHA1(483b4de79f2429236f45c32ec56b97a9a90574a3) ) ROM_LOAD( "rt1_10.12k", 0x10000, 0x10000, CRC(cb8fb607) SHA1(ba9400fb19d29a285897cc3a2d4d739ce845f897) ) ROM_LOAD( "rt1_11.12l", 0x20000, 0x10000, CRC(2bdf5ed9) SHA1(a771e922ad868ca1e008d08a8ff5fdf28aa315fc) ) @@ -1497,7 +1494,7 @@ ROM_START( rthunder2 ) // program updated to rt2, 19/20 banked CPU code updated ROM_REGION( 0x8000, "mcusub", 0 ) ROM_LOAD( "rt2_4.6b", 0x0000, 0x8000, CRC(0387464f) SHA1(ce7f521bc2ecc6525880da2551daf595a394a275) ) // subprogram for the MCU - ROM_REGION( 0x40000, "user1", 0 ) // bank switched data for CPU1 + ROM_REGION( 0x40000, "bankeddata", 0 ) // bank switched data for CPU1 ROM_LOAD( "rt1_17.f1", 0x00000, 0x10000, CRC(766af455) SHA1(8c71772795e783d6c4b88af9a311d55e363c298a) ) ROM_LOAD( "rt1_18.h1", 0x10000, 0x10000, CRC(3f9f2f5d) SHA1(541b8f80800cb55e4b81ac48771d00fe10c90743) ) ROM_LOAD( "rt3_19.k1", 0x20000, 0x10000, CRC(c16675e9) SHA1(e31c28cb95ffa85392c74e1d81bfa89acbaefeb9) ) @@ -1523,15 +1520,15 @@ ROM_START( rthunder1 ) // some roms (mcu + samples) and maybe r19 updated to rt2 ROM_LOAD( "rt1_3.12d", 0x00000, 0x8000, CRC(aaa82885) SHA1(fc2bec3cf7e2de5f90174a2ed3bacfa94b6819f4) ) ROM_LOAD( "rt1_2b.12c", 0x08000, 0x8000, CRC(f22a03d8) SHA1(5b81fc82813978d5cb69402be72b9ccc585fa1d0) ) - ROM_REGION( 0x18000, "gfx1", 0 ) + ROM_REGION( 0x18000, "tiles_0", 0 ) ROM_LOAD( "rt1_7.7r", 0x00000, 0x10000, CRC(a85efa39) SHA1(1ed63b421a93960668cb4558c1ca1b3c86b1f6be) ) // plane 1,2 ROM_LOAD( "rt1_8.7s", 0x10000, 0x08000, CRC(f7a95820) SHA1(82fe0adf6c5b3abef19031646e1eca1585dcc481) ) // plane 3 - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "tiles_1", 0 ) ROM_LOAD( "rt1_5.4r", 0x00000, 0x08000, CRC(d0fc470b) SHA1(70f7f1e29527044eae405f58af08bad3097990bd) ) // plane 1,2 ROM_LOAD( "rt1_6.4s", 0x08000, 0x04000, CRC(6b57edb2) SHA1(4a8f1e024e5be4d76f2c99d506ae7da86af3d1f5) ) // plane 3 - ROM_REGION( 0x80000, "gfx3", 0 ) + ROM_REGION( 0x80000, "sprites", 0 ) ROM_LOAD( "rt1_9.12h", 0x00000, 0x10000, CRC(8e070561) SHA1(483b4de79f2429236f45c32ec56b97a9a90574a3) ) ROM_LOAD( "rt1_10.12k", 0x10000, 0x10000, CRC(cb8fb607) SHA1(ba9400fb19d29a285897cc3a2d4d739ce845f897) ) ROM_LOAD( "rt1_11.12l", 0x20000, 0x10000, CRC(2bdf5ed9) SHA1(a771e922ad868ca1e008d08a8ff5fdf28aa315fc) ) @@ -1554,7 +1551,7 @@ ROM_START( rthunder1 ) // some roms (mcu + samples) and maybe r19 updated to rt2 ROM_REGION( 0x8000, "mcusub", 0 ) ROM_LOAD( "rt2_4.6b", 0x0000, 0x8000, CRC(0387464f) SHA1(ce7f521bc2ecc6525880da2551daf595a394a275) ) // subprogram for the MCU - ROM_REGION( 0x40000, "user1", 0 ) // bank switched data for CPU1 + ROM_REGION( 0x40000, "bankeddata", 0 ) // bank switched data for CPU1 ROM_LOAD( "rt1_17.f1", 0x00000, 0x10000, CRC(766af455) SHA1(8c71772795e783d6c4b88af9a311d55e363c298a) ) ROM_LOAD( "rt1_18.h1", 0x10000, 0x10000, CRC(3f9f2f5d) SHA1(541b8f80800cb55e4b81ac48771d00fe10c90743) ) ROM_LOAD( "r19", 0x20000, 0x10000, CRC(fe9343b0) SHA1(ae8e5ee11eaf7dc1e8f814b0a0beef97731f042b) ) // probably rt2 @@ -1581,15 +1578,15 @@ ROM_START( rthunder0 ) ROM_LOAD( "rt1_3.12d", 0x00000, 0x8000, CRC(aaa82885) SHA1(fc2bec3cf7e2de5f90174a2ed3bacfa94b6819f4) ) ROM_LOAD( "rt1_2b.12c", 0x08000, 0x8000, CRC(f22a03d8) SHA1(5b81fc82813978d5cb69402be72b9ccc585fa1d0) ) - ROM_REGION( 0x18000, "gfx1", 0 ) + ROM_REGION( 0x18000, "tiles_0", 0 ) ROM_LOAD( "rt1_7.7r", 0x00000, 0x10000, CRC(a85efa39) SHA1(1ed63b421a93960668cb4558c1ca1b3c86b1f6be) ) // plane 1,2 ROM_LOAD( "rt1_8.7s", 0x10000, 0x08000, CRC(f7a95820) SHA1(82fe0adf6c5b3abef19031646e1eca1585dcc481) ) // plane 3 - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "tiles_1", 0 ) ROM_LOAD( "rt1_5.4r", 0x00000, 0x08000, CRC(d0fc470b) SHA1(70f7f1e29527044eae405f58af08bad3097990bd) ) // plane 1,2 ROM_LOAD( "rt1_6.4s", 0x08000, 0x04000, CRC(6b57edb2) SHA1(4a8f1e024e5be4d76f2c99d506ae7da86af3d1f5) ) // plane 3 - ROM_REGION( 0x80000, "gfx3", 0 ) + ROM_REGION( 0x80000, "sprites", 0 ) ROM_LOAD( "rt1_9.12h", 0x00000, 0x10000, CRC(8e070561) SHA1(483b4de79f2429236f45c32ec56b97a9a90574a3) ) ROM_LOAD( "rt1_10.12k", 0x10000, 0x10000, CRC(cb8fb607) SHA1(ba9400fb19d29a285897cc3a2d4d739ce845f897) ) ROM_LOAD( "rt1_11.12l", 0x20000, 0x10000, CRC(2bdf5ed9) SHA1(a771e922ad868ca1e008d08a8ff5fdf28aa315fc) ) @@ -1612,7 +1609,7 @@ ROM_START( rthunder0 ) ROM_REGION( 0x8000, "mcusub", 0 ) ROM_LOAD( "rt1_4.6b", 0x0000, 0x8000, CRC(3f795094) SHA1(390eef98e3dec690bf942c35617e2fa004c96e5c) ) // subprogram for the MCU - ROM_REGION( 0x40000, "user1", 0 ) // bank switched data for CPU1 + ROM_REGION( 0x40000, "bankeddata", 0 ) // bank switched data for CPU1 ROM_LOAD( "rt1_17.f1", 0x00000, 0x10000, CRC(766af455) SHA1(8c71772795e783d6c4b88af9a311d55e363c298a) ) ROM_LOAD( "rt1_18.h1", 0x10000, 0x10000, CRC(3f9f2f5d) SHA1(541b8f80800cb55e4b81ac48771d00fe10c90743) ) ROM_LOAD( "rt1_19.k1", 0x20000, 0x10000, CRC(1273a048) SHA1(b8a0a6f5d9f9d351a622252afb409a111431c5ca) ) @@ -1638,15 +1635,15 @@ ROM_START( wndrmomo ) // 12d empty ROM_LOAD( "wm1_2.12c", 0x8000, 0x8000, CRC(3181efd0) SHA1(01a2e0e4c8ced6f48b6e70393a3c4152b079e9b0) ) - ROM_REGION( 0x0c000, "gfx1", 0 ) + ROM_REGION( 0x0c000, "tiles_0", 0 ) ROM_LOAD( "wm1_6.7r", 0x00000, 0x08000, CRC(93955fbb) SHA1(cffd457886c40bf709b573237165ae8fa9784e32) ) // plane 1,2 ROM_LOAD( "wm1_7.7s", 0x08000, 0x04000, CRC(7d662527) SHA1(09d1dc46a402c67dddcdd4cc90f32948c7a28795) ) // plane 3 - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "tiles_1", 0 ) ROM_LOAD( "wm1_4.4r", 0x00000, 0x08000, CRC(bbe67836) SHA1(bc998c2ddc2664db614e7c487f77073a5be69e89) ) // plane 1,2 ROM_LOAD( "wm1_5.4s", 0x08000, 0x04000, CRC(a81b481f) SHA1(b5a029e432b29e157505b975ea57cd4b5da361a7) ) // plane 3 - ROM_REGION( 0x80000, "gfx3", 0 ) + ROM_REGION( 0x80000, "sprites", 0 ) ROM_LOAD( "wm1_8.12h", 0x00000, 0x10000, CRC(14f52e72) SHA1(0f8f58cd13e3393a113817593816f53a218f3ce4) ) ROM_LOAD( "wm1_9.12k", 0x10000, 0x10000, CRC(16f8cdae) SHA1(8281b4c66157580f34aec7c035d06f721f77b3d5) ) ROM_LOAD( "wm1_10.12l", 0x20000, 0x10000, CRC(bfbc1896) SHA1(0308cf907c77417ad3f84326b074567a00245998) ) @@ -1669,7 +1666,7 @@ ROM_START( wndrmomo ) ROM_REGION( 0x8000, "mcusub", 0 ) ROM_LOAD( "wm1_3.6b", 0x0000, 0x8000, CRC(55f01df7) SHA1(c11574a8b51bf965790b97895452e9fa9ab6b752) ) // subprogram for the MCU - ROM_REGION( 0x40000, "user1", 0 ) // bank switched data for CPU1 + ROM_REGION( 0x40000, "bankeddata", 0 ) // bank switched data for CPU1 ROM_LOAD( "wm1_16.f1", 0x00000, 0x10000, CRC(e565f8f3) SHA1(e1f417003ef9f700f9d5ed091484463c704c8b9f) ) // h1 empty // k1 empty @@ -1690,8 +1687,8 @@ ROM_END void namcos86_state::init_namco86() { // shuffle tile ROMs so regular gfx unpack routines can be used - uint8_t *gfx = memregion("gfx1")->base(); - int size = memregion("gfx1")->bytes() * 2 / 3; + uint8_t *gfx = memregion("tiles_0")->base(); + int size = memregion("tiles_0")->bytes() * 2 / 3; { std::vector buffer(size); @@ -1703,8 +1700,8 @@ void namcos86_state::init_namco86() for (int i = 0; i < size; i += 2) { - uint8_t data1 = buffer[i]; - uint8_t data2 = buffer[i+1]; + uint8_t const data1 = buffer[i]; + uint8_t const data2 = buffer[i+1]; *dest1++ = (data1 << 4) | (data2 & 0xf); *dest2++ = (data1 & 0xf0) | (data2 >> 4); @@ -1712,8 +1709,8 @@ void namcos86_state::init_namco86() } } - gfx = memregion("gfx2")->base(); - size = memregion("gfx2")->bytes() * 2 / 3; + gfx = memregion("tiles_1")->base(); + size = memregion("tiles_1")->bytes() * 2 / 3; { std::vector buffer(size); @@ -1725,8 +1722,8 @@ void namcos86_state::init_namco86() for (int i = 0; i < size; i += 2) { - uint8_t data1 = buffer[i]; - uint8_t data2 = buffer[i+1]; + uint8_t const data1 = buffer[i]; + uint8_t const data2 = buffer[i+1]; *dest1++ = (data1 << 4) | (data2 & 0xf); *dest2++ = (data1 & 0xf0) | (data2 >> 4); diff --git a/src/mame/namco/namcos86.h b/src/mame/namco/namcos86.h index 72b90a3fc2e..35578ad691d 100644 --- a/src/mame/namco/namcos86.h +++ b/src/mame/namco/namcos86.h @@ -5,10 +5,13 @@ #pragma once +#include "namco_cus4xtmap.h" + #include "cpu/m6800/m6801.h" #include "machine/watchdog.h" #include "sound/n63701x.h" #include "sound/namco.h" + #include "emupal.h" #include "tilemap.h" @@ -24,21 +27,23 @@ public: , m_cus30(*this, "namco") , m_gfxdecode(*this, "gfxdecode") , m_palette(*this, "palette") + , m_tilegen(*this, "tilegen_%u", 0U) , m_63701x(*this, "namco2") - , m_rthunder_videoram1(*this, "videoram1") - , m_rthunder_videoram2(*this, "videoram2") - , m_rthunder_spriteram(*this, "spriteram") - , m_user1_ptr(*this, "user1") + , m_spriteram(*this, "spriteram") + , m_bankeddata_ptr(*this, "bankeddata") + , m_mainbank(*this, "mainbank") + , m_subbank(*this, "subbank") + , m_io_dsw(*this, "DSW%c", 'A') , m_leds(*this, "led%u", 0U) { } - void genpeitd(machine_config &config); - void wndrmomo(machine_config &config); - void roishtar(machine_config &config); - void rthunder(machine_config &config); - void hopmappy(machine_config &config); + void genpeitd(machine_config &config) ATTR_COLD; + void wndrmomo(machine_config &config) ATTR_COLD; + void roishtar(machine_config &config) ATTR_COLD; + void rthunder(machine_config &config) ATTR_COLD; + void hopmappy(machine_config &config) ATTR_COLD; - void init_namco86(); + void init_namco86() ATTR_COLD; protected: virtual void machine_start() override ATTR_COLD; @@ -52,32 +57,22 @@ private: uint8_t dsw1_r(); void int_ack1_w(uint8_t data); void int_ack2_w(uint8_t data); - void watchdog1_w(uint8_t data); - void watchdog2_w(uint8_t data); + template void watchdog_w(uint8_t data); void coin_w(uint8_t data); void led_w(uint8_t data); void cus115_w(offs_t offset, uint8_t data); - void videoram1_w(offs_t offset, uint8_t data); - void videoram2_w(offs_t offset, uint8_t data); void tilebank_select_w(offs_t offset, uint8_t data); - void scroll0_w(offs_t offset, uint8_t data); - void scroll1_w(offs_t offset, uint8_t data); - void scroll2_w(offs_t offset, uint8_t data); - void scroll3_w(offs_t offset, uint8_t data); void backcolor_w(uint8_t data); void spriteram_w(offs_t offset, uint8_t data); - TILE_GET_INFO_MEMBER(get_tile_info0); - TILE_GET_INFO_MEMBER(get_tile_info1); - TILE_GET_INFO_MEMBER(get_tile_info2); - TILE_GET_INFO_MEMBER(get_tile_info3); + void tile_cb_0(u8 layer, u8 &gfxno, u32 &code); + void tile_cb_1(u8 layer, u8 &gfxno, u32 &code); void namcos86_palette(palette_device &palette); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_vblank(int state); void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void scroll_w(offs_t offset, int data, int layer); void common_mcu_map(address_map &map) ATTR_COLD; void cpu1_map(address_map &map) ATTR_COLD; @@ -99,25 +94,20 @@ private: required_device m_cus30; required_device m_gfxdecode; required_device m_palette; + required_device_array m_tilegen; optional_device m_63701x; - required_shared_ptr m_rthunder_videoram1; - required_shared_ptr m_rthunder_videoram2; - required_shared_ptr m_rthunder_spriteram; - optional_region_ptr m_user1_ptr; + required_shared_ptr m_spriteram; + optional_region_ptr m_bankeddata_ptr; + required_memory_bank m_mainbank; + optional_memory_bank m_subbank; + optional_ioport_array<2> m_io_dsw; output_finder<2> m_leds; - uint8_t *m_spriteram = nullptr; - int m_wdog = 0; - int m_tilebank = 0; - int m_xscroll[4]; - int m_yscroll[4]; - tilemap_t *m_bg_tilemap[4]{}; - int m_backcolor = 0; + uint8_t m_wdog = 0; + uint32_t m_tilebank = 0; + uint16_t m_backcolor = 0; const uint8_t *m_tile_address_prom = nullptr; - int m_copy_sprites = 0; - - inline void get_tile_info(tile_data &tileinfo,int tile_index,int layer,uint8_t *vram); - void set_scroll(int layer); + bool m_copy_sprites = false; }; #endif // MAME_NAMCO_NAMCOS86_H diff --git a/src/mame/namco/namcos86_v.cpp b/src/mame/namco/namcos86_v.cpp index d4027691eb4..f699f3a0372 100644 --- a/src/mame/namco/namcos86_v.cpp +++ b/src/mame/namco/namcos86_v.cpp @@ -8,6 +8,8 @@ Namco System 86 Video Hardware #include "emu.h" #include "namcos86.h" + +#include "video/resnet.h" #include "screen.h" @@ -38,42 +40,54 @@ Namco System 86 Video Hardware void namcos86_state::namcos86_palette(palette_device &palette) { const uint8_t *color_prom = memregion("proms")->base(); + static constexpr int resistances[4] = { 2200, 1000, 470, 220 }; + + // compute the color output resistor weights + double rweights[4], gweights[4], bweights[4]; + compute_resistor_weights(0, 255, -1.0, + 4, &resistances[0], rweights, 0, 0, + 4, &resistances[0], gweights, 0, 0, + 4, &resistances[0], bweights, 0, 0); - rgb_t palette_val[512]; + // create a lookup table for the palette for (int i = 0; i < 512; i++) { int bit0, bit1, bit2, bit3; - bit0 = BIT(color_prom[0], 0); - bit1 = BIT(color_prom[0], 1); - bit2 = BIT(color_prom[0], 2); - bit3 = BIT(color_prom[0], 3); - int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - bit0 = BIT(color_prom[0], 4); - bit1 = BIT(color_prom[0], 5); - bit2 = BIT(color_prom[0], 6); - bit3 = BIT(color_prom[0], 7); - int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - bit0 = BIT(color_prom[512], 0); - bit1 = BIT(color_prom[512], 1); - bit2 = BIT(color_prom[512], 2); - bit3 = BIT(color_prom[512], 3); - int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - palette_val[i] = rgb_t(r, g, b); - color_prom++; + // red component + bit0 = BIT(color_prom[i], 0); + bit1 = BIT(color_prom[i], 1); + bit2 = BIT(color_prom[i], 2); + bit3 = BIT(color_prom[i], 3); + int const r = combine_weights(rweights, bit0, bit1, bit2, bit3); + + // green component + bit0 = BIT(color_prom[i], 4); + bit1 = BIT(color_prom[i], 5); + bit2 = BIT(color_prom[i], 6); + bit3 = BIT(color_prom[i], 7); + int const g = combine_weights(gweights, bit0, bit1, bit2, bit3); + + // blue component + bit0 = BIT(color_prom[i | 0x200], 0); + bit1 = BIT(color_prom[i | 0x200], 1); + bit2 = BIT(color_prom[i | 0x200], 2); + bit3 = BIT(color_prom[i | 0x200], 3); + int const b = combine_weights(bweights, bit0, bit1, bit2, bit3); + + palette.set_indirect_color(i, rgb_t(r, g, b)); } - color_prom += 512; // color_prom now points to the beginning of the lookup table + color_prom += 0x400; // tiles lookup table for (int i = 0; i < 2048; i++) - palette.set_pen_color(i, palette_val[*color_prom++]); + palette.set_pen_indirect(i, *color_prom++); // sprites lookup table for (int i = 0; i < 2048; i++) - palette.set_pen_color(2048 + i, palette_val[256 + *color_prom++]); + palette.set_pen_indirect(2048 + i, 256 + *color_prom++); // color_prom now points to the beginning of the tile address decode PROM @@ -81,47 +95,20 @@ void namcos86_state::namcos86_palette(palette_device &palette) } - - /*************************************************************************** Callbacks for the TileMap code ***************************************************************************/ -inline void namcos86_state::get_tile_info(tile_data &tileinfo,int tile_index,int layer,uint8_t *vram) -{ - int attr = vram[2*tile_index + 1]; - int tile_offs; - if (layer & 2) - tile_offs = ((m_tile_address_prom[((layer & 1) << 4) + (attr & 0x03)] & 0xe0) >> 5) * 0x100; - else - tile_offs = ((m_tile_address_prom[((layer & 1) << 4) + ((attr & 0x03) << 2)] & 0x0e) >> 1) * 0x100 + m_tilebank * 0x800; - - tileinfo.set((layer & 2) ? 1 : 0, - vram[2*tile_index] + tile_offs, - attr, - 0); -} - -TILE_GET_INFO_MEMBER(namcos86_state::get_tile_info0) -{ - get_tile_info(tileinfo,tile_index,0,&m_rthunder_videoram1[0x0000]); -} - -TILE_GET_INFO_MEMBER(namcos86_state::get_tile_info1) -{ - get_tile_info(tileinfo,tile_index,1,&m_rthunder_videoram1[0x1000]); -} - -TILE_GET_INFO_MEMBER(namcos86_state::get_tile_info2) +void namcos86_state::tile_cb_0(u8 layer, u8 &gfxno, u32 &code) { - get_tile_info(tileinfo,tile_index,2,&m_rthunder_videoram2[0x0000]); + code = (code & 0xff) | ((((m_tile_address_prom[((layer & 1) << 4) + (((code >> 8) & 0x03) << 2)] & 0x0e) >> 1) << 8) | (m_tilebank << 11)); } -TILE_GET_INFO_MEMBER(namcos86_state::get_tile_info3) +void namcos86_state::tile_cb_1(u8 layer, u8 &gfxno, u32 &code) { - get_tile_info(tileinfo,tile_index,3,&m_rthunder_videoram2[0x1000]); + code = (code & 0xff) | (((m_tile_address_prom[((layer & 1) << 4) + ((code >> 8) & 0x03)] & 0xe0) >> 5) << 8); } @@ -133,95 +120,28 @@ TILE_GET_INFO_MEMBER(namcos86_state::get_tile_info3) void namcos86_state::video_start() { - m_bg_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(namcos86_state::get_tile_info0)), TILEMAP_SCAN_ROWS, 8,8, 64,32); - m_bg_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(namcos86_state::get_tile_info1)), TILEMAP_SCAN_ROWS, 8,8, 64,32); - m_bg_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(namcos86_state::get_tile_info2)), TILEMAP_SCAN_ROWS, 8,8, 64,32); - m_bg_tilemap[3] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(namcos86_state::get_tile_info3)), TILEMAP_SCAN_ROWS, 8,8, 64,32); - - for (int i = 0; i < 4; i++) - { - static constexpr int xdisp[] = { 47, 49, 46, 48 }; - - m_bg_tilemap[i]->set_scrolldx(xdisp[i], 422 - xdisp[i]); - m_bg_tilemap[i]->set_scrolldy(-9, 9); - m_bg_tilemap[i]->set_transparent_pen(7); - } - - m_spriteram = m_rthunder_spriteram + 0x1800; - save_item(NAME(m_tilebank)); - save_item(NAME(m_xscroll)); - save_item(NAME(m_yscroll)); save_item(NAME(m_backcolor)); save_item(NAME(m_copy_sprites)); - - m_backcolor = 0; } - /*************************************************************************** Memory handlers ***************************************************************************/ -void namcos86_state::videoram1_w(offs_t offset, uint8_t data) -{ - m_rthunder_videoram1[offset] = data; - m_bg_tilemap[offset/0x1000]->mark_tile_dirty((offset & 0xfff)/2); -} - -void namcos86_state::videoram2_w(offs_t offset, uint8_t data) -{ - m_rthunder_videoram2[offset] = data; - m_bg_tilemap[2+offset/0x1000]->mark_tile_dirty((offset & 0xfff)/2); -} - void namcos86_state::tilebank_select_w(offs_t offset, uint8_t data) { - int bit = BIT(offset,10); + uint32_t const bit = BIT(offset, 10); if (m_tilebank != bit) { m_tilebank = bit; - m_bg_tilemap[0]->mark_all_dirty(); - m_bg_tilemap[1]->mark_all_dirty(); - } -} - -void namcos86_state::scroll_w(offs_t offset, int data, int layer) -{ - switch (offset) - { - case 0: - m_xscroll[layer] = (m_xscroll[layer]&0xff)|(data<<8); - break; - case 1: - m_xscroll[layer] = (m_xscroll[layer]&0xff00)|data; - break; - case 2: - m_yscroll[layer] = data; - break; + m_tilegen[0]->mark_all_dirty(); } } -void namcos86_state::scroll0_w(offs_t offset, uint8_t data) -{ - scroll_w(offset,data,0); -} -void namcos86_state::scroll1_w(offs_t offset, uint8_t data) -{ - scroll_w(offset,data,1); -} -void namcos86_state::scroll2_w(offs_t offset, uint8_t data) -{ - scroll_w(offset,data,2); -} -void namcos86_state::scroll3_w(offs_t offset, uint8_t data) -{ - scroll_w(offset,data,3); -} - void namcos86_state::backcolor_w(uint8_t data) { m_backcolor = data; @@ -230,11 +150,11 @@ void namcos86_state::backcolor_w(uint8_t data) void namcos86_state::spriteram_w(offs_t offset, uint8_t data) { - m_rthunder_spriteram[offset] = data; + m_spriteram[offset] = data; - /* a write to this offset tells the sprite chip to buffer the sprite list */ + // a write to this offset tells the sprite chip to buffer the sprite list if (offset == 0x1ff2) - m_copy_sprites = 1; + m_copy_sprites = true; } @@ -266,35 +186,36 @@ sprite format: void namcos86_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const uint8_t *source = &m_spriteram[0x0800-0x20]; /* the last is NOT a sprite */ - const uint8_t *finish = &m_spriteram[0]; - gfx_element *gfx = m_gfxdecode->gfx(2); + const uint8_t *source = &m_spriteram[0x2000-0x20]; // the last is NOT a sprite + const uint8_t *finish = &m_spriteram[0x1800]; + gfx_element *gfx = m_gfxdecode->gfx(0); + + int const sprite_xoffs = m_spriteram[0x1ff5] + ((m_spriteram[0x1ff4] & 1) << 8); + int const sprite_yoffs = m_spriteram[0x1ff7]; - int sprite_xoffs = m_spriteram[0x07f5] + ((m_spriteram[0x07f4] & 1) << 8); - int sprite_yoffs = m_spriteram[0x07f7]; + int const bank_sprites = m_gfxdecode->gfx(0)->elements() / 8; - int bank_sprites = m_gfxdecode->gfx(2)->elements() / 8; + static const int sprite_size[4] = { 16, 8, 32, 4 }; while (source >= finish) { - static const int sprite_size[4] = { 16, 8, 32, 4 }; - int attr1 = source[10]; - int attr2 = source[14]; + int const attr1 = source[10]; + int const attr2 = source[14]; int color = source[12]; - int flipx = (attr1 & 0x20) >> 5; - int flipy = (attr2 & 0x01); - int sizex = sprite_size[(attr1 & 0xc0) >> 6]; - int sizey = sprite_size[(attr2 & 0x06) >> 1]; - int tx = (attr1 & 0x18) & (~(sizex-1)); - int ty = (attr2 & 0x18) & (~(sizey-1)); + bool flipx = BIT(attr1, 5); + bool flipy = BIT(attr2, 0); + int const sizex = sprite_size[(attr1 & 0xc0) >> 6]; + int const sizey = sprite_size[(attr2 & 0x06) >> 1]; + int const tx = (attr1 & 0x18) & (~(sizex - 1)); + int const ty = (attr2 & 0x18) & (~(sizey - 1)); int sx = source[13] + ((color & 0x01) << 8); int sy = -source[15] - sizey; int sprite = source[11]; - int sprite_bank = attr1 & 7; - int priority = (source[14] & 0xe0) >> 5; - int pri_mask = (0xff << (priority + 1)) & 0xff; + int const sprite_bank = attr1 & 7; + int const priority = (source[14] & 0xe0) >> 5; + uint32_t const pri_mask = (0xff << (priority + 1)) & 0xff; - sprite &= bank_sprites-1; + sprite &= bank_sprites - 1; sprite += sprite_bank * bank_sprites; color = color >> 1; @@ -305,59 +226,43 @@ void namcos86_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c { sx = -sx - sizex; sy = -sy - sizey; - flipx ^= 1; - flipy ^= 1; + flipx = !flipx; + flipy = !flipy; } - sy++; /* sprites are buffered and delayed by one scanline */ + sy++; // sprites are buffered and delayed by one scanline gfx->set_source_clip(tx, sizex, ty, sizey); - gfx->prio_transpen(bitmap,cliprect, + gfx->prio_transpen(bitmap, cliprect, sprite, color, - flipx,flipy, + flipx, flipy, sx & 0x1ff, ((sy + 16) & 0xff) - 16, - screen.priority(), pri_mask,0xf); + screen.priority(), pri_mask, 0xf); source -= 0x10; } } -void namcos86_state::set_scroll(int layer) -{ - int scrollx = m_xscroll[layer]; - int scrolly = m_yscroll[layer]; - if (flip_screen()) - { - scrollx = -scrollx; - scrolly = -scrolly; - } - m_bg_tilemap[layer]->set_scrollx(0, scrollx); - m_bg_tilemap[layer]->set_scrolly(0, scrolly); -} - - uint32_t namcos86_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - /* flip screen is embedded in the sprite control registers */ - flip_screen_set(m_spriteram[0x07f6] & 1); - set_scroll(0); - set_scroll(1); - set_scroll(2); - set_scroll(3); + // flip screen is embedded in the sprite control registers + flip_screen_set(BIT(m_spriteram[0x1ff6], 0)); + m_tilegen[0]->init_scroll(flip_screen()); + m_tilegen[1]->init_scroll(flip_screen()); screen.priority().fill(0, cliprect); - bitmap.fill(m_gfxdecode->gfx(0)->colorbase() + 8*m_backcolor+7, cliprect); + bitmap.fill(m_tilegen[0]->gfx(0)->colorbase() + 8*m_backcolor+7, cliprect); - for (int layer = 0;layer < 8;layer++) + for (int layer = 0; layer < 8; layer++) { - for (int i = 3;i >= 0;i--) + for (int i = 3; i >= 0; i--) { - if (((m_xscroll[i] & 0x0e00) >> 9) == layer) - m_bg_tilemap[i]->draw(screen, bitmap, cliprect, 0,layer,0); + if (((m_tilegen[i >> 1]->xscroll_r(i & 1) & 0x0e00) >> 9) == layer) + m_tilegen[i >> 1]->draw(screen, bitmap, cliprect, i & 1, 0, layer, 0); } } @@ -373,13 +278,13 @@ void namcos86_state::screen_vblank(int state) { if (m_copy_sprites) { - for (int i = 0;i < 0x800;i += 16) + for (int i = 0x1800; i < 0x2000; i += 16) { - for (int j = 10;j < 16;j++) - m_spriteram[i+j] = m_spriteram[i+j - 6]; + for (int j = 10; j < 16; j++) + m_spriteram[i + j] = m_spriteram[i + j - 6]; } - m_copy_sprites = 0; + m_copy_sprites = false; } } } -- cgit v1.2.3