diff --git a/src/mame/capcom/exedexes.cpp b/src/mame/capcom/exedexes.cpp index 1d0dec0a432..61c4fbb47af 100644 --- a/src/mame/capcom/exedexes.cpp +++ b/src/mame/capcom/exedexes.cpp @@ -1,8 +1,10 @@ // license:BSD-3-Clause -// copyright-holders:Richard Davies +// copyright-holders: Richard Davies + /*************************************************************************** Exed Exes + Capcom 84110-A-1 + 84110-B-1 PCBs Notes: - Flip screen is not supported, but doesn't seem to be used (no flip screen @@ -12,29 +14,314 @@ ***************************************************************************/ #include "emu.h" -#include "exedexes.h" #include "cpu/z80/z80.h" #include "machine/gen_latch.h" +#include "machine/timer.h" #include "sound/ay8910.h" #include "sound/sn76496.h" +#include "video/bufsprite.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" -TIMER_DEVICE_CALLBACK_MEMBER(exedexes_state::scanline) +namespace { + +class exedexes_state : public driver_device { - int scanline = param; +public: + exedexes_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_spriteram(*this, "spriteram"), + m_videoram(*this, "videoram"), + m_colorram(*this, "colorram"), + m_nbg_yscroll(*this, "nbg_yscroll"), + m_nbg_xscroll(*this, "nbg_xscroll"), + m_bg_scroll(*this, "bg_scroll"), + m_tilerom(*this, "tilerom") + { } - if (scanline == 240) // vblank-out irq - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xd7); /* Z80 - RST 10h - vblank */ + void exedexes(machine_config &config); - if (scanline == 0) // unknown irq event - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xcf); /* Z80 - RST 08h */ +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + // devices + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_spriteram; + + // memory pointers + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + required_shared_ptr m_nbg_yscroll; + required_shared_ptr m_nbg_xscroll; + required_shared_ptr m_bg_scroll; + required_region_ptr m_tilerom; + + // video-related + tilemap_t *m_bg_tilemap = nullptr; + tilemap_t *m_fg_tilemap = nullptr; + tilemap_t *m_tx_tilemap = nullptr; + uint8_t m_chon = 0; + uint8_t m_objon = 0; + uint8_t m_sc1on = 0; + uint8_t m_sc2on = 0; + + void videoram_w(offs_t offset, u8 data); + void colorram_w(offs_t offset, u8 data); + void c804_w(u8 data); + void gfxctrl_w(u8 data); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + TILE_GET_INFO_MEMBER(get_tx_tile_info); + TILEMAP_MAPPER_MEMBER(bg_tilemap_scan); + TILEMAP_MAPPER_MEMBER(fg_tilemap_scan); + void palette(palette_device &palette) const; + u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(scanline); + void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void main_map(address_map &map); + void sound_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + Convert the color PROMs into a more useable format. + + Exed Exes has three 256x4 palette PROMs (one per gun), three 256x4 lookup + table PROMs (one for characters, one for sprites, one for background tiles) + and one 256x4 sprite palette bank selector PROM. + + 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 + +***************************************************************************/ + +void exedexes_state::palette(palette_device &palette) const +{ + const u8 *color_prom = memregion("proms")->base(); + + // create a lookup table for the palette + for (int i = 0; i < 0x100; i++) + { + const int r = pal4bit(color_prom[i + 0x000]); + const int g = pal4bit(color_prom[i + 0x100]); + const int b = pal4bit(color_prom[i + 0x200]); + + palette.set_indirect_color(i, rgb_t(r, g, b)); + } + + // color_prom now points to the beginning of the lookup table + color_prom += 0x300; + + // characters use colors 0xc0-0xcf + for (int i = 0; i < 0x100; i++) + { + const u8 ctabentry = color_prom[i] | 0xc0; + palette.set_pen_indirect(i, ctabentry); + } + + // 32x32 tiles use colors 0-0x0f + for (int i = 0x100; i < 0x200; i++) + { + const u8 ctabentry = color_prom[i]; + palette.set_pen_indirect(i, ctabentry); + } + + // 16x16 tiles use colors 0x40-0x4f + for (int i = 0x200; i < 0x300; i++) + { + const u8 ctabentry = color_prom[i] | 0x40; + palette.set_pen_indirect(i, ctabentry); + } + + // sprites use colors 0x80-0xbf in four banks + for (int i = 0x300; i < 0x400; i++) + { + const u8 ctabentry = color_prom[i] | (color_prom[i + 0x100] << 4) | 0x80; + palette.set_pen_indirect(i, ctabentry); + } +} + +void exedexes_state::videoram_w(offs_t offset, u8 data) +{ + m_videoram[offset] = data; + m_tx_tilemap->mark_tile_dirty(offset); +} + +void exedexes_state::colorram_w(offs_t offset, u8 data) +{ + m_colorram[offset] = data; + m_tx_tilemap->mark_tile_dirty(offset); +} + +void exedexes_state::c804_w(u8 data) +{ + // bits 0 and 1 are coin counters + machine().bookkeeping().coin_counter_w(0, data & 0x01); + machine().bookkeeping().coin_counter_w(1, data & 0x02); + + machine().bookkeeping().coin_lockout_w(0, data & 0x04); + machine().bookkeeping().coin_lockout_w(1, data & 0x08); + + // bit 7 is text enable + m_chon = data & 0x80; + + // other bits seem to be unused +} + +void exedexes_state::gfxctrl_w(u8 data) +{ + // bit 4 is bg enable + m_sc2on = data & 0x10; + + // bit 5 is fg enable + m_sc1on = data & 0x20; + + // bit 6 is sprite enable + m_objon = data & 0x40; + + // other bits seem to be unused } -void exedexes_state::exedexes_map(address_map &map) +TILE_GET_INFO_MEMBER(exedexes_state::get_bg_tile_info) +{ + const u8 attr = m_tilerom[tile_index]; + const u8 code = attr & 0x3f; + const u8 color = m_tilerom[tile_index + (8 * 8)]; + const int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0); + + tileinfo.set(1, code, color, flags); +} + +TILE_GET_INFO_MEMBER(exedexes_state::get_fg_tile_info) +{ + const u8 code = m_tilerom[tile_index]; + + tileinfo.set(2, code, 0, 0); +} + +TILE_GET_INFO_MEMBER(exedexes_state::get_tx_tile_info) +{ + const u32 code = m_videoram[tile_index] + 2 * (m_colorram[tile_index] & 0x80); + const u8 color = m_colorram[tile_index] & 0x3f; + + tileinfo.group = color; + + tileinfo.set(0, code, color, 0); +} + +TILEMAP_MAPPER_MEMBER(exedexes_state::bg_tilemap_scan) +{ + // logical (col,row) -> memory offset + return ((col * 32 & 0xe0) >> 5) + ((row * 32 & 0xe0) >> 2) + ((col * 32 & 0x3f00) >> 1) + 0x4000; +} + +TILEMAP_MAPPER_MEMBER(exedexes_state::fg_tilemap_scan) +{ + // logical (col,row) -> memory offset + return ((col * 16 & 0xf0) >> 4) + (row * 16 & 0xf0) + (col * 16 & 0x700) + ((row * 16 & 0x700) << 3); +} + +void exedexes_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(exedexes_state::get_bg_tile_info)), tilemap_mapper_delegate(*this, FUNC(exedexes_state::bg_tilemap_scan)), 32, 32, 64, 64); + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(exedexes_state::get_fg_tile_info)), tilemap_mapper_delegate(*this, FUNC(exedexes_state::fg_tilemap_scan)), 16, 16, 128, 128); + m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(exedexes_state::get_tx_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + + m_fg_tilemap->set_transparent_pen(0); + m_tx_tilemap->configure_groups(*m_gfxdecode->gfx(0), 0xcf); +} + +void exedexes_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + const u8 *buffered_spriteram = m_spriteram->buffer(); + + if (!m_objon) + return; + + for (int offs = 0; offs < m_spriteram->bytes(); offs += 32) + { + u32 primask = 0; + if (buffered_spriteram[offs + 1] & 0x40) + primask |= GFX_PMASK_2; + + const u32 code = buffered_spriteram[offs]; + const u32 color = buffered_spriteram[offs + 1] & 0x0f; + const bool flipx = buffered_spriteram[offs + 1] & 0x10; + const bool flipy = buffered_spriteram[offs + 1] & 0x20; + const int sx = buffered_spriteram[offs + 3] - ((buffered_spriteram[offs + 1] & 0x80) << 1); + const int sy = buffered_spriteram[offs + 2]; + + m_gfxdecode->gfx(3)->prio_transpen(bitmap, cliprect, + code, + color, + flipx, flipy, + sx, sy, screen.priority(), primask, 0); + } +} + +u32 exedexes_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + screen.priority().fill(0, cliprect); + if (m_sc2on) + { + m_bg_tilemap->set_scrollx(0, ((m_bg_scroll[1]) << 8) + m_bg_scroll[0]); + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1); + } + else + bitmap.fill(0, cliprect); + + if (m_sc1on) + { + m_fg_tilemap->set_scrollx(0, ((m_nbg_yscroll[1]) << 8) + m_nbg_yscroll[0]); + m_fg_tilemap->set_scrolly(0, ((m_nbg_xscroll[1]) << 8) + m_nbg_xscroll[0]); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2); + } + + draw_sprites(screen, bitmap, cliprect); + + if (m_chon) + m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + return 0; +} + + +// machine + +TIMER_DEVICE_CALLBACK_MEMBER(exedexes_state::scanline) +{ + const int scanline = param; + + if (scanline == 240) // vblank-out irq + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xd7); // Z80 - RST 10h - vblank + + if (scanline == 0) // unknown irq event + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xcf); // Z80 - RST 08h +} + + +void exedexes_state::main_map(address_map &map) { map(0x0000, 0xbfff).rom(); map(0xc000, 0xc000).portr("SYSTEM"); @@ -43,16 +330,16 @@ void exedexes_state::exedexes_map(address_map &map) map(0xc003, 0xc003).portr("DSW0"); map(0xc004, 0xc004).portr("DSW1"); map(0xc800, 0xc800).w("soundlatch", FUNC(generic_latch_8_device::write)); - map(0xc804, 0xc804).w(FUNC(exedexes_state::c804_w)); /* coin counters + text layer enable */ - map(0xc806, 0xc806).nopw(); /* Watchdog ?? */ - map(0xd000, 0xd3ff).ram().w(FUNC(exedexes_state::videoram_w)).share("videoram"); /* Video RAM */ - map(0xd400, 0xd7ff).ram().w(FUNC(exedexes_state::colorram_w)).share("colorram"); /* Color RAM */ - map(0xd800, 0xd801).writeonly().share("nbg_yscroll"); - map(0xd802, 0xd803).writeonly().share("nbg_xscroll"); - map(0xd804, 0xd805).writeonly().share("bg_scroll"); - map(0xd807, 0xd807).w(FUNC(exedexes_state::gfxctrl_w)); /* layer enables */ - map(0xe000, 0xefff).ram(); /* Work RAM */ - map(0xf000, 0xffff).ram().share("spriteram"); /* Sprite RAM */ + map(0xc804, 0xc804).w(FUNC(exedexes_state::c804_w)); // coin counters + text layer enable + map(0xc806, 0xc806).nopw(); // watchdog ?? + map(0xd000, 0xd3ff).ram().w(FUNC(exedexes_state::videoram_w)).share(m_videoram); + map(0xd400, 0xd7ff).ram().w(FUNC(exedexes_state::colorram_w)).share(m_colorram); + map(0xd800, 0xd801).writeonly().share(m_nbg_yscroll); + map(0xd802, 0xd803).writeonly().share(m_nbg_xscroll); + map(0xd804, 0xd805).writeonly().share(m_bg_scroll); + map(0xd807, 0xd807).w(FUNC(exedexes_state::gfxctrl_w)); // layer enables + map(0xe000, 0xefff).ram(); // work RAM + map(0xf000, 0xffff).ram().share("spriteram"); } @@ -71,9 +358,9 @@ static INPUT_PORTS_START( exedexes ) PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(8) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) @@ -85,8 +372,8 @@ static INPUT_PORTS_START( exedexes ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused PORT_START("P2") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) @@ -95,8 +382,8 @@ static INPUT_PORTS_START( exedexes ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused PORT_START("DSW0") PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) @@ -150,44 +437,44 @@ INPUT_PORTS_END static const gfx_layout charlayout = { - 8,8, /* 8*8 characters */ - RGN_FRAC(1,1), /* 512 characters */ - 2, /* 2 bits per pixel */ + 8,8, // 8*8 characters + RGN_FRAC(1,1), // 512 characters + 2, // 2 bits per pixel { 4, 0 }, { STEP4(0,1), STEP4(4*2,1) }, { STEP8(0,4*2*2) }, - 16*8 /* every char takes 16 consecutive bytes */ + 16*8 // every char takes 16 consecutive bytes }; static const gfx_layout spritelayout = { - 16,16, /* 16*16 sprites */ - RGN_FRAC(1,2), /* 256 sprites */ - 4, /* 4 bits per pixel */ + 16,16, // 16*16 sprites + RGN_FRAC(1,2), // 256 sprites + 4, // 4 bits per pixel { RGN_FRAC(1,2)+4, RGN_FRAC(1,2)+0, 4, 0 }, { STEP4(0,1), STEP4(4*2,1), STEP4(4*2*2*16,1), STEP4(4*2*2*16+4*2,1) }, { STEP16(0,4*2*2) }, - 64*8 /* every sprite takes 64 consecutive bytes */ + 64*8 // every sprite takes 64 consecutive bytes }; static const gfx_layout tilelayout = { - 32,32, /* 32*32 tiles */ - RGN_FRAC(1,1), /* 64 tiles */ - 2, /* 2 bits per pixel */ + 32,32, // 32*32 tiles + RGN_FRAC(1,1), // 64 tiles + 2, // 2 bits per pixel { 4, 0 }, { STEP4(0,1), STEP4(4*2,1), STEP4(4*2*2*32,1), STEP4(4*2*2*32+4*2,1), STEP4(4*2*2*64,1), STEP4(4*2*2*64+4*2,1), STEP4(4*2*2*96,1), STEP4(4*2*2*96+4*2,1) }, { STEP32(0,4*2*2) }, - 256*8 /* every tile takes 256 consecutive bytes */ + 256*8 // every tile takes 256 consecutive bytes }; static GFXDECODE_START( gfx_exedexes ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 64*4, 64 ) /* 32x32 Tiles */ - GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 2*64*4, 16 ) /* 16x16 Tiles */ - GFXDECODE_ENTRY( "gfx4", 0, spritelayout, 2*64*4+16*16, 16 ) /* Sprites */ + GFXDECODE_ENTRY( "chars", 0, charlayout, 0, 64 ) + GFXDECODE_ENTRY( "32x32tiles", 0, tilelayout, 64*4, 64 ) + GFXDECODE_ENTRY( "16x16tiles", 0, spritelayout, 2*64*4, 16 ) + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 2*64*4+16*16, 16 ) GFXDECODE_END @@ -209,16 +496,16 @@ void exedexes_state::machine_reset() void exedexes_state::exedexes(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware Z80(config, m_maincpu, 12_MHz_XTAL / 4); // 3 MHz, verified on PCB - m_maincpu->set_addrmap(AS_PROGRAM, &exedexes_state::exedexes_map); + m_maincpu->set_addrmap(AS_PROGRAM, &exedexes_state::main_map); TIMER(config, "scantimer").configure_scanline(FUNC(exedexes_state::scanline), "screen", 0, 1); z80_device &audiocpu(Z80(config, "audiocpu", 12_MHz_XTAL / 4)); // 3 MHz, verified on PCB audiocpu.set_addrmap(AS_PROGRAM, &exedexes_state::sound_map); audiocpu.set_periodic_int(FUNC(exedexes_state::irq0_line_hold), attotime::from_hz(4*60)); - /* video hardware */ + // video hardware BUFFERED_SPRITERAM8(config, m_spriteram); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -232,9 +519,9 @@ void exedexes_state::exedexes(machine_config &config) GFXDECODE(config, m_gfxdecode, m_palette, gfx_exedexes); - PALETTE(config, m_palette, FUNC(exedexes_state::exedexes_palette), 64*4+64*4+16*16+16*16, 256); + PALETTE(config, m_palette, FUNC(exedexes_state::palette), 64*4+64*4+16*16+16*16, 256); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, "soundlatch"); @@ -256,37 +543,37 @@ ROM_START( exedexes ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "11e_ee01.bin", 0x00000, 0x4000, CRC(73cdf3b2) SHA1(c9f2c91011bdeecec8fa76a42d95f3a5ec77cec9) ) - ROM_REGION( 0x02000, "gfx1", 0 ) - ROM_LOAD( "05c_ee00.bin", 0x00000, 0x2000, CRC(cadb75bd) SHA1(2086be5e295e5d870bcb35f116cc925f811b7583) ) /* Characters */ + ROM_REGION( 0x02000, "chars", 0 ) + ROM_LOAD( "05c_ee00.bin", 0x00000, 0x2000, CRC(cadb75bd) SHA1(2086be5e295e5d870bcb35f116cc925f811b7583) ) - ROM_REGION( 0x04000, "gfx2", 0 ) - ROM_LOAD( "h01_ee08.bin", 0x00000, 0x4000, CRC(96a65c1d) SHA1(3b49c64b32f01ec72cf2d943bfe3aa575d62a765) ) /* 32x32 tiles planes 0-1 */ + ROM_REGION( 0x04000, "32x32tiles", 0 ) + ROM_LOAD( "h01_ee08.bin", 0x00000, 0x4000, CRC(96a65c1d) SHA1(3b49c64b32f01ec72cf2d943bfe3aa575d62a765) ) // planes 0-1 - ROM_REGION( 0x08000, "gfx3", 0 ) - ROM_LOAD( "a03_ee06.bin", 0x00000, 0x4000, CRC(6039bdd1) SHA1(01156e02ed59e6c1e55204729e515cd4419568fb) ) /* 16x16 tiles planes 0-1 */ - ROM_LOAD( "a02_ee05.bin", 0x04000, 0x4000, CRC(b32d8252) SHA1(738225146ba38f2a9216fda278838e7ebb29a0bb) ) /* 16x16 tiles planes 2-3 */ + ROM_REGION( 0x08000, "16x16tiles", 0 ) + ROM_LOAD( "a03_ee06.bin", 0x00000, 0x4000, CRC(6039bdd1) SHA1(01156e02ed59e6c1e55204729e515cd4419568fb) ) // planes 0-1 + ROM_LOAD( "a02_ee05.bin", 0x04000, 0x4000, CRC(b32d8252) SHA1(738225146ba38f2a9216fda278838e7ebb29a0bb) ) // planes 2-3 - ROM_REGION( 0x08000, "gfx4", 0 ) - ROM_LOAD( "j11_ee10.bin", 0x00000, 0x4000, CRC(bc83e265) SHA1(ac9b4cce9e539c560414abf2fc239910f2bfbb2d) ) /* Sprites planes 0-1 */ - ROM_LOAD( "j12_ee11.bin", 0x04000, 0x4000, CRC(0e0f300d) SHA1(2f973748e459b16673115abf7de8615219e39fa4) ) /* Sprites planes 2-3 */ + ROM_REGION( 0x08000, "sprites", 0 ) + ROM_LOAD( "j11_ee10.bin", 0x00000, 0x4000, CRC(bc83e265) SHA1(ac9b4cce9e539c560414abf2fc239910f2bfbb2d) ) // planes 0-1 + ROM_LOAD( "j12_ee11.bin", 0x04000, 0x4000, CRC(0e0f300d) SHA1(2f973748e459b16673115abf7de8615219e39fa4) ) // planes 2-3 - ROM_REGION( 0x6000, "tilerom", 0 ) /* background tilemaps */ - ROM_LOAD( "c01_ee07.bin", 0x0000, 0x4000, CRC(3625a68d) SHA1(83010ca356385b713bafe03a502c566f6a9a8365) ) /* Front Tile Map */ - ROM_LOAD( "h04_ee09.bin", 0x4000, 0x2000, CRC(6057c907) SHA1(886790641b84b8cd659d2eb5fd1adbabdd7dad3d) ) /* Back Tile map */ + ROM_REGION( 0x6000, "tilerom", 0 ) // background tilemaps + ROM_LOAD( "c01_ee07.bin", 0x0000, 0x4000, CRC(3625a68d) SHA1(83010ca356385b713bafe03a502c566f6a9a8365) ) // Front Tile Map + ROM_LOAD( "h04_ee09.bin", 0x4000, 0x2000, CRC(6057c907) SHA1(886790641b84b8cd659d2eb5fd1adbabdd7dad3d) ) // Back Tile map ROM_REGION( 0x0b20, "proms", 0 ) - ROM_LOAD( "02d_e-02.bin", 0x0000, 0x0100, CRC(8d0d5935) SHA1(a0ab827ff3b641965ef851893c399e3988fde55e) ) /* red component */ - ROM_LOAD( "03d_e-03.bin", 0x0100, 0x0100, CRC(d3c17efc) SHA1(af88340287bd732c91bc5c75970f9de0431b4304) ) /* green component */ - ROM_LOAD( "04d_e-04.bin", 0x0200, 0x0100, CRC(58ba964c) SHA1(1f98f8e484a0462f1a9fadef9e57612a32652599) ) /* blue component */ - ROM_LOAD( "06f_e-05.bin", 0x0300, 0x0100, CRC(35a03579) SHA1(1f1b8c777622a1f5564409c5f3ce69cc68199dae) ) /* char lookup table */ - ROM_LOAD( "l04_e-10.bin", 0x0400, 0x0100, CRC(1dfad87a) SHA1(684844c24e630f46525df97ed67e2e63f7e66d0f) ) /* 32x32 tile lookup table */ - ROM_LOAD( "c04_e-07.bin", 0x0500, 0x0100, CRC(850064e0) SHA1(3884485e91bd82539d0d33f46b7abac60f4c3b1c) ) /* 16x16 tile lookup table */ - ROM_LOAD( "l09_e-11.bin", 0x0600, 0x0100, CRC(2bb68710) SHA1(cfb375316245cb8751e765f163e6acf071dda9ca) ) /* sprite lookup table */ - ROM_LOAD( "l10_e-12.bin", 0x0700, 0x0100, CRC(173184ef) SHA1(f91ecbdc67af1eed6757f660cac8a0e6866c1822) ) /* sprite palette bank */ - ROM_LOAD( "06l_e-06.bin", 0x0800, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ - ROM_LOAD( "k06_e-08.bin", 0x0900, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ - ROM_LOAD( "l03_e-09.bin", 0x0a00, 0x0100, CRC(0d968558) SHA1(b376885ac8452b6cbf9ced81b1080bfd570d9b91) ) /* unknown (all 0) */ - ROM_LOAD( "03e_e-01.bin", 0x0b00, 0x0020, CRC(1acee376) SHA1(367094d924f8e0ec36d8310fada4d8143358f697) ) /* unknown (priority?) */ + ROM_LOAD( "02d_e-02.bin", 0x0000, 0x0100, CRC(8d0d5935) SHA1(a0ab827ff3b641965ef851893c399e3988fde55e) ) // red component + ROM_LOAD( "03d_e-03.bin", 0x0100, 0x0100, CRC(d3c17efc) SHA1(af88340287bd732c91bc5c75970f9de0431b4304) ) // green component + ROM_LOAD( "04d_e-04.bin", 0x0200, 0x0100, CRC(58ba964c) SHA1(1f98f8e484a0462f1a9fadef9e57612a32652599) ) // blue component + ROM_LOAD( "06f_e-05.bin", 0x0300, 0x0100, CRC(35a03579) SHA1(1f1b8c777622a1f5564409c5f3ce69cc68199dae) ) // char lookup table + ROM_LOAD( "l04_e-10.bin", 0x0400, 0x0100, CRC(1dfad87a) SHA1(684844c24e630f46525df97ed67e2e63f7e66d0f) ) // 32x32 tile lookup table + ROM_LOAD( "c04_e-07.bin", 0x0500, 0x0100, CRC(850064e0) SHA1(3884485e91bd82539d0d33f46b7abac60f4c3b1c) ) // 16x16 tile lookup table + ROM_LOAD( "l09_e-11.bin", 0x0600, 0x0100, CRC(2bb68710) SHA1(cfb375316245cb8751e765f163e6acf071dda9ca) ) // sprite lookup table + ROM_LOAD( "l10_e-12.bin", 0x0700, 0x0100, CRC(173184ef) SHA1(f91ecbdc67af1eed6757f660cac8a0e6866c1822) ) // sprite palette bank + ROM_LOAD( "06l_e-06.bin", 0x0800, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) // interrupt timing (not used) + ROM_LOAD( "k06_e-08.bin", 0x0900, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) // video timing (not used) + ROM_LOAD( "l03_e-09.bin", 0x0a00, 0x0100, CRC(0d968558) SHA1(b376885ac8452b6cbf9ced81b1080bfd570d9b91) ) // unknown (all 0) + ROM_LOAD( "03e_e-01.bin", 0x0b00, 0x0020, CRC(1acee376) SHA1(367094d924f8e0ec36d8310fada4d8143358f697) ) // unknown (priority?) ROM_END ROM_START( savgbees ) @@ -298,39 +585,41 @@ ROM_START( savgbees ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "ee01e.11e", 0x00000, 0x4000, CRC(93d3f952) SHA1(5c86d1ddf03083ac2787efb7a29c09b2f46ec3fa) ) - ROM_REGION( 0x02000, "gfx1", 0 ) - ROM_LOAD( "ee00e.5c", 0x00000, 0x2000, CRC(5972f95f) SHA1(7b90ceca37dba773f72a80da6272b00061526348) ) /* Characters */ + ROM_REGION( 0x02000, "chars", 0 ) + ROM_LOAD( "ee00e.5c", 0x00000, 0x2000, CRC(5972f95f) SHA1(7b90ceca37dba773f72a80da6272b00061526348) ) - ROM_REGION( 0x04000, "gfx2", 0 ) - ROM_LOAD( "h01_ee08.bin", 0x00000, 0x4000, CRC(96a65c1d) SHA1(3b49c64b32f01ec72cf2d943bfe3aa575d62a765) ) /* 32x32 tiles planes 0-1 */ + ROM_REGION( 0x04000, "32x32tiles", 0 ) + ROM_LOAD( "h01_ee08.bin", 0x00000, 0x4000, CRC(96a65c1d) SHA1(3b49c64b32f01ec72cf2d943bfe3aa575d62a765) ) // planes 0-1 - ROM_REGION( 0x08000, "gfx3", 0 ) - ROM_LOAD( "a03_ee06.bin", 0x00000, 0x4000, CRC(6039bdd1) SHA1(01156e02ed59e6c1e55204729e515cd4419568fb) ) /* 16x16 tiles planes 0-1 */ - ROM_LOAD( "a02_ee05.bin", 0x04000, 0x4000, CRC(b32d8252) SHA1(738225146ba38f2a9216fda278838e7ebb29a0bb) ) /* 16x16 tiles planes 2-3 */ + ROM_REGION( 0x08000, "16x16tiles", 0 ) + ROM_LOAD( "a03_ee06.bin", 0x00000, 0x4000, CRC(6039bdd1) SHA1(01156e02ed59e6c1e55204729e515cd4419568fb) ) // planes 0-1 + ROM_LOAD( "a02_ee05.bin", 0x04000, 0x4000, CRC(b32d8252) SHA1(738225146ba38f2a9216fda278838e7ebb29a0bb) ) // planes 2-3 - ROM_REGION( 0x08000, "gfx4", 0 ) - ROM_LOAD( "j11_ee10.bin", 0x00000, 0x4000, CRC(bc83e265) SHA1(ac9b4cce9e539c560414abf2fc239910f2bfbb2d) ) /* Sprites planes 0-1 */ - ROM_LOAD( "j12_ee11.bin", 0x04000, 0x4000, CRC(0e0f300d) SHA1(2f973748e459b16673115abf7de8615219e39fa4) ) /* Sprites planes 2-3 */ + ROM_REGION( 0x08000, "sprites", 0 ) + ROM_LOAD( "j11_ee10.bin", 0x00000, 0x4000, CRC(bc83e265) SHA1(ac9b4cce9e539c560414abf2fc239910f2bfbb2d) ) // planes 0-1 + ROM_LOAD( "j12_ee11.bin", 0x04000, 0x4000, CRC(0e0f300d) SHA1(2f973748e459b16673115abf7de8615219e39fa4) ) // planes 2-3 - ROM_REGION( 0x6000, "tilerom", 0 ) /* background tilemaps */ - ROM_LOAD( "c01_ee07.bin", 0x0000, 0x4000, CRC(3625a68d) SHA1(83010ca356385b713bafe03a502c566f6a9a8365) ) /* Front Tile Map */ - ROM_LOAD( "h04_ee09.bin", 0x4000, 0x2000, CRC(6057c907) SHA1(886790641b84b8cd659d2eb5fd1adbabdd7dad3d) ) /* Back Tile map */ + ROM_REGION( 0x6000, "tilerom", 0 ) // background tilemaps + ROM_LOAD( "c01_ee07.bin", 0x0000, 0x4000, CRC(3625a68d) SHA1(83010ca356385b713bafe03a502c566f6a9a8365) ) // Front Tile Map + ROM_LOAD( "h04_ee09.bin", 0x4000, 0x2000, CRC(6057c907) SHA1(886790641b84b8cd659d2eb5fd1adbabdd7dad3d) ) // Back Tile map ROM_REGION( 0x0b20, "proms", 0 ) - ROM_LOAD( "02d_e-02.bin", 0x0000, 0x0100, CRC(8d0d5935) SHA1(a0ab827ff3b641965ef851893c399e3988fde55e) ) /* red component */ - ROM_LOAD( "03d_e-03.bin", 0x0100, 0x0100, CRC(d3c17efc) SHA1(af88340287bd732c91bc5c75970f9de0431b4304) ) /* green component */ - ROM_LOAD( "04d_e-04.bin", 0x0200, 0x0100, CRC(58ba964c) SHA1(1f98f8e484a0462f1a9fadef9e57612a32652599) ) /* blue component */ - ROM_LOAD( "06f_e-05.bin", 0x0300, 0x0100, CRC(35a03579) SHA1(1f1b8c777622a1f5564409c5f3ce69cc68199dae) ) /* char lookup table */ - ROM_LOAD( "l04_e-10.bin", 0x0400, 0x0100, CRC(1dfad87a) SHA1(684844c24e630f46525df97ed67e2e63f7e66d0f) ) /* 32x32 tile lookup table */ - ROM_LOAD( "c04_e-07.bin", 0x0500, 0x0100, CRC(850064e0) SHA1(3884485e91bd82539d0d33f46b7abac60f4c3b1c) ) /* 16x16 tile lookup table */ - ROM_LOAD( "l09_e-11.bin", 0x0600, 0x0100, CRC(2bb68710) SHA1(cfb375316245cb8751e765f163e6acf071dda9ca) ) /* sprite lookup table */ - ROM_LOAD( "l10_e-12.bin", 0x0700, 0x0100, CRC(173184ef) SHA1(f91ecbdc67af1eed6757f660cac8a0e6866c1822) ) /* sprite palette bank */ - ROM_LOAD( "06l_e-06.bin", 0x0800, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ - ROM_LOAD( "k06_e-08.bin", 0x0900, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ - ROM_LOAD( "l03_e-09.bin", 0x0a00, 0x0100, CRC(0d968558) SHA1(b376885ac8452b6cbf9ced81b1080bfd570d9b91) ) /* unknown (all 0) */ - ROM_LOAD( "03e_e-01.bin", 0x0b00, 0x0020, CRC(1acee376) SHA1(367094d924f8e0ec36d8310fada4d8143358f697) ) /* unknown (priority?) */ + ROM_LOAD( "02d_e-02.bin", 0x0000, 0x0100, CRC(8d0d5935) SHA1(a0ab827ff3b641965ef851893c399e3988fde55e) ) // red component + ROM_LOAD( "03d_e-03.bin", 0x0100, 0x0100, CRC(d3c17efc) SHA1(af88340287bd732c91bc5c75970f9de0431b4304) ) // green component + ROM_LOAD( "04d_e-04.bin", 0x0200, 0x0100, CRC(58ba964c) SHA1(1f98f8e484a0462f1a9fadef9e57612a32652599) ) // blue component + ROM_LOAD( "06f_e-05.bin", 0x0300, 0x0100, CRC(35a03579) SHA1(1f1b8c777622a1f5564409c5f3ce69cc68199dae) ) // char lookup table + ROM_LOAD( "l04_e-10.bin", 0x0400, 0x0100, CRC(1dfad87a) SHA1(684844c24e630f46525df97ed67e2e63f7e66d0f) ) // 32x32 tile lookup table + ROM_LOAD( "c04_e-07.bin", 0x0500, 0x0100, CRC(850064e0) SHA1(3884485e91bd82539d0d33f46b7abac60f4c3b1c) ) // 16x16 tile lookup table + ROM_LOAD( "l09_e-11.bin", 0x0600, 0x0100, CRC(2bb68710) SHA1(cfb375316245cb8751e765f163e6acf071dda9ca) ) // sprite lookup table + ROM_LOAD( "l10_e-12.bin", 0x0700, 0x0100, CRC(173184ef) SHA1(f91ecbdc67af1eed6757f660cac8a0e6866c1822) ) // sprite palette bank + ROM_LOAD( "06l_e-06.bin", 0x0800, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) // interrupt timing (not used) + ROM_LOAD( "k06_e-08.bin", 0x0900, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) // video timing (not used) + ROM_LOAD( "l03_e-09.bin", 0x0a00, 0x0100, CRC(0d968558) SHA1(b376885ac8452b6cbf9ced81b1080bfd570d9b91) ) // unknown (all 0) + ROM_LOAD( "03e_e-01.bin", 0x0b00, 0x0020, CRC(1acee376) SHA1(367094d924f8e0ec36d8310fada4d8143358f697) ) // unknown (priority?) ROM_END +} // anonymous namespace -GAME( 1985, exedexes, 0, exedexes, exedexes, exedexes_state, empty_init, ROT270, "Capcom", "Exed Exes", MACHINE_SUPPORTS_SAVE ) + +GAME( 1985, exedexes, 0, exedexes, exedexes, exedexes_state, empty_init, ROT270, "Capcom", "Exed Exes", MACHINE_SUPPORTS_SAVE ) GAME( 1985, savgbees, exedexes, exedexes, exedexes, exedexes_state, empty_init, ROT270, "Capcom (Memetron license)", "Savage Bees", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/capcom/exedexes.h b/src/mame/capcom/exedexes.h deleted file mode 100644 index de2df1364f4..00000000000 --- a/src/mame/capcom/exedexes.h +++ /dev/null @@ -1,79 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Richard Davies -/************************************************************************* - - Exed Exes - -*************************************************************************/ -#ifndef MAME_INCLUDES_EXEDEXES_H -#define MAME_INCLUDES_EXEDEXES_H - -#pragma once - -#include "machine/timer.h" -#include "video/bufsprite.h" -#include "emupal.h" -#include "tilemap.h" - -class exedexes_state : public driver_device -{ -public: - exedexes_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_colorram(*this, "colorram"), - m_nbg_yscroll(*this, "nbg_yscroll"), - m_nbg_xscroll(*this, "nbg_xscroll"), - m_bg_scroll(*this, "bg_scroll"), - m_tilerom(*this, "tilerom"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { } - - void exedexes(machine_config &config); - -private: - /* memory pointers */ - required_device m_spriteram; - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - required_shared_ptr m_nbg_yscroll; - required_shared_ptr m_nbg_xscroll; - required_shared_ptr m_bg_scroll; - required_region_ptr m_tilerom; - - /* video-related */ - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_fg_tilemap = nullptr; - tilemap_t *m_tx_tilemap = nullptr; - int m_chon = 0; - int m_objon = 0; - int m_sc1on = 0; - int m_sc2on = 0; - - void videoram_w(offs_t offset, u8 data); - void colorram_w(offs_t offset, u8 data); - void c804_w(u8 data); - void gfxctrl_w(u8 data); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_tx_tile_info); - TILEMAP_MAPPER_MEMBER(bg_tilemap_scan); - TILEMAP_MAPPER_MEMBER(fg_tilemap_scan); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - void exedexes_palette(palette_device &palette) const; - u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(scanline); - void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - void exedexes_map(address_map &map); - void sound_map(address_map &map); -}; - -#endif // MAME_INCLUDES_EXEDEXES_H diff --git a/src/mame/capcom/exedexes_v.cpp b/src/mame/capcom/exedexes_v.cpp deleted file mode 100644 index bb5aae24b30..00000000000 --- a/src/mame/capcom/exedexes_v.cpp +++ /dev/null @@ -1,221 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Richard Davies -/*************************************************************************** - - video.c - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "exedexes.h" -#include "screen.h" - -/*************************************************************************** - - Convert the color PROMs into a more useable format. - - Exed Exes has three 256x4 palette PROMs (one per gun), three 256x4 lookup - table PROMs (one for characters, one for sprites, one for background tiles) - and one 256x4 sprite palette bank selector PROM. - - 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 - -***************************************************************************/ - -void exedexes_state::exedexes_palette(palette_device &palette) const -{ - const u8 *color_prom = memregion("proms")->base(); - - // create a lookup table for the palette - for (int i = 0; i < 0x100; i++) - { - const int r = pal4bit(color_prom[i + 0x000]); - const int g = pal4bit(color_prom[i + 0x100]); - const int b = pal4bit(color_prom[i + 0x200]); - - palette.set_indirect_color(i, rgb_t(r, g, b)); - } - - // color_prom now points to the beginning of the lookup table - color_prom += 0x300; - - // characters use colors 0xc0-0xcf - for (int i = 0; i < 0x100; i++) - { - const u8 ctabentry = color_prom[i] | 0xc0; - palette.set_pen_indirect(i, ctabentry); - } - - // 32x32 tiles use colors 0-0x0f - for (int i = 0x100; i < 0x200; i++) - { - const u8 ctabentry = color_prom[i]; - palette.set_pen_indirect(i, ctabentry); - } - - // 16x16 tiles use colors 0x40-0x4f - for (int i = 0x200; i < 0x300; i++) - { - const u8 ctabentry = color_prom[i] | 0x40; - palette.set_pen_indirect(i, ctabentry); - } - - // sprites use colors 0x80-0xbf in four banks - for (int i = 0x300; i < 0x400; i++) - { - const u8 ctabentry = color_prom[i] | (color_prom[i + 0x100] << 4) | 0x80; - palette.set_pen_indirect(i, ctabentry); - } -} - -void exedexes_state::videoram_w(offs_t offset, u8 data) -{ - m_videoram[offset] = data; - m_tx_tilemap->mark_tile_dirty(offset); -} - -void exedexes_state::colorram_w(offs_t offset, u8 data) -{ - m_colorram[offset] = data; - m_tx_tilemap->mark_tile_dirty(offset); -} - -void exedexes_state::c804_w(u8 data) -{ - /* bits 0 and 1 are coin counters */ - machine().bookkeeping().coin_counter_w(0, data & 0x01); - machine().bookkeeping().coin_counter_w(1, data & 0x02); - - machine().bookkeeping().coin_lockout_w(0, data & 0x04); - machine().bookkeeping().coin_lockout_w(1, data & 0x08); - - /* bit 7 is text enable */ - m_chon = data & 0x80; - - /* other bits seem to be unused */ -} - -void exedexes_state::gfxctrl_w(u8 data) -{ - /* bit 4 is bg enable */ - m_sc2on = data & 0x10; - - /* bit 5 is fg enable */ - m_sc1on = data & 0x20; - - /* bit 6 is sprite enable */ - m_objon = data & 0x40; - - /* other bits seem to be unused */ -} - - -TILE_GET_INFO_MEMBER(exedexes_state::get_bg_tile_info) -{ - const u8 attr = m_tilerom[tile_index]; - const u8 code = attr & 0x3f; - const u8 color = m_tilerom[tile_index + (8 * 8)]; - const int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0); - - tileinfo.set(1, code, color, flags); -} - -TILE_GET_INFO_MEMBER(exedexes_state::get_fg_tile_info) -{ - const u8 code = m_tilerom[tile_index]; - - tileinfo.set(2, code, 0, 0); -} - -TILE_GET_INFO_MEMBER(exedexes_state::get_tx_tile_info) -{ - const u32 code = m_videoram[tile_index] + 2 * (m_colorram[tile_index] & 0x80); - const u8 color = m_colorram[tile_index] & 0x3f; - - tileinfo.group = color; - - tileinfo.set(0, code, color, 0); -} - -TILEMAP_MAPPER_MEMBER(exedexes_state::bg_tilemap_scan) -{ - /* logical (col,row) -> memory offset */ - return ((col * 32 & 0xe0) >> 5) + ((row * 32 & 0xe0) >> 2) + ((col * 32 & 0x3f00) >> 1) + 0x4000; -} - -TILEMAP_MAPPER_MEMBER(exedexes_state::fg_tilemap_scan) -{ - /* logical (col,row) -> memory offset */ - return ((col * 16 & 0xf0) >> 4) + (row * 16 & 0xf0) + (col * 16 & 0x700) + ((row * 16 & 0x700) << 3); -} - -void exedexes_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(exedexes_state::get_bg_tile_info)), tilemap_mapper_delegate(*this, FUNC(exedexes_state::bg_tilemap_scan)), 32, 32, 64, 64); - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(exedexes_state::get_fg_tile_info)), tilemap_mapper_delegate(*this, FUNC(exedexes_state::fg_tilemap_scan)), 16, 16, 128, 128); - m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(exedexes_state::get_tx_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - - m_fg_tilemap->set_transparent_pen(0); - m_tx_tilemap->configure_groups(*m_gfxdecode->gfx(0), 0xcf); -} - -void exedexes_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - const u8 *buffered_spriteram = m_spriteram->buffer(); - - if (!m_objon) - return; - - for (int offs = 0; offs < m_spriteram->bytes(); offs += 32) - { - u32 primask = 0; - if (buffered_spriteram[offs + 1] & 0x40) - primask |= GFX_PMASK_2; - - const u32 code = buffered_spriteram[offs]; - const u32 color = buffered_spriteram[offs + 1] & 0x0f; - const bool flipx = buffered_spriteram[offs + 1] & 0x10; - const bool flipy = buffered_spriteram[offs + 1] & 0x20; - const int sx = buffered_spriteram[offs + 3] - ((buffered_spriteram[offs + 1] & 0x80) << 1); - const int sy = buffered_spriteram[offs + 2]; - - m_gfxdecode->gfx(3)->prio_transpen(bitmap,cliprect, - code, - color, - flipx,flipy, - sx,sy,screen.priority(),primask,0); - } -} - -u32 exedexes_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - screen.priority().fill(0, cliprect); - if (m_sc2on) - { - m_bg_tilemap->set_scrollx(0, ((m_bg_scroll[1]) << 8) + m_bg_scroll[0]); - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1); - } - else - bitmap.fill(0, cliprect); - - if (m_sc1on) - { - m_fg_tilemap->set_scrollx(0, ((m_nbg_yscroll[1]) << 8) + m_nbg_yscroll[0]); - m_fg_tilemap->set_scrolly(0, ((m_nbg_xscroll[1]) << 8) + m_nbg_xscroll[0]); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2); - } - - draw_sprites(screen, bitmap, cliprect); - - if (m_chon) - m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - return 0; -} diff --git a/src/mame/capcom/higemaru.cpp b/src/mame/capcom/higemaru.cpp index 97dde736728..78ee42edfa5 100644 --- a/src/mame/capcom/higemaru.cpp +++ b/src/mame/capcom/higemaru.cpp @@ -1,8 +1,10 @@ // license:BSD-3-Clause -// copyright-holders:Mirko Buffoni +// copyright-holders: Mirko Buffoni + /**************************************************************************** -Higemaru +Pirate Ship Higemaru +Capcom 84603-1 PCB driver by Mirko Buffoni @@ -13,27 +15,226 @@ Use Player 1 joystick and button, then press START1 to go to next screen. ****************************************************************************/ #include "emu.h" -#include "higemaru.h" #include "cpu/z80/z80.h" +#include "machine/timer.h" #include "sound/ay8910.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" -TIMER_DEVICE_CALLBACK_MEMBER(higemaru_state::higemaru_scanline) +// configurable logging +#define LOG_C800 (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_C800) + +#include "logmacro.h" + +#define LOGC800(...) LOGMASKED(LOG_C800, __VA_ARGS__) + + +namespace { + +class higemaru_state : public driver_device +{ +public: + higemaru_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_videoram(*this, "videoram"), + m_colorram(*this, "colorram"), + m_spriteram(*this, "spriteram"), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") + { } + + void higemaru(machine_config &config); + +protected: + virtual void video_start() override; + +private: + // memory pointers + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + required_shared_ptr m_spriteram; + + // devices + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + + // video-related + tilemap_t *m_bg_tilemap = nullptr; + void videoram_w(offs_t offset, uint8_t data); + void colorram_w(offs_t offset, uint8_t data); + void c800_w(uint8_t data); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(scanline); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void program_map(address_map &map); +}; + + +// video + +void higemaru_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void higemaru_state::colorram_w(offs_t offset, uint8_t data) +{ + m_colorram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +/*************************************************************************** + + Convert the color PROMs into a more useable format. + +***************************************************************************/ + +void higemaru_state::palette(palette_device &palette) const +{ + const uint8_t *color_prom = memregion("proms")->base(); + + // create a lookup table for the palette + for (int i = 0; i < 0x20; i++) + { + int bit0, bit1, bit2; + + // red component + bit0 = (color_prom[i] >> 0) & 0x01; + bit1 = (color_prom[i] >> 1) & 0x01; + bit2 = (color_prom[i] >> 2) & 0x01; + int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // green component + bit0 = (color_prom[i] >> 3) & 0x01; + bit1 = (color_prom[i] >> 4) & 0x01; + bit2 = (color_prom[i] >> 5) & 0x01; + int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // blue component + bit0 = 0; + bit1 = (color_prom[i] >> 6) & 0x01; + bit2 = (color_prom[i] >> 7) & 0x01; + int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + palette.set_indirect_color(i, rgb_t(r, g, b)); + } + + // color_prom now points to the beginning of the lookup table + color_prom += 0x20; + + // characters use colors 0-15 + for (int i = 0; i < 0x80; i++) + { + uint8_t const ctabentry = color_prom[i] & 0x0f; + palette.set_pen_indirect(i, ctabentry); + } + + // sprites use colors 16-31 + for (int i = 0x80; i < 0x180; i++) + { + uint8_t const ctabentry = (color_prom[i + 0x80] & 0x0f) | 0x10; + palette.set_pen_indirect(i, ctabentry); + } +} + +void higemaru_state::c800_w(uint8_t data) +{ + if (data & 0x7c) + LOGC800("c800 = %02x\n", data); + + // bits 0 and 1 are coin counters + machine().bookkeeping().coin_counter_w(0, data & 2); + machine().bookkeeping().coin_counter_w(1, data & 1); + + // bit 7 flips screen + if (flip_screen() != (data & 0x80)) + { + flip_screen_set(data & 0x80); + m_bg_tilemap->mark_all_dirty(); + } +} + +TILE_GET_INFO_MEMBER(higemaru_state::get_bg_tile_info) +{ + int const code = m_videoram[tile_index] + ((m_colorram[tile_index] & 0x80) << 1); + int const color = m_colorram[tile_index] & 0x1f; + + tileinfo.set(0, code, color, 0); +} + +void higemaru_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(higemaru_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); +} + +void higemaru_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int offs = m_spriteram.bytes() - 16; offs >= 0; offs -= 16) + { + int const code = m_spriteram[offs] & 0x7f; + int col = m_spriteram[offs + 4] & 0x0f; + int sx = m_spriteram[offs + 12]; + int sy = m_spriteram[offs + 8]; + int flipx = m_spriteram[offs + 4] & 0x10; + int flipy = m_spriteram[offs + 4] & 0x20; + if (flip_screen()) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, + col, + flipx, flipy, + sx, sy, 15); + + // draw again with wraparound + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, + col, + flipx, flipy, + sx - 256, sy, 15); + } +} + +uint32_t higemaru_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + return 0; +} + + +// machine + +TIMER_DEVICE_CALLBACK_MEMBER(higemaru_state::scanline) { int scanline = param; if(scanline == 240) // vblank-out irq - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xcf); /* Z80 - RST 08h - vblank */ + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xcf); // Z80 - RST 08h - vblank if(scanline == 0) // unknown irq event, does various stuff like copying the spriteram - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xd7); /* Z80 - RST 10h */ + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xd7); // Z80 - RST 10h } -void higemaru_state::higemaru_map(address_map &map) +void higemaru_state::program_map(address_map &map) { map(0x0000, 0x7fff).rom(); map(0xc000, 0xc000).portr("P1"); @@ -41,12 +242,12 @@ void higemaru_state::higemaru_map(address_map &map) map(0xc002, 0xc002).portr("SYSTEM"); map(0xc003, 0xc003).portr("DSW1"); map(0xc004, 0xc004).portr("DSW2"); - map(0xc800, 0xc800).w(FUNC(higemaru_state::higemaru_c800_w)); + map(0xc800, 0xc800).w(FUNC(higemaru_state::c800_w)); map(0xc801, 0xc802).w("ay1", FUNC(ay8910_device::address_data_w)); map(0xc803, 0xc804).w("ay2", FUNC(ay8910_device::address_data_w)); - map(0xd000, 0xd3ff).ram().w(FUNC(higemaru_state::higemaru_videoram_w)).share("videoram"); - map(0xd400, 0xd7ff).ram().w(FUNC(higemaru_state::higemaru_colorram_w)).share("colorram"); - map(0xd880, 0xd9ff).ram().share("spriteram"); + map(0xd000, 0xd3ff).ram().w(FUNC(higemaru_state::videoram_w)).share(m_videoram); + map(0xd400, 0xd7ff).ram().w(FUNC(higemaru_state::colorram_w)).share(m_colorram); + map(0xd880, 0xd9ff).ram().share(m_spriteram); map(0xe000, 0xefff).ram(); } @@ -75,7 +276,7 @@ static INPUT_PORTS_START( higemaru ) PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Freeze") PORT_CODE(KEYCODE_F1) PORT_TOGGLE /* code at 0x0252 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Freeze") PORT_CODE(KEYCODE_F1) PORT_TOGGLE // code at 0x0252 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) @@ -111,7 +312,7 @@ static INPUT_PORTS_START( higemaru ) PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) - PORT_DIPNAME( 0x0e, 0x0e, DEF_STR( Bonus_Life ) ) /* table at 0x0148 */ + PORT_DIPNAME( 0x0e, 0x0e, DEF_STR( Bonus_Life ) ) // table at 0x0148 PORT_DIPSETTING( 0x0e, "10k 50k 50k+" ) PORT_DIPSETTING( 0x0c, "10k 60k 60k+" ) PORT_DIPSETTING( 0x0a, "20k 60k 60k+" ) @@ -120,10 +321,10 @@ static INPUT_PORTS_START( higemaru ) PORT_DIPSETTING( 0x04, "30k 80k 80k+" ) PORT_DIPSETTING( 0x02, "40k 100k 100k+" ) PORT_DIPSETTING( 0x00, DEF_STR( None ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) ) /* code at 0x6234 */ + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) ) // code at 0x6234 PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "Demo Music" ) /* code at 0x6226 - when is it called ? */ + PORT_DIPNAME( 0x20, 0x20, "Demo Music" ) // code at 0x6226 - when is it called ? PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x20, DEF_STR( On ) ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) @@ -158,37 +359,37 @@ static const gfx_layout spritelayout = }; static GFXDECODE_START( gfx_higemaru ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 32 ) - GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 32*4, 16 ) + GFXDECODE_ENTRY( "chars", 0, charlayout, 0, 32 ) + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 32*4, 16 ) GFXDECODE_END void higemaru_state::higemaru(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, XTAL(12'000'000)/4); /* 3 MHz Sharp LH0080A Z80A-CPU-D */ - m_maincpu->set_addrmap(AS_PROGRAM, &higemaru_state::higemaru_map); - TIMER(config, "scantimer").configure_scanline(FUNC(higemaru_state::higemaru_scanline), "screen", 0, 1); + // basic machine hardware + Z80(config, m_maincpu, XTAL(12'000'000) / 4); // 3 MHz Sharp LH0080A Z80A-CPU-D + m_maincpu->set_addrmap(AS_PROGRAM, &higemaru_state::program_map); + TIMER(config, "scantimer").configure_scanline(FUNC(higemaru_state::scanline), "screen", 0, 1); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(32*8, 32*8); screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); - screen.set_screen_update(FUNC(higemaru_state::screen_update_higemaru)); + screen.set_screen_update(FUNC(higemaru_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_higemaru); - PALETTE(config, m_palette, FUNC(higemaru_state::higemaru_palette), 32*4+16*16, 32); + PALETTE(config, m_palette, FUNC(higemaru_state::palette), 32*4+16*16, 32); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - AY8910(config, "ay1", XTAL(12'000'000)/8).add_route(ALL_OUTPUTS, "mono", 0.25); + AY8910(config, "ay1", XTAL(12'000'000) / 8).add_route(ALL_OUTPUTS, "mono", 0.25); - AY8910(config, "ay2", XTAL(12'000'000)/8).add_route(ALL_OUTPUTS, "mono", 0.25); + AY8910(config, "ay2", XTAL(12'000'000) / 8).add_route(ALL_OUTPUTS, "mono", 0.25); } /*************************************************************************** @@ -204,20 +405,22 @@ ROM_START( higemaru ) ROM_LOAD( "hg6.p11", 0x4000, 0x2000, CRC(5f5296aa) SHA1(410ee1df63492e488b3578b9c4cfbfbd2f41c888) ) ROM_LOAD( "hg7.m11", 0x6000, 0x2000, CRC(dc5d455d) SHA1(7d253d6680d35943792746da11d91d7be57367cc) ) - ROM_REGION( 0x2000, "gfx1", 0 ) - ROM_LOAD( "hg3.m1", 0x0000, 0x2000, CRC(b37b88c8) SHA1(7933270969806154f0774d31fda75a5352cf26ad) ) /* characters */ + ROM_REGION( 0x2000, "chars", 0 ) + ROM_LOAD( "hg3.m1", 0x0000, 0x2000, CRC(b37b88c8) SHA1(7933270969806154f0774d31fda75a5352cf26ad) ) - ROM_REGION( 0x4000, "gfx2", 0 ) - ROM_LOAD( "hg1.c14", 0x0000, 0x2000, CRC(ef4c2f5d) SHA1(247ce819cdc4ed4ec99c25c9006bac1911354bc8) ) /* tiles */ + ROM_REGION( 0x4000, "sprites", 0 ) + ROM_LOAD( "hg1.c14", 0x0000, 0x2000, CRC(ef4c2f5d) SHA1(247ce819cdc4ed4ec99c25c9006bac1911354bc8) ) ROM_LOAD( "hg2.e14", 0x2000, 0x2000, CRC(9133f804) SHA1(93661c028709a7134537321e52da85e3c0f917ba) ) ROM_REGION( 0x0420, "proms", 0 ) - ROM_LOAD( "hgb3.l6", 0x0000, 0x0020, CRC(629cebd8) SHA1(c28cd0f341f4f1c7be97f4d8c289860db8ac0857) ) /* palette */ - ROM_LOAD( "hgb5.m4", 0x0020, 0x0100, CRC(dbaa4443) SHA1(cca2f9b187abd735f2309b38570edcd745042b3e) ) /* char lookup table */ - ROM_LOAD( "hgb1.h7", 0x0120, 0x0100, CRC(07c607ce) SHA1(c048602d62f47129152bbc7ccd38627d78a4392f) ) /* sprite lookup table */ - ROM_LOAD( "hgb4.l9", 0x0220, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ - ROM_LOAD( "hgb2.k7", 0x0320, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ + ROM_LOAD( "hgb3.l6", 0x0000, 0x0020, CRC(629cebd8) SHA1(c28cd0f341f4f1c7be97f4d8c289860db8ac0857) ) // palette + ROM_LOAD( "hgb5.m4", 0x0020, 0x0100, CRC(dbaa4443) SHA1(cca2f9b187abd735f2309b38570edcd745042b3e) ) // char lookup table + ROM_LOAD( "hgb1.h7", 0x0120, 0x0100, CRC(07c607ce) SHA1(c048602d62f47129152bbc7ccd38627d78a4392f) ) // sprite lookup table + ROM_LOAD( "hgb4.l9", 0x0220, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) // interrupt timing (not used) + ROM_LOAD( "hgb2.k7", 0x0320, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) // video timing? (not used) ROM_END +} // anonymous namespace + GAME( 1984, higemaru, 0, higemaru, higemaru, higemaru_state, empty_init, ROT0, "Capcom", "Pirate Ship Higemaru", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/capcom/higemaru.h b/src/mame/capcom/higemaru.h deleted file mode 100644 index 78f9340bb49..00000000000 --- a/src/mame/capcom/higemaru.h +++ /dev/null @@ -1,55 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mirko Buffoni -/************************************************************************* - - Pirate Ship Higemaru - -*************************************************************************/ -#ifndef MAME_INCLUDES_HIGEMARU_H -#define MAME_INCLUDES_HIGEMARU_H - -#pragma once - -#include "machine/timer.h" -#include "emupal.h" -#include "tilemap.h" - -class higemaru_state : public driver_device -{ -public: - higemaru_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), - m_spriteram(*this, "spriteram"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { } - - void higemaru(machine_config &config); - -private: - /* memory pointers */ - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - required_shared_ptr m_spriteram; - - /* video-related */ - tilemap_t *m_bg_tilemap = nullptr; - void higemaru_videoram_w(offs_t offset, uint8_t data); - void higemaru_colorram_w(offs_t offset, uint8_t data); - void higemaru_c800_w(uint8_t data); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void video_start() override; - void higemaru_palette(palette_device &palette) const; - uint32_t screen_update_higemaru(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(higemaru_scanline); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - void higemaru_map(address_map &map); -}; - -#endif // MAME_INCLUDES_HIGEMARU_H diff --git a/src/mame/capcom/higemaru_v.cpp b/src/mame/capcom/higemaru_v.cpp deleted file mode 100644 index f9b91f70e37..00000000000 --- a/src/mame/capcom/higemaru_v.cpp +++ /dev/null @@ -1,142 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mirko Buffoni -#include "emu.h" -#include "higemaru.h" - -void higemaru_state::higemaru_videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void higemaru_state::higemaru_colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -/*************************************************************************** - - Convert the color PROMs into a more useable format. - -***************************************************************************/ - -void higemaru_state::higemaru_palette(palette_device &palette) const -{ - const uint8_t *color_prom = memregion("proms")->base(); - - // create a lookup table for the palette - for (int i = 0; i < 0x20; i++) - { - int bit0, bit1, bit2; - - // red component - bit0 = (color_prom[i] >> 0) & 0x01; - bit1 = (color_prom[i] >> 1) & 0x01; - bit2 = (color_prom[i] >> 2) & 0x01; - int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - // green component - bit0 = (color_prom[i] >> 3) & 0x01; - bit1 = (color_prom[i] >> 4) & 0x01; - bit2 = (color_prom[i] >> 5) & 0x01; - int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - // blue component - bit0 = 0; - bit1 = (color_prom[i] >> 6) & 0x01; - bit2 = (color_prom[i] >> 7) & 0x01; - int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - palette.set_indirect_color(i, rgb_t(r, g, b)); - } - - // color_prom now points to the beginning of the lookup table - color_prom += 0x20; - - // characters use colors 0-15 - for (int i = 0; i < 0x80; i++) - { - uint8_t const ctabentry = color_prom[i] & 0x0f; - palette.set_pen_indirect(i, ctabentry); - } - - // sprites use colors 16-31 - for (int i = 0x80; i < 0x180; i++) - { - uint8_t const ctabentry = (color_prom[i + 0x80] & 0x0f) | 0x10; - palette.set_pen_indirect(i, ctabentry); - } -} - -void higemaru_state::higemaru_c800_w(uint8_t data) -{ - if (data & 0x7c) - logerror("c800 = %02x\n",data); - - /* bits 0 and 1 are coin counters */ - machine().bookkeeping().coin_counter_w(0,data & 2); - machine().bookkeeping().coin_counter_w(1,data & 1); - - /* bit 7 flips screen */ - if (flip_screen() != (data & 0x80)) - { - flip_screen_set(data & 0x80); - m_bg_tilemap->mark_all_dirty(); - } -} - -TILE_GET_INFO_MEMBER(higemaru_state::get_bg_tile_info) -{ - int code = m_videoram[tile_index] + ((m_colorram[tile_index] & 0x80) << 1); - int color = m_colorram[tile_index] & 0x1f; - - tileinfo.set(0, code, color, 0); -} - -void higemaru_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(higemaru_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); -} - -void higemaru_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - uint8_t *spriteram = m_spriteram; - - for (int offs = m_spriteram.bytes() - 16; offs >= 0; offs -= 16) - { - int const code = spriteram[offs] & 0x7f; - int col = spriteram[offs + 4] & 0x0f; - int sx = spriteram[offs + 12]; - int sy = spriteram[offs + 8]; - int flipx = spriteram[offs + 4] & 0x10; - int flipy = spriteram[offs + 4] & 0x20; - if (flip_screen()) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code, - col, - flipx,flipy, - sx,sy,15); - - /* draw again with wraparound */ - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code, - col, - flipx,flipy, - sx - 256,sy,15); - } -} - -uint32_t higemaru_state::screen_update_higemaru(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect); - return 0; -} diff --git a/src/mame/capcom/sonson.cpp b/src/mame/capcom/sonson.cpp index a90b9328449..f38715bc305 100644 --- a/src/mame/capcom/sonson.cpp +++ b/src/mame/capcom/sonson.cpp @@ -1,8 +1,10 @@ // license:BSD-3-Clause -// copyright-holders:Mirko Buffoni +// copyright-holders: Mirko Buffoni + /*************************************************************************** Son Son memory map (preliminary) +Capcom 84601-A + 84601-B PCBs driver by Mirko Buffoni @@ -51,16 +53,226 @@ TODO: ***************************************************************************/ #include "emu.h" -#include "sonson.h" #include "cpu/m6809/m6809.h" #include "machine/74259.h" #include "machine/gen_latch.h" #include "sound/ay8910.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" +namespace { + +class sonson_state : public driver_device +{ +public: + sonson_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_videoram(*this, "videoram"), + m_colorram(*this, "colorram"), + m_spriteram(*this, "spriteram"), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") + { } + + void sonson(machine_config &config); + +protected: + virtual void video_start() override; + +private: + // memory pointers + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + required_shared_ptr m_spriteram; + + // devices + required_device m_maincpu; + required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_palette; + + // video-related + tilemap_t *m_bg_tilemap = nullptr; + + DECLARE_WRITE_LINE_MEMBER(sh_irqtrigger_w); + void videoram_w(offs_t offset, uint8_t data); + void colorram_w(offs_t offset, uint8_t data); + void scrollx_w(uint8_t data); + template WRITE_LINE_MEMBER(coin_counter_w); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + + void main_map(address_map &map); + void sound_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + Convert the color PROMs into a more useable format. + + Son Son has two 32x8 palette PROMs and two 256x4 lookup table PROMs (one + for characters, one for sprites). + The palette PROMs are connected to the RGB output this way: + + I don't know the exact values of the resistors between the PROMs and the + RGB output. I assumed these values (the same as Commando) + bit 7 -- 220 ohm resistor -- GREEN + -- 470 ohm resistor -- GREEN + -- 1 kohm resistor -- GREEN + -- 2.2kohm resistor -- GREEN + -- 220 ohm resistor -- BLUE + -- 470 ohm resistor -- BLUE + -- 1 kohm resistor -- BLUE + bit 0 -- 2.2kohm resistor -- BLUE + + bit 7 -- unused + -- unused + -- unused + -- unused + -- 220 ohm resistor -- RED + -- 470 ohm resistor -- RED + -- 1 kohm resistor -- RED + bit 0 -- 2.2kohm resistor -- RED + +***************************************************************************/ + +void sonson_state::palette(palette_device &palette) const +{ + const uint8_t *color_prom = memregion("proms")->base(); + + // create a lookup table for the palette + for (int i = 0; i < 0x20; i++) + { + int bit0, bit1, bit2, bit3; + + // red component + bit0 = (color_prom[i + 0x20] >> 0) & 0x01; + bit1 = (color_prom[i + 0x20] >> 1) & 0x01; + bit2 = (color_prom[i + 0x20] >> 2) & 0x01; + bit3 = (color_prom[i + 0x20] >> 3) & 0x01; + int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + // green component + bit0 = (color_prom[i + 0x00] >> 4) & 0x01; + bit1 = (color_prom[i + 0x00] >> 5) & 0x01; + bit2 = (color_prom[i + 0x00] >> 6) & 0x01; + bit3 = (color_prom[i + 0x00] >> 7) & 0x01; + int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + // blue component + bit0 = (color_prom[i + 0x00] >> 0) & 0x01; + bit1 = (color_prom[i + 0x00] >> 1) & 0x01; + bit2 = (color_prom[i + 0x00] >> 2) & 0x01; + bit3 = (color_prom[i + 0x00] >> 3) & 0x01; + int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + palette.set_indirect_color(i, rgb_t(r, g, b)); + } + + // color_prom now points to the beginning of the lookup table + color_prom += 0x40; + + // characters use colors 0-0x0f + for (int i = 0; i < 0x100; i++) + { + uint8_t const ctabentry = color_prom[i] & 0x0f; + palette.set_pen_indirect(i, ctabentry); + } + + // sprites use colors 0x10-0x1f + for (int i = 0x100; i < 0x200; i++) + { + uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10; + palette.set_pen_indirect(i, ctabentry); + } +} + +void sonson_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void sonson_state::colorram_w(offs_t offset, uint8_t data) +{ + m_colorram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void sonson_state::scrollx_w(uint8_t data) +{ + for (int row = 5; row < 32; row++) + m_bg_tilemap->set_scrollx(row, data); +} + +TILE_GET_INFO_MEMBER(sonson_state::get_bg_tile_info) +{ + int const attr = m_colorram[tile_index]; + int const code = m_videoram[tile_index] + 256 * (attr & 0x03); + int const color = attr >> 2; + + tileinfo.set(0, code, color, 0); +} + +void sonson_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(sonson_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_bg_tilemap->set_scroll_rows(32); +} + +void sonson_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) + { + int const code = m_spriteram[offs + 2] + ((m_spriteram[offs + 1] & 0x20) << 3); + int const color = m_spriteram[offs + 1] & 0x1f; + int flipx = ~m_spriteram[offs + 1] & 0x40; + int flipy = ~m_spriteram[offs + 1] & 0x80; + int sx = m_spriteram[offs + 3]; + int sy = m_spriteram[offs + 0]; + + if (flip_screen()) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, color, + flipx, flipy, + sx, sy, 0); + + // wrap-around + m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, code, color, flipx, flipy, sx - 256, sy, 0); + m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, code, color, flipx, flipy, sx, sy - 256, 0); + } +} + +uint32_t sonson_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + return 0; +} + + +// machine + WRITE_LINE_MEMBER(sonson_state::sh_irqtrigger_w) { // setting bit 0 low then high triggers IRQ on the sound CPU @@ -68,23 +280,19 @@ WRITE_LINE_MEMBER(sonson_state::sh_irqtrigger_w) m_audiocpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE); } -WRITE_LINE_MEMBER(sonson_state::coin1_counter_w) +template +WRITE_LINE_MEMBER(sonson_state::coin_counter_w) { - machine().bookkeeping().coin_counter_w(0, state); -} - -WRITE_LINE_MEMBER(sonson_state::coin2_counter_w) -{ - machine().bookkeeping().coin_counter_w(1, state); + machine().bookkeeping().coin_counter_w(Which, state); } void sonson_state::main_map(address_map &map) { map(0x0000, 0x0fff).ram(); - map(0x1000, 0x13ff).ram().w(FUNC(sonson_state::sonson_videoram_w)).share("videoram"); - map(0x1400, 0x17ff).ram().w(FUNC(sonson_state::sonson_colorram_w)).share("colorram"); - map(0x2020, 0x207f).ram().share("spriteram"); - map(0x3000, 0x3000).w(FUNC(sonson_state::sonson_scrollx_w)); + map(0x1000, 0x13ff).ram().w(FUNC(sonson_state::videoram_w)).share(m_videoram); + map(0x1400, 0x17ff).ram().w(FUNC(sonson_state::colorram_w)).share(m_colorram); + map(0x2020, 0x207f).ram().share(m_spriteram); + map(0x3000, 0x3000).w(FUNC(sonson_state::scrollx_w)); map(0x3002, 0x3002).portr("P1"); map(0x3003, 0x3003).portr("P2"); map(0x3004, 0x3004).portr("SYSTEM"); @@ -110,33 +318,33 @@ void sonson_state::sound_map(address_map &map) static INPUT_PORTS_START( sonson ) PORT_START("P1") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused PORT_START("P2") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused PORT_START("DSW1") PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3,4") @@ -156,14 +364,14 @@ static INPUT_PORTS_START( sonson ) PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ) ) PORT_DIPSETTING( 0x09, DEF_STR( 1C_7C ) ) PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) - PORT_DIPNAME( 0x10, 0x10, "Coinage affects" ) PORT_DIPLOCATION("SW1:5") /* Not documented in manual */ + PORT_DIPNAME( 0x10, 0x10, "Coinage affects" ) PORT_DIPLOCATION("SW1:5") // Not documented in manual PORT_DIPSETTING( 0x10, DEF_STR( Coin_A ) ) PORT_DIPSETTING( 0x00, DEF_STR( Coin_B ) ) PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_SERVICE( 0x40, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW1:7") - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen )) PORT_DIPLOCATION("SW1:8") + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen )) PORT_DIPLOCATION("SW1:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) @@ -173,7 +381,7 @@ static INPUT_PORTS_START( sonson ) PORT_DIPSETTING( 0x02, "4" ) PORT_DIPSETTING( 0x01, "5" ) PORT_DIPSETTING( 0x00, "7" ) - PORT_DIPNAME( 0x04, 0x00, "2 Players Game" ) PORT_DIPLOCATION("SW2:3") /* Not documented in manual */ + PORT_DIPNAME( 0x04, 0x00, "2 Players Game" ) PORT_DIPLOCATION("SW2:3") // Not documented in manual PORT_DIPSETTING( 0x04, "1 Credit" ) PORT_DIPSETTING( 0x00, "2 Credits" ) PORT_DIPNAME( 0x18, 0x08, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:4,5") @@ -206,8 +414,8 @@ static const gfx_layout spritelayout = }; static GFXDECODE_START( gfx_sonson ) - GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x2_planar, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 64*4, 32 ) + GFXDECODE_ENTRY( "chars", 0, gfx_8x8x2_planar, 0, 64 ) + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 64*4, 32 ) GFXDECODE_END @@ -215,41 +423,41 @@ GFXDECODE_END void sonson_state::sonson(machine_config &config) { - /* basic machine hardware */ - MC6809(config, m_maincpu, XTAL(12'000'000)/2); // HD68B09P (/4 internally) + // basic machine hardware + MC6809(config, m_maincpu, XTAL(12'000'000) / 2); // HD68B09P (/4 internally) m_maincpu->set_addrmap(AS_PROGRAM, &sonson_state::main_map); m_maincpu->set_vblank_int("screen", FUNC(sonson_state::irq0_line_hold)); - MC6809(config, m_audiocpu, XTAL(12'000'000)/2); // HD68B09P (/4 internally) + MC6809(config, m_audiocpu, XTAL(12'000'000) / 2); // HD68B09P (/4 internally) m_audiocpu->set_addrmap(AS_PROGRAM, &sonson_state::sound_map); - m_audiocpu->set_periodic_int(FUNC(sonson_state::irq0_line_hold), attotime::from_hz(4*60)); /* FIRQs are triggered by the main CPU */ + m_audiocpu->set_periodic_int(FUNC(sonson_state::irq0_line_hold), attotime::from_hz(4 * 60)); // FIRQs are triggered by the main CPU ls259_device &mainlatch(LS259(config, "mainlatch")); // A9 - mainlatch.q_out_cb<0>().set(FUNC(sonson_state::flipscreen_w)); + mainlatch.q_out_cb<0>().set(FUNC(sonson_state::flip_screen_set)).invert(); mainlatch.q_out_cb<1>().set(FUNC(sonson_state::sh_irqtrigger_w)); - mainlatch.q_out_cb<6>().set(FUNC(sonson_state::coin2_counter_w)); - mainlatch.q_out_cb<7>().set(FUNC(sonson_state::coin1_counter_w)); + mainlatch.q_out_cb<6>().set(FUNC(sonson_state::coin_counter_w<1>)); + mainlatch.q_out_cb<7>().set(FUNC(sonson_state::coin_counter_w<0>)); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(57.37); screen.set_size(32*8, 32*8); screen.set_visarea(1*8, 31*8-1, 1*8, 31*8-1); - screen.set_screen_update(FUNC(sonson_state::screen_update_sonson)); + screen.set_screen_update(FUNC(sonson_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_sonson); - PALETTE(config, m_palette, FUNC(sonson_state::sonson_palette), 64*4 + 32*8, 32); + PALETTE(config, m_palette, FUNC(sonson_state::palette), 64*4 + 32*8, 32); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, "soundlatch"); - AY8910(config, "ay1", XTAL(12'000'000)/8).add_route(ALL_OUTPUTS, "mono", 0.30); /* 1.5 MHz */ + AY8910(config, "ay1", XTAL(12'000'000) / 8).add_route(ALL_OUTPUTS, "mono", 0.30); // 1.5 MHz - AY8910(config, "ay2", XTAL(12'000'000)/8).add_route(ALL_OUTPUTS, "mono", 0.30); /* 1.5 MHz */ + AY8910(config, "ay2", XTAL(12'000'000) / 8).add_route(ALL_OUTPUTS, "mono", 0.30); // 1.5 MHz } @@ -261,7 +469,7 @@ void sonson_state::sonson(machine_config &config) ***************************************************************************/ ROM_START( sonson ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* 64k for code + 3*16k for the banked ROMs images */ + ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "ss.01e", 0x4000, 0x4000, CRC(cd40cc54) SHA1(4269586099638d31dd30381e94538701982e9f5a) ) ROM_LOAD( "ss.02e", 0x8000, 0x4000, CRC(c3476527) SHA1(499b879a12b55443ec833e5a2819e9da20e3b033) ) ROM_LOAD( "ss.03e", 0xc000, 0x4000, CRC(1fd0e729) SHA1(e04215b0c3d11ce844ab250ff3e1a845dd0b6c3e) ) @@ -269,12 +477,12 @@ ROM_START( sonson ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "ss_6.c11", 0xe000, 0x2000, CRC(1135c48a) SHA1(bfc10363fc42fb589088675a6e8e3d1668d8a6b8) ) - ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "ss_7.b6", 0x00000, 0x2000, CRC(990890b1) SHA1(0ae5da75e8ff013d32f2a6e3a015d5e1623fbb19) ) /* characters */ + ROM_REGION( 0x04000, "chars", 0 ) + ROM_LOAD( "ss_7.b6", 0x00000, 0x2000, CRC(990890b1) SHA1(0ae5da75e8ff013d32f2a6e3a015d5e1623fbb19) ) ROM_LOAD( "ss_8.b5", 0x02000, 0x2000, CRC(9388ff82) SHA1(31ff5e61d062262754bbf6763d094495c1d2e838) ) - ROM_REGION( 0x0c000, "gfx2", 0 ) - ROM_LOAD( "ss_9.m5", 0x00000, 0x2000, CRC(8cb1cacf) SHA1(41b479dae84176ceb4eacb30b4dad58b7767606e) ) /* sprites */ + ROM_REGION( 0x0c000, "sprites", 0 ) + ROM_LOAD( "ss_9.m5", 0x00000, 0x2000, CRC(8cb1cacf) SHA1(41b479dae84176ceb4eacb30b4dad58b7767606e) ) ROM_LOAD( "ss_10.m6", 0x02000, 0x2000, CRC(f802815e) SHA1(968145680483620cb0c9e7c00b4927aeace99e0c) ) ROM_LOAD( "ss_11.m3", 0x04000, 0x2000, CRC(4dbad88a) SHA1(721612555714e116564d2b301cfa04980d21ad3b) ) ROM_LOAD( "ss_12.m4", 0x06000, 0x2000, CRC(aa05e687) SHA1(4988d540e3deb9107f0448cd8ef47fa73ec926fe) ) @@ -282,15 +490,15 @@ ROM_START( sonson ) ROM_LOAD( "ss_14.m2", 0x0a000, 0x2000, CRC(e14ef54e) SHA1(69ab42defff2cb91c6e07ea8805f64868a028630) ) ROM_REGION( 0x0340, "proms", 0 ) - ROM_LOAD( "ssb4.b2", 0x0000, 0x0020, CRC(c8eaf234) SHA1(d39dfab6dcad6b0a719c466b5290d2d081e4b58d) ) /* red/green component */ - ROM_LOAD( "ssb5.b1", 0x0020, 0x0020, CRC(0e434add) SHA1(238c281813d6079b9ae877bd0ced33abbbe39442) ) /* blue component */ - ROM_LOAD( "ssb2.c4", 0x0040, 0x0100, CRC(c53321c6) SHA1(439d98a98cdf2118b887c725a7759a98e2c377d9) ) /* character lookup table */ - ROM_LOAD( "ssb3.h7", 0x0140, 0x0100, CRC(7d2c324a) SHA1(3dcf09bd3f58bddb9760183d2c1b0fe5d77536ea) ) /* sprite lookup table */ - ROM_LOAD( "ssb1.k11", 0x0240, 0x0100, CRC(a04b0cfe) SHA1(89ab33c6b0aa313ebda2f11516cea667a9951a81) ) /* unknown (not used) */ + ROM_LOAD( "ssb4.b2", 0x0000, 0x0020, CRC(c8eaf234) SHA1(d39dfab6dcad6b0a719c466b5290d2d081e4b58d) ) // red/green component + ROM_LOAD( "ssb5.b1", 0x0020, 0x0020, CRC(0e434add) SHA1(238c281813d6079b9ae877bd0ced33abbbe39442) ) // blue component + ROM_LOAD( "ssb2.c4", 0x0040, 0x0100, CRC(c53321c6) SHA1(439d98a98cdf2118b887c725a7759a98e2c377d9) ) // character lookup table + ROM_LOAD( "ssb3.h7", 0x0140, 0x0100, CRC(7d2c324a) SHA1(3dcf09bd3f58bddb9760183d2c1b0fe5d77536ea) ) // sprite lookup table + ROM_LOAD( "ssb1.k11", 0x0240, 0x0100, CRC(a04b0cfe) SHA1(89ab33c6b0aa313ebda2f11516cea667a9951a81) ) // unknown (not used) ROM_END ROM_START( sonsonj ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* 64k for code + 3*16k for the banked ROMs images */ + ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "ss_0.l9", 0x4000, 0x2000, CRC(705c168f) SHA1(28d3b186cd0b927d96664051fb759b64ecc18908) ) ROM_LOAD( "ss_1.j9", 0x6000, 0x2000, CRC(0f03b57d) SHA1(7d14a88f43952d5c4df2951a5b62e399ba5ef37b) ) ROM_LOAD( "ss_2.l8", 0x8000, 0x2000, CRC(a243a15d) SHA1(a736a163fbb20fa0e318f53ccf29d155b6f77781) ) @@ -301,12 +509,12 @@ ROM_START( sonsonj ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "ss_6.c11", 0xe000, 0x2000, CRC(1135c48a) SHA1(bfc10363fc42fb589088675a6e8e3d1668d8a6b8) ) - ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "ss_7.b6", 0x00000, 0x2000, CRC(990890b1) SHA1(0ae5da75e8ff013d32f2a6e3a015d5e1623fbb19) ) /* characters */ + ROM_REGION( 0x04000, "chars", 0 ) + ROM_LOAD( "ss_7.b6", 0x00000, 0x2000, CRC(990890b1) SHA1(0ae5da75e8ff013d32f2a6e3a015d5e1623fbb19) ) ROM_LOAD( "ss_8.b5", 0x02000, 0x2000, CRC(9388ff82) SHA1(31ff5e61d062262754bbf6763d094495c1d2e838) ) - ROM_REGION( 0x0c000, "gfx2", 0 ) - ROM_LOAD( "ss_9.m5", 0x00000, 0x2000, CRC(8cb1cacf) SHA1(41b479dae84176ceb4eacb30b4dad58b7767606e) ) /* sprites */ + ROM_REGION( 0x0c000, "sprites", 0 ) + ROM_LOAD( "ss_9.m5", 0x00000, 0x2000, CRC(8cb1cacf) SHA1(41b479dae84176ceb4eacb30b4dad58b7767606e) ) ROM_LOAD( "ss_10.m6", 0x02000, 0x2000, CRC(f802815e) SHA1(968145680483620cb0c9e7c00b4927aeace99e0c) ) ROM_LOAD( "ss_11.m3", 0x04000, 0x2000, CRC(4dbad88a) SHA1(721612555714e116564d2b301cfa04980d21ad3b) ) ROM_LOAD( "ss_12.m4", 0x06000, 0x2000, CRC(aa05e687) SHA1(4988d540e3deb9107f0448cd8ef47fa73ec926fe) ) @@ -314,13 +522,15 @@ ROM_START( sonsonj ) ROM_LOAD( "ss_14.m2", 0x0a000, 0x2000, CRC(e14ef54e) SHA1(69ab42defff2cb91c6e07ea8805f64868a028630) ) ROM_REGION( 0x0340, "proms", 0 ) - ROM_LOAD( "ssb4.b2", 0x0000, 0x0020, CRC(c8eaf234) SHA1(d39dfab6dcad6b0a719c466b5290d2d081e4b58d) ) /* red/green component */ - ROM_LOAD( "ssb5.b1", 0x0020, 0x0020, CRC(0e434add) SHA1(238c281813d6079b9ae877bd0ced33abbbe39442) ) /* blue component */ - ROM_LOAD( "ssb2.c4", 0x0040, 0x0100, CRC(c53321c6) SHA1(439d98a98cdf2118b887c725a7759a98e2c377d9) ) /* character lookup table */ - ROM_LOAD( "ssb3.h7", 0x0140, 0x0100, CRC(7d2c324a) SHA1(3dcf09bd3f58bddb9760183d2c1b0fe5d77536ea) ) /* sprite lookup table */ - ROM_LOAD( "ssb1.k11", 0x0240, 0x0100, CRC(a04b0cfe) SHA1(89ab33c6b0aa313ebda2f11516cea667a9951a81) ) /* unknown (not used) */ + ROM_LOAD( "ssb4.b2", 0x0000, 0x0020, CRC(c8eaf234) SHA1(d39dfab6dcad6b0a719c466b5290d2d081e4b58d) ) // red/green component + ROM_LOAD( "ssb5.b1", 0x0020, 0x0020, CRC(0e434add) SHA1(238c281813d6079b9ae877bd0ced33abbbe39442) ) // blue component + ROM_LOAD( "ssb2.c4", 0x0040, 0x0100, CRC(c53321c6) SHA1(439d98a98cdf2118b887c725a7759a98e2c377d9) ) // character lookup table + ROM_LOAD( "ssb3.h7", 0x0140, 0x0100, CRC(7d2c324a) SHA1(3dcf09bd3f58bddb9760183d2c1b0fe5d77536ea) ) // sprite lookup table + ROM_LOAD( "ssb1.k11", 0x0240, 0x0100, CRC(a04b0cfe) SHA1(89ab33c6b0aa313ebda2f11516cea667a9951a81) ) // unknown (not used) ROM_END +} // anonymous namespace + GAME( 1984, sonson, 0, sonson, sonson, sonson_state, empty_init, ROT0, "Capcom", "Son Son", MACHINE_SUPPORTS_SAVE ) GAME( 1984, sonsonj, sonson, sonson, sonson, sonson_state, empty_init, ROT0, "Capcom", "Son Son (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/capcom/sonson.h b/src/mame/capcom/sonson.h deleted file mode 100644 index 08391dd06c5..00000000000 --- a/src/mame/capcom/sonson.h +++ /dev/null @@ -1,63 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mirko Buffoni -/************************************************************************* - - Son Son - -*************************************************************************/ -#ifndef MAME_INCLUDES_SONSON_H -#define MAME_INCLUDES_SONSON_H - -#pragma once - -#include "emupal.h" -#include "tilemap.h" - -class sonson_state : public driver_device -{ -public: - sonson_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), - m_spriteram(*this, "spriteram"), - m_audiocpu(*this, "audiocpu"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { } - - void sonson(machine_config &config); - -private: - /* memory pointers */ - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - required_shared_ptr m_spriteram; - - /* video-related */ - tilemap_t *m_bg_tilemap = nullptr; - - /* devices */ - required_device m_audiocpu; - DECLARE_WRITE_LINE_MEMBER(sh_irqtrigger_w); - DECLARE_WRITE_LINE_MEMBER(coin1_counter_w); - DECLARE_WRITE_LINE_MEMBER(coin2_counter_w); - void sonson_videoram_w(offs_t offset, uint8_t data); - void sonson_colorram_w(offs_t offset, uint8_t data); - void sonson_scrollx_w(uint8_t data); - DECLARE_WRITE_LINE_MEMBER(flipscreen_w); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void video_start() override; - void sonson_palette(palette_device &palette) const; - uint32_t screen_update_sonson(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - - void main_map(address_map &map); - void sound_map(address_map &map); -}; - -#endif // MAME_INCLUDES_SONSON_H diff --git a/src/mame/capcom/sonson_v.cpp b/src/mame/capcom/sonson_v.cpp deleted file mode 100644 index 56accb6a418..00000000000 --- a/src/mame/capcom/sonson_v.cpp +++ /dev/null @@ -1,172 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mirko Buffoni -/*************************************************************************** - - video.c - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "sonson.h" - -/*************************************************************************** - - Convert the color PROMs into a more useable format. - - Son Son has two 32x8 palette PROMs and two 256x4 lookup table PROMs (one - for characters, one for sprites). - The palette PROMs are connected to the RGB output this way: - - I don't know the exact values of the resistors between the PROMs and the - RGB output. I assumed these values (the same as Commando) - bit 7 -- 220 ohm resistor -- GREEN - -- 470 ohm resistor -- GREEN - -- 1 kohm resistor -- GREEN - -- 2.2kohm resistor -- GREEN - -- 220 ohm resistor -- BLUE - -- 470 ohm resistor -- BLUE - -- 1 kohm resistor -- BLUE - bit 0 -- 2.2kohm resistor -- BLUE - - bit 7 -- unused - -- unused - -- unused - -- unused - -- 220 ohm resistor -- RED - -- 470 ohm resistor -- RED - -- 1 kohm resistor -- RED - bit 0 -- 2.2kohm resistor -- RED - -***************************************************************************/ - -void sonson_state::sonson_palette(palette_device &palette) const -{ - const uint8_t *color_prom = memregion("proms")->base(); - - // create a lookup table for the palette - for (int i = 0; i < 0x20; i++) - { - int bit0, bit1, bit2, bit3; - - // red component - bit0 = (color_prom[i + 0x20] >> 0) & 0x01; - bit1 = (color_prom[i + 0x20] >> 1) & 0x01; - bit2 = (color_prom[i + 0x20] >> 2) & 0x01; - bit3 = (color_prom[i + 0x20] >> 3) & 0x01; - int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - // green component - bit0 = (color_prom[i + 0x00] >> 4) & 0x01; - bit1 = (color_prom[i + 0x00] >> 5) & 0x01; - bit2 = (color_prom[i + 0x00] >> 6) & 0x01; - bit3 = (color_prom[i + 0x00] >> 7) & 0x01; - int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - // blue component - bit0 = (color_prom[i + 0x00] >> 0) & 0x01; - bit1 = (color_prom[i + 0x00] >> 1) & 0x01; - bit2 = (color_prom[i + 0x00] >> 2) & 0x01; - bit3 = (color_prom[i + 0x00] >> 3) & 0x01; - int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - palette.set_indirect_color(i, rgb_t(r, g, b)); - } - - // color_prom now points to the beginning of the lookup table - color_prom += 0x40; - - // characters use colors 0-0x0f - for (int i = 0; i < 0x100; i++) - { - uint8_t const ctabentry = color_prom[i] & 0x0f; - palette.set_pen_indirect(i, ctabentry); - } - - // sprites use colors 0x10-0x1f - for (int i = 0x100; i < 0x200; i++) - { - uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10; - palette.set_pen_indirect(i, ctabentry); - } -} - -void sonson_state::sonson_videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void sonson_state::sonson_colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void sonson_state::sonson_scrollx_w(uint8_t data) -{ - for (int row = 5; row < 32; row++) - m_bg_tilemap->set_scrollx(row, data); -} - -WRITE_LINE_MEMBER(sonson_state::flipscreen_w) -{ - flip_screen_set(!state); -} - -TILE_GET_INFO_MEMBER(sonson_state::get_bg_tile_info) -{ - int attr = m_colorram[tile_index]; - int code = m_videoram[tile_index] + 256 * (attr & 0x03); - int color = attr >> 2; - - tileinfo.set(0, code, color, 0); -} - -void sonson_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(sonson_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_bg_tilemap->set_scroll_rows(32); -} - -void sonson_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - uint8_t *spriteram = m_spriteram; - int offs; - - for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) - { - int code = spriteram[offs + 2] + ((spriteram[offs + 1] & 0x20) << 3); - int color = spriteram[offs + 1] & 0x1f; - int flipx = ~spriteram[offs + 1] & 0x40; - int flipy = ~spriteram[offs + 1] & 0x80; - int sx = spriteram[offs + 3]; - int sy = spriteram[offs + 0]; - - if (flip_screen()) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code, color, - flipx, flipy, - sx, sy, 0); - - /* wrap-around */ - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, code, color, flipx, flipy, sx - 256, sy, 0); - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, code, color, flipx, flipy, sx, sy - 256, 0); - } -} - -uint32_t sonson_state::screen_update_sonson(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect); - return 0; -} diff --git a/src/mame/capcom/srumbler.cpp b/src/mame/capcom/srumbler.cpp index 2781eaf1b62..5b7325f96cc 100644 --- a/src/mame/capcom/srumbler.cpp +++ b/src/mame/capcom/srumbler.cpp @@ -1,8 +1,10 @@ // license:BSD-3-Clause -// copyright-holders:Paul Leaman +// copyright-holders: Paul Leaman + /*************************************************************************** Speed Rumbler + 86610-A-1 + 86610-B-1 PCBs Driver provided by Paul Leaman @@ -11,7 +13,6 @@ ***************************************************************************/ #include "emu.h" -#include "srumbler.h" #include "cpu/z80/z80.h" #include "cpu/m6809/m6809.h" @@ -21,6 +22,223 @@ #include "speaker.h" +#include "machine/timer.h" +#include "video/bufsprite.h" +#include "emupal.h" +#include "tilemap.h" + + +namespace { + +class srumbler_state : public driver_device +{ +public: + srumbler_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this,"maincpu"), + m_spriteram(*this,"spriteram"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_backgroundram(*this, "backgroundram"), + m_foregroundram(*this, "foregroundram"), + m_proms(*this, "proms"), + m_rombank(*this, "%01x000", 5U) + { } + + void srumbler(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + +private: + required_device m_maincpu; + required_device m_spriteram; + required_device m_gfxdecode; + required_device m_palette; + + required_shared_ptr m_backgroundram; + required_shared_ptr m_foregroundram; + required_region_ptr m_proms; + required_memory_bank_array<11> m_rombank; + + tilemap_t *m_bg_tilemap = nullptr; + tilemap_t *m_fg_tilemap = nullptr; + uint8_t m_scroll[4]{}; + + void bankswitch_w(uint8_t data); + void foreground_w(offs_t offset, uint8_t data); + void background_w(offs_t offset, uint8_t data); + void _4009_w(uint8_t data); + void scroll_w(offs_t offset, uint8_t data); + + TILE_GET_INFO_MEMBER(get_fg_tile_info); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + + TIMER_DEVICE_CALLBACK_MEMBER(interrupt); + void main_map(address_map &map); + void sound_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILE_GET_INFO_MEMBER(srumbler_state::get_fg_tile_info) +{ + uint8_t const attr = m_foregroundram[2 * tile_index]; + tileinfo.set(0, + m_foregroundram[2 * tile_index + 1] + ((attr & 0x03) << 8), + (attr & 0x3c) >> 2, + (attr & 0x40) ? TILE_FORCE_LAYER0 : 0); +} + +TILE_GET_INFO_MEMBER(srumbler_state::get_bg_tile_info) +{ + uint8_t const attr = m_backgroundram[2 * tile_index]; + tileinfo.set(1, + m_backgroundram[2 * tile_index + 1] + ((attr & 0x07) << 8), + (attr & 0xe0) >> 5, + ((attr & 0x08) ? TILE_FLIPY : 0)); + tileinfo.group = (attr & 0x10) >> 4; +} + + + +/*************************************************************************** + + Start the video hardware emulation. + +***************************************************************************/ + +void srumbler_state::video_start() +{ + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(srumbler_state::get_fg_tile_info)), TILEMAP_SCAN_COLS, 8, 8, 64,32); + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(srumbler_state::get_bg_tile_info)), TILEMAP_SCAN_COLS, 16,16, 64,64); + + m_fg_tilemap->set_transparent_pen(3); + + m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); // split type 0 is totally transparent in front half + m_bg_tilemap->set_transmask(1, 0x07ff, 0xf800); // split type 1 has pens 0-10 transparent in front half + + save_item(NAME(m_scroll)); +} + + + +/*************************************************************************** + + Memory handlers + +***************************************************************************/ + +void srumbler_state::foreground_w(offs_t offset, uint8_t data) +{ + m_foregroundram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset / 2); +} + +void srumbler_state::background_w(offs_t offset, uint8_t data) +{ + m_backgroundram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset / 2); +} + + +void srumbler_state::_4009_w(uint8_t data) +{ + // bit 0 flips screen + flip_screen_set(data & 1); + + // bits 4-5 used during attract mode, unknown + + // bits 6-7 coin counters + machine().bookkeeping().coin_counter_w(0, data & 0x40); + machine().bookkeeping().coin_counter_w(1, data & 0x80); +} + + +void srumbler_state::scroll_w(offs_t offset, uint8_t data) +{ + m_scroll[offset] = data; + + m_bg_tilemap->set_scrollx(0, m_scroll[0] | (m_scroll[1] << 8)); + m_bg_tilemap->set_scrolly(0, m_scroll[2] | (m_scroll[3] << 8)); +} + + + +/*************************************************************************** + + Display refresh + +***************************************************************************/ + +void srumbler_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + uint8_t *buffered_spriteram = m_spriteram->buffer(); + + // Draw the sprites. + for (int offs = m_spriteram->bytes() - 4; offs >= 0; offs -= 4) + { + /* SPRITES + ===== + Attribute + 0x80 Code MSB + 0x40 Code MSB + 0x20 Code MSB + 0x10 Colour + 0x08 Colour + 0x04 Colour + 0x02 y Flip + 0x01 X MSB + */ + + + int const attr = buffered_spriteram[offs + 1]; + int code = buffered_spriteram[offs]; + code += ((attr & 0xe0) << 3); + int const colour = (attr & 0x1c) >> 2; + int sy = buffered_spriteram[offs + 2]; + int sx = buffered_spriteram[offs + 3] + 0x100 * (attr & 0x01); + int flipy = attr & 0x02; + + if (flip_screen()) + { + sx = 496 - sx; + sy = 240 - sy; + flipy = !flipy; + } + + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, + code, + colour, + flip_screen(), flipy, + sx, sy, 15); + } +} + + +uint32_t srumbler_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); + draw_sprites(bitmap, cliprect); + m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + return 0; +} + + +// machine + void srumbler_state::bankswitch_w(uint8_t data) { /* @@ -31,42 +249,36 @@ void srumbler_state::bankswitch_w(uint8_t data) Note that 5000-8fff can be either ROM or RAM, so we should handle that as well to be 100% accurate. */ - uint8_t *prom1 = memregion("proms")->base() + (data & 0xf0); - uint8_t *prom2 = memregion("proms")->base() + 0x100 + ((data & 0x0f) << 4); + uint8_t const *prom1 = &m_proms[data & 0xf0]; + uint8_t const *prom2 = &m_proms[0x100 + ((data & 0x0f) << 4)]; - for (int i = 0x05;i < 0x10;i++) + for (int i = 0x05; i < 0x10; i++) { - /* bit 2 of prom1 selects ROM or RAM - not supported */ - int bank = ((prom1[i] & 0x03) << 4) | (prom2[i] & 0x0f); + // bit 2 of prom1 selects ROM or RAM - not supported + int const bank = ((prom1[i] & 0x03) << 4) | (prom2[i] & 0x0f); - char bankname[10]; - sprintf(bankname, "%04x", i*0x1000); - membank(bankname)->set_entry(bank); + m_rombank[i - 5]->set_entry(bank); } } void srumbler_state::machine_start() { - for (int i = 0x05; i < 0x10; i++) - { - char bankname[10]; - sprintf(bankname, "%04x", i*0x1000); - membank(bankname)->configure_entries(0, 64, memregion("user1")->base(), 0x1000); - } + for (int i = 0x00; i < 0x0b; i++) + m_rombank[i]->configure_entries(0, 64, memregion("maincpu")->base(), 0x1000); - /* initialize banked ROM pointers */ + // initialize banked ROM pointers bankswitch_w(0); } TIMER_DEVICE_CALLBACK_MEMBER(srumbler_state::interrupt) { - int scanline = param; + int const scanline = param; if (scanline == 248) - m_maincpu->set_input_line(0,HOLD_LINE); + m_maincpu->set_input_line(0, HOLD_LINE); if (scanline == 0) - m_maincpu->set_input_line(M6809_FIRQ_LINE,HOLD_LINE); + m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE); } /* @@ -79,11 +291,11 @@ to the page register. Ignore the warnings about writing to unmapped memory. */ -void srumbler_state::srumbler_map(address_map &map) +void srumbler_state::main_map(address_map &map) { - map(0x0000, 0x1dff).ram(); /* RAM (of 1 sort or another) */ + map(0x0000, 0x1dff).ram(); // RAM (of 1 sort or another) map(0x1e00, 0x1fff).ram().share("spriteram"); - map(0x2000, 0x3fff).ram().w(FUNC(srumbler_state::background_w)).share("backgroundram"); + map(0x2000, 0x3fff).ram().w(FUNC(srumbler_state::background_w)).share(m_backgroundram); map(0x4008, 0x4008).portr("SYSTEM").w(FUNC(srumbler_state::bankswitch_w)); map(0x4009, 0x4009).portr("P1").w(FUNC(srumbler_state::_4009_w)); map(0x400a, 0x400a).portr("P2"); @@ -91,22 +303,22 @@ void srumbler_state::srumbler_map(address_map &map) map(0x400c, 0x400c).portr("DSW2"); map(0x400a, 0x400d).w(FUNC(srumbler_state::scroll_w)); map(0x400e, 0x400e).w("soundlatch", FUNC(generic_latch_8_device::write)); - map(0x5000, 0x5fff).bankr("5000").w(FUNC(srumbler_state::foreground_w)).share("foregroundram"); /* Banked ROM */ - map(0x6000, 0x6fff).bankr("6000"); /* Banked ROM */ - map(0x6000, 0x6fff).nopw(); /* Video RAM 2 ??? (not used) */ - map(0x7000, 0x7fff).bankr("7000"); /* Banked ROM */ + map(0x5000, 0x5fff).bankr(m_rombank[0]).w(FUNC(srumbler_state::foreground_w)).share(m_foregroundram); + map(0x6000, 0x6fff).bankr(m_rombank[1]); + map(0x6000, 0x6fff).nopw(); // Video RAM 2 ??? (not used) + map(0x7000, 0x7fff).bankr(m_rombank[2]); map(0x7000, 0x73ff).w(m_palette, FUNC(palette_device::write8)).share("palette"); - map(0x8000, 0x8fff).bankr("8000"); /* Banked ROM */ - map(0x9000, 0x9fff).bankr("9000"); /* Banked ROM */ - map(0xa000, 0xafff).bankr("a000"); /* Banked ROM */ - map(0xb000, 0xbfff).bankr("b000"); /* Banked ROM */ - map(0xc000, 0xcfff).bankr("c000"); /* Banked ROM */ - map(0xd000, 0xdfff).bankr("d000"); /* Banked ROM */ - map(0xe000, 0xefff).bankr("e000"); /* Banked ROM */ - map(0xf000, 0xffff).bankr("f000"); /* Banked ROM */ + map(0x8000, 0x8fff).bankr(m_rombank[3]); + map(0x9000, 0x9fff).bankr(m_rombank[4]); + map(0xa000, 0xafff).bankr(m_rombank[5]); + map(0xb000, 0xbfff).bankr(m_rombank[6]); + map(0xc000, 0xcfff).bankr(m_rombank[7]); + map(0xd000, 0xdfff).bankr(m_rombank[8]); + map(0xe000, 0xefff).bankr(m_rombank[9]); + map(0xf000, 0xffff).bankr(m_rombank[10]); } -void srumbler_state::srumbler_sound_map(address_map &map) +void srumbler_state::sound_map(address_map &map) { map(0x0000, 0x7fff).rom(); map(0x8000, 0x8001).w("ym1", FUNC(ym2203_device::write)); @@ -236,24 +448,24 @@ static const gfx_layout spritelayout = static GFXDECODE_START( gfx_srumbler ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 448, 16 ) /* colors 448 - 511 */ - GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 128, 8 ) /* colors 128 - 255 */ - GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 256, 8 ) /* colors 256 - 383 */ + GFXDECODE_ENTRY( "chars", 0, charlayout, 448, 16 ) // colors 448 - 511 + GFXDECODE_ENTRY( "tiles", 0, tilelayout, 128, 8 ) // colors 128 - 255 + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 256, 8 ) // colors 256 - 383 GFXDECODE_END void srumbler_state::srumbler(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware MC6809(config, m_maincpu, 16_MHz_XTAL / 2); // HD68B09P - m_maincpu->set_addrmap(AS_PROGRAM, &srumbler_state::srumbler_map); + m_maincpu->set_addrmap(AS_PROGRAM, &srumbler_state::main_map); TIMER(config, "scantimer").configure_scanline(FUNC(srumbler_state::interrupt), "screen", 0, 1); z80_device &audiocpu(Z80(config, "audiocpu", 16_MHz_XTAL / 4)); - audiocpu.set_addrmap(AS_PROGRAM, &srumbler_state::srumbler_sound_map); + audiocpu.set_addrmap(AS_PROGRAM, &srumbler_state::sound_map); - /* video hardware */ + // video hardware BUFFERED_SPRITERAM8(config, m_spriteram); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -269,7 +481,7 @@ void srumbler_state::srumbler(machine_config &config) PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 512); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, "soundlatch"); @@ -297,7 +509,7 @@ void srumbler_state::srumbler(machine_config &config) ***************************************************************************/ ROM_START( srumbler ) - ROM_REGION( 0x40000, "user1", 0 ) /* Paged ROMs */ + ROM_REGION( 0x40000, "maincpu", 0 ) // Paged ROMs ROM_LOAD( "rc04.14e", 0x00000, 0x08000, CRC(a68ce89c) SHA1(cb5dd8c47c24f9d8ac9a6135c0b7942d16002d25) ) ROM_LOAD( "rc03.13e", 0x08000, 0x08000, CRC(87bda812) SHA1(f46dcce21d78c8525a2578b73e05b7cd8a2d8745) ) // sldh ROM_LOAD( "rc02.12e", 0x10000, 0x08000, CRC(d8609cca) SHA1(893f1f1ac0aef5d31e75228252c14c4b522bff16) ) // sldh @@ -310,11 +522,11 @@ ROM_START( srumbler ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "rc05.2f", 0x00000, 0x08000, CRC(0177cebe) SHA1(0fa94d2057f509a6fe1de210bf513efc82f1ffe7) ) // sldh - ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "rc10.6g", 0x00000, 0x04000, CRC(adabe271) SHA1(256d6823dcda404375825103272213e1442c3320) ) /* characters */ + ROM_REGION( 0x04000, "chars", 0 ) + ROM_LOAD( "rc10.6g", 0x00000, 0x04000, CRC(adabe271) SHA1(256d6823dcda404375825103272213e1442c3320) ) - ROM_REGION( 0x40000, "gfx2", 0 ) - ROM_LOAD( "rc11.11a", 0x00000, 0x08000, CRC(5fa042ba) SHA1(9e03eaf22286330826501619a7b74181dc42a5fa) ) /* tiles */ + ROM_REGION( 0x40000, "tiles", 0 ) + ROM_LOAD( "rc11.11a", 0x00000, 0x08000, CRC(5fa042ba) SHA1(9e03eaf22286330826501619a7b74181dc42a5fa) ) ROM_LOAD( "rc12.13a", 0x08000, 0x08000, CRC(a2db64af) SHA1(35ab93397ee8172813e69edd085b36a5b98ba082) ) ROM_LOAD( "rc13.14a", 0x10000, 0x08000, CRC(f1df5499) SHA1(b1c47b35c00bc05825353474ad2b33d9669b879e) ) ROM_LOAD( "rc14.15a", 0x18000, 0x08000, CRC(b22b31b3) SHA1(7aa1a042bccf6a1117c983bb36e88ace7712e867) ) @@ -323,8 +535,8 @@ ROM_START( srumbler ) ROM_LOAD( "rc17.14c", 0x30000, 0x08000, CRC(aa80aaab) SHA1(37a8e57e4d8ed8372bc1d7c94cf5a087a01d79ad) ) ROM_LOAD( "rc18.15c", 0x38000, 0x08000, CRC(ce67868e) SHA1(867d6bc65119fdb7a9788f7d92e6be0326756776) ) - ROM_REGION( 0x40000, "gfx3", 0 ) - ROM_LOAD( "rc20.15e", 0x00000, 0x08000, CRC(3924c861) SHA1(e31e0ea50823a910f87eefc969de53f1ad738629) ) /* sprites */ + ROM_REGION( 0x40000, "sprites", 0 ) + ROM_LOAD( "rc20.15e", 0x00000, 0x08000, CRC(3924c861) SHA1(e31e0ea50823a910f87eefc969de53f1ad738629) ) ROM_LOAD( "rc19.14e", 0x08000, 0x08000, CRC(ff8f9129) SHA1(8402236e297c3b03984a22b727198cc54e0c8117) ) ROM_LOAD( "rc22.15f", 0x10000, 0x08000, CRC(ab64161c) SHA1(4d8b01ba4c85a732df38db7663bd765a49c671de) ) ROM_LOAD( "rc21.14f", 0x18000, 0x08000, CRC(fd64bcd1) SHA1(4bb6c0e0027387284de1dc1320887de3231252e9) ) @@ -334,13 +546,13 @@ ROM_START( srumbler ) ROM_LOAD( "rc25.14j", 0x38000, 0x08000, CRC(d2a4ea4f) SHA1(365e534bf56e08b1e727ea7bfdfb537fa274448b) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "63s141.12a", 0x0000, 0x0100, CRC(8421786f) SHA1(7ffe9f3cd081842d9ee38bd67421cb8836e3f7ed) ) /* ROM banking */ - ROM_LOAD( "63s141.13a", 0x0100, 0x0100, CRC(6048583f) SHA1(a0b0f560e7f52978a1bf59417da13cc852617eff) ) /* ROM banking */ - ROM_LOAD( "63s141.8j", 0x0200, 0x0100, CRC(1a89a7ff) SHA1(437160ad5d61a257b7deaf5f5e8b3d4cf56a9663) ) /* priority (not used) */ + ROM_LOAD( "63s141.12a", 0x0000, 0x0100, CRC(8421786f) SHA1(7ffe9f3cd081842d9ee38bd67421cb8836e3f7ed) ) // ROM banking + ROM_LOAD( "63s141.13a", 0x0100, 0x0100, CRC(6048583f) SHA1(a0b0f560e7f52978a1bf59417da13cc852617eff) ) // ROM banking + ROM_LOAD( "63s141.8j", 0x0200, 0x0100, CRC(1a89a7ff) SHA1(437160ad5d61a257b7deaf5f5e8b3d4cf56a9663) ) // priority (not used) ROM_END ROM_START( srumbler2 ) - ROM_REGION( 0x40000, "user1", 0 ) /* Paged ROMs */ + ROM_REGION( 0x40000, "maincpu", 0 ) // Paged ROMs ROM_LOAD( "rc04.14e", 0x00000, 0x08000, CRC(a68ce89c) SHA1(cb5dd8c47c24f9d8ac9a6135c0b7942d16002d25) ) ROM_LOAD( "rc03.13e", 0x08000, 0x08000, CRC(e82f78d4) SHA1(39cb5d9c18e7635d48aa29221ae99e6a500e2841) ) // sldh ROM_LOAD( "rc02.12e", 0x10000, 0x08000, CRC(009a62d8) SHA1(72b52b34186304d70214f56acdb0f3af5bed9503) ) @@ -353,11 +565,11 @@ ROM_START( srumbler2 ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "rc05.2f", 0x00000, 0x08000, CRC(ea04fa07) SHA1(e29bfc3ed9e6606206ee41c90aaaeddffa26c1b4) ) - ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "rc10.6g", 0x00000, 0x04000, CRC(adabe271) SHA1(256d6823dcda404375825103272213e1442c3320) ) /* characters */ + ROM_REGION( 0x04000, "chars", 0 ) + ROM_LOAD( "rc10.6g", 0x00000, 0x04000, CRC(adabe271) SHA1(256d6823dcda404375825103272213e1442c3320) ) - ROM_REGION( 0x40000, "gfx2", 0 ) - ROM_LOAD( "rc11.11a", 0x00000, 0x08000, CRC(5fa042ba) SHA1(9e03eaf22286330826501619a7b74181dc42a5fa) ) /* tiles */ + ROM_REGION( 0x40000, "tiles", 0 ) + ROM_LOAD( "rc11.11a", 0x00000, 0x08000, CRC(5fa042ba) SHA1(9e03eaf22286330826501619a7b74181dc42a5fa) ) ROM_LOAD( "rc12.13a", 0x08000, 0x08000, CRC(a2db64af) SHA1(35ab93397ee8172813e69edd085b36a5b98ba082) ) ROM_LOAD( "rc13.14a", 0x10000, 0x08000, CRC(f1df5499) SHA1(b1c47b35c00bc05825353474ad2b33d9669b879e) ) ROM_LOAD( "rc14.15a", 0x18000, 0x08000, CRC(b22b31b3) SHA1(7aa1a042bccf6a1117c983bb36e88ace7712e867) ) @@ -366,8 +578,8 @@ ROM_START( srumbler2 ) ROM_LOAD( "rc17.14c", 0x30000, 0x08000, CRC(aa80aaab) SHA1(37a8e57e4d8ed8372bc1d7c94cf5a087a01d79ad) ) ROM_LOAD( "rc18.15c", 0x38000, 0x08000, CRC(ce67868e) SHA1(867d6bc65119fdb7a9788f7d92e6be0326756776) ) - ROM_REGION( 0x40000, "gfx3", 0 ) - ROM_LOAD( "rc20.15e", 0x00000, 0x08000, CRC(3924c861) SHA1(e31e0ea50823a910f87eefc969de53f1ad738629) ) /* sprites */ + ROM_REGION( 0x40000, "sprites", 0 ) + ROM_LOAD( "rc20.15e", 0x00000, 0x08000, CRC(3924c861) SHA1(e31e0ea50823a910f87eefc969de53f1ad738629) ) ROM_LOAD( "rc19.14e", 0x08000, 0x08000, CRC(ff8f9129) SHA1(8402236e297c3b03984a22b727198cc54e0c8117) ) ROM_LOAD( "rc22.15f", 0x10000, 0x08000, CRC(ab64161c) SHA1(4d8b01ba4c85a732df38db7663bd765a49c671de) ) ROM_LOAD( "rc21.14f", 0x18000, 0x08000, CRC(fd64bcd1) SHA1(4bb6c0e0027387284de1dc1320887de3231252e9) ) @@ -377,13 +589,13 @@ ROM_START( srumbler2 ) ROM_LOAD( "rc25.14j", 0x38000, 0x08000, CRC(d2a4ea4f) SHA1(365e534bf56e08b1e727ea7bfdfb537fa274448b) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "63s141.12a", 0x0000, 0x0100, CRC(8421786f) SHA1(7ffe9f3cd081842d9ee38bd67421cb8836e3f7ed) ) /* ROM banking */ - ROM_LOAD( "63s141.13a", 0x0100, 0x0100, CRC(6048583f) SHA1(a0b0f560e7f52978a1bf59417da13cc852617eff) ) /* ROM banking */ - ROM_LOAD( "63s141.8j", 0x0200, 0x0100, CRC(1a89a7ff) SHA1(437160ad5d61a257b7deaf5f5e8b3d4cf56a9663) ) /* priority (not used) */ + ROM_LOAD( "63s141.12a", 0x0000, 0x0100, CRC(8421786f) SHA1(7ffe9f3cd081842d9ee38bd67421cb8836e3f7ed) ) // ROM banking + ROM_LOAD( "63s141.13a", 0x0100, 0x0100, CRC(6048583f) SHA1(a0b0f560e7f52978a1bf59417da13cc852617eff) ) // ROM banking + ROM_LOAD( "63s141.8j", 0x0200, 0x0100, CRC(1a89a7ff) SHA1(437160ad5d61a257b7deaf5f5e8b3d4cf56a9663) ) // priority (not used) ROM_END ROM_START( srumbler3 ) - ROM_REGION( 0x40000, "user1", 0 ) /* Paged ROMs */ + ROM_REGION( 0x40000, "maincpu", 0 ) // Paged ROMs ROM_LOAD( "rc04.14e", 0x00000, 0x08000, CRC(a68ce89c) SHA1(cb5dd8c47c24f9d8ac9a6135c0b7942d16002d25) ) ROM_LOAD( "rc03.13e", 0x08000, 0x08000, CRC(0a21992b) SHA1(6096313210ae729b1c2a27a581473b06c60f5611) ) // sldh ROM_LOAD( "rc02.12e", 0x10000, 0x08000, CRC(009a62d8) SHA1(72b52b34186304d70214f56acdb0f3af5bed9503) ) @@ -396,11 +608,11 @@ ROM_START( srumbler3 ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "rc05.2f", 0x00000, 0x08000, CRC(ea04fa07) SHA1(e29bfc3ed9e6606206ee41c90aaaeddffa26c1b4) ) - ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "rc10.6g", 0x00000, 0x04000, CRC(adabe271) SHA1(256d6823dcda404375825103272213e1442c3320) ) /* characters */ + ROM_REGION( 0x04000, "chars", 0 ) + ROM_LOAD( "rc10.6g", 0x00000, 0x04000, CRC(adabe271) SHA1(256d6823dcda404375825103272213e1442c3320) ) - ROM_REGION( 0x40000, "gfx2", 0 ) - ROM_LOAD( "rc11.11a", 0x00000, 0x08000, CRC(5fa042ba) SHA1(9e03eaf22286330826501619a7b74181dc42a5fa) ) /* tiles */ + ROM_REGION( 0x40000, "tiles", 0 ) + ROM_LOAD( "rc11.11a", 0x00000, 0x08000, CRC(5fa042ba) SHA1(9e03eaf22286330826501619a7b74181dc42a5fa) ) ROM_LOAD( "rc12.13a", 0x08000, 0x08000, CRC(a2db64af) SHA1(35ab93397ee8172813e69edd085b36a5b98ba082) ) ROM_LOAD( "rc13.14a", 0x10000, 0x08000, CRC(f1df5499) SHA1(b1c47b35c00bc05825353474ad2b33d9669b879e) ) ROM_LOAD( "rc14.15a", 0x18000, 0x08000, CRC(b22b31b3) SHA1(7aa1a042bccf6a1117c983bb36e88ace7712e867) ) @@ -409,8 +621,8 @@ ROM_START( srumbler3 ) ROM_LOAD( "rc17.14c", 0x30000, 0x08000, CRC(aa80aaab) SHA1(37a8e57e4d8ed8372bc1d7c94cf5a087a01d79ad) ) ROM_LOAD( "rc18.15c", 0x38000, 0x08000, CRC(ce67868e) SHA1(867d6bc65119fdb7a9788f7d92e6be0326756776) ) - ROM_REGION( 0x40000, "gfx3", 0 ) - ROM_LOAD( "rc20.15e", 0x00000, 0x08000, CRC(3924c861) SHA1(e31e0ea50823a910f87eefc969de53f1ad738629) ) /* sprites */ + ROM_REGION( 0x40000, "sprites", 0 ) + ROM_LOAD( "rc20.15e", 0x00000, 0x08000, CRC(3924c861) SHA1(e31e0ea50823a910f87eefc969de53f1ad738629) ) ROM_LOAD( "rc19.14e", 0x08000, 0x08000, CRC(ff8f9129) SHA1(8402236e297c3b03984a22b727198cc54e0c8117) ) ROM_LOAD( "rc22.15f", 0x10000, 0x08000, CRC(ab64161c) SHA1(4d8b01ba4c85a732df38db7663bd765a49c671de) ) ROM_LOAD( "rc21.14f", 0x18000, 0x08000, CRC(fd64bcd1) SHA1(4bb6c0e0027387284de1dc1320887de3231252e9) ) @@ -420,13 +632,13 @@ ROM_START( srumbler3 ) ROM_LOAD( "rc25.14j", 0x38000, 0x08000, CRC(d2a4ea4f) SHA1(365e534bf56e08b1e727ea7bfdfb537fa274448b) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "63s141.12a", 0x0000, 0x0100, CRC(8421786f) SHA1(7ffe9f3cd081842d9ee38bd67421cb8836e3f7ed) ) /* ROM banking */ - ROM_LOAD( "63s141.13a", 0x0100, 0x0100, CRC(6048583f) SHA1(a0b0f560e7f52978a1bf59417da13cc852617eff) ) /* ROM banking */ - ROM_LOAD( "63s141.8j", 0x0200, 0x0100, CRC(1a89a7ff) SHA1(437160ad5d61a257b7deaf5f5e8b3d4cf56a9663) ) /* priority (not used) */ + ROM_LOAD( "63s141.12a", 0x0000, 0x0100, CRC(8421786f) SHA1(7ffe9f3cd081842d9ee38bd67421cb8836e3f7ed) ) // ROM banking + ROM_LOAD( "63s141.13a", 0x0100, 0x0100, CRC(6048583f) SHA1(a0b0f560e7f52978a1bf59417da13cc852617eff) ) // ROM banking + ROM_LOAD( "63s141.8j", 0x0200, 0x0100, CRC(1a89a7ff) SHA1(437160ad5d61a257b7deaf5f5e8b3d4cf56a9663) ) // priority (not used) ROM_END ROM_START( rushcrsh ) - ROM_REGION( 0x40000, "user1", 0 ) /* Paged ROMs */ + ROM_REGION( 0x40000, "maincpu", 0 ) // Paged ROMs ROM_LOAD( "rc04.14e", 0x00000, 0x08000, CRC(a68ce89c) SHA1(cb5dd8c47c24f9d8ac9a6135c0b7942d16002d25) ) ROM_LOAD( "rc03.13e", 0x08000, 0x08000, CRC(a49c9be0) SHA1(9aa385063a289e71fef4c2846c8c960a8adafcc0) ) ROM_LOAD( "rc02.12e", 0x10000, 0x08000, CRC(009a62d8) SHA1(72b52b34186304d70214f56acdb0f3af5bed9503) ) @@ -439,11 +651,11 @@ ROM_START( rushcrsh ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "rc05.2f", 0x00000, 0x08000, CRC(ea04fa07) SHA1(e29bfc3ed9e6606206ee41c90aaaeddffa26c1b4) ) - ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "rc10.6g", 0x00000, 0x04000, CRC(0a3c0b0d) SHA1(63f4daaea852c077f0ddd04d4bb4cd6333a8de7c) ) /* characters */ // sldh + ROM_REGION( 0x04000, "chars", 0 ) + ROM_LOAD( "rc10.6g", 0x00000, 0x04000, CRC(0a3c0b0d) SHA1(63f4daaea852c077f0ddd04d4bb4cd6333a8de7c) ) // sldh - ROM_REGION( 0x40000, "gfx2", 0 ) - ROM_LOAD( "rc11.11a", 0x00000, 0x08000, CRC(5fa042ba) SHA1(9e03eaf22286330826501619a7b74181dc42a5fa) ) /* tiles */ + ROM_REGION( 0x40000, "tiles", 0 ) + ROM_LOAD( "rc11.11a", 0x00000, 0x08000, CRC(5fa042ba) SHA1(9e03eaf22286330826501619a7b74181dc42a5fa) ) ROM_LOAD( "rc12.13a", 0x08000, 0x08000, CRC(a2db64af) SHA1(35ab93397ee8172813e69edd085b36a5b98ba082) ) ROM_LOAD( "rc13.14a", 0x10000, 0x08000, CRC(f1df5499) SHA1(b1c47b35c00bc05825353474ad2b33d9669b879e) ) ROM_LOAD( "rc14.15a", 0x18000, 0x08000, CRC(b22b31b3) SHA1(7aa1a042bccf6a1117c983bb36e88ace7712e867) ) @@ -452,8 +664,8 @@ ROM_START( rushcrsh ) ROM_LOAD( "rc17.14c", 0x30000, 0x08000, CRC(aa80aaab) SHA1(37a8e57e4d8ed8372bc1d7c94cf5a087a01d79ad) ) ROM_LOAD( "rc18.15c", 0x38000, 0x08000, CRC(ce67868e) SHA1(867d6bc65119fdb7a9788f7d92e6be0326756776) ) - ROM_REGION( 0x40000, "gfx3", 0 ) - ROM_LOAD( "rc20.15e", 0x00000, 0x08000, CRC(3924c861) SHA1(e31e0ea50823a910f87eefc969de53f1ad738629) ) /* sprites */ + ROM_REGION( 0x40000, "sprites", 0 ) + ROM_LOAD( "rc20.15e", 0x00000, 0x08000, CRC(3924c861) SHA1(e31e0ea50823a910f87eefc969de53f1ad738629) ) ROM_LOAD( "rc19.14e", 0x08000, 0x08000, CRC(ff8f9129) SHA1(8402236e297c3b03984a22b727198cc54e0c8117) ) ROM_LOAD( "rc22.15f", 0x10000, 0x08000, CRC(ab64161c) SHA1(4d8b01ba4c85a732df38db7663bd765a49c671de) ) ROM_LOAD( "rc21.14f", 0x18000, 0x08000, CRC(fd64bcd1) SHA1(4bb6c0e0027387284de1dc1320887de3231252e9) ) @@ -463,14 +675,15 @@ ROM_START( rushcrsh ) ROM_LOAD( "rc25.14j", 0x38000, 0x08000, CRC(d2a4ea4f) SHA1(365e534bf56e08b1e727ea7bfdfb537fa274448b) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "63s141.12a", 0x0000, 0x0100, CRC(8421786f) SHA1(7ffe9f3cd081842d9ee38bd67421cb8836e3f7ed) ) /* ROM banking */ - ROM_LOAD( "63s141.13a", 0x0100, 0x0100, CRC(6048583f) SHA1(a0b0f560e7f52978a1bf59417da13cc852617eff) ) /* ROM banking */ - ROM_LOAD( "63s141.8j", 0x0200, 0x0100, CRC(1a89a7ff) SHA1(437160ad5d61a257b7deaf5f5e8b3d4cf56a9663) ) /* priority (not used) */ + ROM_LOAD( "63s141.12a", 0x0000, 0x0100, CRC(8421786f) SHA1(7ffe9f3cd081842d9ee38bd67421cb8836e3f7ed) ) // ROM banking + ROM_LOAD( "63s141.13a", 0x0100, 0x0100, CRC(6048583f) SHA1(a0b0f560e7f52978a1bf59417da13cc852617eff) ) // ROM banking + ROM_LOAD( "63s141.8j", 0x0200, 0x0100, CRC(1a89a7ff) SHA1(437160ad5d61a257b7deaf5f5e8b3d4cf56a9663) ) // priority (not used) ROM_END +} // anonymous namespace -GAME( 1986, srumbler, 0, srumbler, srumbler, srumbler_state, empty_init, ROT270, "Capcom", "The Speed Rumbler (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, srumbler2, srumbler, srumbler, srumbler, srumbler_state, empty_init, ROT270, "Capcom", "The Speed Rumbler (set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, srumbler, 0, srumbler, srumbler, srumbler_state, empty_init, ROT270, "Capcom", "The Speed Rumbler (set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, srumbler2, srumbler, srumbler, srumbler, srumbler_state, empty_init, ROT270, "Capcom", "The Speed Rumbler (set 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, srumbler3, srumbler, srumbler, srumbler, srumbler_state, empty_init, ROT270, "Capcom (Tecfri license)", "The Speed Rumbler (set 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, rushcrsh, srumbler, srumbler, srumbler, srumbler_state, empty_init, ROT270, "Capcom", "Rush & Crash (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, rushcrsh, srumbler, srumbler, srumbler, srumbler_state, empty_init, ROT270, "Capcom", "Rush & Crash (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/capcom/srumbler.h b/src/mame/capcom/srumbler.h deleted file mode 100644 index e5c7c3e1bc3..00000000000 --- a/src/mame/capcom/srumbler.h +++ /dev/null @@ -1,54 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Paul Leaman - -#include "machine/timer.h" -#include "video/bufsprite.h" -#include "emupal.h" -#include "tilemap.h" - -class srumbler_state : public driver_device -{ -public: - srumbler_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this,"maincpu"), - m_spriteram(*this,"spriteram"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_backgroundram(*this, "backgroundram"), - m_foregroundram(*this, "foregroundram") { } - - void srumbler(machine_config &config); - -private: - required_device m_maincpu; - required_device m_spriteram; - required_device m_gfxdecode; - required_device m_palette; - - required_shared_ptr m_backgroundram; - required_shared_ptr m_foregroundram; - - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_fg_tilemap = nullptr; - int m_scroll[4]{}; - - void bankswitch_w(uint8_t data); - void foreground_w(offs_t offset, uint8_t data); - void background_w(offs_t offset, uint8_t data); - void _4009_w(uint8_t data); - void scroll_w(offs_t offset, uint8_t data); - - TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - - virtual void machine_start() override; - virtual void video_start() override; - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - - TIMER_DEVICE_CALLBACK_MEMBER(interrupt); - void srumbler_map(address_map &map); - void srumbler_sound_map(address_map &map); -}; diff --git a/src/mame/capcom/srumbler_v.cpp b/src/mame/capcom/srumbler_v.cpp deleted file mode 100644 index 7d435413c66..00000000000 --- a/src/mame/capcom/srumbler_v.cpp +++ /dev/null @@ -1,165 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Paul Leaman -/*************************************************************************** - - srumbler.c - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "srumbler.h" - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(srumbler_state::get_fg_tile_info) -{ - uint8_t attr = m_foregroundram[2*tile_index]; - tileinfo.set(0, - m_foregroundram[2*tile_index + 1] + ((attr & 0x03) << 8), - (attr & 0x3c) >> 2, - (attr & 0x40) ? TILE_FORCE_LAYER0 : 0); -} - -TILE_GET_INFO_MEMBER(srumbler_state::get_bg_tile_info) -{ - uint8_t attr = m_backgroundram[2*tile_index]; - tileinfo.set(1, - m_backgroundram[2*tile_index + 1] + ((attr & 0x07) << 8), - (attr & 0xe0) >> 5, - ((attr & 0x08) ? TILE_FLIPY : 0)); - tileinfo.group = (attr & 0x10) >> 4; -} - - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void srumbler_state::video_start() -{ - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(srumbler_state::get_fg_tile_info)), TILEMAP_SCAN_COLS, 8, 8, 64,32); - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(srumbler_state::get_bg_tile_info)), TILEMAP_SCAN_COLS, 16,16, 64,64); - - m_fg_tilemap->set_transparent_pen(3); - - m_bg_tilemap->set_transmask(0,0xffff,0x0000); // split type 0 is totally transparent in front half - m_bg_tilemap->set_transmask(1,0x07ff,0xf800); // split type 1 has pens 0-10 transparent in front half - - save_item(NAME(m_scroll)); -} - - - -/*************************************************************************** - - Memory handlers - -***************************************************************************/ - -void srumbler_state::foreground_w(offs_t offset, uint8_t data) -{ - m_foregroundram[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset/2); -} - -void srumbler_state::background_w(offs_t offset, uint8_t data) -{ - m_backgroundram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset/2); -} - - -void srumbler_state::_4009_w(uint8_t data) -{ - /* bit 0 flips screen */ - flip_screen_set(data & 1); - - /* bits 4-5 used during attract mode, unknown */ - - /* bits 6-7 coin counters */ - machine().bookkeeping().coin_counter_w(0,data & 0x40); - machine().bookkeeping().coin_counter_w(1,data & 0x80); -} - - -void srumbler_state::scroll_w(offs_t offset, uint8_t data) -{ - m_scroll[offset] = data; - - m_bg_tilemap->set_scrollx(0,m_scroll[0] | (m_scroll[1] << 8)); - m_bg_tilemap->set_scrolly(0,m_scroll[2] | (m_scroll[3] << 8)); -} - - - -/*************************************************************************** - - Display refresh - -***************************************************************************/ - -void srumbler_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - uint8_t *buffered_spriteram = m_spriteram->buffer(); - int offs; - - /* Draw the sprites. */ - for (offs = m_spriteram->bytes()-4; offs>=0;offs -= 4) - { - /* SPRITES - ===== - Attribute - 0x80 Code MSB - 0x40 Code MSB - 0x20 Code MSB - 0x10 Colour - 0x08 Colour - 0x04 Colour - 0x02 y Flip - 0x01 X MSB - */ - - - int code,colour,sx,sy,flipy; - int attr = buffered_spriteram[offs+1]; - code = buffered_spriteram[offs]; - code += ( (attr&0xe0) << 3 ); - colour = (attr & 0x1c)>>2; - sy = buffered_spriteram[offs + 2]; - sx = buffered_spriteram[offs + 3] + 0x100 * ( attr & 0x01); - flipy = attr & 0x02; - - if (flip_screen()) - { - sx = 496 - sx; - sy = 240 - sy; - flipy = !flipy; - } - - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - code, - colour, - flip_screen(),flipy, - sx, sy,15); - } -} - - -uint32_t srumbler_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); - draw_sprites(bitmap,cliprect); - m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0,0); - return 0; -} diff --git a/src/mame/capcom/vulgus.cpp b/src/mame/capcom/vulgus.cpp index 970908fd47e..5c3c0459b00 100644 --- a/src/mame/capcom/vulgus.cpp +++ b/src/mame/capcom/vulgus.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Mirko Buffoni +// copyright-holders: Mirko Buffoni + /*************************************************************************** Vulgus memory map (preliminary) @@ -44,18 +45,281 @@ All Clocks and Vsync verified by Corrado Tomaselli (August 2012) ***************************************************************************/ #include "emu.h" -#include "vulgus.h" #include "cpu/z80/z80.h" #include "machine/gen_latch.h" #include "sound/ay8910.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" +namespace { + +class vulgus_state : public driver_device +{ +public: + vulgus_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_scroll_low(*this, "scroll_low"), + m_scroll_high(*this, "scroll_high"), + m_spriteram(*this, "spriteram"), + m_fgvideoram(*this, "fgvideoram"), + m_bgvideoram(*this, "bgvideoram") + { } + + void vulgus(machine_config &config); + +protected: + virtual void video_start() override; + +private: + required_device m_maincpu; + required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_palette; + + required_shared_ptr m_scroll_low; + required_shared_ptr m_scroll_high; + required_shared_ptr m_spriteram; + required_shared_ptr m_fgvideoram; + required_shared_ptr m_bgvideoram; + + uint8_t m_palette_bank = 0; + tilemap_t *m_fg_tilemap = nullptr; + tilemap_t *m_bg_tilemap = nullptr; + + void fgvideoram_w(offs_t offset, uint8_t data); + void bgvideoram_w(offs_t offset, uint8_t data); + void c804_w(uint8_t data); + void palette_bank_w(uint8_t data); + + TILE_GET_INFO_MEMBER(get_fg_tile_info); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + + void palette(palette_device &palette) const; + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); + + INTERRUPT_GEN_MEMBER(vblank_irq); + + void main_map(address_map &map); + void sound_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + Convert the color PROMs into a more useable format. + +***************************************************************************/ + +void vulgus_state::palette(palette_device &palette) const +{ + const uint8_t *color_prom = memregion("proms")->base(); + + for (int i = 0; i < 256; i++) + { + int bit0, bit1, bit2, bit3; + + bit0 = (color_prom[0] >> 0) & 0x01; + bit1 = (color_prom[0] >> 1) & 0x01; + bit2 = (color_prom[0] >> 2) & 0x01; + bit3 = (color_prom[0] >> 3) & 0x01; + int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + bit0 = (color_prom[256] >> 0) & 0x01; + bit1 = (color_prom[256] >> 1) & 0x01; + bit2 = (color_prom[256] >> 2) & 0x01; + bit3 = (color_prom[256] >> 3) & 0x01; + int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + bit0 = (color_prom[2*256] >> 0) & 0x01; + bit1 = (color_prom[2*256] >> 1) & 0x01; + bit2 = (color_prom[2*256] >> 2) & 0x01; + bit3 = (color_prom[2*256] >> 3) & 0x01; + int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + palette.set_indirect_color(i, rgb_t(r, g, b)); + color_prom++; + } + + color_prom += 2 * 256; + // color_prom now points to the beginning of the lookup table + + // characters use colors 32-47 (?) + for (int i = 0; i < m_gfxdecode->gfx(0)->colors() * m_gfxdecode->gfx(0)->granularity(); i++) + palette.set_pen_indirect(m_gfxdecode->gfx(0)->colorbase() + i, 32 + *color_prom++); + + // sprites use colors 16-31 + for (int i = 0; i < m_gfxdecode->gfx(2)->colors() * m_gfxdecode->gfx(2)->granularity(); i++) + palette.set_pen_indirect(m_gfxdecode->gfx(2)->colorbase() + i, 16 + *color_prom++); + + // background tiles use colors 0-15, 64-79, 128-143, 192-207 in four banks + for (int i = 0; i < m_gfxdecode->gfx(1)->colors() * m_gfxdecode->gfx(1)->granularity() / 4; i++) + { + palette.set_pen_indirect(m_gfxdecode->gfx(1)->colorbase() + 0 * 32 * 8 + i, *color_prom); + palette.set_pen_indirect(m_gfxdecode->gfx(1)->colorbase() + 1 * 32 * 8 + i, *color_prom + 64); + palette.set_pen_indirect(m_gfxdecode->gfx(1)->colorbase() + 2 * 32 * 8 + i, *color_prom + 128); + palette.set_pen_indirect(m_gfxdecode->gfx(1)->colorbase() + 3 * 32 * 8 + i, *color_prom + 192); + color_prom++; + } +} + + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILE_GET_INFO_MEMBER(vulgus_state::get_fg_tile_info) +{ + int const code = m_fgvideoram[tile_index]; + int const color = m_fgvideoram[tile_index + 0x400]; + tileinfo.set(0, + code + ((color & 0x80) << 1), + color & 0x3f, + 0); + tileinfo.group = color & 0x3f; +} + +TILE_GET_INFO_MEMBER(vulgus_state::get_bg_tile_info) +{ + int const code = m_bgvideoram[tile_index]; + int const color = m_bgvideoram[tile_index + 0x400]; + tileinfo.set(1, + code + ((color & 0x80) << 1), + (color & 0x1f) + (0x20 * m_palette_bank), + TILE_FLIPYX((color & 0x60) >> 5)); +} + + +/*************************************************************************** + + Start the video hardware emulation. + +***************************************************************************/ + +void vulgus_state::video_start() +{ + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vulgus_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vulgus_state::get_bg_tile_info)), TILEMAP_SCAN_COLS, 16, 16, 32, 32); + + m_fg_tilemap->configure_groups(*m_gfxdecode->gfx(0), 47); + + m_bg_tilemap->set_scrolldx(128, 128); + m_bg_tilemap->set_scrolldy(6, 6); + m_fg_tilemap->set_scrolldx(128, 128); + m_fg_tilemap->set_scrolldy(6, 6); + + save_item(NAME(m_palette_bank)); +} + + +/*************************************************************************** + + Memory handlers + +***************************************************************************/ + +void vulgus_state::fgvideoram_w(offs_t offset, uint8_t data) +{ + m_fgvideoram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset & 0x3ff); +} + +void vulgus_state::bgvideoram_w(offs_t offset, uint8_t data) +{ + m_bgvideoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset & 0x3ff); +} + + +void vulgus_state::c804_w(uint8_t data) +{ + // bits 0 and 1 are coin counters + machine().bookkeeping().coin_counter_w(0, data & 0x01); + machine().bookkeeping().coin_counter_w(1, data & 0x02); + + // bit 7 flips screen + flip_screen_set(data & 0x80); +} + + +void vulgus_state::palette_bank_w(uint8_t data) +{ + if (m_palette_bank != (data & 3)) + { + m_palette_bank = data & 3; + m_bg_tilemap->mark_all_dirty(); + } +} + + +/*************************************************************************** + + Display refresh + +***************************************************************************/ + +void vulgus_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + gfx_element *gfx = m_gfxdecode->gfx(2); + + for (int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) + { + int const code = m_spriteram[offs]; + int const color = m_spriteram[offs + 1] & 0x0f; + int sy = m_spriteram[offs + 2]; + int sx = m_spriteram[offs + 3]; + bool const flip = flip_screen() ? true : false; + int dir = 1; + + if (sy == 0) + continue; + + if (flip) + { + sx = 240 - sx; + sy = 240 - sy; + dir = -1; + } + + // draw sprite rows (16*16, 16*32, or 16*64) + int row = (m_spriteram[offs + 1] & 0xc0) >> 6; + if (row == 2) row = 3; + + for (; row >= 0; row--) + gfx->transpen(bitmap, cliprect, code + row, color, flip, flip, sx + 128, sy + 6 + 16 * row * dir, 15); + } +} + +uint32_t vulgus_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->set_scrollx(0, m_scroll_low[1] + 256 * m_scroll_high[1]); + m_bg_tilemap->set_scrolly(0, m_scroll_low[0] + 256 * m_scroll_high[0]); + + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + return 0; +} + + +// machine + INTERRUPT_GEN_MEMBER(vulgus_state::vblank_irq) { - device.execute().set_input_line_and_vector(0, HOLD_LINE, 0xd7); /* Z80 - RST 10h - vblank */ + device.execute().set_input_line_and_vector(0, HOLD_LINE, 0xd7); // Z80 - RST 10h - vblank } void vulgus_state::main_map(address_map &map) @@ -68,13 +332,13 @@ void vulgus_state::main_map(address_map &map) map(0xc004, 0xc004).portr("DSW2"); map(0xc800, 0xc800).w("soundlatch", FUNC(generic_latch_8_device::write)); map(0xc801, 0xc801).nopw(); // ? - map(0xc802, 0xc803).ram().share("scroll_low"); + map(0xc802, 0xc803).ram().share(m_scroll_low); map(0xc804, 0xc804).w(FUNC(vulgus_state::c804_w)); map(0xc805, 0xc805).w(FUNC(vulgus_state::palette_bank_w)); - map(0xc902, 0xc903).ram().share("scroll_high"); - map(0xcc00, 0xcc7f).ram().share("spriteram"); - map(0xd000, 0xd7ff).ram().w(FUNC(vulgus_state::fgvideoram_w)).share("fgvideoram"); - map(0xd800, 0xdfff).ram().w(FUNC(vulgus_state::bgvideoram_w)).share("bgvideoram"); + map(0xc902, 0xc903).ram().share(m_scroll_high); + map(0xcc00, 0xcc7f).ram().share(m_spriteram); + map(0xd000, 0xd7ff).ram().w(FUNC(vulgus_state::fgvideoram_w)).share(m_fgvideoram); + map(0xd800, 0xdfff).ram().w(FUNC(vulgus_state::bgvideoram_w)).share(m_bgvideoram); map(0xe000, 0xefff).ram(); } @@ -92,10 +356,10 @@ static INPUT_PORTS_START( vulgus ) PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -125,7 +389,7 @@ static INPUT_PORTS_START( vulgus ) PORT_DIPSETTING( 0x02, "2" ) PORT_DIPSETTING( 0x03, "3" ) PORT_DIPSETTING( 0x00, "5" ) - /* Only the parent set seems to use/see the second coin slot even if set to Cocktail mode */ + // Only the parent set seems to use/see the second coin slot even if set to Cocktail mode PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:6,5,4") PORT_DIPSETTING( 0x10, DEF_STR( 5C_1C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 4C_1C ) ) @@ -134,7 +398,7 @@ static INPUT_PORTS_START( vulgus ) PORT_DIPSETTING( 0x1c, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x0c, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x14, DEF_STR( 1C_3C ) ) - /* PORT_DIPSETTING( 0x00, "Invalid" ) disables both coins */ + PORT_DIPSETTING( 0x00, "Invalid" ) // disables both coins PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:3,2,1") PORT_DIPSETTING( 0x80, DEF_STR( 5C_1C ) ) PORT_DIPSETTING( 0x40, DEF_STR( 4C_1C ) ) @@ -146,8 +410,8 @@ static INPUT_PORTS_START( vulgus ) PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) PORT_START("DSW2") - PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW2:8" ) /* Shown as "Unused" in the manual, are 7 & 8 undocutmented Difficulty?? */ - PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW2:7" ) /* Shown as "Unused" in the manual, Code performs a read then (& 0x03) */ + PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW2:8" ) // Shown as "Unused" in the manual, are 7 & 8 undocumented Difficulty?? + PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW2:7" ) // Shown as "Unused" in the manual, Code performs a read then (& 0x03) PORT_DIPNAME( 0x04, 0x04, "Demo Music" ) PORT_DIPLOCATION("SW2:6") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x04, DEF_STR( On ) ) @@ -208,9 +472,9 @@ static const gfx_layout spritelayout = static GFXDECODE_START( gfx_vulgus ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 64*4+16*16, 32*4 ) - GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 64*4, 16 ) + GFXDECODE_ENTRY( "chars", 0, charlayout, 0, 64 ) + GFXDECODE_ENTRY( "tiles", 0, tilelayout, 64*4+16*16, 32*4 ) + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 64*4, 16 ) GFXDECODE_END @@ -218,33 +482,33 @@ GFXDECODE_END void vulgus_state::vulgus(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, XTAL(12'000'000)/4); /* 3 MHz */ + // basic machine hardware + Z80(config, m_maincpu, XTAL(12'000'000) / 4); // 3 MHz m_maincpu->set_addrmap(AS_PROGRAM, &vulgus_state::main_map); m_maincpu->set_vblank_int("screen", FUNC(vulgus_state::vblank_irq)); - Z80(config, m_audiocpu, XTAL(12'000'000)/4); /* 3 MHz */ + Z80(config, m_audiocpu, XTAL(12'000'000) / 4); // 3 MHz m_audiocpu->set_addrmap(AS_PROGRAM, &vulgus_state::sound_map); m_audiocpu->set_periodic_int(FUNC(vulgus_state::irq0_line_hold), attotime::from_hz(8*60)); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_raw(XTAL(12'000'000)/2, 384, 128, 0, 262, 22, 246); // hsync is 50..77, vsync is 257..259 + screen.set_raw(XTAL(12'000'000) / 2, 384, 128, 0, 262, 22, 246); // hsync is 50..77, vsync is 257..259 screen.set_screen_update(FUNC(vulgus_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_vulgus); - PALETTE(config, m_palette, FUNC(vulgus_state::vulgus_palette), 64*4+16*16+4*32*8, 256); + PALETTE(config, m_palette, FUNC(vulgus_state::palette), 64*4+16*16+4*32*8, 256); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, "soundlatch"); - AY8910(config, "ay1", XTAL(12'000'000)/8).add_route(ALL_OUTPUTS, "mono", 0.25); /* 1.5 MHz */ + AY8910(config, "ay1", XTAL(12'000'000) / 8).add_route(ALL_OUTPUTS, "mono", 0.25); // 1.5 MHz - AY8910(config, "ay2", XTAL(12'000'000)/8).add_route(ALL_OUTPUTS, "mono", 0.25); /* 1.5 MHz */ + AY8910(config, "ay2", XTAL(12'000'000) / 8).add_route(ALL_OUTPUTS, "mono", 0.25); // 1.5 MHz } @@ -255,7 +519,7 @@ void vulgus_state::vulgus(machine_config &config) ***************************************************************************/ -ROM_START( vulgus ) /* Board ID# 84602-01A-1 */ +ROM_START( vulgus ) // Board ID# 84602-01A-1 ROM_REGION( 0x1c000, "maincpu", 0 ) ROM_LOAD( "vulgus.002", 0x0000, 0x2000, CRC(e49d6c5d) SHA1(48072aaa1f2603b6301d7542cc3df10ead2847bb) ) ROM_LOAD( "vulgus.003", 0x2000, 0x2000, CRC(51acef76) SHA1(14dda82b90f9c3a309561a73c300cb54b5fca77d) ) @@ -266,32 +530,32 @@ ROM_START( vulgus ) /* Board ID# 84602-01A-1 */ ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "1-11c.bin", 0x0000, 0x2000, CRC(3bd2acf4) SHA1(b58fb1ea7e30018102ee420d52a1597615412eb1) ) - ROM_REGION( 0x02000, "gfx1", 0 ) - ROM_LOAD( "1-3d.bin", 0x00000, 0x2000, CRC(8bc5d7a5) SHA1(c572b4a26f12013f5f6463b79ba9cbee4c474bbe) ) /* characters */ + ROM_REGION( 0x02000, "chars", 0 ) + ROM_LOAD( "1-3d.bin", 0x00000, 0x2000, CRC(8bc5d7a5) SHA1(c572b4a26f12013f5f6463b79ba9cbee4c474bbe) ) - ROM_REGION( 0x0c000, "gfx2", 0 ) - ROM_LOAD( "2-2a.bin", 0x00000, 0x2000, CRC(e10aaca1) SHA1(f9f0d05475ae4c554552a71bc2f60e02b1442eb1) ) /* tiles */ + ROM_REGION( 0x0c000, "tiles", 0 ) + ROM_LOAD( "2-2a.bin", 0x00000, 0x2000, CRC(e10aaca1) SHA1(f9f0d05475ae4c554552a71bc2f60e02b1442eb1) ) ROM_LOAD( "2-3a.bin", 0x02000, 0x2000, CRC(8da520da) SHA1(c4c633a909526308de4ad83e8ca449fa71eb3cb5) ) ROM_LOAD( "2-4a.bin", 0x04000, 0x2000, CRC(206a13f1) SHA1(645666895127aededfa7872b20b7725948a9c462) ) ROM_LOAD( "2-5a.bin", 0x06000, 0x2000, CRC(b6d81984) SHA1(c935176f8a9bce0f74ff466e10c23ff6557f85ec) ) ROM_LOAD( "2-6a.bin", 0x08000, 0x2000, CRC(5a26b38f) SHA1(987a4844c4568a088932f43a3aff847e6d6b4860) ) ROM_LOAD( "2-7a.bin", 0x0a000, 0x2000, CRC(1e1ca773) SHA1(dbced07d4a886ed9ad3302aaa37bc02c599ee132) ) - ROM_REGION( 0x08000, "gfx3", 0 ) - ROM_LOAD( "2-2n.bin", 0x00000, 0x2000, CRC(6db1b10d) SHA1(85bf67ce4d60b260767ba5fe9b9777f857937fe3) ) /* sprites */ + ROM_REGION( 0x08000, "sprites", 0 ) + ROM_LOAD( "2-2n.bin", 0x00000, 0x2000, CRC(6db1b10d) SHA1(85bf67ce4d60b260767ba5fe9b9777f857937fe3) ) ROM_LOAD( "2-3n.bin", 0x02000, 0x2000, CRC(5d8c34ec) SHA1(7b7df89398bf83ace1a8c216ca8526beae90972d) ) ROM_LOAD( "2-4n.bin", 0x04000, 0x2000, CRC(0071a2e3) SHA1(3f7bb4658d2126576a0f8f46f2c947eec1cd231a) ) ROM_LOAD( "2-5n.bin", 0x06000, 0x2000, CRC(4023a1ec) SHA1(8b69b9cd6db37db94a00da8712413055a631186a) ) ROM_REGION( 0x0800, "proms", 0 ) - ROM_LOAD( "e8.bin", 0x0000, 0x0100, CRC(06a83606) SHA1(218c1b404b4b5b06f06e04143872f6758f83f266) ) /* red component */ - ROM_LOAD( "e9.bin", 0x0100, 0x0100, CRC(beacf13c) SHA1(d597097afc53fef752b2530d2de04e5aabb664b4) ) /* green component */ - ROM_LOAD( "e10.bin", 0x0200, 0x0100, CRC(de1fb621) SHA1(c719892f0c6d8c82ee2ff41bfe74b67648f5b4f5) ) /* blue component */ - ROM_LOAD( "d1.bin", 0x0300, 0x0100, CRC(7179080d) SHA1(6c1e8572a4c7b4825b89fc9549265be7c8f17788) ) /* char lookup table */ - ROM_LOAD( "j2.bin", 0x0400, 0x0100, CRC(d0842029) SHA1(7d76e1ff75466e190bc2e07ff3ffb45034f838cd) ) /* sprite lookup table */ - ROM_LOAD( "c9.bin", 0x0500, 0x0100, CRC(7a1f0bd6) SHA1(5a2110e97e82c087999ee4e5adf32d7fa06a3dfb) ) /* tile lookup table */ - ROM_LOAD( "82s126.9k", 0x0600, 0x0100, CRC(32b10521) SHA1(10b258e32813cfa3a853cbd146657b11c08cb770) ) /* interrupt timing? (not used) */ - ROM_LOAD( "82s129.8n", 0x0700, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ + ROM_LOAD( "e8.bin", 0x0000, 0x0100, CRC(06a83606) SHA1(218c1b404b4b5b06f06e04143872f6758f83f266) ) // red component + ROM_LOAD( "e9.bin", 0x0100, 0x0100, CRC(beacf13c) SHA1(d597097afc53fef752b2530d2de04e5aabb664b4) ) // green component + ROM_LOAD( "e10.bin", 0x0200, 0x0100, CRC(de1fb621) SHA1(c719892f0c6d8c82ee2ff41bfe74b67648f5b4f5) ) // blue component + ROM_LOAD( "d1.bin", 0x0300, 0x0100, CRC(7179080d) SHA1(6c1e8572a4c7b4825b89fc9549265be7c8f17788) ) // char lookup table + ROM_LOAD( "j2.bin", 0x0400, 0x0100, CRC(d0842029) SHA1(7d76e1ff75466e190bc2e07ff3ffb45034f838cd) ) // sprite lookup table + ROM_LOAD( "c9.bin", 0x0500, 0x0100, CRC(7a1f0bd6) SHA1(5a2110e97e82c087999ee4e5adf32d7fa06a3dfb) ) // tile lookup table + ROM_LOAD( "82s126.9k", 0x0600, 0x0100, CRC(32b10521) SHA1(10b258e32813cfa3a853cbd146657b11c08cb770) ) // interrupt timing? (not used) + ROM_LOAD( "82s129.8n", 0x0700, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) // video timing? (not used) ROM_END ROM_START( vulgusa ) @@ -305,32 +569,32 @@ ROM_START( vulgusa ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "1-11c.bin", 0x0000, 0x2000, CRC(3bd2acf4) SHA1(b58fb1ea7e30018102ee420d52a1597615412eb1) ) - ROM_REGION( 0x02000, "gfx1", 0 ) - ROM_LOAD( "1-3d.bin", 0x00000, 0x2000, CRC(8bc5d7a5) SHA1(c572b4a26f12013f5f6463b79ba9cbee4c474bbe) ) /* characters */ + ROM_REGION( 0x02000, "chars", 0 ) + ROM_LOAD( "1-3d.bin", 0x00000, 0x2000, CRC(8bc5d7a5) SHA1(c572b4a26f12013f5f6463b79ba9cbee4c474bbe) ) - ROM_REGION( 0x0c000, "gfx2", 0 ) - ROM_LOAD( "2-2a.bin", 0x00000, 0x2000, CRC(e10aaca1) SHA1(f9f0d05475ae4c554552a71bc2f60e02b1442eb1) ) /* tiles */ + ROM_REGION( 0x0c000, "tiles", 0 ) + ROM_LOAD( "2-2a.bin", 0x00000, 0x2000, CRC(e10aaca1) SHA1(f9f0d05475ae4c554552a71bc2f60e02b1442eb1) ) ROM_LOAD( "2-3a.bin", 0x02000, 0x2000, CRC(8da520da) SHA1(c4c633a909526308de4ad83e8ca449fa71eb3cb5) ) ROM_LOAD( "2-4a.bin", 0x04000, 0x2000, CRC(206a13f1) SHA1(645666895127aededfa7872b20b7725948a9c462) ) ROM_LOAD( "2-5a.bin", 0x06000, 0x2000, CRC(b6d81984) SHA1(c935176f8a9bce0f74ff466e10c23ff6557f85ec) ) ROM_LOAD( "2-6a.bin", 0x08000, 0x2000, CRC(5a26b38f) SHA1(987a4844c4568a088932f43a3aff847e6d6b4860) ) ROM_LOAD( "2-7a.bin", 0x0a000, 0x2000, CRC(1e1ca773) SHA1(dbced07d4a886ed9ad3302aaa37bc02c599ee132) ) - ROM_REGION( 0x08000, "gfx3", 0 ) - ROM_LOAD( "2-2n.bin", 0x00000, 0x2000, CRC(6db1b10d) SHA1(85bf67ce4d60b260767ba5fe9b9777f857937fe3) ) /* sprites */ + ROM_REGION( 0x08000, "sprites", 0 ) + ROM_LOAD( "2-2n.bin", 0x00000, 0x2000, CRC(6db1b10d) SHA1(85bf67ce4d60b260767ba5fe9b9777f857937fe3) ) ROM_LOAD( "2-3n.bin", 0x02000, 0x2000, CRC(5d8c34ec) SHA1(7b7df89398bf83ace1a8c216ca8526beae90972d) ) ROM_LOAD( "2-4n.bin", 0x04000, 0x2000, CRC(0071a2e3) SHA1(3f7bb4658d2126576a0f8f46f2c947eec1cd231a) ) ROM_LOAD( "2-5n.bin", 0x06000, 0x2000, CRC(4023a1ec) SHA1(8b69b9cd6db37db94a00da8712413055a631186a) ) ROM_REGION( 0x0800, "proms", 0 ) - ROM_LOAD( "e8.bin", 0x0000, 0x0100, CRC(06a83606) SHA1(218c1b404b4b5b06f06e04143872f6758f83f266) ) /* red component */ - ROM_LOAD( "e9.bin", 0x0100, 0x0100, CRC(beacf13c) SHA1(d597097afc53fef752b2530d2de04e5aabb664b4) ) /* green component */ - ROM_LOAD( "e10.bin", 0x0200, 0x0100, CRC(de1fb621) SHA1(c719892f0c6d8c82ee2ff41bfe74b67648f5b4f5) ) /* blue component */ - ROM_LOAD( "d1.bin", 0x0300, 0x0100, CRC(7179080d) SHA1(6c1e8572a4c7b4825b89fc9549265be7c8f17788) ) /* char lookup table */ - ROM_LOAD( "j2.bin", 0x0400, 0x0100, CRC(d0842029) SHA1(7d76e1ff75466e190bc2e07ff3ffb45034f838cd) ) /* sprite lookup table */ - ROM_LOAD( "c9.bin", 0x0500, 0x0100, CRC(7a1f0bd6) SHA1(5a2110e97e82c087999ee4e5adf32d7fa06a3dfb) ) /* tile lookup table */ - ROM_LOAD( "82s126.9k", 0x0600, 0x0100, CRC(32b10521) SHA1(10b258e32813cfa3a853cbd146657b11c08cb770) ) /* interrupt timing? (not used) */ - ROM_LOAD( "82s129.8n", 0x0700, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ + ROM_LOAD( "e8.bin", 0x0000, 0x0100, CRC(06a83606) SHA1(218c1b404b4b5b06f06e04143872f6758f83f266) ) // red component + ROM_LOAD( "e9.bin", 0x0100, 0x0100, CRC(beacf13c) SHA1(d597097afc53fef752b2530d2de04e5aabb664b4) ) // green component + ROM_LOAD( "e10.bin", 0x0200, 0x0100, CRC(de1fb621) SHA1(c719892f0c6d8c82ee2ff41bfe74b67648f5b4f5) ) // blue component + ROM_LOAD( "d1.bin", 0x0300, 0x0100, CRC(7179080d) SHA1(6c1e8572a4c7b4825b89fc9549265be7c8f17788) ) // char lookup table + ROM_LOAD( "j2.bin", 0x0400, 0x0100, CRC(d0842029) SHA1(7d76e1ff75466e190bc2e07ff3ffb45034f838cd) ) // sprite lookup table + ROM_LOAD( "c9.bin", 0x0500, 0x0100, CRC(7a1f0bd6) SHA1(5a2110e97e82c087999ee4e5adf32d7fa06a3dfb) ) // tile lookup table + ROM_LOAD( "82s126.9k", 0x0600, 0x0100, CRC(32b10521) SHA1(10b258e32813cfa3a853cbd146657b11c08cb770) ) // interrupt timing? (not used) + ROM_LOAD( "82s129.8n", 0x0700, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) // video timing? (not used) ROM_END ROM_START( vulgusj ) @@ -344,32 +608,32 @@ ROM_START( vulgusj ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "1-11c.bin", 0x0000, 0x2000, CRC(3bd2acf4) SHA1(b58fb1ea7e30018102ee420d52a1597615412eb1) ) - ROM_REGION( 0x02000, "gfx1", 0 ) - ROM_LOAD( "1-3d.bin", 0x00000, 0x2000, CRC(8bc5d7a5) SHA1(c572b4a26f12013f5f6463b79ba9cbee4c474bbe) ) /* characters */ + ROM_REGION( 0x02000, "chars", 0 ) + ROM_LOAD( "1-3d.bin", 0x00000, 0x2000, CRC(8bc5d7a5) SHA1(c572b4a26f12013f5f6463b79ba9cbee4c474bbe) ) - ROM_REGION( 0x0c000, "gfx2", 0 ) - ROM_LOAD( "2-2a.bin", 0x00000, 0x2000, CRC(e10aaca1) SHA1(f9f0d05475ae4c554552a71bc2f60e02b1442eb1) ) /* tiles */ + ROM_REGION( 0x0c000, "tiles", 0 ) + ROM_LOAD( "2-2a.bin", 0x00000, 0x2000, CRC(e10aaca1) SHA1(f9f0d05475ae4c554552a71bc2f60e02b1442eb1) ) ROM_LOAD( "2-3a.bin", 0x02000, 0x2000, CRC(8da520da) SHA1(c4c633a909526308de4ad83e8ca449fa71eb3cb5) ) ROM_LOAD( "2-4a.bin", 0x04000, 0x2000, CRC(206a13f1) SHA1(645666895127aededfa7872b20b7725948a9c462) ) ROM_LOAD( "2-5a.bin", 0x06000, 0x2000, CRC(b6d81984) SHA1(c935176f8a9bce0f74ff466e10c23ff6557f85ec) ) ROM_LOAD( "2-6a.bin", 0x08000, 0x2000, CRC(5a26b38f) SHA1(987a4844c4568a088932f43a3aff847e6d6b4860) ) ROM_LOAD( "2-7a.bin", 0x0a000, 0x2000, CRC(1e1ca773) SHA1(dbced07d4a886ed9ad3302aaa37bc02c599ee132) ) - ROM_REGION( 0x08000, "gfx3", 0 ) - ROM_LOAD( "2-2n.bin", 0x00000, 0x2000, CRC(6db1b10d) SHA1(85bf67ce4d60b260767ba5fe9b9777f857937fe3) ) /* sprites */ + ROM_REGION( 0x08000, "sprites", 0 ) + ROM_LOAD( "2-2n.bin", 0x00000, 0x2000, CRC(6db1b10d) SHA1(85bf67ce4d60b260767ba5fe9b9777f857937fe3) ) ROM_LOAD( "2-3n.bin", 0x02000, 0x2000, CRC(5d8c34ec) SHA1(7b7df89398bf83ace1a8c216ca8526beae90972d) ) ROM_LOAD( "2-4n.bin", 0x04000, 0x2000, CRC(0071a2e3) SHA1(3f7bb4658d2126576a0f8f46f2c947eec1cd231a) ) ROM_LOAD( "2-5n.bin", 0x06000, 0x2000, CRC(4023a1ec) SHA1(8b69b9cd6db37db94a00da8712413055a631186a) ) ROM_REGION( 0x0800, "proms", 0 ) - ROM_LOAD( "e8.bin", 0x0000, 0x0100, CRC(06a83606) SHA1(218c1b404b4b5b06f06e04143872f6758f83f266) ) /* red component */ - ROM_LOAD( "e9.bin", 0x0100, 0x0100, CRC(beacf13c) SHA1(d597097afc53fef752b2530d2de04e5aabb664b4) ) /* green component */ - ROM_LOAD( "e10.bin", 0x0200, 0x0100, CRC(de1fb621) SHA1(c719892f0c6d8c82ee2ff41bfe74b67648f5b4f5) ) /* blue component */ - ROM_LOAD( "d1.bin", 0x0300, 0x0100, CRC(7179080d) SHA1(6c1e8572a4c7b4825b89fc9549265be7c8f17788) ) /* char lookup table */ - ROM_LOAD( "j2.bin", 0x0400, 0x0100, CRC(d0842029) SHA1(7d76e1ff75466e190bc2e07ff3ffb45034f838cd) ) /* sprite lookup table */ - ROM_LOAD( "c9.bin", 0x0500, 0x0100, CRC(7a1f0bd6) SHA1(5a2110e97e82c087999ee4e5adf32d7fa06a3dfb) ) /* tile lookup table */ - ROM_LOAD( "82s126.9k", 0x0600, 0x0100, CRC(32b10521) SHA1(10b258e32813cfa3a853cbd146657b11c08cb770) ) /* interrupt timing? (not used) */ - ROM_LOAD( "82s129.8n", 0x0700, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ + ROM_LOAD( "e8.bin", 0x0000, 0x0100, CRC(06a83606) SHA1(218c1b404b4b5b06f06e04143872f6758f83f266) ) // red component + ROM_LOAD( "e9.bin", 0x0100, 0x0100, CRC(beacf13c) SHA1(d597097afc53fef752b2530d2de04e5aabb664b4) ) // green component + ROM_LOAD( "e10.bin", 0x0200, 0x0100, CRC(de1fb621) SHA1(c719892f0c6d8c82ee2ff41bfe74b67648f5b4f5) ) // blue component + ROM_LOAD( "d1.bin", 0x0300, 0x0100, CRC(7179080d) SHA1(6c1e8572a4c7b4825b89fc9549265be7c8f17788) ) // char lookup table + ROM_LOAD( "j2.bin", 0x0400, 0x0100, CRC(d0842029) SHA1(7d76e1ff75466e190bc2e07ff3ffb45034f838cd) ) // sprite lookup table + ROM_LOAD( "c9.bin", 0x0500, 0x0100, CRC(7a1f0bd6) SHA1(5a2110e97e82c087999ee4e5adf32d7fa06a3dfb) ) // tile lookup table + ROM_LOAD( "82s126.9k", 0x0600, 0x0100, CRC(32b10521) SHA1(10b258e32813cfa3a853cbd146657b11c08cb770) ) // interrupt timing? (not used) + ROM_LOAD( "82s129.8n", 0x0700, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) // video timing? (not used) ROM_END ROM_START( mach9 ) @@ -383,35 +647,38 @@ ROM_START( mach9 ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "07_11c.bin", 0x0000, 0x2000, CRC(3bd2acf4) SHA1(b58fb1ea7e30018102ee420d52a1597615412eb1) ) - ROM_REGION( 0x02000, "gfx1", 0 ) - ROM_LOAD( "01_3d.bin", 0x00000, 0x2000, CRC(be556775) SHA1(16a4e746ea2462689b7a0e9f01c88d7edf06092d) ) /* characters */ + ROM_REGION( 0x02000, "chars", 0 ) + ROM_LOAD( "01_3d.bin", 0x00000, 0x2000, CRC(be556775) SHA1(16a4e746ea2462689b7a0e9f01c88d7edf06092d) ) - ROM_REGION( 0x0c000, "gfx2", 0 ) - ROM_LOAD( "08_2a.bin", 0x00000, 0x2000, CRC(e10aaca1) SHA1(f9f0d05475ae4c554552a71bc2f60e02b1442eb1) ) /* tiles */ + ROM_REGION( 0x0c000, "tiles", 0 ) + ROM_LOAD( "08_2a.bin", 0x00000, 0x2000, CRC(e10aaca1) SHA1(f9f0d05475ae4c554552a71bc2f60e02b1442eb1) ) ROM_LOAD( "09_3a.bin", 0x02000, 0x2000, CRC(9193f2f1) SHA1(de1ee725627baeabec6823f6ecc4e7f6df152ce3) ) ROM_LOAD( "10_4a.bin", 0x04000, 0x2000, CRC(206a13f1) SHA1(645666895127aededfa7872b20b7725948a9c462) ) ROM_LOAD( "11_5a.bin", 0x06000, 0x2000, CRC(d729b5b7) SHA1(e9af9bc7f627e313ec070dc9e41ce6f2cddc5b38) ) ROM_LOAD( "12_6a.bin", 0x08000, 0x2000, CRC(5a26b38f) SHA1(987a4844c4568a088932f43a3aff847e6d6b4860) ) ROM_LOAD( "13_7a.bin", 0x0a000, 0x2000, CRC(8033cd4f) SHA1(5eb2e5931e44ca6bf64117dd34e9b6072e6b0ffc) ) - ROM_REGION( 0x08000, "gfx3", 0 ) - ROM_LOAD( "14_2n.bin", 0x00000, 0x2000, CRC(6db1b10d) SHA1(85bf67ce4d60b260767ba5fe9b9777f857937fe3) ) /* sprites */ + ROM_REGION( 0x08000, "sprites", 0 ) + ROM_LOAD( "14_2n.bin", 0x00000, 0x2000, CRC(6db1b10d) SHA1(85bf67ce4d60b260767ba5fe9b9777f857937fe3) ) ROM_LOAD( "15_3n.bin", 0x02000, 0x2000, CRC(5d8c34ec) SHA1(7b7df89398bf83ace1a8c216ca8526beae90972d) ) ROM_LOAD( "16_4n.bin", 0x04000, 0x2000, CRC(0071a2e3) SHA1(3f7bb4658d2126576a0f8f46f2c947eec1cd231a) ) ROM_LOAD( "17_5n.bin", 0x06000, 0x2000, CRC(4023a1ec) SHA1(8b69b9cd6db37db94a00da8712413055a631186a) ) ROM_REGION( 0x0800, "proms", 0 ) - ROM_LOAD( "82s129_8e.bin", 0x0000, 0x0100, CRC(06a83606) SHA1(218c1b404b4b5b06f06e04143872f6758f83f266) ) /* red component */ - ROM_LOAD( "82s129_9e.bin", 0x0100, 0x0100, CRC(beacf13c) SHA1(d597097afc53fef752b2530d2de04e5aabb664b4) ) /* green component */ - ROM_LOAD( "82s129_10e.bin", 0x0200, 0x0100, CRC(8404067c) SHA1(6e8826f56267007e2adf02dc03dd96bd40e64935) ) /* blue component, only PROM slightly different from original? */ - ROM_LOAD( "82s129_1d.bin", 0x0300, 0x0100, CRC(7179080d) SHA1(6c1e8572a4c7b4825b89fc9549265be7c8f17788) ) /* char lookup table */ - ROM_LOAD( "82s129_2j.bin", 0x0400, 0x0100, CRC(d0842029) SHA1(7d76e1ff75466e190bc2e07ff3ffb45034f838cd) ) /* sprite lookup table */ - ROM_LOAD( "82s129_9c.bin", 0x0500, 0x0100, CRC(7a1f0bd6) SHA1(5a2110e97e82c087999ee4e5adf32d7fa06a3dfb) ) /* tile lookup table */ - ROM_LOAD( "82s129_9k.bin", 0x0600, 0x0100, CRC(32b10521) SHA1(10b258e32813cfa3a853cbd146657b11c08cb770) ) /* interrupt timing? (not used) */ - ROM_LOAD( "82s129_8n.bin", 0x0700, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ + ROM_LOAD( "82s129_8e.bin", 0x0000, 0x0100, CRC(06a83606) SHA1(218c1b404b4b5b06f06e04143872f6758f83f266) ) // red component + ROM_LOAD( "82s129_9e.bin", 0x0100, 0x0100, CRC(beacf13c) SHA1(d597097afc53fef752b2530d2de04e5aabb664b4) ) // green component + ROM_LOAD( "82s129_10e.bin", 0x0200, 0x0100, CRC(8404067c) SHA1(6e8826f56267007e2adf02dc03dd96bd40e64935) ) // blue component, only PROM slightly different from original? + ROM_LOAD( "82s129_1d.bin", 0x0300, 0x0100, CRC(7179080d) SHA1(6c1e8572a4c7b4825b89fc9549265be7c8f17788) ) // char lookup table + ROM_LOAD( "82s129_2j.bin", 0x0400, 0x0100, CRC(d0842029) SHA1(7d76e1ff75466e190bc2e07ff3ffb45034f838cd) ) // sprite lookup table + ROM_LOAD( "82s129_9c.bin", 0x0500, 0x0100, CRC(7a1f0bd6) SHA1(5a2110e97e82c087999ee4e5adf32d7fa06a3dfb) ) // tile lookup table + ROM_LOAD( "82s129_9k.bin", 0x0600, 0x0100, CRC(32b10521) SHA1(10b258e32813cfa3a853cbd146657b11c08cb770) ) // interrupt timing? (not used) + ROM_LOAD( "82s129_8n.bin", 0x0700, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) // video timing? (not used) ROM_END -GAME( 1984, vulgus, 0, vulgus, vulgus, vulgus_state, empty_init, ROT270, "Capcom", "Vulgus (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, vulgusa, vulgus, vulgus, vulgus, vulgus_state, empty_init, ROT90, "Capcom", "Vulgus (set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, vulgusj, vulgus, vulgus, vulgus, vulgus_state, empty_init, ROT270, "Capcom", "Vulgus (Japan?)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, mach9, vulgus, vulgus, vulgus, vulgus_state, empty_init, ROT270, "bootleg (ITISA)", "Mach-9 (bootleg of Vulgus)", MACHINE_SUPPORTS_SAVE ) +} // anonymous namespace + + +GAME( 1984, vulgus, 0, vulgus, vulgus, vulgus_state, empty_init, ROT270, "Capcom", "Vulgus (set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, vulgusa, vulgus, vulgus, vulgus, vulgus_state, empty_init, ROT90, "Capcom", "Vulgus (set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, vulgusj, vulgus, vulgus, vulgus, vulgus_state, empty_init, ROT270, "Capcom", "Vulgus (Japan?)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, mach9, vulgus, vulgus, vulgus, vulgus_state, empty_init, ROT270, "bootleg (ITISA)", "Mach-9 (bootleg of Vulgus)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/capcom/vulgus.h b/src/mame/capcom/vulgus.h deleted file mode 100644 index 1a0671dc7a2..00000000000 --- a/src/mame/capcom/vulgus.h +++ /dev/null @@ -1,70 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mirko Buffoni -/*************************************************************************** - - Capcom Vulgus hardware - -***************************************************************************/ -#ifndef MAME_INCLUDES_VULGUS_H -#define MAME_INCLUDES_VULGUS_H - -#pragma once - -#include "emupal.h" -#include "tilemap.h" - -class vulgus_state : public driver_device -{ -public: - vulgus_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_scroll_low(*this, "scroll_low"), - m_scroll_high(*this, "scroll_high"), - m_spriteram(*this, "spriteram"), - m_fgvideoram(*this, "fgvideoram"), - m_bgvideoram(*this, "bgvideoram") - { } - - void vulgus(machine_config &config); - -private: - required_device m_maincpu; - required_device m_audiocpu; - required_device m_gfxdecode; - required_device m_palette; - - required_shared_ptr m_scroll_low; - required_shared_ptr m_scroll_high; - required_shared_ptr m_spriteram; - required_shared_ptr m_fgvideoram; - required_shared_ptr m_bgvideoram; - - int m_palette_bank = 0; - tilemap_t *m_fg_tilemap = nullptr; - tilemap_t *m_bg_tilemap = nullptr; - - void fgvideoram_w(offs_t offset, uint8_t data); - void bgvideoram_w(offs_t offset, uint8_t data); - void c804_w(uint8_t data); - void palette_bank_w(uint8_t data); - - TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - - virtual void video_start() override; - void vulgus_palette(palette_device &palette) const; - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); - - INTERRUPT_GEN_MEMBER(vblank_irq); - - void main_map(address_map &map); - void sound_map(address_map &map); -}; - -#endif // MAME_INCLUDES_VULGUS_H diff --git a/src/mame/capcom/vulgus_v.cpp b/src/mame/capcom/vulgus_v.cpp deleted file mode 100644 index 103e60386b6..00000000000 --- a/src/mame/capcom/vulgus_v.cpp +++ /dev/null @@ -1,214 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mirko Buffoni -/*************************************************************************** - - Capcom Vulgus hardware - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "vulgus.h" - - -/*************************************************************************** - - Convert the color PROMs into a more useable format. - -***************************************************************************/ - -void vulgus_state::vulgus_palette(palette_device &palette) const -{ - const uint8_t *color_prom = memregion("proms")->base(); - - for (int i = 0; i < 256; i++) - { - int bit0,bit1,bit2,bit3; - - bit0 = (color_prom[0] >> 0) & 0x01; - bit1 = (color_prom[0] >> 1) & 0x01; - bit2 = (color_prom[0] >> 2) & 0x01; - bit3 = (color_prom[0] >> 3) & 0x01; - int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - bit0 = (color_prom[256] >> 0) & 0x01; - bit1 = (color_prom[256] >> 1) & 0x01; - bit2 = (color_prom[256] >> 2) & 0x01; - bit3 = (color_prom[256] >> 3) & 0x01; - int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - bit0 = (color_prom[2*256] >> 0) & 0x01; - bit1 = (color_prom[2*256] >> 1) & 0x01; - bit2 = (color_prom[2*256] >> 2) & 0x01; - bit3 = (color_prom[2*256] >> 3) & 0x01; - int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - palette.set_indirect_color(i, rgb_t(r, g, b)); - color_prom++; - } - - color_prom += 2*256; - // color_prom now points to the beginning of the lookup table - - // characters use colors 32-47 (?) - for (int i = 0; i < m_gfxdecode->gfx(0)->colors() * m_gfxdecode->gfx(0)->granularity(); i++) - palette.set_pen_indirect(m_gfxdecode->gfx(0)->colorbase() + i, 32 + *color_prom++); - - // sprites use colors 16-31 - for (int i = 0; i < m_gfxdecode->gfx(2)->colors() * m_gfxdecode->gfx(2)->granularity(); i++) - palette.set_pen_indirect(m_gfxdecode->gfx(2)->colorbase() + i, 16 + *color_prom++); - - // background tiles use colors 0-15, 64-79, 128-143, 192-207 in four banks - for (int i = 0; i < m_gfxdecode->gfx(1)->colors() * m_gfxdecode->gfx(1)->granularity() / 4; i++) - { - palette.set_pen_indirect(m_gfxdecode->gfx(1)->colorbase() + 0*32*8 + i, *color_prom); - palette.set_pen_indirect(m_gfxdecode->gfx(1)->colorbase() + 1*32*8 + i, *color_prom + 64); - palette.set_pen_indirect(m_gfxdecode->gfx(1)->colorbase() + 2*32*8 + i, *color_prom + 128); - palette.set_pen_indirect(m_gfxdecode->gfx(1)->colorbase() + 3*32*8 + i, *color_prom + 192); - color_prom++; - } -} - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(vulgus_state::get_fg_tile_info) -{ - int code, color; - - code = m_fgvideoram[tile_index]; - color = m_fgvideoram[tile_index + 0x400]; - tileinfo.set(0, - code + ((color & 0x80) << 1), - color & 0x3f, - 0); - tileinfo.group = color & 0x3f; -} - -TILE_GET_INFO_MEMBER(vulgus_state::get_bg_tile_info) -{ - int code, color; - - code = m_bgvideoram[tile_index]; - color = m_bgvideoram[tile_index + 0x400]; - tileinfo.set(1, - code + ((color & 0x80) << 1), - (color & 0x1f) + (0x20 * m_palette_bank), - TILE_FLIPYX((color & 0x60) >> 5)); -} - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void vulgus_state::video_start() -{ - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vulgus_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32,32); - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vulgus_state::get_bg_tile_info)), TILEMAP_SCAN_COLS, 16,16, 32,32); - - m_fg_tilemap->configure_groups(*m_gfxdecode->gfx(0), 47); - - m_bg_tilemap->set_scrolldx(128, 128); - m_bg_tilemap->set_scrolldy( 6, 6); - m_fg_tilemap->set_scrolldx(128, 128); - m_fg_tilemap->set_scrolldy( 6, 6); - - save_item(NAME(m_palette_bank)); -} - - -/*************************************************************************** - - Memory handlers - -***************************************************************************/ - -void vulgus_state::fgvideoram_w(offs_t offset, uint8_t data) -{ - m_fgvideoram[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset & 0x3ff); -} - -void vulgus_state::bgvideoram_w(offs_t offset, uint8_t data) -{ - m_bgvideoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset & 0x3ff); -} - - -void vulgus_state::c804_w(uint8_t data) -{ - /* bits 0 and 1 are coin counters */ - machine().bookkeeping().coin_counter_w(0, data & 0x01); - machine().bookkeeping().coin_counter_w(1, data & 0x02); - - /* bit 7 flips screen */ - flip_screen_set(data & 0x80); -} - - -void vulgus_state::palette_bank_w(uint8_t data) -{ - if (m_palette_bank != (data & 3)) - { - m_palette_bank = data & 3; - m_bg_tilemap->mark_all_dirty(); - } -} - - -/*************************************************************************** - - Display refresh - -***************************************************************************/ - -void vulgus_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - gfx_element *gfx = m_gfxdecode->gfx(2); - - for (int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) - { - int code = m_spriteram[offs]; - int color = m_spriteram[offs + 1] & 0x0f; - int sy = m_spriteram[offs + 2]; - int sx = m_spriteram[offs + 3]; - bool flip = flip_screen() ? true : false; - int dir = 1; - - if (sy == 0) - continue; - - if (flip) - { - sx = 240 - sx; - sy = 240 - sy; - dir = -1; - } - - // draw sprite rows (16*16, 16*32, or 16*64) - int row = (m_spriteram[offs + 1] & 0xc0) >> 6; - if (row == 2) row = 3; - - for (; row >= 0; row--) - gfx->transpen(bitmap, cliprect, code + row, color, flip, flip, sx+128, sy + 6 + 16 * row * dir, 15); - } -} - -uint32_t vulgus_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->set_scrollx(0, m_scroll_low[1] + 256 * m_scroll_high[1]); - m_bg_tilemap->set_scrolly(0, m_scroll_low[0] + 256 * m_scroll_high[0]); - - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - return 0; -} diff --git a/src/mame/msx/msx.cpp b/src/mame/msx/msx.cpp index af10262dfdb..49cb91e1483 100644 --- a/src/mame/msx/msx.cpp +++ b/src/mame/msx/msx.cpp @@ -1,7 +1,7 @@ // license:BSD-3-Clause // copyright-holders:Wilbert Pol /* -** msx.cpp : Enulation of the MSX family of machines +** msx.cpp : Emulation of the MSX family of machines ** ** Special usage notes: **