From b278453e7621b069833660ec3f46e6073c55f812 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Thu, 31 Mar 2022 08:26:40 +0200 Subject: [PATCH] galpanic.cpp, hcastle.cpp, tbowl.cpp: finders and other minor cleanups --- scripts/target/mame/arcade.lua | 6 - src/mame/drivers/galpanic.cpp | 228 +++++++++++---- src/mame/drivers/hcastle.cpp | 456 +++++++++++++++++++++++------- src/mame/drivers/tbowl.cpp | 488 +++++++++++++++++++++++---------- src/mame/includes/galpanic.h | 59 ---- src/mame/includes/hcastle.h | 88 ------ src/mame/includes/tbowl.h | 101 ------- src/mame/video/galpanic.cpp | 56 ---- src/mame/video/hcastle.cpp | 239 ---------------- src/mame/video/tbowl.cpp | 164 ----------- 10 files changed, 869 insertions(+), 1016 deletions(-) delete mode 100644 src/mame/includes/galpanic.h delete mode 100644 src/mame/includes/hcastle.h delete mode 100644 src/mame/includes/tbowl.h delete mode 100644 src/mame/video/galpanic.cpp delete mode 100644 src/mame/video/hcastle.cpp delete mode 100644 src/mame/video/tbowl.cpp diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index ed047d4cf33..23e9bb9789b 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -2358,8 +2358,6 @@ files { MAME_DIR .. "src/mame/drivers/galpanic.cpp", MAME_DIR .. "src/mame/drivers/galpanic_ms.cpp", MAME_DIR .. "src/mame/includes/galpnipt.h", - MAME_DIR .. "src/mame/includes/galpanic.h", - MAME_DIR .. "src/mame/video/galpanic.cpp", MAME_DIR .. "src/mame/drivers/galpani2.cpp", MAME_DIR .. "src/mame/includes/galpani2.h", MAME_DIR .. "src/mame/video/galpani2.cpp", @@ -2480,8 +2478,6 @@ files { MAME_DIR .. "src/mame/includes/gyruss.h", MAME_DIR .. "src/mame/video/gyruss.cpp", MAME_DIR .. "src/mame/drivers/hcastle.cpp", - MAME_DIR .. "src/mame/includes/hcastle.h", - MAME_DIR .. "src/mame/video/hcastle.cpp", MAME_DIR .. "src/mame/drivers/hexion.cpp", MAME_DIR .. "src/mame/includes/hexion.h", MAME_DIR .. "src/mame/video/hexion.cpp", @@ -4357,8 +4353,6 @@ files { MAME_DIR .. "src/mame/includes/spbactn.h", MAME_DIR .. "src/mame/video/spbactn.cpp", MAME_DIR .. "src/mame/drivers/tbowl.cpp", - MAME_DIR .. "src/mame/includes/tbowl.h", - MAME_DIR .. "src/mame/video/tbowl.cpp", MAME_DIR .. "src/mame/drivers/tecmo.cpp", MAME_DIR .. "src/mame/includes/tecmo.h", MAME_DIR .. "src/mame/video/tecmo.cpp", diff --git a/src/mame/drivers/galpanic.cpp b/src/mame/drivers/galpanic.cpp index 52f0285e3de..a4006344859 100644 --- a/src/mame/drivers/galpanic.cpp +++ b/src/mame/drivers/galpanic.cpp @@ -46,7 +46,7 @@ Stephh's additional notes : - I added the 'galpanica' romset which is in fact the same as 'galpanic', but with the PRG ROMS which aren't overwritten and simulated the CALC1 - MCU functions + ULA functions Here are a few notes about what I found : * This version is also a World version (0x03ffff.b = 03). * In this version, there is a "Coin Mode" Dip Switch, but no @@ -66,20 +66,133 @@ Stephh's additional notes : ***************************************************************************/ #include "emu.h" -#include "includes/galpanic.h" + #include "includes/galpnipt.h" +#include "machine/kaneko_hit.h" +#include "video/kan_pand.h" #include "cpu/m68000/m68000.h" +#include "machine/timer.h" #include "machine/watchdog.h" #include "sound/okim6295.h" -#include "video/kan_pand.h" -#include "machine/kaneko_hit.h" + +#include "emupal.h" +#include "screen.h" #include "speaker.h" +namespace { + +class galpanic_state : public driver_device +{ +public: + galpanic_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_screen(*this, "screen") + , m_palette(*this, "palette") + , m_pandora(*this, "pandora") + , m_bgvideoram(*this, "bgvideoram") + , m_fgvideoram(*this, "fgvideoram") + , m_okibank(*this, "okibank") + { } + + void galpanica(machine_config &config); + void galpanic(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + +private: + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + required_device m_pandora; + + required_shared_ptr m_bgvideoram; + required_shared_ptr m_fgvideoram; + required_memory_bank m_okibank; + + bitmap_ind16 m_bitmap; + + void m6295_bankswitch_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void coin_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void bgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + + void palette(palette_device &palette) const; + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(screen_vblank); + TIMER_DEVICE_CALLBACK_MEMBER(scanline); + void draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); + + void galpanic_map(address_map &map); + void oki_map(address_map &map); + void galpanica_map(address_map &map); +}; + + +// video + +void galpanic_state::video_start() +{ + m_screen->register_screen_bitmap(m_bitmap); + + save_item(NAME(m_bitmap)); +} + +void galpanic_state::palette(palette_device &palette) const +{ + // first 1024 colors are dynamic + + // initialize 555 GRB lookup + for (int i = 0; i < 32768; i++) + palette.set_pen_color(i + 1024, pal5bit(i >> 5), pal5bit(i >> 10), pal5bit(i >> 0)); +} + +void galpanic_state::bgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + data = COMBINE_DATA(&m_bgvideoram[offset]); + + int sy = offset / 256; + int sx = offset % 256; + + m_bitmap.pix(sy, sx) = 1024 + (data >> 1); +} + +void galpanic_state::draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int offs = 0; offs < m_fgvideoram.bytes() / 2; offs++) + { + int const sx = offs % 256; + int const sy = offs / 256; + int const color = m_fgvideoram[offs]; + if (color) + bitmap.pix(sy, sx) = color; + } +} + +uint32_t galpanic_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // copy the temporary bitmap to the screen + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + + draw_fgbitmap(bitmap, cliprect); + + m_pandora->update(bitmap, cliprect); + + return 0; +} + + +// machine + void galpanic_state::machine_start() { - membank("okibank")->configure_entries(0, 16, memregion("oki")->base(), 0x10000); + m_okibank->configure_entries(0, 16, memregion("oki")->base(), 0x10000); } WRITE_LINE_MEMBER(galpanic_state::screen_vblank) @@ -98,7 +211,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(galpanic_state::scanline) if(scanline == 224) // vblank-out irq m_maincpu->set_input_line(3, HOLD_LINE); - /* Pandora "sprite end dma" irq? */ + // Pandora "sprite end dma" irq? if(scanline == 32) m_maincpu->set_input_line(5, HOLD_LINE); } @@ -110,10 +223,10 @@ void galpanic_state::m6295_bankswitch_w(offs_t offset, uint16_t data, uint16_t m { if (ACCESSING_BITS_8_15) { - membank("okibank")->set_entry((data >> 8) & 0x0f); + m_okibank->set_entry((data >> 8) & 0x0f); // used before title screen - m_pandora->set_clear_bitmap((data & 0x8000)>>15); + m_pandora->set_clear_bitmap((data & 0x8000) >> 15); } } @@ -137,44 +250,44 @@ void galpanic_state::galpanic_map(address_map &map) { map(0x000000, 0x3fffff).rom(); map(0x400001, 0x400001).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); - map(0x500000, 0x51ffff).ram().share("fgvideoram"); - map(0x520000, 0x53ffff).ram().w(FUNC(galpanic_state::bgvideoram_w)).share("bgvideoram"); /* + work RAM */ - map(0x600000, 0x6007ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); /* 1024 colors, but only 512 seem to be used */ + map(0x500000, 0x51ffff).ram().share(m_fgvideoram); + map(0x520000, 0x53ffff).ram().w(FUNC(galpanic_state::bgvideoram_w)).share(m_bgvideoram); // + work RAM + map(0x600000, 0x6007ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // 1024 colors, but only 512 seem to be used map(0x700000, 0x701fff).rw(m_pandora, FUNC(kaneko_pandora_device::spriteram_LSB_r), FUNC(kaneko_pandora_device::spriteram_LSB_w)); map(0x702000, 0x704fff).ram(); map(0x800000, 0x800001).portr("DSW1"); map(0x800002, 0x800003).portr("DSW2"); map(0x800004, 0x800005).portr("SYSTEM"); map(0x900000, 0x900001).w(FUNC(galpanic_state::m6295_bankswitch_w)); - map(0xa00000, 0xa00001).w(FUNC(galpanic_state::coin_w)); /* coin counters */ - map(0xb00000, 0xb00001).nopw(); /* ??? */ - map(0xc00000, 0xc00001).nopw(); /* ??? */ - map(0xd00000, 0xd00001).nopw(); /* ??? */ + map(0xa00000, 0xa00001).w(FUNC(galpanic_state::coin_w)); // coin counters + map(0xb00000, 0xb00001).nopw(); // ??? + map(0xc00000, 0xc00001).nopw(); // ??? + map(0xd00000, 0xd00001).nopw(); // ??? } void galpanic_state::galpanica_map(address_map &map) { galpanic_map(map); - map(0xe00000, 0xe00015).rw("calc1_mcu", FUNC(kaneko_hit_device::kaneko_hit_r), FUNC(kaneko_hit_device::kaneko_hit_w)); + map(0xe00000, 0xe00015).rw("calc1", FUNC(kaneko_hit_device::kaneko_hit_r), FUNC(kaneko_hit_device::kaneko_hit_w)); } -void galpanic_state::galpanic_oki_map(address_map &map) +void galpanic_state::oki_map(address_map &map) { map(0x00000, 0x2ffff).rom(); - map(0x30000, 0x3ffff).bankr("okibank"); + map(0x30000, 0x3ffff).bankr(m_okibank); } static INPUT_PORTS_START( galpanic ) PORT_START("DSW1") PORT_DIPUNUSED_DIPLOC( 0x0001, 0x0001, "SW1:1" ) - PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:2") /* flip screen? - code at 0x000522 */ + PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:2") // flip screen? - code at 0x000522 PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_SERVICE_DIPLOC( 0x0004, IP_ACTIVE_LOW, "SW1:3" ) PORT_DIPUNUSED_DIPLOC( 0x0008, 0x0008, "SW1:4" ) COINAGE_WORLD - GALS_PANIC_JOYSTICK_4WAY(1) /* "Shot2" is shown in "test mode" but not used by the game */ + GALS_PANIC_JOYSTICK_4WAY(1) // "Shot2" is shown in "test mode" but not used by the game PORT_START("DSW2") PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") @@ -189,20 +302,20 @@ static INPUT_PORTS_START( galpanic ) PORT_DIPSETTING( 0x0030, "3" ) PORT_DIPSETTING( 0x0020, "4" ) PORT_DIPSETTING( 0x0000, "5" ) - PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7") /* demo sounds? - see notes */ + PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7") // demo sounds? - see notes PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_DIPNAME( 0x0080, 0x0080, "Character Test" ) PORT_DIPLOCATION("SW2:8") PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - GALS_PANIC_JOYSTICK_4WAY(2) /* "Shot2" is shown in "test mode" but not used by the game */ + GALS_PANIC_JOYSTICK_4WAY(2) // "Shot2" is shown in "test mode" but not used by the game SYSTEM_SERVICE INPUT_PORTS_END static INPUT_PORTS_START( galpanica ) PORT_START("DSW1") - COINAGE_TEST_LOC /* Unknown DSW switch 2 is flip screen? - code at 0x00060a */ + COINAGE_TEST_LOC // Unknown DSW switch 2 is flip screen? - code at 0x00060a GALS_PANIC_JOYSTICK_4WAY(1) PORT_START("DSW2") @@ -214,23 +327,23 @@ INPUT_PORTS_END static GFXDECODE_START( gfx_galpanic ) - GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_row_2x2_group_packed_msb, 256, 16 ) + GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_row_2x2_group_packed_msb, 256, 16 ) GFXDECODE_END void galpanic_state::galpanic(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, XTAL(12'000'000)); /* verified on pcb */ + // basic machine hardware + M68000(config, m_maincpu, XTAL(12'000'000)); // verified on PCB m_maincpu->set_addrmap(AS_PROGRAM, &galpanic_state::galpanic_map); TIMER(config, "scantimer").configure_scanline(FUNC(galpanic_state::scanline), "screen", 0, 1); WATCHDOG_TIMER(config, "watchdog"); - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(60); - m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0) /* frames per second, vblank duration */); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); // frames per second, vblank duration m_screen->set_size(256, 256); m_screen->set_visarea(0, 256-1, 0, 224-1); m_screen->set_screen_update(FUNC(galpanic_state::screen_update)); @@ -239,17 +352,17 @@ void galpanic_state::galpanic(machine_config &config) GFXDECODE(config, m_gfxdecode, m_palette, gfx_galpanic); // fg palette RAM, bit 0 seems to be a transparency flag for the front bitmap - PALETTE(config, m_palette, FUNC(galpanic_state::galpanic_palette)).set_format(palette_device::GRBx_555, 1024 + 32768); + PALETTE(config, m_palette, FUNC(galpanic_state::palette)).set_format(palette_device::GRBx_555, 1024 + 32768); KANEKO_PANDORA(config, m_pandora, 0); m_pandora->set_offsets(0, -16); m_pandora->set_gfxdecode_tag(m_gfxdecode); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - okim6295_device &oki(OKIM6295(config, "oki", XTAL(12'000'000)/6, okim6295_device::PIN7_LOW)); /* verified on pcb */ - oki.set_addrmap(0, &galpanic_state::galpanic_oki_map); + okim6295_device &oki(OKIM6295(config, "oki", XTAL(12'000'000) / 6, okim6295_device::PIN7_LOW)); // verified on PCB + oki.set_addrmap(0, &galpanic_state::oki_map); oki.add_route(ALL_OUTPUTS, "mono", 1.0); } @@ -259,11 +372,11 @@ void galpanic_state::galpanica(machine_config &config) galpanic(config); m_maincpu->set_addrmap(AS_PROGRAM, &galpanic_state::galpanica_map); - /* basic machine hardware */ - KANEKO_HIT(config, "calc1_mcu").set_type(0); + // basic machine hardware + KANEKO_HIT(config, "calc1").set_type(0); - /* arm watchdog */ - subdevice("watchdog")->set_time(attotime::from_seconds(3)); /* a guess, and certainly wrong */ + // arm watchdog + subdevice("watchdog")->set_time(attotime::from_seconds(3)); // a guess, and certainly wrong } @@ -273,12 +386,12 @@ void galpanic_state::galpanica(machine_config &config) ***************************************************************************/ -ROM_START( galpanic ) /* PAMERA-04 PCB with the PAMERA-SUB daughter card and unpopulated CALC1 MCU socket */ - ROM_REGION( 0x400000, "maincpu", 0 ) /* 68000 code */ +ROM_START( galpanic ) // PAMERA-04 PCB with the PAMERA-SUB daughter card and unpopulated CALC1 ULA socket + ROM_REGION( 0x400000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "pm110.4m2", 0x000000, 0x80000, CRC(ae6b17a8) SHA1(f3a625eef45cc85cdf9760f77ea7ce93387911f9) ) ROM_LOAD16_BYTE( "pm109.4m1", 0x000001, 0x80000, CRC(b85d792d) SHA1(0ed78e15f6e58285ce6944200b023ada1e673b0e) ) - ROM_LOAD16_BYTE( "pm112.subic6", 0x000000, 0x20000, CRC(7b972b58) SHA1(a7f619fca665b15f4f004ae739f5776ee2d4d432) ) /* Located on the PAMERA-SUB daughter card */ - ROM_LOAD16_BYTE( "pm111.subic5", 0x000001, 0x20000, CRC(4eb7298d) SHA1(8858a40ffefbe4ecea7d5b70311c3775b7d987eb) ) /* Located on the PAMERA-SUB daughter card */ + ROM_LOAD16_BYTE( "pm112.subic6", 0x000000, 0x20000, CRC(7b972b58) SHA1(a7f619fca665b15f4f004ae739f5776ee2d4d432) ) // Located on the PAMERA-SUB daughter card + ROM_LOAD16_BYTE( "pm111.subic5", 0x000001, 0x20000, CRC(4eb7298d) SHA1(8858a40ffefbe4ecea7d5b70311c3775b7d987eb) ) // Located on the PAMERA-SUB daughter card ROM_LOAD16_BYTE( "pm004e.8", 0x100001, 0x80000, CRC(d3af52bc) SHA1(46be057106388578defecab1cdd1793ec76ebe92) ) ROM_LOAD16_BYTE( "pm005e.7", 0x100000, 0x80000, CRC(d7ec650c) SHA1(6c2250c74381497154bf516e0cf1db6bb56bb446) ) ROM_LOAD16_BYTE( "pm000e.15", 0x200001, 0x80000, CRC(5d220f3f) SHA1(7ff373e01027c8832712f7a2d732f8e49b875878) ) @@ -286,17 +399,17 @@ ROM_START( galpanic ) /* PAMERA-04 PCB with the PAMERA-SUB daughter card and unp ROM_LOAD16_BYTE( "pm002e.17", 0x300001, 0x80000, CRC(713ee898) SHA1(c9f608a57fb90e5ee15eb76a74a7afcc406d5b4e) ) ROM_LOAD16_BYTE( "pm003e.16", 0x300000, 0x80000, CRC(6bb060fd) SHA1(4fc3946866c5a55e8340b62b5ad9beae723ce0da) ) - ROM_REGION( 0x100000, "gfx1", 0 ) /* sprites */ + ROM_REGION( 0x100000, "sprites", 0 ) ROM_LOAD( "pm006e.67", 0x000000, 0x100000, CRC(57aec037) SHA1(e6ba095b6892d4dcd76ba3343a97dd98ae29dc24) ) - ROM_REGION( 0x100000, "oki", 0 ) /* OKIM6295 samples */ - /* 00000-2ffff is fixed, 30000-3ffff is bank switched from all the ROMs */ + ROM_REGION( 0x100000, "oki", 0 ) + // 00000-2ffff is fixed, 30000-3ffff is bank switched from all the ROMs ROM_LOAD( "pm008e.l", 0x00000, 0x80000, CRC(d9379ba8) SHA1(5ae7c743319b1a12f2b101a9f0f8fe0728ed1476) ) ROM_LOAD( "pm007e.u", 0x80000, 0x80000, CRC(c7ed7950) SHA1(133258b058d3c562208d0d00b9fac71202647c32) ) ROM_END -ROM_START( galpanica ) /* PAMERA-04 PCB with the CALC1 MCU used */ - ROM_REGION( 0x400000, "maincpu", 0 ) /* 68000 code */ +ROM_START( galpanica ) // PAMERA-04 PCB with the CALC1 ULA used + ROM_REGION( 0x400000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "pm110.4m2", 0x000000, 0x80000, CRC(ae6b17a8) SHA1(f3a625eef45cc85cdf9760f77ea7ce93387911f9) ) ROM_LOAD16_BYTE( "pm109.4m1", 0x000001, 0x80000, CRC(b85d792d) SHA1(0ed78e15f6e58285ce6944200b023ada1e673b0e) ) ROM_LOAD16_BYTE( "pm004e.8", 0x100001, 0x80000, CRC(d3af52bc) SHA1(46be057106388578defecab1cdd1793ec76ebe92) ) @@ -306,17 +419,17 @@ ROM_START( galpanica ) /* PAMERA-04 PCB with the CALC1 MCU used */ ROM_LOAD16_BYTE( "pm002e.17", 0x300001, 0x80000, CRC(713ee898) SHA1(c9f608a57fb90e5ee15eb76a74a7afcc406d5b4e) ) ROM_LOAD16_BYTE( "pm003e.16", 0x300000, 0x80000, CRC(6bb060fd) SHA1(4fc3946866c5a55e8340b62b5ad9beae723ce0da) ) - ROM_REGION( 0x100000, "gfx1", 0 ) /* sprites */ + ROM_REGION( 0x100000, "sprites", 0 ) ROM_LOAD( "pm006e.67", 0x000000, 0x100000, CRC(57aec037) SHA1(e6ba095b6892d4dcd76ba3343a97dd98ae29dc24) ) - ROM_REGION( 0x100000, "oki", 0 ) /* OKIM6295 samples */ - /* 00000-2ffff is fixed, 30000-3ffff is bank switched from all the ROMs */ + ROM_REGION( 0x100000, "oki", 0 ) + // 00000-2ffff is fixed, 30000-3ffff is bank switched from all the ROMs ROM_LOAD( "pm008e.l", 0x00000, 0x80000, CRC(d9379ba8) SHA1(5ae7c743319b1a12f2b101a9f0f8fe0728ed1476) ) ROM_LOAD( "pm007e.u", 0x80000, 0x80000, CRC(c7ed7950) SHA1(133258b058d3c562208d0d00b9fac71202647c32) ) ROM_END -ROM_START( galpanicb ) /* PAMERA-04 PCB with the CALC1 MCU used */ - ROM_REGION( 0x400000, "maincpu", 0 ) /* 68000 code */ +ROM_START( galpanicb ) // PAMERA-04 PCB with the CALC1 ULA used + ROM_REGION( 0x400000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "pm109p.u88-01.ic6", 0x000000, 0x20000, CRC(a6d60dba) SHA1(2a63642709051c27b9a366c433127426bb579c35) ) // read as 27C010 ROM_LOAD16_BYTE( "pm110p.u87-01.ic5", 0x000001, 0x20000, CRC(3214fd48) SHA1(d8d77cb6b74caea2545f4e62eb9223aaf770785a) ) // read as 27C010 ROM_LOAD16_BYTE( "pm004e.8", 0x100001, 0x80000, CRC(d3af52bc) SHA1(46be057106388578defecab1cdd1793ec76ebe92) ) @@ -326,15 +439,18 @@ ROM_START( galpanicb ) /* PAMERA-04 PCB with the CALC1 MCU used */ ROM_LOAD16_BYTE( "pm002e.17", 0x300001, 0x80000, CRC(713ee898) SHA1(c9f608a57fb90e5ee15eb76a74a7afcc406d5b4e) ) ROM_LOAD16_BYTE( "pm003e.16", 0x300000, 0x80000, CRC(6bb060fd) SHA1(4fc3946866c5a55e8340b62b5ad9beae723ce0da) ) - ROM_REGION( 0x100000, "gfx1", 0 ) /* sprites */ + ROM_REGION( 0x100000, "sprites", 0 ) ROM_LOAD( "pm006e.67", 0x000000, 0x100000, CRC(57aec037) SHA1(e6ba095b6892d4dcd76ba3343a97dd98ae29dc24) ) - ROM_REGION( 0x100000, "oki", 0 ) /* OKIM6295 samples */ - /* 00000-2ffff is fixed, 30000-3ffff is bank switched from all the ROMs */ + ROM_REGION( 0x100000, "oki", 0 ) + // 00000-2ffff is fixed, 30000-3ffff is bank switched from all the ROMs ROM_LOAD( "pm008e.l", 0x00000, 0x80000, CRC(d9379ba8) SHA1(5ae7c743319b1a12f2b101a9f0f8fe0728ed1476) ) ROM_LOAD( "pm007e.u", 0x80000, 0x80000, CRC(c7ed7950) SHA1(133258b058d3c562208d0d00b9fac71202647c32) ) ROM_END -GAME( 1990, galpanic, 0, galpanic, galpanic, galpanic_state, empty_init, ROT90, "Kaneko", "Gals Panic (Unprotected)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -GAME( 1990, galpanica, galpanic, galpanica, galpanica, galpanic_state, empty_init, ROT90, "Kaneko", "Gals Panic (MCU Protected, set 1)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -GAME( 1990, galpanicb, galpanic, galpanica, galpanica, galpanic_state, empty_init, ROT90, "Kaneko", "Gals Panic (MCU Protected, set 2)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) +} // anonymous namespace + + +GAME( 1990, galpanic, 0, galpanic, galpanic, galpanic_state, empty_init, ROT90, "Kaneko", "Gals Panic (unprotected)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) +GAME( 1990, galpanica, galpanic, galpanica, galpanica, galpanic_state, empty_init, ROT90, "Kaneko", "Gals Panic (ULA protected, set 1)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) +GAME( 1990, galpanicb, galpanic, galpanica, galpanica, galpanic_state, empty_init, ROT90, "Kaneko", "Gals Panic (ULA protected, set 2)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/hcastle.cpp b/src/mame/drivers/hcastle.cpp index bfa39818725..4080af1d507 100644 --- a/src/mame/drivers/hcastle.cpp +++ b/src/mame/drivers/hcastle.cpp @@ -9,31 +9,292 @@ ***************************************************************************/ #include "emu.h" -#include "includes/hcastle.h" + #include "includes/konamipt.h" +#include "video/k007121.h" #include "cpu/m6809/konami.h" #include "cpu/z80/z80.h" #include "machine/gen_latch.h" #include "machine/watchdog.h" +#include "sound/k007232.h" #include "sound/k051649.h" #include "sound/ymopl.h" +#include "video/bufsprite.h" +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" -void hcastle_state::hcastle_bankswitch_w(uint8_t data) +namespace { + +class hcastle_state : public driver_device { - membank("bank1")->set_entry(data & 0x1f); +public: + hcastle_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_audiocpu(*this, "audiocpu"), + m_k007121(*this, "k007121_%u", 1U), + m_k007232(*this, "k007232"), + m_spriteram(*this, "spriteram%u", 1U), + m_pf_videoram(*this, "pf_videoram%u", 1U), + m_mainbank(*this, "mainbank") + { } + + void hcastle(machine_config &config); + +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_audiocpu; + required_device_array m_k007121; + required_device m_k007232; + required_device_array m_spriteram; + + // memory pointers + required_shared_ptr_array m_pf_videoram; + required_memory_bank m_mainbank; + + // video-related + tilemap_t *m_tilemap[2]{}; + uint16_t m_pf_bankbase[2]{}; + int32_t m_old_pf[2]{}; + uint8_t m_gfx_bank = 0; + + void bankswitch_w(uint8_t data); + void soundirq_w(uint8_t data); + void coin_w(uint8_t data); + void gfxbank_w(uint8_t data); + uint8_t gfxbank_r(); + void sound_bank_w(uint8_t data); + template void pf_video_w(offs_t offset, uint8_t data); + template void pf_control_w(offs_t offset, uint8_t data); + template TILE_GET_INFO_MEMBER(get_tile_info); + TILEMAP_MAPPER_MEMBER(tilemap_scan); + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + template void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, uint8_t *sbank); + void volume_callback(uint8_t data); + + void main_map(address_map &map); + void sound_map(address_map &map); +}; + + +// video + +void hcastle_state::palette(palette_device &palette) const +{ + uint8_t const *const color_prom = memregion("proms")->base(); + for (int chip = 0; chip < 2; chip++) + { + for (int pal = 0; pal < 8; pal++) + { + int const clut = (chip << 1) | (pal & 1); + + for (int i = 0; i < 0x100; i++) + { + uint8_t ctabentry; + + if (((pal & 0x01) == 0) && (color_prom[(clut << 8) | i] == 0)) + ctabentry = 0; + else + ctabentry = (pal << 4) | (color_prom[(clut << 8) | i] & 0x0f); + + palette.set_pen_indirect((chip << 11) | (pal << 8) | i, ctabentry); + } + } + } } -void hcastle_state::hcastle_soundirq_w(uint8_t data) + + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILEMAP_MAPPER_MEMBER(hcastle_state::tilemap_scan) +{ + // logical (col,row) -> memory offset + return (col & 0x1f) + ((row & 0x1f) << 5) + ((col & 0x20) << 6); // skip 0x400 +} + +template // 0 = FG, 1 = BG +TILE_GET_INFO_MEMBER(hcastle_state::get_tile_info) +{ + uint8_t ctrl_5 = m_k007121[Which]->ctrlram_r(5); + uint8_t ctrl_6 = m_k007121[Which]->ctrlram_r(6); + 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 attr = m_pf_videoram[Which][tile_index]; + int tile = m_pf_videoram[Which][tile_index + 0x400]; + int color = attr & 0x7; + int bank = ((attr & 0x80) >> 7) | + ((attr >> (bit0 + 2)) & 0x02) | + ((attr >> (bit1 + 1)) & 0x04) | + ((attr >> (bit2 )) & 0x08) | + ((attr >> (bit3 - 1)) & 0x10); + + tileinfo.set(Which, + tile + bank * 0x100 + m_pf_bankbase[Which], + ((ctrl_6 & 0x30) * 2 + 16) + color, + 0); +} + + + +/*************************************************************************** + + Start the video hardware emulation. + +***************************************************************************/ + +void hcastle_state::video_start() +{ + // 0 = FG, 1 = BG + m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(hcastle_state::get_tile_info<0>)), tilemap_mapper_delegate(*this, FUNC(hcastle_state::tilemap_scan)), 8, 8, 64, 32); + m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(hcastle_state::get_tile_info<1>)), tilemap_mapper_delegate(*this, FUNC(hcastle_state::tilemap_scan)), 8, 8, 64, 32); + + m_tilemap[0]->set_transparent_pen(0); +} + + + +/*************************************************************************** + + Memory handlers + +***************************************************************************/ + +template // 0 = FG, 1 = BG +void hcastle_state::pf_video_w(offs_t offset, uint8_t data) +{ + m_pf_videoram[Which][offset] = data; + m_tilemap[Which]->mark_tile_dirty(offset & 0xbff); +} + +void hcastle_state::gfxbank_w(uint8_t data) +{ + m_gfx_bank = data; +} + +uint8_t hcastle_state::gfxbank_r() +{ + return m_gfx_bank; +} + +template // 0 = FG, 1 = BG +void hcastle_state::pf_control_w(offs_t offset, uint8_t data) +{ + if (offset == 3) + { + if ((data & 0x8) == 0) + m_spriteram[Which]->copy(0x800, 0x800); + else + m_spriteram[Which]->copy(0x000, 0x800); + } + else if (offset == 7) + { + m_tilemap[Which]->set_flip((data & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); + } + m_k007121[Which]->ctrl_w(offset, data); +} + +/*****************************************************************************/ + +template // 0 = FG, 1 = BG +void hcastle_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, uint8_t *sbank) +{ + int base_color = (m_k007121[Which]->ctrlram_r(6) & 0x30) * 2; + int bank_base = (Which == 0) ? 0x4000 * (m_gfx_bank & 1) : 0; + + m_k007121[Which]->sprites_draw(bitmap, cliprect, m_gfxdecode->gfx(Which), *m_palette, sbank, base_color, 0, bank_base, priority_bitmap, (uint32_t)-1); +} + +/*****************************************************************************/ + +uint32_t hcastle_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + uint8_t ctrl_1_0 = m_k007121[0]->ctrlram_r(0); + uint8_t ctrl_1_1 = m_k007121[0]->ctrlram_r(1); + uint8_t ctrl_1_2 = m_k007121[0]->ctrlram_r(2); + uint8_t ctrl_1_3 = m_k007121[0]->ctrlram_r(3); + uint8_t ctrl_2_0 = m_k007121[1]->ctrlram_r(0); + uint8_t ctrl_2_1 = m_k007121[1]->ctrlram_r(1); + uint8_t ctrl_2_2 = m_k007121[1]->ctrlram_r(2); + uint8_t ctrl_2_3 = m_k007121[1]->ctrlram_r(3); + + m_pf_bankbase[0] = 0x0000; + m_pf_bankbase[1] = 0x4000 * ((m_gfx_bank & 2) >> 1); + + if (ctrl_1_3 & 0x01) + m_pf_bankbase[0] += 0x2000; + if (ctrl_2_3 & 0x01) + m_pf_bankbase[1] += 0x2000; + + if (m_pf_bankbase[0] != m_old_pf[0]) + m_tilemap[0]->mark_all_dirty(); + + if (m_pf_bankbase[1] != m_old_pf[1]) + m_tilemap[1]->mark_all_dirty(); + + m_old_pf[0] = m_pf_bankbase[0]; + m_old_pf[1] = m_pf_bankbase[1]; + + m_tilemap[1]->set_scrolly(0, ctrl_2_2); + m_tilemap[1]->set_scrollx(0, ((ctrl_2_1 << 8) + ctrl_2_0)); + m_tilemap[0]->set_scrolly(0, ctrl_1_2); + m_tilemap[0]->set_scrollx(0, ((ctrl_1_1 << 8) + ctrl_1_0)); + +// Sprite priority +// if (ctrl_1_3 & 0x20) + if ((m_gfx_bank & 0x04) == 0) + { + m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites<0>(bitmap, cliprect, screen.priority(), m_spriteram[0]->buffer()); + draw_sprites<1>(bitmap, cliprect, screen.priority(), m_spriteram[1]->buffer()); + m_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0); + } + else + { + m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); + m_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites<0>(bitmap, cliprect, screen.priority(), m_spriteram[0]->buffer()); + draw_sprites<1>(bitmap, cliprect, screen.priority(), m_spriteram[1]->buffer()); + } + return 0; +} + + +// machine + +void hcastle_state::bankswitch_w(uint8_t data) +{ + m_mainbank->set_entry(data & 0x1f); +} + +void hcastle_state::soundirq_w(uint8_t data) { m_audiocpu->set_input_line(0, HOLD_LINE); } -void hcastle_state::hcastle_coin_w(uint8_t data) +void hcastle_state::coin_w(uint8_t data) { machine().bookkeeping().coin_counter_w(0, data & 0x40); machine().bookkeeping().coin_counter_w(1, data & 0x80); @@ -41,30 +302,30 @@ void hcastle_state::hcastle_coin_w(uint8_t data) -void hcastle_state::hcastle_map(address_map &map) +void hcastle_state::main_map(address_map &map) { - map(0x0000, 0x0007).w(FUNC(hcastle_state::hcastle_pf1_control_w)); - map(0x0020, 0x003f).ram(); /* rowscroll? */ - map(0x0200, 0x0207).w(FUNC(hcastle_state::hcastle_pf2_control_w)); - map(0x0220, 0x023f).ram(); /* rowscroll? */ - map(0x0400, 0x0400).w(FUNC(hcastle_state::hcastle_bankswitch_w)); + map(0x0000, 0x0007).w(FUNC(hcastle_state::pf_control_w<0>)); + map(0x0020, 0x003f).ram(); // rowscroll? + map(0x0200, 0x0207).w(FUNC(hcastle_state::pf_control_w<1>)); + map(0x0220, 0x023f).ram(); // rowscroll? + map(0x0400, 0x0400).w(FUNC(hcastle_state::bankswitch_w)); map(0x0404, 0x0404).w("soundlatch", FUNC(generic_latch_8_device::write)); - map(0x0408, 0x0408).w(FUNC(hcastle_state::hcastle_soundirq_w)); + map(0x0408, 0x0408).w(FUNC(hcastle_state::soundirq_w)); map(0x040c, 0x040c).w("watchdog", FUNC(watchdog_timer_device::reset_w)); - map(0x0410, 0x0410).portr("SYSTEM").w(FUNC(hcastle_state::hcastle_coin_w)); + map(0x0410, 0x0410).portr("SYSTEM").w(FUNC(hcastle_state::coin_w)); map(0x0411, 0x0411).portr("P1"); map(0x0412, 0x0412).portr("P2"); map(0x0413, 0x0413).portr("DSW3"); map(0x0414, 0x0414).portr("DSW1"); map(0x0415, 0x0415).portr("DSW2"); - map(0x0418, 0x0418).rw(FUNC(hcastle_state::hcastle_gfxbank_r), FUNC(hcastle_state::hcastle_gfxbank_w)); + map(0x0418, 0x0418).rw(FUNC(hcastle_state::gfxbank_r), FUNC(hcastle_state::gfxbank_w)); map(0x0600, 0x06ff).ram().w(m_palette, FUNC(palette_device::write_indirect)).share("palette"); map(0x0700, 0x1fff).ram(); - map(0x2000, 0x2fff).ram().w(FUNC(hcastle_state::hcastle_pf1_video_w)).share("pf1_videoram"); - map(0x3000, 0x3fff).ram().share("spriteram"); - map(0x4000, 0x4fff).ram().w(FUNC(hcastle_state::hcastle_pf2_video_w)).share("pf2_videoram"); + map(0x2000, 0x2fff).ram().w(FUNC(hcastle_state::pf_video_w<0>)).share(m_pf_videoram[0]); + map(0x3000, 0x3fff).ram().share("spriteram1"); + map(0x4000, 0x4fff).ram().w(FUNC(hcastle_state::pf_video_w<1>)).share(m_pf_videoram[1]); map(0x5000, 0x5fff).ram().share("spriteram2"); - map(0x6000, 0x7fff).bankr("bank1"); + map(0x6000, 0x7fff).bankr(m_mainbank); map(0x8000, 0xffff).rom(); } @@ -72,9 +333,9 @@ void hcastle_state::hcastle_map(address_map &map) void hcastle_state::sound_bank_w(uint8_t data) { - int bank_A=(data&0x3); - int bank_B=((data>>2)&0x3); - m_k007232->set_bank(bank_A, bank_B ); + int bank_a = data & 0x3; + int bank_b = (data >> 2) & 0x3; + m_k007232->set_bank(bank_a, bank_b); } void hcastle_state::sound_map(address_map &map) @@ -84,7 +345,7 @@ void hcastle_state::sound_map(address_map &map) map(0x9800, 0x98ff).m("k051649", FUNC(k051649_device::scc_map)); map(0xa000, 0xa001).rw("ymsnd", FUNC(ym3812_device::read), FUNC(ym3812_device::write)); map(0xb000, 0xb00d).rw(m_k007232, FUNC(k007232_device::read), FUNC(k007232_device::write)); - map(0xc000, 0xc000).w(FUNC(hcastle_state::sound_bank_w)); /* 7232 bankswitch */ + map(0xc000, 0xc000).w(FUNC(hcastle_state::sound_bank_w)); // 7232 bankswitch map(0xd000, 0xd000).r("soundlatch", FUNC(generic_latch_8_device::read)); } @@ -102,24 +363,24 @@ static INPUT_PORTS_START( hcastle ) PORT_START("DSW1") KONAMI_COINAGE_LOC(DEF_STR( Free_Play ), "Invalid", SW1) - /* "Invalid" = both coin slots disabled */ + // "Invalid" = both coin slots disabled PORT_START("DSW2") - PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW2:1" ) /* Listed as "Unused" */ - PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW2:2" ) /* Listed as "Unused" */ + PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW2:1" ) // Listed as "Unused" + PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW2:2" ) // Listed as "Unused" PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:3") PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x04, DEF_STR( Cocktail ) ) - PORT_DIPNAME( 0x18, 0x10, "Difficulty 1 (Game)" ) PORT_DIPLOCATION("SW2:4,5") /* Overall difficulty of game */ + PORT_DIPNAME( 0x18, 0x10, "Difficulty 1 (Game)" ) PORT_DIPLOCATION("SW2:4,5") // Overall difficulty of game PORT_DIPSETTING( 0x18, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x10, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x08, DEF_STR( Difficult ) ) PORT_DIPSETTING( 0x00, DEF_STR( Very_Difficult ) ) - PORT_DIPNAME( 0x60, 0x40, "Difficulty 2 (Strength)" ) PORT_DIPLOCATION("SW2:6,7") /* Listed in manual as "Strength of Player" */ - PORT_DIPSETTING( 0x00, "Very Weak" ) /* Takes most damage per hit */ - PORT_DIPSETTING( 0x20, "Weak" ) /* Takes more damage per hit */ - PORT_DIPSETTING( 0x40, DEF_STR( Normal ) ) /* Takes average damage per hit */ - PORT_DIPSETTING( 0x60, "Strong" ) /* Takes least damage per hit */ + PORT_DIPNAME( 0x60, 0x40, "Difficulty 2 (Strength)" ) PORT_DIPLOCATION("SW2:6,7") // Listed in manual as "Strength of Player" + PORT_DIPSETTING( 0x00, "Very Weak" ) // Takes most damage per hit + PORT_DIPSETTING( 0x20, "Weak" ) // Takes more damage per hit + PORT_DIPSETTING( 0x40, DEF_STR( Normal ) ) // Takes average damage per hit + PORT_DIPSETTING( 0x60, "Strong" ) // Takes least damage per hit PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) @@ -152,8 +413,8 @@ static const gfx_layout charlayout = }; static GFXDECODE_START( gfx_hcastle ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 8*16 ) /* 007121 #0 */ - GFXDECODE_ENTRY( "gfx2", 0, charlayout, 8*16*16, 8*16 ) /* 007121 #1 */ + GFXDECODE_ENTRY( "k007121_1", 0, charlayout, 0, 8*16 ) + GFXDECODE_ENTRY( "k007121_2", 0, charlayout, 8*16*16, 8*16 ) GFXDECODE_END /*****************************************************************************/ @@ -166,31 +427,29 @@ void hcastle_state::volume_callback(uint8_t data) void hcastle_state::machine_start() { - uint8_t *ROM = memregion("maincpu")->base(); + uint8_t *rom = memregion("maincpu")->base(); - membank("bank1")->configure_entries(0, 16, &ROM[0x10000], 0x2000); + m_mainbank->configure_entries(0, 16, &rom[0x10000], 0x2000); - save_item(NAME(m_pf2_bankbase)); - save_item(NAME(m_pf1_bankbase)); + save_item(NAME(m_pf_bankbase)); save_item(NAME(m_gfx_bank)); - save_item(NAME(m_old_pf1)); - save_item(NAME(m_old_pf2)); + save_item(NAME(m_old_pf)); } void hcastle_state::machine_reset() { - m_pf2_bankbase = 0; - m_pf1_bankbase = 0; + m_pf_bankbase[1] = 0; + m_pf_bankbase[0] = 0; m_gfx_bank = 0; - m_old_pf1 = -1; - m_old_pf2 = -1; + m_old_pf[0] = -1; + m_old_pf[1] = -1; } void hcastle_state::hcastle(machine_config &config) { - /* basic machine hardware */ - KONAMI(config, m_maincpu, 3000000); /* Derived from 24 MHz clock */ - m_maincpu->set_addrmap(AS_PROGRAM, &hcastle_state::hcastle_map); + // basic machine hardware + KONAMI(config, m_maincpu, 3000000); // Derived from 24 MHz clock + m_maincpu->set_addrmap(AS_PROGRAM, &hcastle_state::main_map); m_maincpu->set_vblank_int("screen", FUNC(hcastle_state::irq0_line_hold)); Z80(config, m_audiocpu, 3579545); @@ -198,27 +457,27 @@ void hcastle_state::hcastle(machine_config &config) WATCHDOG_TIMER(config, "watchdog"); - /* video hardware */ - BUFFERED_SPRITERAM8(config, m_spriteram); - BUFFERED_SPRITERAM8(config, m_spriteram2); + // video hardware + BUFFERED_SPRITERAM8(config, m_spriteram[0]); + BUFFERED_SPRITERAM8(config, m_spriteram[1]); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(59); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); /* frames per second verified by comparison with real board */ + screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); // frames per second verified by comparison with real board 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(hcastle_state::screen_update_hcastle)); + screen.set_screen_update(FUNC(hcastle_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_hcastle); - PALETTE(config, m_palette, FUNC(hcastle_state::hcastle_palette)).set_format(palette_device::xBGR_555, 2*8*16*16, 128); + PALETTE(config, m_palette, FUNC(hcastle_state::palette)).set_format(palette_device::xBGR_555, 2*8*16*16, 128); - K007121(config, m_k007121_1, 0); - m_k007121_1->set_palette_tag(m_palette); - K007121(config, m_k007121_2, 0); - m_k007121_2->set_palette_tag(m_palette); + K007121(config, m_k007121[0], 0); + m_k007121[0]->set_palette_tag(m_palette); + K007121(config, m_k007121[1], 0); + m_k007121[1]->set_palette_tag(m_palette); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, "soundlatch"); @@ -229,7 +488,7 @@ void hcastle_state::hcastle(machine_config &config) m_k007232->add_route(1, "mono", 0.50); ym3812_device &ymsnd(YM3812(config, "ymsnd", 3579545)); - ymsnd.irq_handler().set_inputline("audiocpu", INPUT_LINE_NMI); /* from schematic; NMI handler is just a retn */ + ymsnd.irq_handler().set_inputline("audiocpu", INPUT_LINE_NMI); // from schematic; NMI handler is just a retn ymsnd.add_route(ALL_OUTPUTS, "mono", 0.70); K051649(config, "k051649", 3579545).add_route(ALL_OUTPUTS, "mono", 0.45); @@ -245,22 +504,22 @@ ROM_START( hcastle ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "768e01.e4", 0x00000, 0x08000, CRC(b9fff184) SHA1(c55f468c0da6afdaa2af65a111583c0c42868bd1) ) - ROM_REGION( 0x100000, "gfx1", 0 ) + ROM_REGION( 0x100000, "k007121_1", 0 ) // chars and sprites ROM_LOAD( "768c09.g21", 0x000000, 0x80000, CRC(e3be3fdd) SHA1(01a686af33a0a700066b1a5334d8552454ff186f) ) ROM_LOAD( "768c08.g19", 0x080000, 0x80000, CRC(9633db8b) SHA1(fe1b117c2566288b88f000106c649c2fa5648ddc) ) - ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_REGION( 0x100000, "k007121_2", 0 ) // chars and sprites ROM_LOAD( "768c04.j5", 0x000000, 0x80000, CRC(2960680e) SHA1(72e1f025496c907de8516e3b5f1781e73d5b2c6c) ) ROM_LOAD( "768c05.j6", 0x080000, 0x80000, CRC(65a2f227) SHA1(43f368e533d6a164dc68d54130b81883e0d1bafe) ) ROM_REGION( 0x0500, "proms", 0 ) - ROM_LOAD( "768c13.j21", 0x0000, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) /* 007121 #0 sprite lookup table */ - ROM_LOAD( "768c14.j22", 0x0100, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) /* 007121 #0 char lookup table */ - ROM_LOAD( "768c11.i4", 0x0200, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) /* 007121 #1 sprite lookup table (same) */ - ROM_LOAD( "768c10.i3", 0x0300, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) /* 007121 #1 char lookup table (same) */ - ROM_LOAD( "768b12.d20", 0x0400, 0x0100, CRC(362544b8) SHA1(744c8d2ccfa980fc9a7354b4d241c569b3c1fffe) ) /* priority encoder (not used) */ + ROM_LOAD( "768c13.j21", 0x0000, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) // 007121 #0 sprite lookup table + ROM_LOAD( "768c14.j22", 0x0100, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) // 007121 #0 char lookup table + ROM_LOAD( "768c11.i4", 0x0200, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) // 007121 #1 sprite lookup table (same) + ROM_LOAD( "768c10.i3", 0x0300, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) // 007121 #1 char lookup table (same) + ROM_LOAD( "768b12.d20", 0x0400, 0x0100, CRC(362544b8) SHA1(744c8d2ccfa980fc9a7354b4d241c569b3c1fffe) ) // priority encoder (not used) - ROM_REGION( 0x80000, "k007232", 0 ) /* 512k for the samples */ + ROM_REGION( 0x80000, "k007232", 0 ) // samples ROM_LOAD( "768c07.e17", 0x00000, 0x80000, CRC(01f9889c) SHA1(01252d2ce7b14cfbe39ac8d7a5bd7417f1c2fc22) ) ROM_END @@ -272,22 +531,22 @@ ROM_START( hcastlek ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "768e01.e4", 0x00000, 0x08000, CRC(b9fff184) SHA1(c55f468c0da6afdaa2af65a111583c0c42868bd1) ) - ROM_REGION( 0x100000, "gfx1", 0 ) + ROM_REGION( 0x100000, "k007121_1", 0 ) // chars and sprites ROM_LOAD( "768c09.g21", 0x000000, 0x80000, CRC(e3be3fdd) SHA1(01a686af33a0a700066b1a5334d8552454ff186f) ) ROM_LOAD( "768c08.g19", 0x080000, 0x80000, CRC(9633db8b) SHA1(fe1b117c2566288b88f000106c649c2fa5648ddc) ) - ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_REGION( 0x100000, "k007121_2", 0 ) // chars and sprites ROM_LOAD( "768c04.j5", 0x000000, 0x80000, CRC(2960680e) SHA1(72e1f025496c907de8516e3b5f1781e73d5b2c6c) ) ROM_LOAD( "768c05.j6", 0x080000, 0x80000, CRC(65a2f227) SHA1(43f368e533d6a164dc68d54130b81883e0d1bafe) ) ROM_REGION( 0x0500, "proms", 0 ) - ROM_LOAD( "768c13.j21", 0x0000, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) /* 007121 #0 sprite lookup table */ - ROM_LOAD( "768c14.j22", 0x0100, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) /* 007121 #0 char lookup table */ - ROM_LOAD( "768c11.i4", 0x0200, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) /* 007121 #1 sprite lookup table (same) */ - ROM_LOAD( "768c10.i3", 0x0300, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) /* 007121 #1 char lookup table (same) */ - ROM_LOAD( "768b12.d20", 0x0400, 0x0100, CRC(362544b8) SHA1(744c8d2ccfa980fc9a7354b4d241c569b3c1fffe) ) /* priority encoder (not used) */ + ROM_LOAD( "768c13.j21", 0x0000, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) // 007121 #0 sprite lookup table + ROM_LOAD( "768c14.j22", 0x0100, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) // 007121 #0 char lookup table + ROM_LOAD( "768c11.i4", 0x0200, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) // 007121 #1 sprite lookup table (same) + ROM_LOAD( "768c10.i3", 0x0300, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) // 007121 #1 char lookup table (same) + ROM_LOAD( "768b12.d20", 0x0400, 0x0100, CRC(362544b8) SHA1(744c8d2ccfa980fc9a7354b4d241c569b3c1fffe) ) // priority encoder (not used) - ROM_REGION( 0x80000, "k007232", 0 ) /* 512k for the samples */ + ROM_REGION( 0x80000, "k007232", 0 ) // samples ROM_LOAD( "768c07.e17", 0x00000, 0x80000, CRC(01f9889c) SHA1(01252d2ce7b14cfbe39ac8d7a5bd7417f1c2fc22) ) ROM_END @@ -299,22 +558,22 @@ ROM_START( hcastlee ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "768e01.e4", 0x00000, 0x08000, CRC(b9fff184) SHA1(c55f468c0da6afdaa2af65a111583c0c42868bd1) ) - ROM_REGION( 0x100000, "gfx1", 0 ) + ROM_REGION( 0x100000, "k007121_1", 0 ) // chars and sprites ROM_LOAD( "768c09.g21", 0x000000, 0x80000, CRC(e3be3fdd) SHA1(01a686af33a0a700066b1a5334d8552454ff186f) ) ROM_LOAD( "768c08.g19", 0x080000, 0x80000, CRC(9633db8b) SHA1(fe1b117c2566288b88f000106c649c2fa5648ddc) ) - ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_REGION( 0x100000, "k007121_2", 0 ) // chars and sprites ROM_LOAD( "768c04.j5", 0x000000, 0x80000, CRC(2960680e) SHA1(72e1f025496c907de8516e3b5f1781e73d5b2c6c) ) ROM_LOAD( "768c05.j6", 0x080000, 0x80000, CRC(65a2f227) SHA1(43f368e533d6a164dc68d54130b81883e0d1bafe) ) ROM_REGION( 0x0500, "proms", 0 ) - ROM_LOAD( "768c13.j21", 0x0000, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) /* 007121 #0 sprite lookup table */ - ROM_LOAD( "768c14.j22", 0x0100, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) /* 007121 #0 char lookup table */ - ROM_LOAD( "768c11.i4", 0x0200, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) /* 007121 #1 sprite lookup table (same) */ - ROM_LOAD( "768c10.i3", 0x0300, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) /* 007121 #1 char lookup table (same) */ - ROM_LOAD( "768b12.d20", 0x0400, 0x0100, CRC(362544b8) SHA1(744c8d2ccfa980fc9a7354b4d241c569b3c1fffe) ) /* priority encoder (not used) */ + ROM_LOAD( "768c13.j21", 0x0000, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) // 007121 #0 sprite lookup table + ROM_LOAD( "768c14.j22", 0x0100, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) // 007121 #0 char lookup table + ROM_LOAD( "768c11.i4", 0x0200, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) // 007121 #1 sprite lookup table (same) + ROM_LOAD( "768c10.i3", 0x0300, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) // 007121 #1 char lookup table (same) + ROM_LOAD( "768b12.d20", 0x0400, 0x0100, CRC(362544b8) SHA1(744c8d2ccfa980fc9a7354b4d241c569b3c1fffe) ) // priority encoder (not used) - ROM_REGION( 0x80000, "k007232", 0 ) /* 512k for the samples */ + ROM_REGION( 0x80000, "k007232", 0 ) // samples ROM_LOAD( "768c07.e17", 0x00000, 0x80000, CRC(01f9889c) SHA1(01252d2ce7b14cfbe39ac8d7a5bd7417f1c2fc22) ) ROM_END @@ -326,22 +585,22 @@ ROM_START( akumajou ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "768e01.e4", 0x00000, 0x08000, CRC(b9fff184) SHA1(c55f468c0da6afdaa2af65a111583c0c42868bd1) ) - ROM_REGION( 0x100000, "gfx1", 0 ) + ROM_REGION( 0x100000, "k007121_1", 0 ) // chars and sprites ROM_LOAD( "768c09.g21", 0x000000, 0x80000, CRC(e3be3fdd) SHA1(01a686af33a0a700066b1a5334d8552454ff186f) ) ROM_LOAD( "768c08.g19", 0x080000, 0x80000, CRC(9633db8b) SHA1(fe1b117c2566288b88f000106c649c2fa5648ddc) ) - ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_REGION( 0x100000, "k007121_2", 0 ) // chars and sprites ROM_LOAD( "768c04.j5", 0x000000, 0x80000, CRC(2960680e) SHA1(72e1f025496c907de8516e3b5f1781e73d5b2c6c) ) ROM_LOAD( "768c05.j6", 0x080000, 0x80000, CRC(65a2f227) SHA1(43f368e533d6a164dc68d54130b81883e0d1bafe) ) ROM_REGION( 0x0500, "proms", 0 ) - ROM_LOAD( "768c13.j21", 0x0000, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) /* 007121 #0 sprite lookup table */ - ROM_LOAD( "768c14.j22", 0x0100, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) /* 007121 #0 char lookup table */ - ROM_LOAD( "768c11.i4", 0x0200, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) /* 007121 #1 sprite lookup table (same) */ - ROM_LOAD( "768c10.i3", 0x0300, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) /* 007121 #1 char lookup table (same) */ - ROM_LOAD( "768b12.d20", 0x0400, 0x0100, CRC(362544b8) SHA1(744c8d2ccfa980fc9a7354b4d241c569b3c1fffe) ) /* priority encoder (not used) */ + ROM_LOAD( "768c13.j21", 0x0000, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) // 007121 #0 sprite lookup table + ROM_LOAD( "768c14.j22", 0x0100, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) // 007121 #0 char lookup table + ROM_LOAD( "768c11.i4", 0x0200, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) // 007121 #1 sprite lookup table (same) + ROM_LOAD( "768c10.i3", 0x0300, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) // 007121 #1 char lookup table (same) + ROM_LOAD( "768b12.d20", 0x0400, 0x0100, CRC(362544b8) SHA1(744c8d2ccfa980fc9a7354b4d241c569b3c1fffe) ) // priority encoder (not used) - ROM_REGION( 0x80000, "k007232", 0 ) /* 512k for the samples */ + ROM_REGION( 0x80000, "k007232", 0 ) // samples ROM_LOAD( "768c07.e17", 0x00000, 0x80000, CRC(01f9889c) SHA1(01252d2ce7b14cfbe39ac8d7a5bd7417f1c2fc22) ) ROM_END @@ -353,25 +612,26 @@ ROM_START( akumajoun ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "768e01.e4", 0x00000, 0x08000, CRC(b9fff184) SHA1(c55f468c0da6afdaa2af65a111583c0c42868bd1) ) - ROM_REGION( 0x100000, "gfx1", 0 ) + ROM_REGION( 0x100000, "k007121_1", 0 ) // chars and sprites ROM_LOAD( "768c09.g21", 0x000000, 0x80000, CRC(e3be3fdd) SHA1(01a686af33a0a700066b1a5334d8552454ff186f) ) ROM_LOAD( "768c08.g19", 0x080000, 0x80000, CRC(9633db8b) SHA1(fe1b117c2566288b88f000106c649c2fa5648ddc) ) - ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_REGION( 0x100000, "k007121_2", 0 ) // chars and sprites ROM_LOAD( "768c04.j5", 0x000000, 0x80000, CRC(2960680e) SHA1(72e1f025496c907de8516e3b5f1781e73d5b2c6c) ) ROM_LOAD( "768c05.j6", 0x080000, 0x80000, CRC(65a2f227) SHA1(43f368e533d6a164dc68d54130b81883e0d1bafe) ) ROM_REGION( 0x0500, "proms", 0 ) - ROM_LOAD( "768c13.j21", 0x0000, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) /* 007121 #0 sprite lookup table */ - ROM_LOAD( "768c14.j22", 0x0100, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) /* 007121 #0 char lookup table */ - ROM_LOAD( "768c11.i4", 0x0200, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) /* 007121 #1 sprite lookup table (same) */ - ROM_LOAD( "768c10.i3", 0x0300, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) /* 007121 #1 char lookup table (same) */ - ROM_LOAD( "768b12.d20", 0x0400, 0x0100, CRC(362544b8) SHA1(744c8d2ccfa980fc9a7354b4d241c569b3c1fffe) ) /* priority encoder (not used) */ + ROM_LOAD( "768c13.j21", 0x0000, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) // 007121 #0 sprite lookup table + ROM_LOAD( "768c14.j22", 0x0100, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) // 007121 #0 char lookup table + ROM_LOAD( "768c11.i4", 0x0200, 0x0100, CRC(f5de80cb) SHA1(e8cc3e14a5d23b25fb7bf790e64786c6aa2df8b7) ) // 007121 #1 sprite lookup table (same) + ROM_LOAD( "768c10.i3", 0x0300, 0x0100, CRC(b32071b7) SHA1(09a699a3f20c155eae1e63429f03ed91abc54784) ) // 007121 #1 char lookup table (same) + ROM_LOAD( "768b12.d20", 0x0400, 0x0100, CRC(362544b8) SHA1(744c8d2ccfa980fc9a7354b4d241c569b3c1fffe) ) // priority encoder (not used) - ROM_REGION( 0x80000, "k007232", 0 ) /* 512k for the samples */ + ROM_REGION( 0x80000, "k007232", 0 ) // samples ROM_LOAD( "768c07.e17", 0x00000, 0x80000, CRC(01f9889c) SHA1(01252d2ce7b14cfbe39ac8d7a5bd7417f1c2fc22) ) ROM_END +} // anonymous namespace GAME( 1988, hcastle, 0, hcastle, hcastle, hcastle_state, empty_init, ROT0, "Konami", "Haunted Castle (version M)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/tbowl.cpp b/src/mame/drivers/tbowl.cpp index 24933082829..6bb2b389a1a 100644 --- a/src/mame/drivers/tbowl.cpp +++ b/src/mame/drivers/tbowl.cpp @@ -15,16 +15,220 @@ Might be some priority glitches ***/ #include "emu.h" -#include "includes/tbowl.h" + +#include "video/tecmo_spr.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" +#include "sound/msm5205.h" #include "sound/ymopl.h" +#include "emupal.h" #include "layout/generic.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" +namespace { + +class tbowl_state : public driver_device +{ +public: + tbowl_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%u", 1U), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_sprgen(*this, "spritegen"), + m_soundlatch(*this, "soundlatch"), + m_txvideoram(*this, "txvideoram"), + m_bgvideoram(*this, "bgvideoram%u", 1U), + m_spriteram(*this, "spriteram"), + m_mainbank(*this, "mainbank"), + m_subbank(*this, "subbank"), + m_adpcm_rom(*this, "adpcm") + { } + + void tbowl(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + required_device m_maincpu; + required_device m_audiocpu; + required_device_array m_msm; + required_device m_gfxdecode; + required_device m_palette; + required_device m_sprgen; + required_device m_soundlatch; + + required_shared_ptr m_txvideoram; + required_shared_ptr_array m_bgvideoram; + required_shared_ptr m_spriteram; + required_memory_bank m_mainbank; + required_memory_bank m_subbank; + required_region_ptr m_adpcm_rom; + + tilemap_t *m_tx_tilemap = nullptr; + tilemap_t *m_bg_tilemap[2]{}; + uint16_t m_bgxscroll[2]{}; + uint16_t m_bgyscroll[2]{}; + uint16_t m_adpcm_pos[2]{}; + uint32_t m_adpcm_end[2]{}; + int16_t m_adpcm_data[2]{}; + + void coincounter_w(uint8_t data); + void boardb_bankswitch_w(uint8_t data); + void boardc_bankswitch_w(uint8_t data); + void trigger_nmi(uint8_t data); + template void adpcm_start_w(uint8_t data); + template void adpcm_end_w(uint8_t data); + template void adpcm_vol_w(uint8_t data); + void txvideoram_w(offs_t offset, uint8_t data); + template void bgvideoram_w(offs_t offset, uint8_t data); + template void bgxscroll_lo(uint8_t data); + template void bgxscroll_hi(uint8_t data); + template void bgyscroll_lo(uint8_t data); + template void bgyscroll_hi(uint8_t data); + + TILE_GET_INFO_MEMBER(get_tx_tile_info); + template TILE_GET_INFO_MEMBER(get_bg_tile_info); + + uint32_t screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + template DECLARE_WRITE_LINE_MEMBER(adpcm_int); + + void _6206A_map(address_map &map); + void _6206B_map(address_map &map); + void _6206C_map(address_map &map); +}; + + +// video + +// Foreground Layer (tx) Tilemap + +TILE_GET_INFO_MEMBER(tbowl_state::get_tx_tile_info) +{ + int tileno = m_txvideoram[tile_index] | ((m_txvideoram[tile_index + 0x800] & 0x07) << 8); + int col = (m_txvideoram[tile_index + 0x800] & 0xf0) >> 4; + + tileinfo.set(0, tileno, col, 0); +} + +void tbowl_state::txvideoram_w(offs_t offset, uint8_t data) +{ + m_txvideoram[offset] = data; + m_tx_tilemap->mark_tile_dirty(offset & 0x7ff); +} + +// Bottom BG Layer (0) and Middle BG Layer (1) Tilemaps + +template +TILE_GET_INFO_MEMBER(tbowl_state::get_bg_tile_info) +{ + int tileno = m_bgvideoram[Which][tile_index] | ((m_bgvideoram[Which][tile_index + 0x1000] & 0x0f) << 8); + int col = (m_bgvideoram[Which][tile_index + 0x1000] & 0xf0) >> 4; + + tileinfo.set(Which + 1, Which ? tileno ^= 0x400 : tileno, col, 0); +} + +template +void tbowl_state::bgvideoram_w(offs_t offset, uint8_t data) +{ + m_bgvideoram[Which][offset] = data; + m_bg_tilemap[Which]->mark_tile_dirty(offset & 0xfff); +} + +template +void tbowl_state::bgxscroll_lo(uint8_t data) +{ + m_bgxscroll[Which] = (m_bgxscroll[Which] & 0xff00) | data; +} + +template +void tbowl_state::bgxscroll_hi(uint8_t data) +{ + m_bgxscroll[Which] = (m_bgxscroll[Which] & 0x00ff) | (data << 8); +} + +template +void tbowl_state::bgyscroll_lo(uint8_t data) +{ + m_bgyscroll[Which] = (m_bgyscroll[Which] & 0xff00) | data; +} + +template +void tbowl_state::bgyscroll_hi(uint8_t data) +{ + m_bgyscroll[Which] = (m_bgyscroll[Which] & 0x00ff) | (data << 8); +} + + +//*** Video Start / Update *** + +void tbowl_state::video_start() +{ + m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tbowl_state::get_tx_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64,32); + m_bg_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tbowl_state::get_bg_tile_info<0>)), TILEMAP_SCAN_ROWS, 16,16, 128,32); + m_bg_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tbowl_state::get_bg_tile_info<1>)), TILEMAP_SCAN_ROWS, 16,16, 128,32); + + m_tx_tilemap->set_transparent_pen(0); + m_bg_tilemap[0]->set_transparent_pen(0); + m_bg_tilemap[1]->set_transparent_pen(0); + + save_item(NAME(m_bgxscroll)); + save_item(NAME(m_bgyscroll)); +} + + + +uint32_t tbowl_state::screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap[0]->set_scrollx(0, m_bgxscroll[0]); + m_bg_tilemap[0]->set_scrolly(0, m_bgyscroll[0]); + m_bg_tilemap[1]->set_scrollx(0, m_bgxscroll[1]); + m_bg_tilemap[1]->set_scrolly(0, m_bgyscroll[1]); + m_tx_tilemap->set_scrollx(0, 0); + m_tx_tilemap->set_scrolly(0, 0); + + bitmap.fill(0x100, cliprect); // is there a register controlling the colour? looks odd when screen is blank + m_bg_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0); + m_sprgen->tbowl_draw_sprites(bitmap, cliprect, m_gfxdecode->gfx(3), 0, m_spriteram); + m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); + m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + return 0; +} + +uint32_t tbowl_state::screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap[0]->set_scrollx(0, m_bgxscroll[0] + 32*8); + m_bg_tilemap[0]->set_scrolly(0, m_bgyscroll[0]); + m_bg_tilemap[1]->set_scrollx(0, m_bgxscroll[1] + 32*8); + m_bg_tilemap[1]->set_scrolly(0, m_bgyscroll[1]); + m_tx_tilemap->set_scrollx(0, 32*8); + m_tx_tilemap->set_scrolly(0, 0); + + bitmap.fill(0x100, cliprect); // is there a register controlling the colour? looks odd when screen is blank + m_bg_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0); + m_sprgen->tbowl_draw_sprites(bitmap, cliprect, m_gfxdecode->gfx(3), 32*8, m_spriteram); + m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); + m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + return 0; +} + + +// machine + void tbowl_state::coincounter_w(uint8_t data) { machine().bookkeeping().coin_counter_w(0, data & 1); @@ -38,12 +242,12 @@ note: check this, its borrowed from tecmo.cpp / wc90.cpp at the moment and could void tbowl_state::boardb_bankswitch_w(uint8_t data) { - membank("mainbank")->set_entry(data >> 3); + m_mainbank->set_entry(data >> 3); } void tbowl_state::boardc_bankswitch_w(uint8_t data) { - membank("subbank")->set_entry(data >> 3); + m_subbank->set_entry(data >> 3); } /*** Memory Structures @@ -55,47 +259,47 @@ void tbowl_state::boardc_bankswitch_w(uint8_t data) ***/ -/* Board B */ +// Board B void tbowl_state::_6206B_map(address_map &map) { map(0x0000, 0x7fff).rom(); map(0x8000, 0x9fff).ram(); - map(0xa000, 0xbfff).ram().w(FUNC(tbowl_state::bg2videoram_w)).share("bg2videoram"); - map(0xc000, 0xdfff).ram().w(FUNC(tbowl_state::bgvideoram_w)).share("bgvideoram"); - map(0xe000, 0xefff).ram().w(FUNC(tbowl_state::txvideoram_w)).share("txvideoram"); -// map(0xf000, 0xf000).w(FUNC(tbowl_state::unknown_write)); * written during start-up, not again */ - map(0xf000, 0xf7ff).bankr("mainbank"); - map(0xf800, 0xfbff).ram().share("shared_ram"); /* check */ + map(0xa000, 0xbfff).ram().w(FUNC(tbowl_state::bgvideoram_w<1>)).share(m_bgvideoram[1]); + map(0xc000, 0xdfff).ram().w(FUNC(tbowl_state::bgvideoram_w<0>)).share(m_bgvideoram[0]); + map(0xe000, 0xefff).ram().w(FUNC(tbowl_state::txvideoram_w)).share(m_txvideoram); +// map(0xf000, 0xf000).w(FUNC(tbowl_state::unknown_write)); // written during start-up, not again + map(0xf000, 0xf7ff).bankr(m_mainbank); + map(0xf800, 0xfbff).ram().share("shared_ram"); // check map(0xfc00, 0xfc00).portr("P1").w(FUNC(tbowl_state::boardb_bankswitch_w)); map(0xfc01, 0xfc01).portr("P2"); -// map(0xfc01, 0xfc01).w(FUNC(tbowl_state::unknown_write)); /* written during start-up, not again */ +// map(0xfc01, 0xfc01).w(FUNC(tbowl_state::unknown_write)); // written during start-up, not again map(0xfc02, 0xfc02).portr("P3"); -// map(0xfc02, 0xfc02).w(FUNC(tbowl_state::unknown_write)); /* written during start-up, not again */ +// map(0xfc02, 0xfc02).w(FUNC(tbowl_state::unknown_write)); // written during start-up, not again map(0xfc03, 0xfc03).portr("P4").w(FUNC(tbowl_state::coincounter_w)); -// map(0xfc05, 0xfc05).w(FUNC(tbowl_state::unknown_write)); /* no idea */ -// map(0xfc06, 0xfc06).r(FUNC(tbowl_state::dummy_r)); /* Read During NMI */ +// map(0xfc05, 0xfc05).w(FUNC(tbowl_state::unknown_write)); // no idea +// map(0xfc06, 0xfc06).r(FUNC(tbowl_state::dummy_r)); // Read During NMI map(0xfc07, 0xfc07).portr("SYSTEM"); map(0xfc08, 0xfc08).portr("DSW1"); -// map(0xfc08, 0xfc08).w(FUNC(tbowl_state::unknown_write)); /* hardly used .. */ +// map(0xfc08, 0xfc08).w(FUNC(tbowl_state::unknown_write)); // hardly used .. map(0xfc09, 0xfc09).portr("DSW2"); map(0xfc0a, 0xfc0a).portr("DSW3"); -// map(0xfc0a, 0xfc0a).w(FUNC(tbowl_state::unknown_write)); /* hardly used .. */ +// map(0xfc0a, 0xfc0a).w(FUNC(tbowl_state::unknown_write)); // hardly used .. map(0xfc0d, 0xfc0d).w(m_soundlatch, FUNC(generic_latch_8_device::write)); - map(0xfc10, 0xfc10).w(FUNC(tbowl_state::bg2xscroll_lo)); - map(0xfc11, 0xfc11).w(FUNC(tbowl_state::bg2xscroll_hi)); - map(0xfc12, 0xfc12).w(FUNC(tbowl_state::bg2yscroll_lo)); - map(0xfc13, 0xfc13).w(FUNC(tbowl_state::bg2yscroll_hi)); - map(0xfc14, 0xfc14).w(FUNC(tbowl_state::bgxscroll_lo)); - map(0xfc15, 0xfc15).w(FUNC(tbowl_state::bgxscroll_hi)); - map(0xfc16, 0xfc16).w(FUNC(tbowl_state::bgyscroll_lo)); - map(0xfc17, 0xfc17).w(FUNC(tbowl_state::bgyscroll_hi)); + map(0xfc10, 0xfc10).w(FUNC(tbowl_state::bgxscroll_lo<1>)); + map(0xfc11, 0xfc11).w(FUNC(tbowl_state::bgxscroll_hi<1>)); + map(0xfc12, 0xfc12).w(FUNC(tbowl_state::bgyscroll_lo<1>)); + map(0xfc13, 0xfc13).w(FUNC(tbowl_state::bgyscroll_hi<1>)); + map(0xfc14, 0xfc14).w(FUNC(tbowl_state::bgxscroll_lo<0>)); + map(0xfc15, 0xfc15).w(FUNC(tbowl_state::bgxscroll_hi<0>)); + map(0xfc16, 0xfc16).w(FUNC(tbowl_state::bgyscroll_lo<0>)); + map(0xfc17, 0xfc17).w(FUNC(tbowl_state::bgyscroll_hi<0>)); } -/* Board C */ +// Board C void tbowl_state::trigger_nmi(uint8_t data) { - /* trigger NMI on 6206B's Cpu? (guess but seems to work..) */ + // trigger NMI on 6206B's Cpu? (guess but seems to work..) m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); } @@ -103,75 +307,70 @@ void tbowl_state::_6206C_map(address_map &map) { map(0x0000, 0xbfff).rom(); map(0xc000, 0xd7ff).ram(); - map(0xd800, 0xdfff).ram().share("spriteram"); + map(0xd800, 0xdfff).ram().share(m_spriteram); map(0xe000, 0xefff).ram().w(m_palette, FUNC(palette_device::write8)).share("palette"); // 2x palettes, one for each monitor? - map(0xf000, 0xf7ff).bankr("subbank"); + map(0xf000, 0xf7ff).bankr(m_subbank); map(0xf800, 0xfbff).ram().share("shared_ram"); map(0xfc00, 0xfc00).w(FUNC(tbowl_state::boardc_bankswitch_w)); - map(0xfc01, 0xfc01).nopw(); /* ? */ - map(0xfc02, 0xfc02).w(FUNC(tbowl_state::trigger_nmi)); /* ? */ - map(0xfc03, 0xfc03).nopw(); /* ? */ - map(0xfc06, 0xfc06).nopw(); /* ? */ + map(0xfc01, 0xfc01).nopw(); // ? + map(0xfc02, 0xfc02).w(FUNC(tbowl_state::trigger_nmi)); // ? + map(0xfc03, 0xfc03).nopw(); // ? + map(0xfc06, 0xfc06).nopw(); // ? } -/* Board A */ +// Board A -void tbowl_state::adpcm_start_w(offs_t offset, uint8_t data) +template +void tbowl_state::adpcm_start_w(uint8_t data) { - msm5205_device *adpcm = (offset & 1) ? m_msm2 : m_msm1; - m_adpcm_pos[offset & 1] = data << 8; - adpcm->reset_w(0); + m_adpcm_pos[Which] = data << 8; + m_msm[Which]->reset_w(0); } -void tbowl_state::adpcm_end_w(offs_t offset, uint8_t data) +template +void tbowl_state::adpcm_end_w(uint8_t data) { - m_adpcm_end[offset & 1] = (data + 1) << 8; + m_adpcm_end[Which] = (data + 1) << 8; } -void tbowl_state::adpcm_vol_w(offs_t offset, uint8_t data) +template +void tbowl_state::adpcm_vol_w(uint8_t data) { - msm5205_device *adpcm = (offset & 1) ? m_msm2 : m_msm1; - adpcm->set_output_gain(ALL_OUTPUTS, (data & 127) / 127.0); + m_msm[Which]->set_output_gain(ALL_OUTPUTS, (data & 127) / 127.0); } -void tbowl_state::adpcm_int( msm5205_device *device, int num ) +template +WRITE_LINE_MEMBER(tbowl_state::adpcm_int) { - if (m_adpcm_pos[num] >= m_adpcm_end[num] || - m_adpcm_pos[num] >= memregion("adpcm")->bytes()/2) - device->reset_w(1); - else if (m_adpcm_data[num] != -1) + if (m_adpcm_pos[Which] >= m_adpcm_end[Which] || + m_adpcm_pos[Which] >= m_adpcm_rom.bytes() / 2) + m_msm[Which]->reset_w(1); + else if (m_adpcm_data[Which] != -1) { - device->data_w(m_adpcm_data[num] & 0x0f); - m_adpcm_data[num] = -1; + m_msm[Which]->data_w(m_adpcm_data[Which] & 0x0f); + m_adpcm_data[Which] = -1; } else { - uint8_t *ROM = memregion("adpcm")->base() + 0x10000 * num; + uint8_t *rom = &m_adpcm_rom[0x10000 * Which]; - m_adpcm_data[num] = ROM[m_adpcm_pos[num]++]; - device->data_w(m_adpcm_data[num] >> 4); + m_adpcm_data[Which] = rom[m_adpcm_pos[Which]++]; + m_msm[Which]->data_w(m_adpcm_data[Which] >> 4); } } -WRITE_LINE_MEMBER(tbowl_state::adpcm_int_1) -{ - adpcm_int(m_msm1, 0); -} - -WRITE_LINE_MEMBER(tbowl_state::adpcm_int_2) -{ - adpcm_int(m_msm2, 1); -} - void tbowl_state::_6206A_map(address_map &map) { map(0x0000, 0x7fff).rom(); map(0xc000, 0xc7ff).ram(); map(0xd000, 0xd001).w("ym1", FUNC(ym3812_device::write)); map(0xd800, 0xd801).w("ym2", FUNC(ym3812_device::write)); - map(0xe000, 0xe001).w(FUNC(tbowl_state::adpcm_end_w)); - map(0xe002, 0xe003).w(FUNC(tbowl_state::adpcm_start_w)); - map(0xe004, 0xe005).w(FUNC(tbowl_state::adpcm_vol_w)); + map(0xe000, 0xe000).w(FUNC(tbowl_state::adpcm_end_w<0>)); + map(0xe001, 0xe001).w(FUNC(tbowl_state::adpcm_end_w<1>)); + map(0xe002, 0xe002).w(FUNC(tbowl_state::adpcm_start_w<0>)); + map(0xe003, 0xe003).w(FUNC(tbowl_state::adpcm_start_w<1>)); + map(0xe004, 0xe004).w(FUNC(tbowl_state::adpcm_vol_w<0>)); + map(0xe005, 0xe005).w(FUNC(tbowl_state::adpcm_vol_w<1>)); map(0xe006, 0xe006).w(m_soundlatch, FUNC(generic_latch_8_device::acknowledge_w)); map(0xe007, 0xe007).nopw(); // sound watchdog map(0xe010, 0xe010).r(m_soundlatch, FUNC(generic_latch_8_device::read)); @@ -235,19 +434,19 @@ bits 0 and 1 ? I'll try to have another look when the sprites stuff is finished. static INPUT_PORTS_START( tbowl ) - PORT_START("P1") /* 0xfc00 */ + PORT_START("P1") // 0xfc00 TBOWL_PLAYER_INPUT(1) - PORT_START("P2") /* 0xfc01 */ + PORT_START("P2") // 0xfc01 TBOWL_PLAYER_INPUT(2) - PORT_START("P3") /* 0xfc02 */ + PORT_START("P3") // 0xfc02 TBOWL_PLAYER_INPUT(3) - PORT_START("P4") /* 0xfc03 */ + PORT_START("P4") // 0xfc03 TBOWL_PLAYER_INPUT(4) - PORT_START("SYSTEM") /* 0xfc07 -> 0x80f9 */ + PORT_START("SYSTEM") // 0xfc07 -> 0x80f9 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) @@ -257,7 +456,7 @@ static INPUT_PORTS_START( tbowl ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_START("DSW1") /* 0xfc08 -> 0xffb4 */ + PORT_START("DSW1") // 0xfc08 -> 0xffb4 PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3") PORT_DIPSETTING ( 0x00, DEF_STR( 8C_1C ) ) PORT_DIPSETTING ( 0x01, DEF_STR( 7C_1C ) ) @@ -292,6 +491,7 @@ static INPUT_PORTS_START( tbowl ) PORT_DIPSETTING ( 0xa8, "1:10" ) PORT_DIPSETTING ( 0xb0, "1:05" ) PORT_DIPSETTING ( 0xb8, "1:00" ) + PORT_DIPSETTING ( 0xf8, "1:00" ) // duplicate PORT_DIPSETTING ( 0xc0, "0:55" ) PORT_DIPSETTING ( 0xc8, "0:50" ) PORT_DIPSETTING ( 0xd0, "0:45" ) @@ -299,24 +499,23 @@ static INPUT_PORTS_START( tbowl ) PORT_DIPSETTING ( 0xe0, "0:35" ) PORT_DIPSETTING ( 0xe8, "0:30" ) PORT_DIPSETTING ( 0xf0, "0:25" ) -// PORT_DIPSETTING ( 0xf8, "1:00" ) - PORT_START("DSW2") /* 0xfc09 -> 0xffb5 */ + PORT_START("DSW2") // 0xfc09 -> 0xffb5 PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") // To be checked again PORT_DIPSETTING ( 0x02, DEF_STR( Easy ) ) PORT_DIPSETTING ( 0x03, DEF_STR( Normal ) ) PORT_DIPSETTING ( 0x01, DEF_STR( Hard ) ) PORT_DIPSETTING ( 0x00, DEF_STR( Hardest ) ) PORT_DIPNAME( 0x0c, 0x0c, "Extra Time (Players)" ) PORT_DIPLOCATION("SW2:3,4") // For multiple "credits" - PORT_DIPSETTING ( 0x00, "0:30" ) /* manual shows 0:10 */ - PORT_DIPSETTING ( 0x04, "0:20" ) /* manual shows 0:05 */ - PORT_DIPSETTING ( 0x08, "0:10" ) /* manual shows 0:02 */ + PORT_DIPSETTING ( 0x00, "0:30" ) // manual shows 0:10 + PORT_DIPSETTING ( 0x04, "0:20" ) // manual shows 0:05 + PORT_DIPSETTING ( 0x08, "0:10" ) // manual shows 0:02 PORT_DIPSETTING ( 0x0c, DEF_STR( None ) ) PORT_DIPNAME( 0x30, 0x30, "Timer Speed" ) PORT_DIPLOCATION("SW2:5,6") - PORT_DIPSETTING ( 0x00, "Slowest" ) /* manual shows 1 Count = 60/60 Second - was 56/60 */ - PORT_DIPSETTING ( 0x10, "Slow" ) /* manual shows 1 Count = 54/60 Second - was 51/60 */ - PORT_DIPSETTING ( 0x30, DEF_STR( Normal ) ) /* manual shows 1 Count = 50/60 Second - was 47/60 */ - PORT_DIPSETTING ( 0x20, "Fast" ) /* manual shows 1 Count = 45/60 Second - was 42/60 */ + PORT_DIPSETTING ( 0x00, "Slowest" ) // manual shows 1 Count = 60/60 Second - was 56/60 + PORT_DIPSETTING ( 0x10, "Slow" ) // manual shows 1 Count = 54/60 Second - was 51/60 + PORT_DIPSETTING ( 0x30, DEF_STR( Normal ) ) // manual shows 1 Count = 50/60 Second - was 47/60 + PORT_DIPSETTING ( 0x20, "Fast" ) // manual shows 1 Count = 45/60 Second - was 42/60 PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7") // Check code at 0x0393 PORT_DIPSETTING ( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING ( 0x40, DEF_STR( On ) ) @@ -324,22 +523,22 @@ static INPUT_PORTS_START( tbowl ) PORT_DIPSETTING ( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING ( 0x80, DEF_STR( On ) ) - PORT_START("DSW3") /* 0xfc0a -> 0xffb6 */ + PORT_START("DSW3") // 0xfc0a -> 0xffb6 PORT_DIPNAME( 0x03, 0x03, "Time (Quarter)" ) PORT_DIPLOCATION("SW3:1,2") PORT_DIPSETTING ( 0x00, "8:00" ) PORT_DIPSETTING ( 0x01, "5:00" ) PORT_DIPSETTING ( 0x03, "4:00" ) PORT_DIPSETTING ( 0x02, "3:00" ) PORT_DIPNAME( 0x0c, 0x08, "Bonus Frequency" ) PORT_DIPLOCATION("SW3:3,4") // Check code at 0x6e16 (0x6e37 for tbowlj), each step is + 0x12 - PORT_DIPSETTING ( 0x00, "Most" ) /* Value in 0x8126.w = 0x54f3 (0x5414 for tbowlj) */ - PORT_DIPSETTING ( 0x04, "More" ) /* Value in 0x8126.w = 0x54e1 (0x5402 for tbowlj) */ - PORT_DIPSETTING ( 0x08, DEF_STR( Normal ) ) /* Value in 0x8126.w = 0x54cf (0x54f0 for tbowlj), manual shows this is Least, but values is > least */ - PORT_DIPSETTING ( 0x0c, "Least" ) /* Value in 0x8126.w = 0x54bd (0x54de for tbowlj), manual shows this is Normal, but value is least */ + PORT_DIPSETTING ( 0x00, "Most" ) // Value in 0x8126.w = 0x54f3 (0x5414 for tbowlj) + PORT_DIPSETTING ( 0x04, "More" ) // Value in 0x8126.w = 0x54e1 (0x5402 for tbowlj) + PORT_DIPSETTING ( 0x08, DEF_STR( Normal ) ) // Value in 0x8126.w = 0x54cf (0x54f0 for tbowlj), manual shows this is Least, but values is > least + PORT_DIPSETTING ( 0x0c, "Least" ) // Value in 0x8126.w = 0x54bd (0x54de for tbowlj), manual shows this is Normal, but value is least PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END -static INPUT_PORTS_START( tbowlj ) /* "Quarter Time" Dip Switch for "3:00" and "4:00" are inverted */ +static INPUT_PORTS_START( tbowlj ) // "Quarter Time" Dip Switch for "3:00" and "4:00" are inverted PORT_INCLUDE( tbowl ) PORT_MODIFY("DSW3") @@ -367,33 +566,22 @@ static const gfx_layout bgtilelayout = 128*8 /* offset to next tile */ }; -static const gfx_layout sprite8layout = -{ - 8,8, /* tile size */ - RGN_FRAC(1,1), /* number of tiles */ - 4, /* 4 bits per pixel */ - { 0, 1, 2, 3 }, /* the bitplanes are packed in one nibble */ - { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 }, - { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, - 8*32 /* offset to next tile */ -}; - static GFXDECODE_START( gfx_tbowl ) GFXDECODE_ENTRY( "characters", 0, gfx_8x8x4_packed_msb, 256, 16 ) GFXDECODE_ENTRY( "bg_tiles", 0, bgtilelayout, 768, 16 ) GFXDECODE_ENTRY( "bg_tiles", 0, bgtilelayout, 512, 16 ) - GFXDECODE_ENTRY( "sprites", 0, sprite8layout, 0, 16 ) + GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_packed_msb, 0, 16 ) GFXDECODE_END /*** Machine Driver -there are 3 boards, each with a cpu, boards b and c contain -NEC D70008AC-8's which is just a Z80, board a (the sound board) +there are 3 boards, each with a CPU, boards b and c contain +NEC D70008AC-8s which is just a Z80, board a (the sound board) has an actual Z80 chip -Sound Hardware should be 2 YM3812's + 2 MSM5205's +Sound Hardware should be 2 YM3812s + 2 MSM5205s The game is displayed on 2 monitors @@ -401,8 +589,8 @@ The game is displayed on 2 monitors void tbowl_state::machine_start() { - membank("mainbank")->configure_entries(0, 32, memregion("maincpu")->base() + 0x10000, 0x800); - membank("subbank")->configure_entries(0, 32, memregion("sub")->base() + 0x10000, 0x800); + m_mainbank->configure_entries(0, 32, memregion("maincpu")->base() + 0x10000, 0x800); + m_subbank->configure_entries(0, 32, memregion("sub")->base() + 0x10000, 0x800); save_item(NAME(m_adpcm_pos)); save_item(NAME(m_adpcm_end)); @@ -420,23 +608,23 @@ void tbowl_state::machine_reset() void tbowl_state::tbowl(machine_config &config) { - /* CPU on Board '6206B' */ - Z80(config, m_maincpu, 8000000); /* NEC D70008AC-8 (Z80 Clone) */ + // CPU on Board '6206B' + Z80(config, m_maincpu, 8000000); // NEC D70008AC-8 (Z80 Clone) m_maincpu->set_addrmap(AS_PROGRAM, &tbowl_state::_6206B_map); m_maincpu->set_vblank_int("lscreen", FUNC(tbowl_state::irq0_line_hold)); - /* CPU on Board '6206C' */ - z80_device &sub(Z80(config, "sub", 8000000)); /* NEC D70008AC-8 (Z80 Clone) */ + // CPU on Board '6206C' + z80_device &sub(Z80(config, "sub", 8000000)); // NEC D70008AC-8 (Z80 Clone) sub.set_addrmap(AS_PROGRAM, &tbowl_state::_6206C_map); sub.set_vblank_int("lscreen", FUNC(tbowl_state::irq0_line_hold)); - /* CPU on Board '6206A' */ - Z80(config, m_audiocpu, 4000000); /* Actual Z80 */ + // CPU on Board '6206A' + Z80(config, m_audiocpu, 4000000); // Actual Z80 m_audiocpu->set_addrmap(AS_PROGRAM, &tbowl_state::_6206A_map); config.set_maximum_quantum(attotime::from_hz(6000)); - /* video hardware */ + // video hardware GFXDECODE(config, m_gfxdecode, m_palette, gfx_tbowl); PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 1024*2).set_endianness(ENDIANNESS_BIG); config.set_default_layout(layout_dualhsxs); @@ -459,7 +647,7 @@ void tbowl_state::tbowl(machine_config &config) rscreen.set_screen_update(FUNC(tbowl_state::screen_update_right)); rscreen.set_palette(m_palette); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); @@ -473,16 +661,15 @@ void tbowl_state::tbowl(machine_config &config) ym3812_device &ym2(YM3812(config, "ym2", 4000000)); ym2.add_route(ALL_OUTPUTS, "mono", 0.80); - /* something for the samples? */ - MSM5205(config, m_msm1, 384000); - m_msm1->vck_legacy_callback().set(FUNC(tbowl_state::adpcm_int_1)); /* interrupt function */ - m_msm1->set_prescaler_selector(msm5205_device::S48_4B); /* 8KHz */ - m_msm1->add_route(ALL_OUTPUTS, "mono", 0.50); + MSM5205(config, m_msm[0], 384000); + m_msm[0]->vck_legacy_callback().set(FUNC(tbowl_state::adpcm_int<0>)); // interrupt function + m_msm[0]->set_prescaler_selector(msm5205_device::S48_4B); // 8KHz + m_msm[0]->add_route(ALL_OUTPUTS, "mono", 0.50); - MSM5205(config, m_msm2, 384000); - m_msm2->vck_legacy_callback().set(FUNC(tbowl_state::adpcm_int_2)); /* interrupt function */ - m_msm2->set_prescaler_selector(msm5205_device::S48_4B); /* 8KHz */ - m_msm2->add_route(ALL_OUTPUTS, "mono", 0.50); + MSM5205(config, m_msm[1], 384000); + m_msm[1]->vck_legacy_callback().set(FUNC(tbowl_state::adpcm_int<1>)); // interrupt function + m_msm[1]->set_prescaler_selector(msm5205_device::S48_4B); // 8KHz + m_msm[1]->add_route(ALL_OUTPUTS, "mono", 0.50); } @@ -540,10 +727,10 @@ void tbowl_state::tbowl(machine_config &config) /*** Rom Loading *** -we currently have two dumps, one appears to be a world/us version, the +we currently have two dumps, one appears to be a world/US version, the other is clearly a Japan version as it displays a regional warning -there is also a bad dump which for reference has the following roms +there is also a bad dump which for reference has the following ROMs different to the world dump "24.rom" 0x10000 0x39a2d923 (code) @@ -553,28 +740,28 @@ different to the world dump "22.rom" 0x10000 0xee7561d9 (gfx) "23.rom" 0x10000 0x46b3c186 (gfx) -this fails its rom check so I assume its corrupt +this fails its ROM check so I assume it's corrupt ***/ ROM_START( tbowl ) - ROM_REGION( 0x20000, "maincpu", 0 ) /* NEC D70008AC-8 (Z80 Clone) */ + ROM_REGION( 0x20000, "maincpu", 0 ) // NEC D70008AC-8 (Z80 Clone) ROM_LOAD( "4.b11", 0x00000, 0x08000, CRC(db8a4f5d) SHA1(730dee040c18ed8736c07a7de0b986f667b0f2f5) ) ROM_LOAD( "6206b-5.b13", 0x10000, 0x10000, CRC(133c5c11) SHA1(7d4e76db3505ccf033d0d9b8d21feaf09b76dcc4) ) - ROM_REGION( 0x20000, "sub", 0 ) /* NEC D70008AC-8 (Z80 Clone) */ + ROM_REGION( 0x20000, "sub", 0 ) // NEC D70008AC-8 (Z80 Clone) ROM_LOAD( "6206c-24.h5", 0x00000, 0x10000, CRC(040c8138) SHA1(f6fea192bf2ef0a3f0876133c761488184f54f50) ) ROM_LOAD( "6206c-25.h7", 0x10000, 0x10000, CRC(92c3cef5) SHA1(75883663b309bf46be544114c6e9086ab222300d) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 */ + ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 ROM_LOAD( "6206a-1.f11", 0x00000, 0x08000, CRC(4370207b) SHA1(2c929b571c86d35e646870644751e86bd16b5e22) ) - ROM_REGION( 0x10000, "characters", 0 ) /* 8x8 Characters inc. Alphanumerics */ + ROM_REGION( 0x10000, "characters", 0 ) // 8x8 Characters inc. Alphanumerics ROM_LOAD16_BYTE( "14.13l", 0x00000, 0x08000, CRC(f9cf60b9) SHA1(0a79ed29f82ac7bd08062f922f79e439c194f30a) ) ROM_LOAD16_BYTE( "15.15l", 0x00001, 0x08000, CRC(a23f6c53) SHA1(0bb64894a27f41d74117ec492aafd52bc5b16ca4) ) - ROM_REGION( 0x80000, "bg_tiles", 0 ) /* BG GFX */ + ROM_REGION( 0x80000, "bg_tiles", 0 ) ROM_LOAD16_BYTE( "6206b-8.e1", 0x40001, 0x10000, CRC(b9615ffa) SHA1(813896387291f5325ed7e4058347fe35c0d7b839) ) ROM_LOAD16_BYTE( "6206b-8.e4", 0x40000, 0x10000, CRC(6389c719) SHA1(8043907d6f5b37228c09f05bbf12b4b9bb9bc130) ) ROM_LOAD16_BYTE( "6206b-7.e2", 0x00001, 0x10000, CRC(d139c397) SHA1(4093220e6bddb95d0af445944bead7a064b64c39) ) @@ -584,7 +771,7 @@ ROM_START( tbowl ) ROM_LOAD16_BYTE( "6206b-11.l2", 0x20001, 0x10000, CRC(06bf07bb) SHA1(9f12a39b8832bff2ffd84b7e6c1ddb2855ff924b) ) ROM_LOAD16_BYTE( "6206b-13.l6", 0x20000, 0x10000, CRC(4ad72c16) SHA1(554474987349b5b11e181ee8a2d1308777b030c1) ) - ROM_REGION( 0x80000, "sprites", 0 ) /* SPR GFX */ + ROM_REGION( 0x80000, "sprites", 0 ) ROM_LOAD16_BYTE( "6206c-16.b11", 0x60001, 0x10000, CRC(1a2fb925) SHA1(bc96ee87372826d5bee2b4d2aefde4c47b9ee80a) ) ROM_LOAD16_BYTE( "6206c-20.d11", 0x60000, 0x10000, CRC(70bb38a3) SHA1(5145b246f7720dd0359b97be35aa027af07cb6da) ) ROM_LOAD16_BYTE( "6206c-17.b13", 0x40001, 0x10000, CRC(de16bc10) SHA1(88e2452c7caf44cd541c27fc56c99703f3330bd7) ) @@ -601,22 +788,22 @@ ROM_END ROM_START( tbowla ) - ROM_REGION( 0x20000, "maincpu", 0 ) /* NEC D70008AC-8 (Z80 Clone) */ + ROM_REGION( 0x20000, "maincpu", 0 ) // NEC D70008AC-8 (Z80 Clone) ROM_LOAD( "6206b-4.b11", 0x00000, 0x08000, CRC(8c4260b1) SHA1(1559849b00c6ba818a5dae4e96ccc3bf58e6243f) ) ROM_LOAD( "6206b-5.b13", 0x10000, 0x10000, CRC(133c5c11) SHA1(7d4e76db3505ccf033d0d9b8d21feaf09b76dcc4) ) - ROM_REGION( 0x20000, "sub", 0 ) /* NEC D70008AC-8 (Z80 Clone) */ + ROM_REGION( 0x20000, "sub", 0 ) // NEC D70008AC-8 (Z80 Clone) ROM_LOAD( "6206c-24.h5", 0x00000, 0x10000, CRC(040c8138) SHA1(f6fea192bf2ef0a3f0876133c761488184f54f50) ) ROM_LOAD( "6206c-25.h7", 0x10000, 0x10000, CRC(92c3cef5) SHA1(75883663b309bf46be544114c6e9086ab222300d) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 */ + ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 ROM_LOAD( "6206a-1.f11", 0x00000, 0x08000, CRC(4370207b) SHA1(2c929b571c86d35e646870644751e86bd16b5e22) ) - ROM_REGION( 0x10000, "characters", 0 ) /* 8x8 Characters inc. Alphanumerics */ + ROM_REGION( 0x10000, "characters", 0 ) // 8x8 Characters inc. Alphanumerics ROM_LOAD16_BYTE( "6206b-14.l13", 0x00000, 0x08000, CRC(cf99d0bf) SHA1(d1f23e23c2ebd26e2ffe8b23a02d86e4d32c6f11) ) ROM_LOAD16_BYTE( "6206b-15.l14", 0x00001, 0x08000, CRC(d69248cf) SHA1(4dad6a3fdc36b2fe625df0a43fd9e82d1dfd2af6) ) - ROM_REGION( 0x80000, "bg_tiles", 0 ) /* BG GFX */ + ROM_REGION( 0x80000, "bg_tiles", 0 ) ROM_LOAD16_BYTE( "6206b-8.e1", 0x40001, 0x10000, CRC(b9615ffa) SHA1(813896387291f5325ed7e4058347fe35c0d7b839) ) ROM_LOAD16_BYTE( "6206b-8.e4", 0x40000, 0x10000, CRC(6389c719) SHA1(8043907d6f5b37228c09f05bbf12b4b9bb9bc130) ) ROM_LOAD16_BYTE( "6206b-7.e2", 0x00001, 0x10000, CRC(d139c397) SHA1(4093220e6bddb95d0af445944bead7a064b64c39) ) @@ -626,7 +813,7 @@ ROM_START( tbowla ) ROM_LOAD16_BYTE( "6206b-11.l2", 0x20001, 0x10000, CRC(06bf07bb) SHA1(9f12a39b8832bff2ffd84b7e6c1ddb2855ff924b) ) ROM_LOAD16_BYTE( "6206b-13.l6", 0x20000, 0x10000, CRC(4ad72c16) SHA1(554474987349b5b11e181ee8a2d1308777b030c1) ) - ROM_REGION( 0x80000, "sprites", 0 ) /* SPR GFX */ + ROM_REGION( 0x80000, "sprites", 0 ) ROM_LOAD16_BYTE( "6206c-16.b11", 0x60001, 0x10000, CRC(1a2fb925) SHA1(bc96ee87372826d5bee2b4d2aefde4c47b9ee80a) ) ROM_LOAD16_BYTE( "6206c-20.d11", 0x60000, 0x10000, CRC(70bb38a3) SHA1(5145b246f7720dd0359b97be35aa027af07cb6da) ) ROM_LOAD16_BYTE( "6206c-17.b13", 0x40001, 0x10000, CRC(de16bc10) SHA1(88e2452c7caf44cd541c27fc56c99703f3330bd7) ) @@ -642,28 +829,28 @@ ROM_START( tbowla ) ROM_END ROM_START( tbowlp ) - ROM_REGION( 0x20000, "maincpu", 0 ) /* NEC D70008AC-8 (Z80 Clone) */ + ROM_REGION( 0x20000, "maincpu", 0 ) // NEC D70008AC-8 (Z80 Clone) // same as 'tbowl' ROM_LOAD( "4.b11", 0x00000, 0x08000, CRC(db8a4f5d) SHA1(730dee040c18ed8736c07a7de0b986f667b0f2f5) ) ROM_LOAD( "main_data_10-25.b13", 0x10000, 0x10000, CRC(133c5c11) SHA1(7d4e76db3505ccf033d0d9b8d21feaf09b76dcc4) ) - ROM_REGION( 0x20000, "sub", 0 ) /* NEC D70008AC-8 (Z80 Clone) */ + ROM_REGION( 0x20000, "sub", 0 ) // NEC D70008AC-8 (Z80 Clone) // different to other sets ROM_LOAD( "sub_pro_10-29.h5", 0x00000, 0x10000, CRC(1933a3f0) SHA1(e19b3d7ad3cf6ccfc7b51240608f0edb95a50b5a) ) ROM_LOAD( "sub_data_10-25.h7", 0x10000, 0x10000, CRC(7277c852) SHA1(0b9e607159f54cf59727299c82cfc01dd90c8eb3) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 */ - // this rom is quite strange, maybe damaged / badly programmed? areas which should be a 0x00 0x00 end up being + ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 + // this ROM is quite strange, maybe damaged / badly programmed? areas which should be a 0x00 0x00 end up being // a 0x00 / 0xff alternating pattern, and there are some odd sounds at times. It does however read consistently // and is a different revision of the code to the other sets, so it might be correct and we can't just replace it - // with a rom from another set. + // with a ROM from another set. ROM_LOAD( "6206_sound_10-25.f11", 0x00000, 0x08000, CRC(2158472d) SHA1(bc47f4d59505fec6a5c2b924cbe8fc6d6cd4609e) ) - ROM_REGION( 0x10000, "characters", 0 ) /* 8x8 Characters inc. Alphanumerics */ + ROM_REGION( 0x10000, "characters", 0 ) // 8x8 Characters inc. Alphanumerics ROM_LOAD16_BYTE( "14.13l", 0x00000, 0x08000, CRC(f9cf60b9) SHA1(0a79ed29f82ac7bd08062f922f79e439c194f30a) ) ROM_LOAD16_BYTE( "15.15l", 0x00001, 0x08000, CRC(a23f6c53) SHA1(0bb64894a27f41d74117ec492aafd52bc5b16ca4) ) - ROM_REGION( 0x80000, "bg_tiles", 0 ) /* BG GFX */ + ROM_REGION( 0x80000, "bg_tiles", 0 ) ROM_LOAD16_BYTE( "6206b-8.e1", 0x40001, 0x10000, CRC(b9615ffa) SHA1(813896387291f5325ed7e4058347fe35c0d7b839) ) ROM_LOAD16_BYTE( "6206b-8.e4", 0x40000, 0x10000, CRC(6389c719) SHA1(8043907d6f5b37228c09f05bbf12b4b9bb9bc130) ) ROM_LOAD16_BYTE( "6206b-7.e2", 0x00001, 0x10000, CRC(d139c397) SHA1(4093220e6bddb95d0af445944bead7a064b64c39) ) @@ -673,7 +860,7 @@ ROM_START( tbowlp ) ROM_LOAD16_BYTE( "6206b-11.l2", 0x20001, 0x10000, CRC(06bf07bb) SHA1(9f12a39b8832bff2ffd84b7e6c1ddb2855ff924b) ) ROM_LOAD16_BYTE( "6206b-13.l6", 0x20000, 0x10000, CRC(4ad72c16) SHA1(554474987349b5b11e181ee8a2d1308777b030c1) ) - ROM_REGION( 0x80000, "sprites", 0 ) /* SPR GFX */ + ROM_REGION( 0x80000, "sprites", 0 ) // todo: check how these differ ROM_LOAD16_BYTE( "sp_7_10-16.b11", 0x60001, 0x10000, CRC(807af46a) SHA1(c7b2ce489b129de16e1081595c255b85ea2b684a) ) ROM_LOAD16_BYTE( "sp_6_10-16.d11", 0x60000, 0x10000, CRC(3c5654a9) SHA1(44f8d251c9f5d8c2c0aaaf23426c16d3fedaa0c0) ) @@ -690,22 +877,22 @@ ROM_START( tbowlp ) ROM_END ROM_START( tbowlj ) - ROM_REGION( 0x20000, "maincpu", 0 ) /* NEC D70008AC-8 (Z80 Clone) */ + ROM_REGION( 0x20000, "maincpu", 0 ) // NEC D70008AC-8 (Z80 Clone) ROM_LOAD( "6206b.4", 0x00000, 0x08000, CRC(7ed3eff7) SHA1(4a17f2838e9bbed8b1638783c62d07d1074e2b35) ) ROM_LOAD( "6206b.5", 0x10000, 0x10000, CRC(133c5c11) SHA1(7d4e76db3505ccf033d0d9b8d21feaf09b76dcc4) ) - ROM_REGION( 0x20000, "sub", 0 ) /* NEC D70008AC-8 (Z80 Clone) */ + ROM_REGION( 0x20000, "sub", 0 ) // NEC D70008AC-8 (Z80 Clone) ROM_LOAD( "6206c-24.h5", 0x00000, 0x10000, CRC(040c8138) SHA1(f6fea192bf2ef0a3f0876133c761488184f54f50) ) ROM_LOAD( "6206c-25.h7", 0x10000, 0x10000, CRC(92c3cef5) SHA1(75883663b309bf46be544114c6e9086ab222300d) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 */ + ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 ROM_LOAD( "6206a-1.f11", 0x00000, 0x08000, CRC(4370207b) SHA1(2c929b571c86d35e646870644751e86bd16b5e22) ) - ROM_REGION( 0x10000, "characters", 0 ) /* 8x8 Characters inc. Alphanumerics */ + ROM_REGION( 0x10000, "characters", 0 ) // 8x8 Characters inc. Alphanumerics ROM_LOAD16_BYTE( "6206b-14.l13", 0x00000, 0x08000, CRC(cf99d0bf) SHA1(d1f23e23c2ebd26e2ffe8b23a02d86e4d32c6f11) ) ROM_LOAD16_BYTE( "6206b-15.l14", 0x00001, 0x08000, CRC(d69248cf) SHA1(4dad6a3fdc36b2fe625df0a43fd9e82d1dfd2af6) ) - ROM_REGION( 0x80000, "bg_tiles", 0 ) /* BG GFX */ + ROM_REGION( 0x80000, "bg_tiles", 0 ) ROM_LOAD16_BYTE( "6206b-8.e1", 0x40001, 0x10000, CRC(b9615ffa) SHA1(813896387291f5325ed7e4058347fe35c0d7b839) ) ROM_LOAD16_BYTE( "6206b-8.e4", 0x40000, 0x10000, CRC(6389c719) SHA1(8043907d6f5b37228c09f05bbf12b4b9bb9bc130) ) ROM_LOAD16_BYTE( "6206b-7.e2", 0x00001, 0x10000, CRC(d139c397) SHA1(4093220e6bddb95d0af445944bead7a064b64c39) ) @@ -715,7 +902,7 @@ ROM_START( tbowlj ) ROM_LOAD16_BYTE( "6206b-11.l2", 0x20001, 0x10000, CRC(06bf07bb) SHA1(9f12a39b8832bff2ffd84b7e6c1ddb2855ff924b) ) ROM_LOAD16_BYTE( "6206b-13.l6", 0x20000, 0x10000, CRC(4ad72c16) SHA1(554474987349b5b11e181ee8a2d1308777b030c1) ) - ROM_REGION( 0x80000, "sprites", 0 ) /* SPR GFX */ + ROM_REGION( 0x80000, "sprites", 0 ) ROM_LOAD16_BYTE( "6206c-16.b11", 0x60001, 0x10000, CRC(1a2fb925) SHA1(bc96ee87372826d5bee2b4d2aefde4c47b9ee80a) ) ROM_LOAD16_BYTE( "6206c-20.d11", 0x60000, 0x10000, CRC(70bb38a3) SHA1(5145b246f7720dd0359b97be35aa027af07cb6da) ) ROM_LOAD16_BYTE( "6206c-17.b13", 0x40001, 0x10000, CRC(de16bc10) SHA1(88e2452c7caf44cd541c27fc56c99703f3330bd7) ) @@ -730,6 +917,9 @@ ROM_START( tbowlj ) ROM_LOAD( "6206a-2.l16", 0x10000, 0x10000, CRC(1e9e5936) SHA1(60370d1de28b1c5ffeff7843702aaddb19ff1f58) ) ROM_END +} // anonymous namespace + + GAME( 1987, tbowl, 0, tbowl, tbowl, tbowl_state, empty_init, ROT0, "Tecmo", "Tecmo Bowl (World, set 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, tbowla, tbowl, tbowl, tbowl, tbowl_state, empty_init, ROT0, "Tecmo", "Tecmo Bowl (World, set 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, tbowlp, tbowl, tbowl, tbowl, tbowl_state, empty_init, ROT0, "Tecmo", "Tecmo Bowl (World, prototype?)", MACHINE_SUPPORTS_SAVE ) // or early version, handwritten labels diff --git a/src/mame/includes/galpanic.h b/src/mame/includes/galpanic.h deleted file mode 100644 index 6b239aec6f1..00000000000 --- a/src/mame/includes/galpanic.h +++ /dev/null @@ -1,59 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -#ifndef MAME_INCLUDES_GALPANIC_H -#define MAME_INCLUDES_GALPANIC_H - -#pragma once - -#include "machine/timer.h" -#include "video/kan_pand.h" -#include "emupal.h" -#include "screen.h" - -class galpanic_state : public driver_device -{ -public: - galpanic_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_bgvideoram(*this, "bgvideoram") - , m_fgvideoram(*this, "fgvideoram") - , m_gfxdecode(*this, "gfxdecode") - , m_screen(*this, "screen") - , m_palette(*this, "palette") - , m_pandora(*this, "pandora") - { } - - void galpanica(machine_config &config); - void galpanic(machine_config &config); - -private: - required_device m_maincpu; - required_shared_ptr m_bgvideoram; - required_shared_ptr m_fgvideoram; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - required_device m_pandora; - - bitmap_ind16 m_bitmap; - - void m6295_bankswitch_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void coin_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void bgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - - virtual void machine_start() override; - virtual void video_start() override; - void galpanic_palette(palette_device &palette) const; - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(screen_vblank); - TIMER_DEVICE_CALLBACK_MEMBER(scanline); - void draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); - - void galpanic_map(address_map &map); - void galpanic_oki_map(address_map &map); - void galpanica_map(address_map &map); -}; - -#endif // MAME_INCLUDES_GALPANIC_H diff --git a/src/mame/includes/hcastle.h b/src/mame/includes/hcastle.h deleted file mode 100644 index 8402f930bf5..00000000000 --- a/src/mame/includes/hcastle.h +++ /dev/null @@ -1,88 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Bryan McPhail -/************************************************************************* - - Haunted Castle - -*************************************************************************/ -#ifndef MAME_INCLUDES_HCASTLE_H -#define MAME_INCLUDES_HCASTLE_H - -#pragma once - -#include "video/bufsprite.h" -#include "sound/k007232.h" -#include "video/k007121.h" -#include "emupal.h" -#include "tilemap.h" - -class hcastle_state : public driver_device -{ -public: - hcastle_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_spriteram(*this, "spriteram"), - m_spriteram2(*this, "spriteram2") , - m_pf1_videoram(*this, "pf1_videoram"), - m_pf2_videoram(*this, "pf2_videoram"), - m_audiocpu(*this, "audiocpu"), - m_k007121_1(*this, "k007121_1"), - m_k007121_2(*this, "k007121_2"), - m_k007232(*this, "k007232"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { } - - void hcastle(machine_config &config); - -private: - required_device m_spriteram; - required_device m_spriteram2; - /* memory pointers */ - required_shared_ptr m_pf1_videoram; - required_shared_ptr m_pf2_videoram; - - /* video-related */ - tilemap_t *m_fg_tilemap = nullptr; - tilemap_t *m_bg_tilemap = nullptr; - int m_pf2_bankbase = 0; - int m_pf1_bankbase = 0; - int m_old_pf1 = 0; - int m_old_pf2 = 0; - int m_gfx_bank = 0; - - /* devices */ - required_device m_audiocpu; - required_device m_k007121_1; - required_device m_k007121_2; - required_device m_k007232; - - void hcastle_bankswitch_w(uint8_t data); - void hcastle_soundirq_w(uint8_t data); - void hcastle_coin_w(uint8_t data); - void hcastle_pf1_video_w(offs_t offset, uint8_t data); - void hcastle_pf2_video_w(offs_t offset, uint8_t data); - void hcastle_gfxbank_w(uint8_t data); - uint8_t hcastle_gfxbank_r(); - void hcastle_pf1_control_w(offs_t offset, uint8_t data); - void hcastle_pf2_control_w(offs_t offset, uint8_t data); - void sound_bank_w(uint8_t data); - TILEMAP_MAPPER_MEMBER(tilemap_scan); - TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - void hcastle_palette(palette_device &palette) const; - uint32_t screen_update_hcastle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, uint8_t *sbank, int bank ); - void volume_callback(uint8_t data); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - void hcastle_map(address_map &map); - void sound_map(address_map &map); -}; - -#endif // MAME_INCLUDES_HCASTLE_H diff --git a/src/mame/includes/tbowl.h b/src/mame/includes/tbowl.h deleted file mode 100644 index 1165ad63f91..00000000000 --- a/src/mame/includes/tbowl.h +++ /dev/null @@ -1,101 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood -#ifndef MAME_INCLUDES_TBOWL_H -#define MAME_INCLUDES_TBOWL_H - -#pragma once - -#include "machine/gen_latch.h" -#include "sound/msm5205.h" -#include "video/tecmo_spr.h" -#include "emupal.h" -#include "tilemap.h" - -class tbowl_state : public driver_device -{ -public: - tbowl_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_msm1(*this, "msm1"), - m_msm2(*this, "msm2"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_sprgen(*this, "spritegen"), - m_soundlatch(*this, "soundlatch"), - m_txvideoram(*this, "txvideoram"), - m_bgvideoram(*this, "bgvideoram"), - m_bg2videoram(*this, "bg2videoram"), - m_spriteram(*this, "spriteram") - { } - - void tbowl(machine_config &config); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - -private: - required_device m_maincpu; - required_device m_audiocpu; - required_device m_msm1; - required_device m_msm2; - required_device m_gfxdecode; - required_device m_palette; - required_device m_sprgen; - required_device m_soundlatch; - - required_shared_ptr m_txvideoram; - required_shared_ptr m_bgvideoram; - required_shared_ptr m_bg2videoram; - required_shared_ptr m_spriteram; - - tilemap_t *m_tx_tilemap = nullptr; - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_bg2_tilemap = nullptr; - uint16_t m_xscroll = 0; - uint16_t m_yscroll = 0; - uint16_t m_bg2xscroll = 0; - uint16_t m_bg2yscroll = 0; - int m_adpcm_pos[2]{}; - int m_adpcm_end[2]{}; - int m_adpcm_data[2]{}; - - void coincounter_w(uint8_t data); - void boardb_bankswitch_w(uint8_t data); - void boardc_bankswitch_w(uint8_t data); - void trigger_nmi(uint8_t data); - void adpcm_start_w(offs_t offset, uint8_t data); - void adpcm_end_w(offs_t offset, uint8_t data); - void adpcm_vol_w(offs_t offset, uint8_t data); - void txvideoram_w(offs_t offset, uint8_t data); - void bg2videoram_w(offs_t offset, uint8_t data); - void bgxscroll_lo(uint8_t data); - void bgxscroll_hi(uint8_t data); - void bgyscroll_lo(uint8_t data); - void bgyscroll_hi(uint8_t data); - void bgvideoram_w(offs_t offset, uint8_t data); - void bg2xscroll_lo(uint8_t data); - void bg2xscroll_hi(uint8_t data); - void bg2yscroll_lo(uint8_t data); - void bg2yscroll_hi(uint8_t data); - - TILE_GET_INFO_MEMBER(get_tx_tile_info); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - TILE_GET_INFO_MEMBER(get_bg2_tile_info); - - uint32_t screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - void adpcm_int(msm5205_device *device, int chip); - DECLARE_WRITE_LINE_MEMBER(adpcm_int_1); - DECLARE_WRITE_LINE_MEMBER(adpcm_int_2); - - void _6206A_map(address_map &map); - void _6206B_map(address_map &map); - void _6206C_map(address_map &map); -}; - -#endif // MAME_INCLUDES_TBOWL_H diff --git a/src/mame/video/galpanic.cpp b/src/mame/video/galpanic.cpp deleted file mode 100644 index a306fc143b9..00000000000 --- a/src/mame/video/galpanic.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -#include "emu.h" -#include "kan_pand.h" -#include "includes/galpanic.h" - - -void galpanic_state::video_start() -{ - m_screen->register_screen_bitmap(m_bitmap); - - save_item(NAME(m_bitmap)); -} - -void galpanic_state::galpanic_palette(palette_device &palette) const -{ - // first 1024 colors are dynamic - - // initialize 555 GRB lookup - for (int i = 0; i < 32768; i++) - palette.set_pen_color(i + 1024, pal5bit(i >> 5), pal5bit(i >> 10), pal5bit(i >> 0)); -} - -void galpanic_state::bgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - data = COMBINE_DATA(&m_bgvideoram[offset]); - - int sy = offset / 256; - int sx = offset % 256; - - m_bitmap.pix(sy, sx) = 1024 + (data >> 1); -} - -void galpanic_state::draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - for (int offs = 0;offs < m_fgvideoram.bytes()/2;offs++) - { - int const sx = offs % 256; - int const sy = offs / 256; - int const color = m_fgvideoram[offs]; - if (color) - bitmap.pix(sy, sx) = color; - } -} - -uint32_t galpanic_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - /* copy the temporary bitmap to the screen */ - copybitmap(bitmap,m_bitmap,0,0,0,0,cliprect); - - draw_fgbitmap(bitmap, cliprect); - - m_pandora->update(bitmap, cliprect); - - return 0; -} diff --git a/src/mame/video/hcastle.cpp b/src/mame/video/hcastle.cpp deleted file mode 100644 index 06c93830ede..00000000000 --- a/src/mame/video/hcastle.cpp +++ /dev/null @@ -1,239 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Bryan McPhail -/*************************************************************************** - - Haunted Castle video emulation - -***************************************************************************/ - -#include "emu.h" -#include "includes/hcastle.h" -#include "screen.h" - - -void hcastle_state::hcastle_palette(palette_device &palette) const -{ - uint8_t const *const color_prom = memregion("proms")->base(); - for (int chip = 0; chip < 2; chip++) - { - for (int pal = 0; pal < 8; pal++) - { - int const clut = (chip << 1) | (pal & 1); - - for (int i = 0; i < 0x100; i++) - { - uint8_t ctabentry; - - if (((pal & 0x01) == 0) && (color_prom[(clut << 8) | i] == 0)) - ctabentry = 0; - else - ctabentry = (pal << 4) | (color_prom[(clut << 8) | i] & 0x0f); - - palette.set_pen_indirect((chip << 11) | (pal << 8) | i, ctabentry); - } - } - } -} - - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILEMAP_MAPPER_MEMBER(hcastle_state::tilemap_scan) -{ - /* logical (col,row) -> memory offset */ - return (col & 0x1f) + ((row & 0x1f) << 5) + ((col & 0x20) << 6); /* skip 0x400 */ -} - -TILE_GET_INFO_MEMBER(hcastle_state::get_fg_tile_info) -{ - uint8_t ctrl_5 = m_k007121_1->ctrlram_r(5); - uint8_t ctrl_6 = m_k007121_1->ctrlram_r(6); - 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 attr = m_pf1_videoram[tile_index]; - int tile = m_pf1_videoram[tile_index + 0x400]; - int color = attr & 0x7; - int bank = ((attr & 0x80) >> 7) | - ((attr >> (bit0 + 2)) & 0x02) | - ((attr >> (bit1 + 1)) & 0x04) | - ((attr >> (bit2 )) & 0x08) | - ((attr >> (bit3 - 1)) & 0x10); - - tileinfo.set(0, - tile + bank * 0x100 + m_pf1_bankbase, - ((ctrl_6 & 0x30) * 2 + 16) + color, - 0); -} - -TILE_GET_INFO_MEMBER(hcastle_state::get_bg_tile_info) -{ - uint8_t ctrl_5 = m_k007121_2->ctrlram_r(5); - uint8_t ctrl_6 = m_k007121_2->ctrlram_r(6); - 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 attr = m_pf2_videoram[tile_index]; - int tile = m_pf2_videoram[tile_index + 0x400]; - int color = attr & 0x7; - int bank = ((attr & 0x80) >> 7) | - ((attr >> (bit0 + 2)) & 0x02) | - ((attr >> (bit1 + 1)) & 0x04) | - ((attr >> (bit2 )) & 0x08) | - ((attr >> (bit3 - 1)) & 0x10); - - tileinfo.set(1, - tile + bank * 0x100 + m_pf2_bankbase, - ((ctrl_6 & 0x30) * 2 + 16) + color, - 0); -} - - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void hcastle_state::video_start() -{ - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(hcastle_state::get_fg_tile_info)), tilemap_mapper_delegate(*this, FUNC(hcastle_state::tilemap_scan)), 8, 8, 64, 32); - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(hcastle_state::get_bg_tile_info)), tilemap_mapper_delegate(*this, FUNC(hcastle_state::tilemap_scan)), 8, 8, 64, 32); - - m_fg_tilemap->set_transparent_pen(0); -} - - - -/*************************************************************************** - - Memory handlers - -***************************************************************************/ - -void hcastle_state::hcastle_pf1_video_w(offs_t offset, uint8_t data) -{ - m_pf1_videoram[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset & 0xbff); -} - -void hcastle_state::hcastle_pf2_video_w(offs_t offset, uint8_t data) -{ - m_pf2_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset & 0xbff); -} - -void hcastle_state::hcastle_gfxbank_w(uint8_t data) -{ - m_gfx_bank = data; -} - -uint8_t hcastle_state::hcastle_gfxbank_r() -{ - return m_gfx_bank; -} - -void hcastle_state::hcastle_pf1_control_w(offs_t offset, uint8_t data) -{ - if (offset == 3) - { - if ((data & 0x8) == 0) - m_spriteram->copy(0x800, 0x800); - else - m_spriteram->copy(0x000, 0x800); - } - else if (offset == 7) - { - m_fg_tilemap->set_flip((data & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); - } - m_k007121_1->ctrl_w(offset, data); -} - -void hcastle_state::hcastle_pf2_control_w(offs_t offset, uint8_t data) -{ - if (offset == 3) - { - if ((data & 0x8) == 0) - m_spriteram2->copy(0x800, 0x800); - else - m_spriteram2->copy(0x000, 0x800); - } - else if (offset == 7) - { - m_bg_tilemap->set_flip((data & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); - } - m_k007121_2->ctrl_w(offset, data); -} - -/*****************************************************************************/ - -void hcastle_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, uint8_t *sbank, int bank ) -{ - k007121_device *k007121 = bank ? m_k007121_2 : m_k007121_1; - int base_color = (k007121->ctrlram_r(6) & 0x30) * 2; - int bank_base = (bank == 0) ? 0x4000 * (m_gfx_bank & 1) : 0; - - k007121->sprites_draw(bitmap, cliprect, m_gfxdecode->gfx(bank), *m_palette, sbank, base_color, 0, bank_base, priority_bitmap, (uint32_t)-1); -} - -/*****************************************************************************/ - -uint32_t hcastle_state::screen_update_hcastle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - uint8_t ctrl_1_0 = m_k007121_1->ctrlram_r(0); - uint8_t ctrl_1_1 = m_k007121_1->ctrlram_r(1); - uint8_t ctrl_1_2 = m_k007121_1->ctrlram_r(2); - uint8_t ctrl_1_3 = m_k007121_1->ctrlram_r(3); - uint8_t ctrl_2_0 = m_k007121_2->ctrlram_r(0); - uint8_t ctrl_2_1 = m_k007121_2->ctrlram_r(1); - uint8_t ctrl_2_2 = m_k007121_2->ctrlram_r(2); - uint8_t ctrl_2_3 = m_k007121_2->ctrlram_r(3); - - m_pf1_bankbase = 0x0000; - m_pf2_bankbase = 0x4000 * ((m_gfx_bank & 2) >> 1); - - if (ctrl_1_3 & 0x01) - m_pf1_bankbase += 0x2000; - if (ctrl_2_3 & 0x01) - m_pf2_bankbase += 0x2000; - - if (m_pf1_bankbase != m_old_pf1) - m_fg_tilemap->mark_all_dirty(); - - if (m_pf2_bankbase != m_old_pf2) - m_bg_tilemap->mark_all_dirty(); - - m_old_pf1 = m_pf1_bankbase; - m_old_pf2 = m_pf2_bankbase; - - m_bg_tilemap->set_scrolly(0, ctrl_2_2); - m_bg_tilemap->set_scrollx(0, ((ctrl_2_1 << 8) + ctrl_2_0)); - m_fg_tilemap->set_scrolly(0, ctrl_1_2); - m_fg_tilemap->set_scrollx(0, ((ctrl_1_1 << 8) + ctrl_1_0)); - -// /* Sprite priority */ -// if (ctrl_1_3 & 0x20) - if ((m_gfx_bank & 0x04) == 0) - { - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect, screen.priority(), m_spriteram->buffer(), 0); - draw_sprites(bitmap, cliprect, screen.priority(), m_spriteram2->buffer(), 1); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - } - else - { - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect, screen.priority(), m_spriteram->buffer(), 0); - draw_sprites(bitmap, cliprect, screen.priority(), m_spriteram2->buffer(), 1); - } - return 0; -} diff --git a/src/mame/video/tbowl.cpp b/src/mame/video/tbowl.cpp deleted file mode 100644 index 9bb287ae1fa..00000000000 --- a/src/mame/video/tbowl.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood -/* video/tbowl.c */ - -/* see drivers/tbowl.cpp for more info */ - -#include "emu.h" -#include "includes/tbowl.h" - - -/* Foreground Layer (tx) Tilemap */ - -TILE_GET_INFO_MEMBER(tbowl_state::get_tx_tile_info) -{ - int tileno; - int col; - - tileno = m_txvideoram[tile_index] | ((m_txvideoram[tile_index+0x800] & 0x07) << 8); - col = (m_txvideoram[tile_index+0x800] & 0xf0) >> 4; - - tileinfo.set(0,tileno,col,0); -} - -void tbowl_state::txvideoram_w(offs_t offset, uint8_t data) -{ - m_txvideoram[offset] = data; - m_tx_tilemap->mark_tile_dirty(offset & 0x7ff); -} - -/* Bottom BG Layer (bg) Tilemap */ - -TILE_GET_INFO_MEMBER(tbowl_state::get_bg_tile_info) -{ - int tileno; - int col; - - tileno = m_bgvideoram[tile_index] | ((m_bgvideoram[tile_index+0x1000] & 0x0f) << 8); - col = (m_bgvideoram[tile_index+0x1000] & 0xf0) >> 4; - - tileinfo.set(1,tileno,col,0); -} - -void tbowl_state::bg2videoram_w(offs_t offset, uint8_t data) -{ - m_bg2videoram[offset] = data; - m_bg2_tilemap->mark_tile_dirty(offset & 0xfff); -} - -void tbowl_state::bgxscroll_lo(uint8_t data) -{ - m_xscroll = (m_xscroll & 0xff00) | data; -} - -void tbowl_state::bgxscroll_hi(uint8_t data) -{ - m_xscroll = (m_xscroll & 0x00ff) | (data << 8); -} - -void tbowl_state::bgyscroll_lo(uint8_t data) -{ - m_yscroll = (m_yscroll & 0xff00) | data; -} - -void tbowl_state::bgyscroll_hi(uint8_t data) -{ - m_yscroll = (m_yscroll & 0x00ff) | (data << 8); -} - -/* Middle BG Layer (bg2) Tilemaps */ - -TILE_GET_INFO_MEMBER(tbowl_state::get_bg2_tile_info) -{ - int tileno; - int col; - - tileno = m_bg2videoram[tile_index] | ((m_bg2videoram[tile_index+0x1000] & 0x0f) << 8); - tileno ^= 0x400; - col = (m_bg2videoram[tile_index+0x1000] & 0xf0) >> 4; - - tileinfo.set(2,tileno,col,0); -} - -void tbowl_state::bgvideoram_w(offs_t offset, uint8_t data) -{ - m_bgvideoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset & 0xfff); -} - -void tbowl_state::bg2xscroll_lo(uint8_t data) -{ - m_bg2xscroll = (m_bg2xscroll & 0xff00) | data; -} - -void tbowl_state::bg2xscroll_hi(uint8_t data) -{ - m_bg2xscroll = (m_bg2xscroll & 0x00ff) | (data << 8); -} - -void tbowl_state::bg2yscroll_lo(uint8_t data) -{ - m_bg2yscroll = (m_bg2yscroll & 0xff00) | data; -} - -void tbowl_state::bg2yscroll_hi(uint8_t data) -{ - m_bg2yscroll = (m_bg2yscroll & 0x00ff) | (data << 8); -} - - -/*** Video Start / Update ***/ - -void tbowl_state::video_start() -{ - m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tbowl_state::get_tx_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64,32); - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tbowl_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 16,16, 128,32); - m_bg2_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tbowl_state::get_bg2_tile_info)), TILEMAP_SCAN_ROWS, 16,16, 128,32); - - m_tx_tilemap->set_transparent_pen(0); - m_bg_tilemap->set_transparent_pen(0); - m_bg2_tilemap->set_transparent_pen(0); - - save_item(NAME(m_xscroll)); - save_item(NAME(m_yscroll)); - save_item(NAME(m_bg2xscroll)); - save_item(NAME(m_bg2yscroll)); -} - - - -uint32_t tbowl_state::screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->set_scrollx(0, m_xscroll ); - m_bg_tilemap->set_scrolly(0, m_yscroll ); - m_bg2_tilemap->set_scrollx(0, m_bg2xscroll ); - m_bg2_tilemap->set_scrolly(0, m_bg2yscroll ); - m_tx_tilemap->set_scrollx(0, 0 ); - m_tx_tilemap->set_scrolly(0, 0 ); - - bitmap.fill(0x100, cliprect); /* is there a register controlling the colour? looks odd when screen is blank */ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0,0); - m_sprgen->tbowl_draw_sprites(bitmap,cliprect, m_gfxdecode->gfx(3), 0, m_spriteram); - m_bg2_tilemap->draw(screen, bitmap, cliprect, 0,0); - m_tx_tilemap->draw(screen, bitmap, cliprect, 0,0); - - return 0; -} - -uint32_t tbowl_state::screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->set_scrollx(0, m_xscroll+32*8 ); - m_bg_tilemap->set_scrolly(0, m_yscroll ); - m_bg2_tilemap->set_scrollx(0, m_bg2xscroll+32*8 ); - m_bg2_tilemap->set_scrolly(0, m_bg2yscroll ); - m_tx_tilemap->set_scrollx(0, 32*8 ); - m_tx_tilemap->set_scrolly(0, 0 ); - - bitmap.fill(0x100, cliprect); /* is there a register controlling the colour? looks odd when screen is blank */ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0,0); - m_sprgen->tbowl_draw_sprites(bitmap,cliprect, m_gfxdecode->gfx(3), 32*8, m_spriteram); - m_bg2_tilemap->draw(screen, bitmap, cliprect, 0,0); - m_tx_tilemap->draw(screen, bitmap, cliprect, 0,0); - - return 0; -}