From 926e59db2b56a1e9ae72406d9af58c5a8f362418 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Mon, 11 Apr 2022 18:23:03 +0200 Subject: labyrunr.cpp, pcktgal.cpp: used finders and other small cleanups --- scripts/target/mame/arcade.lua | 4 - src/mame/drivers/labyrunr.cpp | 366 +++++++++++++++++++++++++++++++++----- src/mame/drivers/pcktgal.cpp | 388 +++++++++++++++++++++++++++-------------- src/mame/includes/labyrunr.h | 72 -------- src/mame/includes/pcktgal.h | 62 ------- src/mame/video/labyrunr.cpp | 260 --------------------------- src/mame/video/pcktgal.cpp | 81 --------- 7 files changed, 580 insertions(+), 653 deletions(-) delete mode 100644 src/mame/includes/labyrunr.h delete mode 100644 src/mame/includes/pcktgal.h delete mode 100644 src/mame/video/labyrunr.cpp delete mode 100644 src/mame/video/pcktgal.cpp diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 5703c473a12..7356d9d4050 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -1784,8 +1784,6 @@ files { MAME_DIR .. "src/mame/video/metlclsh.cpp", MAME_DIR .. "src/mame/drivers/mirage.cpp", MAME_DIR .. "src/mame/drivers/pcktgal.cpp", - MAME_DIR .. "src/mame/includes/pcktgal.h", - MAME_DIR .. "src/mame/video/pcktgal.cpp", MAME_DIR .. "src/mame/drivers/pktgaldx.cpp", MAME_DIR .. "src/mame/includes/pktgaldx.h", MAME_DIR .. "src/mame/video/pktgaldx.cpp", @@ -2535,8 +2533,6 @@ files { MAME_DIR .. "src/mame/machine/zs01.cpp", MAME_DIR .. "src/mame/machine/zs01.h", MAME_DIR .. "src/mame/drivers/labyrunr.cpp", - MAME_DIR .. "src/mame/includes/labyrunr.h", - MAME_DIR .. "src/mame/video/labyrunr.cpp", MAME_DIR .. "src/mame/drivers/lethal.cpp", MAME_DIR .. "src/mame/includes/lethal.h", MAME_DIR .. "src/mame/video/lethal.cpp", diff --git a/src/mame/drivers/labyrunr.cpp b/src/mame/drivers/labyrunr.cpp index d50d0164826..6d17fdc9bac 100644 --- a/src/mame/drivers/labyrunr.cpp +++ b/src/mame/drivers/labyrunr.cpp @@ -11,15 +11,299 @@ ***************************************************************************/ #include "emu.h" -#include "includes/labyrunr.h" + #include "includes/konamipt.h" +#include "video/k007121.h" +#include "video/k051733.h" #include "cpu/m6809/hd6309.h" #include "machine/watchdog.h" #include "sound/ymopn.h" +#include "emupal.h" +#include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class labyrunr_state : public driver_device +{ +public: + labyrunr_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this,"maincpu"), + m_k007121(*this, "k007121"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), + m_scrollram(*this, "scrollram"), + m_spriteram(*this, "spriteram"), + m_videoram(*this, "videoram%u", 1U), + m_mainbank(*this, "mainbank") + { } + + void labyrunr(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + +private: + // devices + required_device m_maincpu; + required_device m_k007121; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + + // memory pointers + required_shared_ptr m_scrollram; + required_shared_ptr m_spriteram; + required_shared_ptr_array m_videoram; + required_memory_bank m_mainbank; + + // video-related + tilemap_t *m_layer[2]{}; + rectangle m_clip[2]{}; + + void bankswitch_w(uint8_t data); + template void vram_w(offs_t offset, uint8_t data); + template TILE_GET_INFO_MEMBER(get_tile_info); + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(vblank_irq); + INTERRUPT_GEN_MEMBER(timer_interrupt); + void prg_map(address_map &map); +}; + + +// video + +void labyrunr_state::palette(palette_device &palette) const +{ + const uint8_t *color_prom = memregion("proms")->base(); + + for (int pal = 0; pal < 8; pal++) + { + if (pal & 1) + { + // chars, no lookup table + for (int i = 0; i < 0x100; i++) + palette.set_pen_indirect((pal << 8) | i, (pal << 4) | (i & 0x0f)); + } + else + { + // sprites + for (int i = 0; i < 0x100; i++) + { + uint8_t const ctabentry = !color_prom[i] ? 0 : ((pal << 4) | (color_prom[i] & 0x0f)); + + palette.set_pen_indirect((pal << 8) | i, ctabentry); + } + } + } +} + + + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +template +TILE_GET_INFO_MEMBER(labyrunr_state::get_tile_info) +{ + uint8_t ctrl_3 = m_k007121->ctrlram_r(3); + uint8_t ctrl_4 = m_k007121->ctrlram_r(4); + uint8_t ctrl_5 = m_k007121->ctrlram_r(5); + uint8_t ctrl_6 = m_k007121->ctrlram_r(6); + int attr = m_videoram[Which][tile_index]; + int code = m_videoram[Which][tile_index + 0x400]; + int bit0 = (ctrl_5 >> 0) & 0x03; + int bit1 = (ctrl_5 >> 2) & 0x03; + int bit2 = (ctrl_5 >> 4) & 0x03; + int bit3 = (ctrl_5 >> 6) & 0x03; + int bank = ((attr & 0x80) >> 7) | + ((attr >> (bit0 + 2)) & 0x02) | + ((attr >> (bit1 + 1)) & 0x04) | + ((attr >> (bit2 )) & 0x08) | + ((attr >> (bit3 - 1)) & 0x10) | + ((ctrl_3 & 0x01) << 5); + int mask = (ctrl_4 & 0xf0) >> 4; + + bank = (bank & ~(mask << 1)) | ((ctrl_4 & mask) << 1); + + tileinfo.set(0, + code + bank * 256, + ((ctrl_6 & 0x30) * 2 + 16) + (attr & 7), + 0); + tileinfo.category = Which ? (attr & 0x40) >> 6 : 0; +} + + +/*************************************************************************** + + Start the video hardware emulation. + +***************************************************************************/ + +void labyrunr_state::video_start() +{ + m_layer[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(labyrunr_state::get_tile_info<0>)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_layer[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(labyrunr_state::get_tile_info<1>)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + + m_layer[0]->set_transparent_pen(0); + m_layer[1]->set_transparent_pen(0); + + m_clip[0] = m_screen->visible_area(); + m_clip[0].min_x += 40; + + m_clip[1] = m_screen->visible_area(); + m_clip[1].max_x = 39; + m_clip[1].min_x = 0; + + m_layer[0]->set_scroll_cols(32); +} + + + +/*************************************************************************** + + Memory Handlers + +***************************************************************************/ + +template +void labyrunr_state::vram_w(offs_t offset, uint8_t data) +{ + m_videoram[Which][offset] = data; + m_layer[Which]->mark_tile_dirty(offset & 0x3ff); +} + + + +/*************************************************************************** + + Screen Refresh +***************************************************************************/ + +uint32_t labyrunr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + uint8_t ctrl_0 = m_k007121->ctrlram_r(0); + rectangle finalclip0, finalclip1; + + screen.priority().fill(0, cliprect); + bitmap.fill(m_palette->black_pen(), cliprect); + + if (~m_k007121->ctrlram_r(3) & 0x20) + { + finalclip0 = m_clip[0]; + finalclip1 = m_clip[1]; + + finalclip0 &= cliprect; + finalclip1 &= cliprect; + + m_layer[0]->set_scrollx(0, ctrl_0 - 40); + m_layer[1]->set_scrollx(0, 0); + + for (int i = 0; i < 32; i++) + { + // enable colscroll + if ((m_k007121->ctrlram_r(1) & 6) == 6) // it's probably just one bit, but it's only used once in the game so I don't know which it's + m_layer[0]->set_scrolly((i + 2) & 0x1f, m_k007121->ctrlram_r(2) + m_scrollram[i]); + else + m_layer[0]->set_scrolly((i + 2) & 0x1f, m_k007121->ctrlram_r(2)); + } + + m_layer[0]->draw(screen, bitmap, finalclip0, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_CATEGORY(0), 0); + m_k007121->sprites_draw(bitmap, cliprect, m_gfxdecode->gfx(0), *m_palette, m_spriteram, (m_k007121->ctrlram_r(6) & 0x30) * 2, 40, 0, screen.priority(), (m_k007121->ctrlram_r(3) & 0x40) >> 5); + m_layer[0]->draw(screen, bitmap, finalclip0, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_CATEGORY(1), 0); + // we ignore the transparency because layer1 is drawn only at the top of the screen also covering sprites + m_layer[1]->draw(screen, bitmap, finalclip1, TILEMAP_DRAW_OPAQUE, 0); + } + else + { + int use_clip3[2] = { 0, 0 }; + rectangle finalclip3; + + // custom cliprects needed for the weird effect used in the ending sequence to hide and show the needed part of text + finalclip0.min_y = finalclip1.min_y = cliprect.min_y; + finalclip0.max_y = finalclip1.max_y = cliprect.max_y; + + if (m_k007121->ctrlram_r(1) & 1) + { + finalclip0.min_x = cliprect.max_x - ctrl_0 + 8; + finalclip0.max_x = cliprect.max_x; + + if (ctrl_0 >= 40) + { + finalclip1.min_x = cliprect.min_x; + } + else + { + use_clip3[0] = 1; + + finalclip1.min_x = 40 - ctrl_0; + } + + finalclip1.max_x = cliprect.max_x - ctrl_0 + 8; + + } + else + { + if (ctrl_0 >= 40) + { + finalclip0.min_x = cliprect.min_x; + } + else + { + use_clip3[1] = 1; + + finalclip0.min_x = 40 - ctrl_0; + } + + finalclip0.max_x = cliprect.max_x - ctrl_0 + 8; + + finalclip1.min_x = cliprect.max_x - ctrl_0 + 8; + finalclip1.max_x = cliprect.max_x; + } + + if (use_clip3[0] || use_clip3[1]) + { + finalclip3.min_y = cliprect.min_y; + finalclip3.max_y = cliprect.max_y; + finalclip3.min_x = cliprect.min_x; + finalclip3.max_x = 40 - ctrl_0 - 8; + } + + m_layer[0]->set_scrollx(0, ctrl_0 - 40); + m_layer[1]->set_scrollx(0, ctrl_0 - 40); + + m_layer[0]->draw(screen, bitmap, finalclip0, TILEMAP_DRAW_CATEGORY(0), 0); + if (use_clip3[0]) + m_layer[0]->draw(screen, bitmap, finalclip3, TILEMAP_DRAW_CATEGORY(0), 0); + + m_k007121->sprites_draw(bitmap, cliprect, m_gfxdecode->gfx(0), *m_palette, m_spriteram, (m_k007121->ctrlram_r(6) & 0x30) * 2,40,0,screen.priority(),(m_k007121->ctrlram_r(3) & 0x40) >> 5); + + m_layer[0]->draw(screen, bitmap, finalclip0, TILEMAP_DRAW_CATEGORY(1), 0); + if (use_clip3[0]) + m_layer[0]->draw(screen, bitmap, finalclip3, TILEMAP_DRAW_CATEGORY(1), 0); + + m_layer[1]->draw(screen, bitmap, finalclip1, 0, 0); + if (use_clip3[1]) + m_layer[1]->draw(screen, bitmap, finalclip3, 0, 0); + + } + return 0; +} + + +// machine WRITE_LINE_MEMBER(labyrunr_state::vblank_irq) { @@ -27,29 +311,29 @@ WRITE_LINE_MEMBER(labyrunr_state::vblank_irq) m_maincpu->set_input_line(HD6309_IRQ_LINE, HOLD_LINE); } -INTERRUPT_GEN_MEMBER(labyrunr_state::labyrunr_timer_interrupt) +INTERRUPT_GEN_MEMBER(labyrunr_state::timer_interrupt) { if (m_k007121->ctrlram_r(7) & 0x01) device.execute().pulse_input_line(INPUT_LINE_NMI, attotime::zero); } -void labyrunr_state::labyrunr_bankswitch_w(uint8_t data) +void labyrunr_state::bankswitch_w(uint8_t data) { - if (data & 0xe0) popmessage("bankswitch %02x", data); + if (data & 0xe0) logerror("bankswitch %02x", data); - /* bits 0-2 = bank number */ - membank("bank1")->set_entry(data & 0x07); // shall we check if data&7 > #banks? + // bits 0-2 = bank number + m_mainbank->set_entry(data & 0x07); // shall we check if data & 7 > #banks? - /* bits 3 and 4 are coin counters */ + // bits 3 and 4 are coin counters machine().bookkeeping().coin_counter_w(0, data & 0x08); machine().bookkeeping().coin_counter_w(1, data & 0x10); } -void labyrunr_state::labyrunr_map(address_map &map) +void labyrunr_state::prg_map(address_map &map) { map(0x0000, 0x0007).w(m_k007121, FUNC(k007121_device::ctrl_w)); - map(0x0020, 0x005f).ram().share("scrollram"); + map(0x0020, 0x005f).ram().share(m_scrollram); map(0x0800, 0x0800).rw("ym1", FUNC(ym2203_device::data_r), FUNC(ym2203_device::data_w)); map(0x0801, 0x0801).rw("ym1", FUNC(ym2203_device::status_r), FUNC(ym2203_device::address_w)); map(0x0900, 0x0900).rw("ym2", FUNC(ym2203_device::data_r), FUNC(ym2203_device::data_w)); @@ -57,15 +341,15 @@ void labyrunr_state::labyrunr_map(address_map &map) map(0x0a00, 0x0a00).portr("P2"); map(0x0a01, 0x0a01).portr("P1"); map(0x0b00, 0x0b00).portr("SYSTEM"); - map(0x0c00, 0x0c00).w(FUNC(labyrunr_state::labyrunr_bankswitch_w)); + map(0x0c00, 0x0c00).w(FUNC(labyrunr_state::bankswitch_w)); map(0x0d00, 0x0d1f).rw("k051733", FUNC(k051733_device::read), FUNC(k051733_device::write)); map(0x0e00, 0x0e00).w("watchdog", FUNC(watchdog_timer_device::reset_w)); map(0x1000, 0x10ff).ram().w(m_palette, FUNC(palette_device::write_indirect)).share("palette"); map(0x1800, 0x1fff).ram(); - map(0x2000, 0x2fff).ram().share("spriteram"); - map(0x3000, 0x37ff).ram().w(FUNC(labyrunr_state::labyrunr_vram1_w)).share("videoram1"); - map(0x3800, 0x3fff).ram().w(FUNC(labyrunr_state::labyrunr_vram2_w)).share("videoram2"); - map(0x4000, 0x7fff).bankr("bank1"); + map(0x2000, 0x2fff).ram().share(m_spriteram); + map(0x3000, 0x37ff).ram().w(FUNC(labyrunr_state::vram_w<0>)).share(m_videoram[0]); + map(0x3800, 0x3fff).ram().w(FUNC(labyrunr_state::vram_w<1>)).share(m_videoram[1]); + map(0x4000, 0x7fff).bankr(m_mainbank); map(0x8000, 0xffff).rom(); } @@ -95,7 +379,7 @@ static INPUT_PORTS_START( labyrunr ) PORT_START("DSW1") KONAMI_COINAGE_LOC(DEF_STR( Free_Play ), DEF_STR( None ), SW1) - /* "None" = coin slot B disabled */ + // "None" = coin slot B disabled PORT_START("DSW2") PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") @@ -148,7 +432,7 @@ static const gfx_layout gfxlayout = }; static GFXDECODE_START( gfx_labyrunr ) - GFXDECODE_ENTRY( "gfx1", 0, gfxlayout, 0, 8*16 ) + GFXDECODE_ENTRY( "gfx", 0, gfxlayout, 0, 8*16 ) GFXDECODE_END /*************************************************************************** @@ -161,30 +445,30 @@ void labyrunr_state::machine_start() { uint8_t *ROM = memregion("maincpu")->base(); - membank("bank1")->configure_entries(0, 6, &ROM[0x10000], 0x4000); + m_mainbank->configure_entries(0, 6, &ROM[0x10000], 0x4000); } void labyrunr_state::labyrunr(machine_config &config) { - /* basic machine hardware */ - HD6309(config, m_maincpu, 3000000*4); /* 24MHz/8? */ - m_maincpu->set_addrmap(AS_PROGRAM, &labyrunr_state::labyrunr_map); - m_maincpu->set_periodic_int(FUNC(labyrunr_state::labyrunr_timer_interrupt), attotime::from_hz(4*60)); + // basic machine hardware + HD6309(config, m_maincpu, 3000000 * 4); // 24MHz / 8? + m_maincpu->set_addrmap(AS_PROGRAM, &labyrunr_state::prg_map); + m_maincpu->set_periodic_int(FUNC(labyrunr_state::timer_interrupt), attotime::from_hz(4 * 60)); WATCHDOG_TIMER(config, "watchdog"); - /* 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(37*8, 32*8); screen.set_visarea(0*8, 35*8-1, 2*8, 30*8-1); - screen.set_screen_update(FUNC(labyrunr_state::screen_update_labyrunr)); + screen.set_screen_update(FUNC(labyrunr_state::screen_update)); screen.set_palette(m_palette); screen.screen_vblank().set(FUNC(labyrunr_state::vblank_irq)); GFXDECODE(config, m_gfxdecode, m_palette, gfx_labyrunr); - PALETTE(config, m_palette, FUNC(labyrunr_state::labyrunr_palette)); + PALETTE(config, m_palette, FUNC(labyrunr_state::palette)); m_palette->set_format(palette_device::xBGR_555, 2*8*16*16, 128); K007121(config, m_k007121, 0); @@ -192,7 +476,7 @@ void labyrunr_state::labyrunr(machine_config &config) K051733(config, "k051733", 0); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); ym2203_device &ym1(YM2203(config, "ym1", 3000000)); @@ -219,53 +503,55 @@ void labyrunr_state::labyrunr(machine_config &config) ***************************************************************************/ ROM_START( tricktrp ) - ROM_REGION( 0x28000, "maincpu", 0 ) /* code + banked roms */ + ROM_REGION( 0x28000, "maincpu", 0 ) // code + banked ROMs ROM_LOAD( "771e04", 0x10000, 0x08000, CRC(ba2c7e20) SHA1(713dcc0e65bf9431f2c0df9db1210346a9476a52) ) ROM_CONTINUE( 0x08000, 0x08000 ) ROM_LOAD( "771e03", 0x18000, 0x10000, CRC(d0d68036) SHA1(8589ee07e229259341a4cc22bc64de8f06536472) ) - ROM_REGION( 0x40000, "gfx1", 0 ) - ROM_LOAD16_BYTE( "771e01a", 0x00000, 0x10000, CRC(103ffa0d) SHA1(1949c49ca3b243e4cfb5fb19ecd3a1e1492cfddd) ) /* tiles + sprites */ + ROM_REGION( 0x40000, "gfx", 0 ) + ROM_LOAD16_BYTE( "771e01a", 0x00000, 0x10000, CRC(103ffa0d) SHA1(1949c49ca3b243e4cfb5fb19ecd3a1e1492cfddd) ) // tiles + sprites ROM_LOAD16_BYTE( "771e01c", 0x00001, 0x10000, CRC(cfec5be9) SHA1(2b6a32e2608a70c47d1ec9b4de38b5c3a0898cde) ) ROM_LOAD16_BYTE( "771d01b", 0x20000, 0x10000, CRC(07f2a71c) SHA1(63c79e75e71539e69d4d9d35e629a6021124f6d0) ) ROM_LOAD16_BYTE( "771d01d", 0x20001, 0x10000, CRC(f6810a49) SHA1(b40e9f0d0919188a05c1990347da8dc8ff12d65a) ) ROM_REGION( 0x0100, "proms", 0 ) - ROM_LOAD( "771d02.08d", 0x0000, 0x0100, CRC(3d34bb5a) SHA1(3f3c845f1197457244e7c7e4f9b2a03c278613e4) ) /* sprite lookup table */ - /* there is no char lookup table */ + ROM_LOAD( "771d02.08d", 0x0000, 0x0100, CRC(3d34bb5a) SHA1(3f3c845f1197457244e7c7e4f9b2a03c278613e4) ) // sprite lookup table + // there is no char lookup table ROM_END ROM_START( labyrunr ) - ROM_REGION( 0x28000, "maincpu", 0 ) /* code + banked roms */ + ROM_REGION( 0x28000, "maincpu", 0 ) // code + banked ROMs ROM_LOAD( "771j04.10f", 0x10000, 0x08000, CRC(354a41d0) SHA1(302e8f5c469ad3f615aeca8005ebde6b6051aaae) ) ROM_CONTINUE( 0x08000, 0x08000 ) ROM_LOAD( "771j03.08f", 0x18000, 0x10000, CRC(12b49044) SHA1(e9b22fb093cfb746a9767e94ef5deef98bed5b7a) ) - ROM_REGION( 0x40000, "gfx1", 0 ) - ROM_LOAD( "771d01.14a", 0x00000, 0x40000, CRC(15c8f5f9) SHA1(e4235e1315d0331f3ce5047834a68764ed43aa4b) ) /* tiles + sprites */ + ROM_REGION( 0x40000, "gfx", 0 ) + ROM_LOAD( "771d01.14a", 0x00000, 0x40000, CRC(15c8f5f9) SHA1(e4235e1315d0331f3ce5047834a68764ed43aa4b) ) // tiles + sprites ROM_REGION( 0x0100, "proms", 0 ) - ROM_LOAD( "771d02.08d", 0x0000, 0x0100, CRC(3d34bb5a) SHA1(3f3c845f1197457244e7c7e4f9b2a03c278613e4) ) /* sprite lookup table */ - /* there is no char lookup table */ + ROM_LOAD( "771d02.08d", 0x0000, 0x0100, CRC(3d34bb5a) SHA1(3f3c845f1197457244e7c7e4f9b2a03c278613e4) ) // sprite lookup table + // there is no char lookup table ROM_END ROM_START( labyrunrk ) - ROM_REGION( 0x28000, "maincpu", 0 ) /* code + banked roms */ + ROM_REGION( 0x28000, "maincpu", 0 ) // code + banked ROMs ROM_LOAD( "771k04.10f", 0x10000, 0x08000, CRC(9816ab35) SHA1(6efb0332f4a62f20889f212682ee7225e4a182a9) ) ROM_CONTINUE( 0x08000, 0x08000 ) ROM_LOAD( "771k03.8f", 0x18000, 0x10000, CRC(48d732ae) SHA1(8bc7917397f32cf5f995b3763ae921725e27de05) ) - ROM_REGION( 0x40000, "gfx1", 0 ) - ROM_LOAD16_BYTE( "771d01a.13a", 0x00000, 0x10000, CRC(0cd1ed1a) SHA1(eac6c106de28acc54535ae1fb99f778c1ed4013e) ) /* tiles + sprites */ + ROM_REGION( 0x40000, "gfx", 0 ) + ROM_LOAD16_BYTE( "771d01a.13a", 0x00000, 0x10000, CRC(0cd1ed1a) SHA1(eac6c106de28acc54535ae1fb99f778c1ed4013e) ) // tiles + sprites ROM_LOAD16_BYTE( "771d01c.13a", 0x00001, 0x10000, CRC(d75521fe) SHA1(72f0c4d9511bc70d77415f50be93293026305bd5) ) ROM_LOAD16_BYTE( "771d01b", 0x20000, 0x10000, CRC(07f2a71c) SHA1(63c79e75e71539e69d4d9d35e629a6021124f6d0) ) ROM_LOAD16_BYTE( "771d01d", 0x20001, 0x10000, CRC(f6810a49) SHA1(b40e9f0d0919188a05c1990347da8dc8ff12d65a) ) ROM_REGION( 0x0100, "proms", 0 ) - ROM_LOAD( "771d02.08d", 0x0000, 0x0100, CRC(3d34bb5a) SHA1(3f3c845f1197457244e7c7e4f9b2a03c278613e4) ) /* sprite lookup table */ - /* there is no char lookup table */ + ROM_LOAD( "771d02.08d", 0x0000, 0x0100, CRC(3d34bb5a) SHA1(3f3c845f1197457244e7c7e4f9b2a03c278613e4) ) // sprite lookup table + // there is no char lookup table ROM_END +} // anonymous namespace + GAME( 1987, tricktrp, 0, labyrunr, labyrunr, labyrunr_state, empty_init, ROT90, "Konami", "Trick Trap (World?)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, labyrunr, tricktrp, labyrunr, labyrunr, labyrunr_state, empty_init, ROT90, "Konami", "Labyrinth Runner (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/pcktgal.cpp b/src/mame/drivers/pcktgal.cpp index 7fb937bb41a..ed7a72673a9 100644 --- a/src/mame/drivers/pcktgal.cpp +++ b/src/mame/drivers/pcktgal.cpp @@ -15,30 +15,172 @@ ***************************************************************************/ #include "emu.h" -#include "includes/pcktgal.h" + +#include "machine/deco222.h" +#include "video/decbac06.h" #include "cpu/m6502/m6502.h" -#include "sound/ymopn.h" +#include "machine/gen_latch.h" +#include "sound/msm5205.h" #include "sound/ymopl.h" -#include "machine/deco222.h" +#include "sound/ymopn.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +namespace { + +class pcktgal_state : public driver_device +{ +public: + pcktgal_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_msm(*this, "msm"), + m_tilegen(*this, "tilegen"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), + m_spriteram(*this, "spriteram"), + m_mainbank(*this, "mainbank%u", 0U), + m_soundbank(*this, "soundbank") + { } + + void init_original(); + + void bootleg(machine_config &config); + void pcktgal(machine_config &config); + void pcktgal2(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + required_device m_maincpu; + required_device m_audiocpu; + required_device m_msm; + required_device m_tilegen; + required_device m_gfxdecode; + required_device m_palette; + required_device m_soundlatch; + + required_shared_ptr m_spriteram; + required_memory_bank_array<2> m_mainbank; + required_memory_bank m_soundbank; + + uint16_t m_msm5205next = 0; + uint8_t m_toggle = 0; + + void bank_w(uint8_t data); + void sound_bank_w(uint8_t data); + void sound_w(uint8_t data); + void adpcm_data_w(uint8_t data); + uint8_t sound_unk_r(); + DECLARE_WRITE_LINE_MEMBER(adpcm_int); + + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_bootleg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bool flip_screen); + + void main_map(address_map &map); + void sound_map(address_map &map); +}; + + +// video + + +void pcktgal_state::palette(palette_device &palette) const +{ + uint8_t const *const color_prom = memregion("proms")->base(); + + for (int i = 0; i < palette.entries(); i++) + { + int bit0 = BIT(color_prom[i], 0); + int bit1 = BIT(color_prom[i], 1); + int bit2 = BIT(color_prom[i], 2); + int bit3 = BIT(color_prom[i], 3); + int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + bit0 = BIT(color_prom[i], 4); + bit1 = BIT(color_prom[i], 5); + bit2 = BIT(color_prom[i], 6); + bit3 = BIT(color_prom[i], 7); + int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + bit0 = BIT(color_prom[i + palette.entries()], 0); + bit1 = BIT(color_prom[i + palette.entries()], 1); + bit2 = BIT(color_prom[i + palette.entries()], 2); + bit3 = BIT(color_prom[i + palette.entries()], 3); + int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + palette.set_pen_color(i, rgb_t(r, g, b)); + } +} + +void pcktgal_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bool flip_screen) +{ + for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) + { + if (m_spriteram[offs] != 0xf8) + { + int sx = 240 - m_spriteram[offs + 2]; + int sy = 240 - m_spriteram[offs]; + + int flipx = m_spriteram[offs + 1] & 0x04; + int flipy = m_spriteram[offs + 1] & 0x02; + if (flip_screen) { + sx = 240 - sx; + sy = 240 - sy; + if (flipx) flipx = 0; else flipx = 1; + if (flipy) flipy = 0; else flipy = 1; + } + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + m_spriteram[offs + 3] + ((m_spriteram[offs + 1] & 1) << 8), + (m_spriteram[offs + 1] & 0x70) >> 4, + flipx, flipy, + sx, sy, 0); + } + } +} + +uint32_t pcktgal_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bool flip = m_tilegen->get_flip_state(); + m_tilegen->set_flip_screen(flip); + m_tilegen->deco_bac06_pf_draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); + draw_sprites(bitmap, cliprect, flip); + return 0; +} + +uint32_t pcktgal_state::screen_update_bootleg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bool flip = m_tilegen->get_flip_state(); + m_tilegen->set_flip_screen(flip); + // the bootleg doesn't properly set the tilemap registers, because it's on non-original hardware, which probably doesn't have the flexible tilemaps. + m_tilegen->deco_bac06_pf_draw_bootleg(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0, 2, 0); + draw_sprites(bitmap, cliprect, flip); + return 0; +} + + +// machine + /***************************************************************************/ void pcktgal_state::bank_w(uint8_t data) { - if (data & 1) { membank("bank1")->set_entry(0); } - else { membank("bank1")->set_entry(1); } + m_mainbank[0]->set_entry(data & 1); - if (data & 2) { membank("bank2")->set_entry(0); } - else { membank("bank2")->set_entry(1); } + m_mainbank[1]->set_entry((data & 2) >> 1); } void pcktgal_state::sound_bank_w(uint8_t data) { - membank("bank3")->set_entry((data >> 2) & 1); + m_soundbank->set_entry((data >> 2) & 1); m_msm->reset_w((data & 2) >> 1); } @@ -73,35 +215,34 @@ uint8_t pcktgal_state::sound_unk_r() /***************************************************************************/ -void pcktgal_state::pcktgal_map(address_map &map) +void pcktgal_state::main_map(address_map &map) { map(0x0000, 0x07ff).ram(); map(0x0800, 0x0fff).rw(m_tilegen, FUNC(deco_bac06_device::pf_data_8bit_r), FUNC(deco_bac06_device::pf_data_8bit_w)); - map(0x1000, 0x11ff).ram().share("spriteram"); + map(0x1000, 0x11ff).ram().share(m_spriteram); map(0x1800, 0x1800).portr("P1"); map(0x1800, 0x1807).w(m_tilegen, FUNC(deco_bac06_device::pf_control0_8bit_w)); map(0x1810, 0x181f).rw(m_tilegen, FUNC(deco_bac06_device::pf_control1_8bit_r), FUNC(deco_bac06_device::pf_control1_8bit_w)); - map(0x1a00, 0x1a00).portr("P2").w(FUNC(pcktgal_state::sound_w)); map(0x1c00, 0x1c00).portr("DSW").w(FUNC(pcktgal_state::bank_w)); - map(0x4000, 0x5fff).bankr("bank1"); - map(0x6000, 0x7fff).bankr("bank2"); + map(0x4000, 0x5fff).bankr(m_mainbank[0]); + map(0x6000, 0x7fff).bankr(m_mainbank[1]); map(0x8000, 0xffff).rom(); } /***************************************************************************/ -void pcktgal_state::pcktgal_sound_map(address_map &map) +void pcktgal_state::sound_map(address_map &map) { map(0x0000, 0x07ff).ram(); map(0x0800, 0x0801).w("ym1", FUNC(ym2203_device::write)); map(0x1000, 0x1001).w("ym2", FUNC(ym3812_device::write)); - map(0x1800, 0x1800).w(FUNC(pcktgal_state::adpcm_data_w)); /* ADPCM data for the MSM5205 chip */ + map(0x1800, 0x1800).w(FUNC(pcktgal_state::adpcm_data_w)); // ADPCM data for the MSM5205 chip map(0x2000, 0x2000).w(FUNC(pcktgal_state::sound_bank_w)); map(0x3000, 0x3000).r(m_soundlatch, FUNC(generic_latch_8_device::read)); map(0x3400, 0x3400).r(FUNC(pcktgal_state::sound_unk_r)); - map(0x4000, 0x7fff).bankr("bank3"); + map(0x4000, 0x7fff).bankr(m_soundbank); map(0x8000, 0xffff).rom(); } @@ -159,56 +300,56 @@ INPUT_PORTS_END static const gfx_layout charlayout = { - 8,8, /* 8*8 characters */ + 8,8, // 8*8 characters 4096, 4, { 0x10000*8, 0, 0x18000*8, 0x8000*8 }, { 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 consecutive bytes */ + 8*8 // every char takes 8 consecutive bytes }; static const gfx_layout bootleg_charlayout = { - 8,8, /* 8*8 characters */ + 8,8, // 8*8 characters 4096, 4, { 0x18000*8, 0x8000*8, 0x10000*8, 0 }, { 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 consecutive bytes */ + 8*8 // every char takes 8 consecutive bytes }; static const gfx_layout spritelayout = { - 16,16, /* 16*16 sprites */ - 1024, /* 1024 sprites */ - 2, /* 2 bits per pixel */ + 16,16, // 16*16 sprites + 1024, // 1024 sprites + 2, // 2 bits per pixel { 0x8000*8, 0 }, { 128+0, 128+1, 128+2, 128+3, 128+4, 128+5, 128+6, 128+7, 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 32*8 /* every char takes 8 consecutive bytes */ + 32*8 // every char takes 8 consecutive bytes }; static const gfx_layout bootleg_spritelayout = { - 16,16, /* 16*16 sprites */ - 1024, /* 1024 sprites */ - 2, /* 2 bits per pixel */ + 16,16, // 16*16 sprites + 1024, // 1024 sprites + 2, // 2 bits per pixel { 0x8000*8, 0 }, { 128+7, 128+6, 128+5, 128+4, 128+3, 128+2, 128+1, 128+0, 7, 6, 5, 4, 3, 2, 1, 0 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 32*8 /* every char takes 8 consecutive bytes */ + 32*8 // every char takes 8 consecutive bytes }; static GFXDECODE_START( gfx_pcktgal ) - GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout, 256, 16 ) /* chars */ - GFXDECODE_ENTRY( "gfx2", 0x00000, spritelayout, 0, 8 ) /* sprites */ + GFXDECODE_ENTRY( "chars", 0x00000, charlayout, 256, 16 ) + GFXDECODE_ENTRY( "sprites", 0x00000, spritelayout, 0, 8 ) GFXDECODE_END static GFXDECODE_START( gfx_bootleg ) - GFXDECODE_ENTRY( "gfx1", 0x00000, bootleg_charlayout, 256, 16 ) /* chars */ - GFXDECODE_ENTRY( "gfx2", 0x00000, bootleg_spritelayout, 0, 8 ) /* sprites */ + GFXDECODE_ENTRY( "chars", 0x00000, bootleg_charlayout, 256, 16 ) + GFXDECODE_ENTRY( "sprites", 0x00000, bootleg_spritelayout, 0, 8 ) GFXDECODE_END @@ -217,9 +358,11 @@ GFXDECODE_END void pcktgal_state::machine_start() { - membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x4000, 0xc000); - membank("bank2")->configure_entries(0, 2, memregion("maincpu")->base() + 0x6000, 0xc000); - membank("bank3")->configure_entries(0, 2, memregion("audiocpu")->base() + 0x10000, 0x4000); + m_mainbank[0]->configure_entry(0, memregion("maincpu")->base()); + m_mainbank[0]->configure_entry(1, memregion("maincpu")->base() + 0x4000); + m_mainbank[1]->configure_entry(0, memregion("maincpu")->base() + 0x2000); + m_mainbank[1]->configure_entry(1, memregion("maincpu")->base() + 0x6000); + m_soundbank->configure_entries(0, 2, memregion("audiocpu")->base(), 0x4000); save_item(NAME(m_msm5205next)); save_item(NAME(m_toggle)); @@ -227,33 +370,33 @@ void pcktgal_state::machine_start() void pcktgal_state::pcktgal(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware M6502(config, m_maincpu, 2000000); - m_maincpu->set_addrmap(AS_PROGRAM, &pcktgal_state::pcktgal_map); + m_maincpu->set_addrmap(AS_PROGRAM, &pcktgal_state::main_map); DECO_222(config, m_audiocpu, 1500000); - m_audiocpu->set_addrmap(AS_PROGRAM, &pcktgal_state::pcktgal_sound_map); - /* IRQs are caused by the ADPCM chip */ - /* NMIs are caused by the main CPU */ + m_audiocpu->set_addrmap(AS_PROGRAM, &pcktgal_state::sound_map); + // IRQs are caused by the ADPCM chip + // NMIs are caused by the main CPU - /* 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(pcktgal_state::screen_update_pcktgal)); + screen.set_screen_update(FUNC(pcktgal_state::screen_update)); screen.set_palette(m_palette); screen.screen_vblank().set_inputline(m_maincpu, INPUT_LINE_NMI); GFXDECODE(config, m_gfxdecode, "palette", gfx_pcktgal); - PALETTE(config, m_palette, FUNC(pcktgal_state::pcktgal_palette), 512); + PALETTE(config, m_palette, FUNC(pcktgal_state::palette), 512); DECO_BAC06(config, m_tilegen, 0); m_tilegen->set_gfx_region_wide(0, 0, 0); m_tilegen->set_gfxdecode_tag(m_gfxdecode); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); @@ -271,190 +414,167 @@ void pcktgal_state::bootleg(machine_config &config) { pcktgal(config); m_gfxdecode->set_info(gfx_bootleg); - subdevice("screen")->set_screen_update(FUNC(pcktgal_state::screen_update_pcktgalb)); + subdevice("screen")->set_screen_update(FUNC(pcktgal_state::screen_update_bootleg)); } void pcktgal_state::pcktgal2(machine_config &config) { pcktgal(config); - M6502(config.replace(), m_audiocpu, 1500000); /* doesn't use the encrypted 222 */ - m_audiocpu->set_addrmap(AS_PROGRAM, &pcktgal_state::pcktgal_sound_map); + M6502(config.replace(), m_audiocpu, 1500000); // doesn't use the encrypted 222 + m_audiocpu->set_addrmap(AS_PROGRAM, &pcktgal_state::sound_map); } /***************************************************************************/ ROM_START( pcktgal ) - ROM_REGION( 0x14000, "maincpu", 0 ) /* 64k for code + 16k for banks */ - ROM_LOAD( "eb04.j7", 0x10000, 0x4000, CRC(8215d60d) SHA1(ac26dfce7e215be21f2a17f864c5e966b8b8322e) ) - ROM_CONTINUE( 0x04000, 0xc000) - /* 4000-7fff is banked but code falls through from 7fff to 8000, so */ - /* I have to load the bank directly at 4000. */ + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "eb04.j7", 0x00000, 0x10000, CRC(8215d60d) SHA1(ac26dfce7e215be21f2a17f864c5e966b8b8322e) ) - ROM_REGION( 0x18000, "audiocpu", 0 ) /* 96k for code + 96k for decrypted opcodes */ - ROM_LOAD( "eb03.f2", 0x10000, 0x8000, CRC(cb029b02) SHA1(fbb3da08ed05ae73fbeeb13e0e2ff735aaf83db8) ) - ROM_CONTINUE( 0x08000, 0x8000 ) + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "eb03.f2", 0x00000, 0x10000, CRC(cb029b02) SHA1(fbb3da08ed05ae73fbeeb13e0e2ff735aaf83db8) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "chars", 0 ) ROM_LOAD( "eb01.d11", 0x00000, 0x10000, CRC(63542c3d) SHA1(4f42af99a6d9d4766afe0bebe10d6a97811a0082) ) ROM_LOAD( "eb02.d12", 0x10000, 0x10000, CRC(a9dcd339) SHA1(245824ab86cdfe4b842ce1be0af60f2ff4c6ae07) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "sprites", 0 ) ROM_LOAD( "eb00.a1", 0x00000, 0x10000, CRC(6c1a14a8) SHA1(03201197304c5f1d854b8c4f4a5c78336b51f872) ) ROM_REGION( 0x0400, "proms", 0 ) - ROM_LOAD( "eb05.k14", 0x0000, 0x0200, CRC(3b6198cb) SHA1(d32b364cfce99637998ca83ad21783f80364dd65) ) /* 82s147.084 */ - ROM_LOAD( "eb06.k15", 0x0200, 0x0200, CRC(1fbd4b59) SHA1(84e20329003cf09b849b49e1d83edc330d49f404) ) /* 82s131.101 */ + ROM_LOAD( "eb05.k14", 0x0000, 0x0200, CRC(3b6198cb) SHA1(d32b364cfce99637998ca83ad21783f80364dd65) ) // 82s147.084 + ROM_LOAD( "eb06.k15", 0x0200, 0x0200, CRC(1fbd4b59) SHA1(84e20329003cf09b849b49e1d83edc330d49f404) ) // 82s131.101 ROM_END -ROM_START( pcktgalb ) /* bootleg - "Yada East Corporation" */ - ROM_REGION( 0x14000, "maincpu", 0 ) /* 64k for code + 16k for banks */ - ROM_LOAD( "sexybill.001", 0x10000, 0x4000, CRC(4acb3e84) SHA1(c83d03969587c6be80fb8fc84afe250907674a44) ) - ROM_CONTINUE( 0x04000, 0xc000) - /* 4000-7fff is banked but code falls through from 7fff to 8000, so */ - /* I have to load the bank directly at 4000. */ +ROM_START( pcktgalb ) // bootleg - "Yada East Corporation" + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "sexybill.001", 0x00000, 0x10000, CRC(4acb3e84) SHA1(c83d03969587c6be80fb8fc84afe250907674a44) ) - ROM_REGION( 0x18000, "audiocpu", 0 ) /* 96k for code + 96k for decrypted opcodes */ - ROM_LOAD( "eb03.f2", 0x10000, 0x8000, CRC(cb029b02) SHA1(fbb3da08ed05ae73fbeeb13e0e2ff735aaf83db8) ) - ROM_CONTINUE( 0x08000, 0x8000 ) + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "eb03.f2", 0x00000, 0x10000, CRC(cb029b02) SHA1(fbb3da08ed05ae73fbeeb13e0e2ff735aaf83db8) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "chars", 0 ) ROM_LOAD( "sexybill.005", 0x00000, 0x10000, CRC(3128dc7b) SHA1(d011181e544b8284ecdf54578da5469804e06c63) ) ROM_LOAD( "sexybill.006", 0x10000, 0x10000, CRC(0fc91eeb) SHA1(9d9a54c8dd41c10d07aabb6a2d8dbaf35c6e4533) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "sprites", 0 ) ROM_LOAD( "sexybill.003", 0x00000, 0x08000, CRC(58182daa) SHA1(55ce4b0ea2cb1c559c12815c9e453624e0d95515) ) ROM_LOAD( "sexybill.004", 0x08000, 0x08000, CRC(33a67af6) SHA1(6d9c04658ed75b970821a5c8b1f60c3c08fdda0a) ) ROM_REGION( 0x0400, "proms", 0 ) - ROM_LOAD( "eb05.k14", 0x0000, 0x0200, CRC(3b6198cb) SHA1(d32b364cfce99637998ca83ad21783f80364dd65) ) /* 82s147.084 */ - ROM_LOAD( "eb06.k15", 0x0200, 0x0200, CRC(1fbd4b59) SHA1(84e20329003cf09b849b49e1d83edc330d49f404) ) /* 82s131.101 */ + ROM_LOAD( "eb05.k14", 0x0000, 0x0200, CRC(3b6198cb) SHA1(d32b364cfce99637998ca83ad21783f80364dd65) ) // 82s147.084 + ROM_LOAD( "eb06.k15", 0x0200, 0x0200, CRC(1fbd4b59) SHA1(84e20329003cf09b849b49e1d83edc330d49f404) ) // 82s131.101 ROM_REGION( 0x0400, "plds", 0 ) // same as official sets? ROM_LOAD( "pal16l8", 0x0000, 0x0104, CRC(b8d4b318) SHA1(6dd68892501c9b61714aaa7a3cfe14cc8ad1a877) ) - ROM_LOAD( "pal16r6", 0x0200, 0x0104, CRC(43aad537) SHA1(892104f4315d7a739718ce32b910694ea9b13fae) ) /* also seen peel18CV8 used on other boards */ + ROM_LOAD( "pal16r6", 0x0200, 0x0104, CRC(43aad537) SHA1(892104f4315d7a739718ce32b910694ea9b13fae) ) // also seen peel18CV8 used on other boards ROM_END ROM_START( pcktgal2 ) - ROM_REGION( 0x14000, "maincpu", 0 ) /* 64k for code + 16k for banks */ - ROM_LOAD( "eb04-2.j7", 0x10000, 0x4000, CRC(0c7f2905) SHA1(882dbc1888a0149486c1fac5568dc3d297c2dadd) ) - ROM_CONTINUE( 0x04000, 0xc000) - /* 4000-7fff is banked but code falls through from 7fff to 8000, so */ - /* I have to load the bank directly at 4000. */ + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "eb04-2.j7", 0x00000, 0x10000, CRC(0c7f2905) SHA1(882dbc1888a0149486c1fac5568dc3d297c2dadd) ) - ROM_REGION( 0x18000, "audiocpu", 0 ) /* audio cpu */ - ROM_LOAD( "eb03-2.f2", 0x10000, 0x8000, CRC(9408ffb4) SHA1(ddcb67da4acf3d986d54ad10404f213528a8bb62) ) - ROM_CONTINUE( 0x08000, 0x8000) + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "eb03-2.f2", 0x00000, 0x10000, CRC(9408ffb4) SHA1(ddcb67da4acf3d986d54ad10404f213528a8bb62) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "chars", 0 ) ROM_LOAD( "eb01-2.rom", 0x00000, 0x10000, CRC(e52b1f97) SHA1(4814fe3b2eb08ac173e09ffadc6e5daa9affa1a0) ) ROM_LOAD( "eb02-2.rom", 0x10000, 0x10000, CRC(f30d965d) SHA1(a787457b33ad39e78fcf8da0715fab7a63869bf9) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "sprites", 0 ) ROM_LOAD( "eb00.a1", 0x00000, 0x10000, CRC(6c1a14a8) SHA1(03201197304c5f1d854b8c4f4a5c78336b51f872) ) ROM_REGION( 0x0400, "proms", 0 ) - ROM_LOAD( "eb05.k14", 0x0000, 0x0200, CRC(3b6198cb) SHA1(d32b364cfce99637998ca83ad21783f80364dd65) ) /* 82s147.084 */ - ROM_LOAD( "eb06.k15", 0x0200, 0x0200, CRC(1fbd4b59) SHA1(84e20329003cf09b849b49e1d83edc330d49f404) ) /* 82s131.101 */ + ROM_LOAD( "eb05.k14", 0x0000, 0x0200, CRC(3b6198cb) SHA1(d32b364cfce99637998ca83ad21783f80364dd65) ) // 82s147.084 + ROM_LOAD( "eb06.k15", 0x0200, 0x0200, CRC(1fbd4b59) SHA1(84e20329003cf09b849b49e1d83edc330d49f404) ) // 82s131.101 ROM_END ROM_START( pcktgal2j ) - ROM_REGION( 0x14000, "maincpu", 0 ) /* 64k for code + 16k for banks */ - ROM_LOAD( "eb04-2.j7", 0x10000, 0x4000, CRC(0c7f2905) SHA1(882dbc1888a0149486c1fac5568dc3d297c2dadd) ) - ROM_CONTINUE( 0x04000, 0xc000) - /* 4000-7fff is banked but code falls through from 7fff to 8000, so */ - /* I have to load the bank directly at 4000. */ + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "eb04-2.j7", 0x00000, 0x10000, CRC(0c7f2905) SHA1(882dbc1888a0149486c1fac5568dc3d297c2dadd) ) - ROM_REGION( 0x18000, "audiocpu", 0 ) /* audio cpu */ - ROM_LOAD( "eb03-2.f2", 0x10000, 0x8000, CRC(9408ffb4) SHA1(ddcb67da4acf3d986d54ad10404f213528a8bb62) ) - ROM_CONTINUE( 0x08000, 0x8000) + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "eb03-2.f2", 0x00000, 0x10000, CRC(9408ffb4) SHA1(ddcb67da4acf3d986d54ad10404f213528a8bb62) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "chars", 0 ) ROM_LOAD( "eb01-2.d11", 0x00000, 0x10000, CRC(8f42ab1a) SHA1(315fb26bbe004c08629a0a3a6e9d129768119e6b) ) ROM_LOAD( "eb02-2.d12", 0x10000, 0x10000, CRC(f394cb35) SHA1(f351b8b6fd8a6637ef9031f7a410a334da8ea5ae) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "sprites", 0 ) ROM_LOAD( "eb00.a1", 0x00000, 0x10000, CRC(6c1a14a8) SHA1(03201197304c5f1d854b8c4f4a5c78336b51f872) ) ROM_REGION( 0x0400, "proms", 0 ) - ROM_LOAD( "eb05.k14", 0x0000, 0x0200, CRC(3b6198cb) SHA1(d32b364cfce99637998ca83ad21783f80364dd65) ) /* 82s147.084 */ - ROM_LOAD( "eb06.k15", 0x0200, 0x0200, CRC(1fbd4b59) SHA1(84e20329003cf09b849b49e1d83edc330d49f404) ) /* 82s131.101 */ + ROM_LOAD( "eb05.k14", 0x0000, 0x0200, CRC(3b6198cb) SHA1(d32b364cfce99637998ca83ad21783f80364dd65) ) // 82s147.084 + ROM_LOAD( "eb06.k15", 0x0200, 0x0200, CRC(1fbd4b59) SHA1(84e20329003cf09b849b49e1d83edc330d49f404) ) // 82s131.101 ROM_END ROM_START( spool3 ) - ROM_REGION( 0x14000, "maincpu", 0 ) /* 64k for code + 16k for banks */ - ROM_LOAD( "eb04-2.j7", 0x10000, 0x4000, CRC(0c7f2905) SHA1(882dbc1888a0149486c1fac5568dc3d297c2dadd) ) - ROM_CONTINUE( 0x04000, 0xc000) - /* 4000-7fff is banked but code falls through from 7fff to 8000, so */ - /* I have to load the bank directly at 4000. */ + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "eb04-2.j7", 0x00000, 0x10000, CRC(0c7f2905) SHA1(882dbc1888a0149486c1fac5568dc3d297c2dadd) ) - ROM_REGION( 0x18000, "audiocpu", 0 ) /* audio cpu */ - ROM_LOAD( "eb03-2.f2", 0x10000, 0x8000, CRC(9408ffb4) SHA1(ddcb67da4acf3d986d54ad10404f213528a8bb62) ) - ROM_CONTINUE( 0x08000, 0x8000) + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "eb03-2.f2", 0x00000, 0x10000, CRC(9408ffb4) SHA1(ddcb67da4acf3d986d54ad10404f213528a8bb62) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "chars", 0 ) ROM_LOAD( "deco2.bin", 0x00000, 0x10000, CRC(0a23f0cf) SHA1(8554215001ffc9e6f141e57cc11b400a853f89f2) ) ROM_LOAD( "deco3.bin", 0x10000, 0x10000, CRC(55ea7c45) SHA1(a8a6ff0c8a5aaee3afbfc3e71a171fb1d2360b45) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "sprites", 0 ) ROM_LOAD( "eb00.a1", 0x00000, 0x10000, CRC(6c1a14a8) SHA1(03201197304c5f1d854b8c4f4a5c78336b51f872) ) ROM_REGION( 0x0400, "proms", 0 ) - ROM_LOAD( "eb05.k14", 0x0000, 0x0200, CRC(3b6198cb) SHA1(d32b364cfce99637998ca83ad21783f80364dd65) ) /* 82s147.084 */ - ROM_LOAD( "eb06.k15", 0x0200, 0x0200, CRC(1fbd4b59) SHA1(84e20329003cf09b849b49e1d83edc330d49f404) ) /* 82s131.101 */ + ROM_LOAD( "eb05.k14", 0x0000, 0x0200, CRC(3b6198cb) SHA1(d32b364cfce99637998ca83ad21783f80364dd65) ) // 82s147.084 + ROM_LOAD( "eb06.k15", 0x0200, 0x0200, CRC(1fbd4b59) SHA1(84e20329003cf09b849b49e1d83edc330d49f404) ) // 82s131.101 ROM_END ROM_START( spool3i ) - ROM_REGION( 0x14000, "maincpu", 0 ) /* 64k for code + 16k for banks */ - ROM_LOAD( "de1.bin", 0x10000, 0x4000, CRC(a59980fe) SHA1(64b55af4d0b314d14184784e9f817b56be0f24f2) ) - ROM_CONTINUE( 0x04000, 0xc000) - /* 4000-7fff is banked but code falls through from 7fff to 8000, so */ - /* I have to load the bank directly at 4000. */ + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "de1.bin", 0x00000, 0x10000, CRC(a59980fe) SHA1(64b55af4d0b314d14184784e9f817b56be0f24f2) ) - ROM_REGION( 0x18000, "audiocpu", 0 ) /* audio cpu */ - ROM_LOAD( "eb03-2.f2", 0x10000, 0x8000, CRC(9408ffb4) SHA1(ddcb67da4acf3d986d54ad10404f213528a8bb62) ) - ROM_CONTINUE( 0x08000, 0x8000) + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "eb03-2.f2", 0x00000, 0x10000, CRC(9408ffb4) SHA1(ddcb67da4acf3d986d54ad10404f213528a8bb62) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "chars", 0 ) ROM_LOAD( "deco2.bin", 0x00000, 0x10000, CRC(0a23f0cf) SHA1(8554215001ffc9e6f141e57cc11b400a853f89f2) ) ROM_LOAD( "deco3.bin", 0x10000, 0x10000, CRC(55ea7c45) SHA1(a8a6ff0c8a5aaee3afbfc3e71a171fb1d2360b45) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "sprites", 0 ) ROM_LOAD( "eb00.a1", 0x00000, 0x10000, CRC(6c1a14a8) SHA1(03201197304c5f1d854b8c4f4a5c78336b51f872) ) ROM_REGION( 0x0400, "proms", 0 ) - ROM_LOAD( "eb05.k14", 0x0000, 0x0200, CRC(3b6198cb) SHA1(d32b364cfce99637998ca83ad21783f80364dd65) ) /* 82s147.084 */ - ROM_LOAD( "eb06.k15", 0x0200, 0x0200, CRC(1fbd4b59) SHA1(84e20329003cf09b849b49e1d83edc330d49f404) ) /* 82s131.101 */ + ROM_LOAD( "eb05.k14", 0x0000, 0x0200, CRC(3b6198cb) SHA1(d32b364cfce99637998ca83ad21783f80364dd65) ) // 82s147.084 + ROM_LOAD( "eb06.k15", 0x0200, 0x0200, CRC(1fbd4b59) SHA1(84e20329003cf09b849b49e1d83edc330d49f404) ) // 82s131.101 ROM_END /***************************************************************************/ -void pcktgal_state::init_pcktgal() +void pcktgal_state::init_original() { - uint8_t *rom = memregion("gfx1")->base(); - const int len = memregion("gfx1")->bytes(); + uint8_t *rom = memregion("chars")->base(); + const int len = memregion("chars")->bytes(); - /* Tile graphics roms have some swapped lines, original version only */ + // Tile graphics ROMs have some swapped lines, original version only for (int i = 0x00000; i < len; i += 32) { int temp[16]; for (int j = 0; j < 16; j++) { - temp[j] = rom[i+j+16]; - rom[i+j+16] = rom[i+j]; - rom[i+j] = temp[j]; + temp[j] = rom[i + j + 16]; + rom[i + j + 16] = rom[i + j]; + rom[i + j] = temp[j]; } } } +} // anonymous namespace /***************************************************************************/ -GAME( 1987, pcktgal, 0, pcktgal, pcktgal, pcktgal_state, init_pcktgal, ROT0, "Data East Corporation", "Pocket Gal (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, pcktgalb, pcktgal, bootleg, pcktgal, pcktgal_state, empty_init, ROT0, "bootleg", "Pocket Gal (Yada East bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, pcktgal2, pcktgal, pcktgal2,pcktgal, pcktgal_state, init_pcktgal, ROT0, "Data East Corporation", "Pocket Gal 2 (English)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, pcktgal2j,pcktgal, pcktgal2,pcktgal, pcktgal_state, init_pcktgal, ROT0, "Data East Corporation", "Pocket Gal 2 (Japanese)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, spool3, pcktgal, pcktgal2,pcktgal, pcktgal_state, init_pcktgal, ROT0, "Data East Corporation", "Super Pool III (English)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, spool3i, pcktgal, pcktgal2,pcktgal, pcktgal_state, init_pcktgal, ROT0, "Data East Corporation (I-Vics license)", "Super Pool III (I-Vics)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, pcktgal, 0, pcktgal, pcktgal, pcktgal_state, init_original, ROT0, "Data East Corporation", "Pocket Gal (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, pcktgalb, pcktgal, bootleg, pcktgal, pcktgal_state, empty_init, ROT0, "bootleg", "Pocket Gal (Yada East bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, pcktgal2, pcktgal, pcktgal2,pcktgal, pcktgal_state, init_original, ROT0, "Data East Corporation", "Pocket Gal 2 (English)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, pcktgal2j,pcktgal, pcktgal2,pcktgal, pcktgal_state, init_original, ROT0, "Data East Corporation", "Pocket Gal 2 (Japanese)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, spool3, pcktgal, pcktgal2,pcktgal, pcktgal_state, init_original, ROT0, "Data East Corporation", "Super Pool III (English)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, spool3i, pcktgal, pcktgal2,pcktgal, pcktgal_state, init_original, ROT0, "Data East Corporation (I-Vics license)", "Super Pool III (I-Vics)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/labyrunr.h b/src/mame/includes/labyrunr.h deleted file mode 100644 index 2097a58206f..00000000000 --- a/src/mame/includes/labyrunr.h +++ /dev/null @@ -1,72 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -/************************************************************************* - - Labyrinth Runner - -*************************************************************************/ -#ifndef MAME_INCLUDES_LABYRUNR_H -#define MAME_INCLUDES_LABYRUNR_H - -#pragma once - -#include "video/k007121.h" -#include "video/k051733.h" -#include "emupal.h" -#include "screen.h" -#include "tilemap.h" - -class labyrunr_state : public driver_device -{ -public: - labyrunr_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_k007121(*this, "k007121"), - m_maincpu(*this,"maincpu"), - m_scrollram(*this, "scrollram"), - m_spriteram(*this, "spriteram"), - m_videoram1(*this, "videoram1"), - m_videoram2(*this, "videoram2"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette") - { } - - void labyrunr(machine_config &config); - -private: - /* devices */ - required_device m_k007121; - - required_device m_maincpu; - /* memory pointers */ - required_shared_ptr m_scrollram; - required_shared_ptr m_spriteram; - required_shared_ptr m_videoram1; - required_shared_ptr m_videoram2; - - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - - /* video-related */ - tilemap_t *m_layer0 = nullptr; - tilemap_t *m_layer1 = nullptr; - rectangle m_clip0{}; - rectangle m_clip1{}; - - void labyrunr_bankswitch_w(uint8_t data); - void labyrunr_vram1_w(offs_t offset, uint8_t data); - void labyrunr_vram2_w(offs_t offset, uint8_t data); - TILE_GET_INFO_MEMBER(get_tile_info0); - TILE_GET_INFO_MEMBER(get_tile_info1); - virtual void machine_start() override; - virtual void video_start() override; - void labyrunr_palette(palette_device &palette) const; - uint32_t screen_update_labyrunr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(vblank_irq); - INTERRUPT_GEN_MEMBER(labyrunr_timer_interrupt); - void labyrunr_map(address_map &map); -}; - -#endif // MAME_INCLUDES_LABYRUNR_H diff --git a/src/mame/includes/pcktgal.h b/src/mame/includes/pcktgal.h deleted file mode 100644 index ed607cf74cf..00000000000 --- a/src/mame/includes/pcktgal.h +++ /dev/null @@ -1,62 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Bryan McPhail -#ifndef MAME_INCLUDES_PCKTGAL_H -#define MAME_INCLUDES_PCKTGAL_H - -#pragma once - -#include "machine/gen_latch.h" -#include "sound/msm5205.h" -#include "video/decbac06.h" -#include "emupal.h" - -class pcktgal_state : public driver_device -{ -public: - pcktgal_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_msm(*this, "msm"), - m_tilegen(*this, "tilegen"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch"), - m_spriteram(*this, "spriteram") - { } - - required_device m_maincpu; - required_device m_audiocpu; - required_device m_msm; - required_device m_tilegen; - required_device m_gfxdecode; - required_device m_palette; - required_device m_soundlatch; - - required_shared_ptr m_spriteram; - - int m_msm5205next = 0; - int m_toggle = 0; - - void bank_w(uint8_t data); - void sound_bank_w(uint8_t data); - void sound_w(uint8_t data); - void adpcm_data_w(uint8_t data); - uint8_t sound_unk_r(); - DECLARE_WRITE_LINE_MEMBER(adpcm_int); - - void init_pcktgal(); - void pcktgal_palette(palette_device &palette) const; - virtual void machine_start() override; - - uint32_t screen_update_pcktgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_pcktgalb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bool flip_screen); - void bootleg(machine_config &config); - void pcktgal(machine_config &config); - void pcktgal2(machine_config &config); - void pcktgal_map(address_map &map); - void pcktgal_sound_map(address_map &map); -}; - -#endif // MAME_INCLUDES_PCKTGAL_H diff --git a/src/mame/video/labyrunr.cpp b/src/mame/video/labyrunr.cpp deleted file mode 100644 index 24f4cfba8a7..00000000000 --- a/src/mame/video/labyrunr.cpp +++ /dev/null @@ -1,260 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -#include "emu.h" - -#include "includes/labyrunr.h" - -void labyrunr_state::labyrunr_palette(palette_device &palette) const -{ - const uint8_t *color_prom = memregion("proms")->base(); - - for (int pal = 0; pal < 8; pal++) - { - if (pal & 1) - { - // chars, no lookup table - for (int i = 0; i < 0x100; i++) - palette.set_pen_indirect((pal << 8) | i, (pal << 4) | (i & 0x0f)); - } - else - { - // sprites - for (int i = 0; i < 0x100; i++) - { - uint8_t const ctabentry = !color_prom[i] ? 0 : ((pal << 4) | (color_prom[i] & 0x0f)); - - palette.set_pen_indirect((pal << 8) | i, ctabentry); - } - } - } -} - - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(labyrunr_state::get_tile_info0) -{ - uint8_t ctrl_3 = m_k007121->ctrlram_r(3); - uint8_t ctrl_4 = m_k007121->ctrlram_r(4); - uint8_t ctrl_5 = m_k007121->ctrlram_r(5); - uint8_t ctrl_6 = m_k007121->ctrlram_r(6); - int attr = m_videoram1[tile_index]; - int code = m_videoram1[tile_index + 0x400]; - int bit0 = (ctrl_5 >> 0) & 0x03; - int bit1 = (ctrl_5 >> 2) & 0x03; - int bit2 = (ctrl_5 >> 4) & 0x03; - int bit3 = (ctrl_5 >> 6) & 0x03; - int bank = ((attr & 0x80) >> 7) | - ((attr >> (bit0+2)) & 0x02) | - ((attr >> (bit1+1)) & 0x04) | - ((attr >> (bit2 )) & 0x08) | - ((attr >> (bit3-1)) & 0x10) | - ((ctrl_3 & 0x01) << 5); - int mask = (ctrl_4 & 0xf0) >> 4; - - bank = (bank & ~(mask << 1)) | ((ctrl_4 & mask) << 1); - - tileinfo.set(0, - code + bank * 256, - ((ctrl_6 & 0x30) * 2 + 16)+(attr & 7), - 0); - tileinfo.category = (attr & 0x40) >> 6; -} - -TILE_GET_INFO_MEMBER(labyrunr_state::get_tile_info1) -{ - uint8_t ctrl_3 = m_k007121->ctrlram_r(3); - uint8_t ctrl_4 = m_k007121->ctrlram_r(4); - uint8_t ctrl_5 = m_k007121->ctrlram_r(5); - uint8_t ctrl_6 = m_k007121->ctrlram_r(6); - int attr = m_videoram2[tile_index]; - int code = m_videoram2[tile_index + 0x400]; - int bit0 = (ctrl_5 >> 0) & 0x03; - int bit1 = (ctrl_5 >> 2) & 0x03; - int bit2 = (ctrl_5 >> 4) & 0x03; - int bit3 = (ctrl_5 >> 6) & 0x03; - int bank = ((attr & 0x80) >> 7) | - ((attr >> (bit0+2)) & 0x02) | - ((attr >> (bit1+1)) & 0x04) | - ((attr >> (bit2 )) & 0x08) | - ((attr >> (bit3-1)) & 0x10) | - ((ctrl_3 & 0x01) << 5); - int mask = (ctrl_4 & 0xf0) >> 4; - - bank = (bank & ~(mask << 1)) | ((ctrl_4 & mask) << 1); - - tileinfo.set(0, - code+bank*256, - ((ctrl_6 & 0x30) * 2 + 16) + (attr & 7), - 0); -} - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void labyrunr_state::video_start() -{ - m_layer0 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(labyrunr_state::get_tile_info0)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_layer1 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(labyrunr_state::get_tile_info1)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - - m_layer0->set_transparent_pen(0); - m_layer1->set_transparent_pen(0); - - m_clip0 = m_screen->visible_area(); - m_clip0.min_x += 40; - - m_clip1 = m_screen->visible_area(); - m_clip1.max_x = 39; - m_clip1.min_x = 0; - - m_layer0->set_scroll_cols(32); -} - - - -/*************************************************************************** - - Memory Handlers - -***************************************************************************/ - -void labyrunr_state::labyrunr_vram1_w(offs_t offset, uint8_t data) -{ - m_videoram1[offset] = data; - m_layer0->mark_tile_dirty(offset & 0x3ff); -} - -void labyrunr_state::labyrunr_vram2_w(offs_t offset, uint8_t data) -{ - m_videoram2[offset] = data; - m_layer1->mark_tile_dirty(offset & 0x3ff); -} - - - -/*************************************************************************** - - Screen Refresh - -***************************************************************************/ - -uint32_t labyrunr_state::screen_update_labyrunr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - uint8_t ctrl_0 = m_k007121->ctrlram_r(0); - rectangle finalclip0, finalclip1; - - screen.priority().fill(0, cliprect); - bitmap.fill(m_palette->black_pen(), cliprect); - - if (~m_k007121->ctrlram_r(3) & 0x20) - { - int i; - - finalclip0 = m_clip0; - finalclip1 = m_clip1; - - finalclip0 &= cliprect; - finalclip1 &= cliprect; - - m_layer0->set_scrollx(0, ctrl_0 - 40); - m_layer1->set_scrollx(0, 0); - - for(i = 0; i < 32; i++) - { - /* enable colscroll */ - if((m_k007121->ctrlram_r(1) & 6) == 6) // it's probably just one bit, but it's only used once in the game so I don't know which it's - m_layer0->set_scrolly((i + 2) & 0x1f, m_k007121->ctrlram_r(2) + m_scrollram[i]); - else - m_layer0->set_scrolly((i + 2) & 0x1f, m_k007121->ctrlram_r(2)); - } - - m_layer0->draw(screen, bitmap, finalclip0, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_CATEGORY(0), 0); - m_k007121->sprites_draw(bitmap, cliprect, m_gfxdecode->gfx(0), *m_palette, m_spriteram,(m_k007121->ctrlram_r(6) & 0x30) * 2, 40,0,screen.priority(),(m_k007121->ctrlram_r(3) & 0x40) >> 5); - m_layer0->draw(screen, bitmap, finalclip0, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_CATEGORY(1), 0); - /* we ignore the transparency because layer1 is drawn only at the top of the screen also covering sprites */ - m_layer1->draw(screen, bitmap, finalclip1, TILEMAP_DRAW_OPAQUE, 0); - } - else - { - int use_clip3[2] = { 0, 0 }; - rectangle finalclip3; - - /* custom cliprects needed for the weird effect used in the endinq sequence to hide and show the needed part of text */ - finalclip0.min_y = finalclip1.min_y = cliprect.min_y; - finalclip0.max_y = finalclip1.max_y = cliprect.max_y; - - if(m_k007121->ctrlram_r(1) & 1) - { - finalclip0.min_x = cliprect.max_x - ctrl_0 + 8; - finalclip0.max_x = cliprect.max_x; - - if(ctrl_0 >= 40) - { - finalclip1.min_x = cliprect.min_x; - } - else - { - use_clip3[0] = 1; - - finalclip1.min_x = 40 - ctrl_0; - } - - finalclip1.max_x = cliprect.max_x - ctrl_0 + 8; - - } - else - { - if(ctrl_0 >= 40) - { - finalclip0.min_x = cliprect.min_x; - } - else - { - use_clip3[1] = 1; - - finalclip0.min_x = 40 - ctrl_0; - } - - finalclip0.max_x = cliprect.max_x - ctrl_0 + 8; - - finalclip1.min_x = cliprect.max_x - ctrl_0 + 8; - finalclip1.max_x = cliprect.max_x; - } - - if(use_clip3[0] || use_clip3[1]) - { - finalclip3.min_y = cliprect.min_y; - finalclip3.max_y = cliprect.max_y; - finalclip3.min_x = cliprect.min_x; - finalclip3.max_x = 40 - ctrl_0 - 8; - } - - m_layer0->set_scrollx(0, ctrl_0 - 40); - m_layer1->set_scrollx(0, ctrl_0 - 40); - - m_layer0->draw(screen, bitmap, finalclip0, TILEMAP_DRAW_CATEGORY(0), 0); - if(use_clip3[0]) - m_layer0->draw(screen, bitmap, finalclip3, TILEMAP_DRAW_CATEGORY(0), 0); - - m_k007121->sprites_draw(bitmap, cliprect, m_gfxdecode->gfx(0), *m_palette, m_spriteram, (m_k007121->ctrlram_r(6) & 0x30) * 2,40,0,screen.priority(),(m_k007121->ctrlram_r(3) & 0x40) >> 5); - - m_layer0->draw(screen, bitmap, finalclip0, TILEMAP_DRAW_CATEGORY(1), 0); - if(use_clip3[0]) - m_layer0->draw(screen, bitmap, finalclip3, TILEMAP_DRAW_CATEGORY(1), 0); - - m_layer1->draw(screen, bitmap, finalclip1, 0, 0); - if(use_clip3[1]) - m_layer1->draw(screen, bitmap, finalclip3, 0, 0); - - } - return 0; -} diff --git a/src/mame/video/pcktgal.cpp b/src/mame/video/pcktgal.cpp deleted file mode 100644 index 63270fb69d1..00000000000 --- a/src/mame/video/pcktgal.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Bryan McPhail -#include "emu.h" -#include "includes/pcktgal.h" - -void pcktgal_state::pcktgal_palette(palette_device &palette) const -{ - uint8_t const *const color_prom = memregion("proms")->base(); - - for (int i = 0; i < palette.entries(); i++) - { - int bit0, bit1, bit2, bit3; - - bit0 = BIT(color_prom[i], 0); - bit1 = BIT(color_prom[i], 1); - bit2 = BIT(color_prom[i], 2); - bit3 = BIT(color_prom[i], 3); - int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - bit0 = BIT(color_prom[i], 4); - bit1 = BIT(color_prom[i], 5); - bit2 = BIT(color_prom[i], 6); - bit3 = BIT(color_prom[i], 7); - int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - bit0 = BIT(color_prom[i + palette.entries()], 0); - bit1 = BIT(color_prom[i + palette.entries()], 1); - bit2 = BIT(color_prom[i + palette.entries()], 2); - bit3 = BIT(color_prom[i + palette.entries()], 3); - int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - palette.set_pen_color(i, rgb_t(r, g, b)); - } -} - -void pcktgal_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bool flip_screen) -{ - for (int offs = 0;offs < m_spriteram.bytes();offs += 4) - { - if (m_spriteram[offs] != 0xf8) - { - int sx,sy,flipx,flipy; - - - sx = 240 - m_spriteram[offs+2]; - sy = 240 - m_spriteram[offs]; - - flipx = m_spriteram[offs+1] & 0x04; - flipy = m_spriteram[offs+1] & 0x02; - if (flip_screen) { - sx=240-sx; - sy=240-sy; - if (flipx) flipx=0; else flipx=1; - if (flipy) flipy=0; else flipy=1; - } - - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - m_spriteram[offs+3] + ((m_spriteram[offs+1] & 1) << 8), - (m_spriteram[offs+1] & 0x70) >> 4, - flipx,flipy, - sx,sy,0); - } - } -} - -uint32_t pcktgal_state::screen_update_pcktgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bool flip = m_tilegen->get_flip_state(); - m_tilegen->set_flip_screen(flip); - m_tilegen->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0); - draw_sprites(bitmap, cliprect, flip); - return 0; -} - -uint32_t pcktgal_state::screen_update_pcktgalb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bool flip = m_tilegen->get_flip_state(); - m_tilegen->set_flip_screen(flip); - // the bootleg doesn't properly set the tilemap registers, because it's on non-original hardware, which probably doesn't have the flexible tilemaps. - m_tilegen->deco_bac06_pf_draw_bootleg(screen, bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0, 2, 0); - draw_sprites(bitmap, cliprect, flip); - return 0; -} -- cgit v1.2.3