diff --git a/src/mame/drivers/blktiger_ms.cpp b/src/mame/drivers/blktiger_ms.cpp index b03d2ed5378..5e736f461ef 100644 --- a/src/mame/drivers/blktiger_ms.cpp +++ b/src/mame/drivers/blktiger_ms.cpp @@ -15,6 +15,16 @@ MOD51/1 - Sprite board, has logic + 4 sprite ROMs. MOD 4/3 - Tilemap board, has logic + 2 tilemap ROMs, long thin sub-board (CAR-0484/1 SOLD) with no chips, just routing along one edge. MOD 4/3 - Tilemap board, has logic + 4 tilemap ROMs, long thin sub-board (CAR-0484/1 SOLD) with no chips, just routing along one edge. + + TODO: practically everything: + - derive from blktiger_state? (eventually, if differences aren't too much) + - chars and sprites related functions are copied from blktiger.cpp. Verify differences + - correct GFX decoding + - tiles + - palette + - banking: seems to work by accident, tweaking the ROM loading. Pretty sure it's wrong. + - where are the sound latch and the other functions that the original has mapped in the io space? + - lots of other stuff */ @@ -25,15 +35,21 @@ #include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" +namespace { + class blktiger_ms_state : public driver_device { public: blktiger_ms_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_screen(*this, "screen") + m_screen(*this, "screen"), + m_gfxdecode(*this, "gfxdecode"), + m_txvideoram(*this, "txvideoram"), + m_spriteram(*this, "spriteram") { } void blktigerm(machine_config &config); @@ -42,28 +58,45 @@ public: protected: virtual void machine_start() override; + virtual void video_start() override; private: required_device m_maincpu; required_device m_screen; + required_device m_gfxdecode; + required_shared_ptr m_txvideoram; + required_shared_ptr m_spriteram; + + TILE_GET_INFO_MEMBER(get_tx_tile_info); + void txvideoram_w(offs_t offset, uint8_t data); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void blktigerm_map(address_map &map); - void blktigerm_sound_map(address_map &map); + void main_map(address_map &map); + void sound_map(address_map &map); + + tilemap_t *m_tx_tilemap; }; -void blktiger_ms_state::blktigerm_map(address_map &map) +void blktiger_ms_state::main_map(address_map &map) { map(0x0000, 0x7fff).rom().region("maincpu", 0); - //map(0x8000, 0xbfff).bankr("mainbank"); - //map(0xc003, 0xc003).r(); // ?? - //map(0xd800, 0xd800).w(); // bankswitch? - map(0xe000, 0xffff).ram(); + map(0x8000, 0xbfff).bankr("mainbank"); + map(0xc000, 0xcfff).ram(); + map(0xc000, 0xc000).portr("IN0"); + map(0xc001, 0xc001).portr("IN1"); + map(0xc002, 0xc002).portr("IN2"); + map(0xc003, 0xc003).portr("DSW0"); + map(0xc004, 0xc004).portr("DSW1"); + map(0xd000, 0xd7ff).ram().w(FUNC(blktiger_ms_state::txvideoram_w)).share(m_txvideoram); + map(0xd800, 0xd800).lw8(NAME([this] (u8 data) { membank("mainbank")->set_entry(data & 0x0f); })); // very probably wrong + map(0xe000, 0xfdff).ram(); + map(0xfe00, 0xffff).ram().share(m_spriteram); } -void blktiger_ms_state::blktigerm_sound_map(address_map &map) // seems similar to toki_ms.cpp and raiden_ms.cpp +void blktiger_ms_state::sound_map(address_map &map) // seems similar to toki_ms.cpp and raiden_ms.cpp { map(0x0000, 0x7fff).rom().region("audiocpu", 0); map(0xc000, 0xc7ff).ram(); @@ -78,35 +111,190 @@ void blktiger_ms_state::blktigerm_sound_map(address_map &map) // seems similar t void blktiger_ms_state::machine_start() { + membank("mainbank")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); } +void blktiger_ms_state::video_start() +{ + m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(blktiger_ms_state::get_tx_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); +} + +void blktiger_ms_state::txvideoram_w(offs_t offset, uint8_t data) +{ + m_txvideoram[offset] = data; + m_tx_tilemap->mark_tile_dirty(offset & 0x3ff); +} + +void blktiger_ms_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) + { + int attr = m_spriteram[offs + 1]; + int sx = m_spriteram[offs + 3] - ((attr & 0x10) << 4); + int sy = m_spriteram[offs + 2]; + int code = m_spriteram[offs] | ((attr & 0xe0) << 3); + int color = attr & 0x07; + int flipx = attr & 0x08; + + if (flip_screen()) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + } + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, + color, + flipx, flip_screen(), + sx, sy, 15); + } +} uint32_t blktiger_ms_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { + m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + draw_sprites(bitmap, cliprect); + return 0; } +TILE_GET_INFO_MEMBER(blktiger_ms_state::get_tx_tile_info) +{ + uint8_t attr = m_txvideoram[tile_index + 0x400]; + tileinfo.set(0, + m_txvideoram[tile_index] + ((attr & 0xe0) << 3), + attr & 0x1f, + 0); +} + static INPUT_PORTS_START( blktigerm ) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) + + PORT_START("IN1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("IN2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("DSW0") + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION( "SW1:1,2,3" ) + PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) + PORT_DIPSETTING( 0x03, DEF_STR( 1C_5C ) ) + PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION( "SW1:4,5,6" ) + PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x38, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x30, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x28, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) ) + PORT_DIPSETTING( 0x18, DEF_STR( 1C_5C ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION( "SW1:7" ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Test ) ) PORT_DIPLOCATION( "SW1:8" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("DSW1") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION( "SW2:1,2" ) + PORT_DIPSETTING( 0x02, "2" ) + PORT_DIPSETTING( 0x03, "3" ) + PORT_DIPSETTING( 0x01, "5" ) + PORT_DIPSETTING( 0x00, "7") + PORT_DIPNAME( 0x1c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION( "SW2:3,4,5" ) + PORT_DIPSETTING( 0x1c, "1 (Easiest)") + PORT_DIPSETTING( 0x18, "2" ) + PORT_DIPSETTING( 0x14, "3" ) + PORT_DIPSETTING( 0x10, "4" ) + PORT_DIPSETTING( 0x0c, "5 (Normal)" ) + PORT_DIPSETTING( 0x08, "6" ) + PORT_DIPSETTING( 0x04, "7" ) + PORT_DIPSETTING( 0x00, "8 (Hardest)" ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION( "SW2:6" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION( "SW2:7" ) + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION( "SW2:8" ) + PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Cocktail ) ) INPUT_PORTS_END +static const gfx_layout charlayout = +{ + 8,8, + RGN_FRAC(1,4), + 4, + { RGN_FRAC(0,4), RGN_FRAC(1,4), RGN_FRAC(2,4), RGN_FRAC(3,4) }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static const gfx_layout tiles16x16x4_layout = +{ + 16,16, + RGN_FRAC(1,1), + 4, + { 0,8,16,24 }, + { 0,1,2,3,4,5,6,7, 512,513,514,515,516,517,518,519 }, + { STEP16(0,32) }, + 16 * 16 * 4 +}; + static GFXDECODE_START( gfx_blktiger_ms ) + GFXDECODE_ENTRY( "chars", 0, charlayout, 0x300, 32 ) + GFXDECODE_ENTRY( "sprites", 0, tiles16x16x4_layout, 0x100, 32 ) GFXDECODE_END void blktiger_ms_state::blktigerm(machine_config &config) { // basic machine hardware Z80(config, m_maincpu, 24_MHz_XTAL / 4); // divisor unknown - m_maincpu->set_addrmap(AS_PROGRAM, &blktiger_ms_state::blktigerm_map); + m_maincpu->set_addrmap(AS_PROGRAM, &blktiger_ms_state::main_map); + m_maincpu->set_vblank_int("screen", FUNC(blktiger_ms_state::irq0_line_hold)); z80_device &audiocpu(Z80(config, "audiocpu", 24_MHz_XTAL / 8)); // divisor unknown, no XTAL on the PCB, might also use the 20 MHz one - audiocpu.set_addrmap(AS_PROGRAM, &blktiger_ms_state::blktigerm_sound_map); + audiocpu.set_addrmap(AS_PROGRAM, &blktiger_ms_state::sound_map); // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); // all wrong m_screen->set_refresh_hz(60); - m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate - m_screen->set_size(256, 256); - m_screen->set_visarea(0, 256-1, 0, 256-32-1); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); + m_screen->set_size(32*8, 32*8); + m_screen->set_visarea(0*8, 32*8-1, 2*8, 30*8-1); m_screen->set_screen_update(FUNC(blktiger_ms_state::screen_update)); m_screen->set_palette("palette"); @@ -127,31 +315,29 @@ void blktiger_ms_state::blktigerm(machine_config &config) ROM_START( blktigerm ) ROM_REGION( 0x50000, "maincpu", 0 ) // on MOD 3/4 board ROM_LOAD( "3_bl_301.ic14", 0x00000, 0x08000, CRC(b4525312) SHA1(958ce9a7f41422f3011412e4a16dd3ad65019733) ) - ROM_LOAD( "3_bl_302_c.ic13", 0x10000, 0x10000, CRC(c943415f) SHA1(08e82d2557de01c979a0a58b5433e9bdcdb118cb) ) - ROM_LOAD( "3_bl_303_b.ic12", 0x20000, 0x10000, CRC(72114f6b) SHA1(049e747431cd95db2e7414467754424f68a8d757) ) - ROM_LOAD( "3_bl_304.ic18", 0x30000, 0x10000, CRC(36f669c6) SHA1(e91fd222919904d4d4b3ef70a22ab599a7cfa263) ) // this and the following ROM are swapped wrt to the sets in blktiger.cpp - ROM_LOAD( "3_bl_305.ic19", 0x40000, 0x10000, CRC(b30a99af) SHA1(19d6dbe11ffeb9a21dbfe75eb39ce9ceaef5eb31) ) // leaving them in the order suggested by the labels for now, since the banking calls have been changed + ROM_LOAD( "3_bl_304.ic18", 0x10000, 0x10000, CRC(36f669c6) SHA1(e91fd222919904d4d4b3ef70a22ab599a7cfa263) ) + ROM_LOAD( "3_bl_305.ic19", 0x20000, 0x10000, CRC(b30a99af) SHA1(19d6dbe11ffeb9a21dbfe75eb39ce9ceaef5eb31) ) + ROM_LOAD( "3_bl_302_c.ic13", 0x30000, 0x10000, CRC(c943415f) SHA1(08e82d2557de01c979a0a58b5433e9bdcdb118cb) ) + ROM_LOAD( "3_bl_303_b.ic12", 0x40000, 0x10000, CRC(72114f6b) SHA1(049e747431cd95db2e7414467754424f68a8d757) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x8000, "audiocpu", 0 ) ROM_LOAD( "1_bl_101.ic12", 0x0000, 0x8000, CRC(14028686) SHA1(64dc219d906f1bdd0c2bc05aff5aa73e001a6901) ) - ROM_REGION( 0x08000, "gfx1", 0 ) // on one of the MOD 4/3 boards, both ROMs 0xxxxxxxxxxxxxx = 0xFF - ROM_LOAD( "4_bl_401.ic17", 0x00000, 0x04000, CRC(ab1afb3d) SHA1(555332ccfb69e65b776f94ffac9a4a051fb6f09e) ) // characters - ROM_CONTINUE( 0x00000, 0x04000) - ROM_LOAD( "4_bl_402.ic16", 0x04000, 0x04000, CRC(89445b11) SHA1(7d9ab6e88d7de3a0e31b3b8a5e57dd39afd7940d) ) - ROM_CONTINUE( 0x04000, 0x04000) + ROM_REGION( 0x10000, "chars", ROMREGION_INVERT ) // on one of the MOD 4/3 boards, both ROMs 0xxxxxxxxxxxxxx = 0xFF + ROM_LOAD( "4_bl_401.ic17", 0x0000, 0x8000, CRC(ab1afb3d) SHA1(555332ccfb69e65b776f94ffac9a4a051fb6f09e) ) + ROM_LOAD( "4_bl_402.ic16", 0x8000, 0x8000, CRC(89445b11) SHA1(7d9ab6e88d7de3a0e31b3b8a5e57dd39afd7940d) ) - ROM_REGION( 0x40000, "gfx2", 0 ) // on the other MOD 4/3 board - ROM_LOAD( "4_a_bl_4a01.ic17", 0x00000, 0x10000, CRC(fc00fd6c) SHA1(066714421fa782c6cfad9f695f05e6e3551ffdc7) ) // tiles - ROM_LOAD( "4_a_bl_4a02.ic16", 0x10000, 0x10000, CRC(49cd8afa) SHA1(147b65dad4f05b940d1f7a4028f5748ba1b7daa5) ) - ROM_LOAD( "4_a_bl_4a03.ic15", 0x20000, 0x10000, CRC(50207dd4) SHA1(bee343fbefc817fa14b8b303f013bf5b89e911f8) ) - ROM_LOAD( "4_a_bl_4a04.ic14", 0x30000, 0x10000, CRC(4bb0c1ba) SHA1(9433c78f0de7cb1f92b22612b9f3c51d813b025a) ) + ROM_REGION( 0x40000, "tiles", 0 ) // on the other MOD 4/3 board + ROM_LOAD32_BYTE( "4_a_bl_4a01.ic17", 0x00003, 0x10000, CRC(fc00fd6c) SHA1(066714421fa782c6cfad9f695f05e6e3551ffdc7) ) + ROM_LOAD32_BYTE( "4_a_bl_4a02.ic16", 0x00002, 0x10000, CRC(49cd8afa) SHA1(147b65dad4f05b940d1f7a4028f5748ba1b7daa5) ) + ROM_LOAD32_BYTE( "4_a_bl_4a03.ic15", 0x00001, 0x10000, CRC(50207dd4) SHA1(bee343fbefc817fa14b8b303f013bf5b89e911f8) ) + ROM_LOAD32_BYTE( "4_a_bl_4a04.ic14", 0x00000, 0x10000, CRC(4bb0c1ba) SHA1(9433c78f0de7cb1f92b22612b9f3c51d813b025a) ) - ROM_REGION( 0x40000, "gfx3", 0 ) // on MOD 51/1 board - ROM_LOAD( "51_bl_501.ic43", 0x00000, 0x10000, CRC(ace32b94) SHA1(4a09e8dc73bd16f7d378aefbe5d433dd1396f97d) ) // sprites - ROM_LOAD( "51_bl_502.ic42", 0x10000, 0x10000, CRC(f6c4cc0b) SHA1(678fd71e90237f8e19eae78fe150a4c5d3494c6c) ) - ROM_LOAD( "51_bl_503.ic41", 0x20000, 0x10000, CRC(61e3ae0b) SHA1(cbb83827f027acd6b905f4210476810bcd4b03a9) ) - ROM_LOAD( "51_bl_504.ic40", 0x30000, 0x10000, CRC(2cb45034) SHA1(b2fd3b7b7b9d68b6ff1985166b106e65b17dbb23) ) + ROM_REGION( 0x40000, "sprites", ROMREGION_INVERT ) // on MOD 51/1 board + ROM_LOAD32_BYTE( "51_bl_501.ic43", 0x00003, 0x10000, CRC(ace32b94) SHA1(4a09e8dc73bd16f7d378aefbe5d433dd1396f97d) ) + ROM_LOAD32_BYTE( "51_bl_502.ic42", 0x00002, 0x10000, CRC(f6c4cc0b) SHA1(678fd71e90237f8e19eae78fe150a4c5d3494c6c) ) + ROM_LOAD32_BYTE( "51_bl_503.ic41", 0x00001, 0x10000, CRC(61e3ae0b) SHA1(cbb83827f027acd6b905f4210476810bcd4b03a9) ) + ROM_LOAD32_BYTE( "51_bl_504.ic40", 0x00000, 0x10000, CRC(2cb45034) SHA1(b2fd3b7b7b9d68b6ff1985166b106e65b17dbb23) ) ROM_REGION( 0x0700, "proms", 0 ) // PROMs (function unknown) ROM_LOAD( "1_p0101_82s123.ic20", 0x0000, 0x0020, CRC(3fd60d3a) SHA1(8100fa7453638ac40193b5d92404f41b101ed2cc) ) @@ -184,4 +370,7 @@ void blktiger_ms_state::init_blktigerm() src[i] = buffer[bitswap<24>(i, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 10, 8, 6, 4, 0, 2, 7, 3, 1, 9, 11, 5)]; } +} // Anonymous namespace + + GAME( 1991, blktigerm, blktiger, blktigerm, blktigerm, blktiger_ms_state, init_blktigerm, ROT0, "bootleg (Gaelco / Ervisa)", "Black Tiger (Modular System)", MACHINE_IS_SKELETON )