diff --git a/src/mame/vsystem/aerofgt.cpp b/src/mame/vsystem/aerofgt.cpp index 53301c044c093..f6b9999bfa3f6 100644 --- a/src/mame/vsystem/aerofgt.cpp +++ b/src/mame/vsystem/aerofgt.cpp @@ -58,6 +58,7 @@ class aerofgt_state : public driver_device void setbank(int layer, int num, int bank); void gfxbank_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); uint32_t tile_callback(uint32_t code); + uint32_t pri_callback(uint32_t color); void soundlatch_pending_w(int state); void sh_bankswitch_w(uint8_t data); @@ -123,11 +124,17 @@ void aerofgt_state::video_start() save_item(NAME(m_gfxbank)); save_item(NAME(m_bank)); + save_item(NAME(m_scrolly)); } uint32_t aerofgt_state::tile_callback(uint32_t code) { - return m_sprlookupram[code&0x7fff]; + return m_sprlookupram[code & 0x7fff]; +} + +uint32_t aerofgt_state::pri_callback(uint32_t color) +{ + return BIT(color, 5) ? 0 : GFX_PMASK_2; } @@ -171,15 +178,10 @@ uint32_t aerofgt_state::screen_update(screen_device &screen, bitmap_ind16 &bitma screen.priority().fill(0, cliprect); - m_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0); - - m_spr->draw_sprites(m_spriteram, m_spriteram.bytes(), screen, bitmap, cliprect, 0x03, 0x00); - m_spr->draw_sprites(m_spriteram, m_spriteram.bytes(), screen, bitmap, cliprect, 0x03, 0x01); + m_tilemap[0]->draw(screen, bitmap, cliprect, 0, 1); + m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 2); - m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); - - m_spr->draw_sprites(m_spriteram, m_spriteram.bytes(), screen, bitmap, cliprect, 0x03, 0x02); - m_spr->draw_sprites(m_spriteram, m_spriteram.bytes(), screen, bitmap, cliprect, 0x03, 0x03); + m_spr->draw_sprites(m_spriteram, m_spriteram.bytes(), screen, bitmap, cliprect); return 0; } @@ -339,20 +341,23 @@ INPUT_PORTS_END static GFXDECODE_START( gfx_aerofgt ) - GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_msb, 0, 16 ) - GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_msb, 256, 16 ) - GFXDECODE_ENTRY( "gfx2", 0, gfx_16x16x4_packed_msb, 512, 32 ) + GFXDECODE_ENTRY( "tiles", 0, gfx_8x8x4_packed_msb, 0, 16 ) + GFXDECODE_ENTRY( "tiles", 0, gfx_8x8x4_packed_msb, 256, 16 ) +GFXDECODE_END + +static GFXDECODE_START( gfx_aerofgt_spr ) + GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_msb, 512, 32 ) GFXDECODE_END void aerofgt_state::machine_start() { - m_soundbank->configure_entries(0, 4, memregion("soundbank")->base(), 0x8000); + m_soundbank->configure_entries(0, 4, memregion("audiocpu")->base(), 0x8000); } void aerofgt_state::machine_reset() { - m_soundbank->set_entry(0); // needed by spinlbrk + m_soundbank->set_entry(0); } void aerofgt_state::aerofgt(machine_config &config) @@ -390,10 +395,9 @@ void aerofgt_state::aerofgt(machine_config &config) GFXDECODE(config, m_gfxdecode, m_palette, gfx_aerofgt); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024); - VSYSTEM_SPR(config, m_spr, 0); + VSYSTEM_SPR(config, m_spr, 0, m_palette, gfx_aerofgt_spr); m_spr->set_tile_indirect_cb(FUNC(aerofgt_state::tile_callback)); - m_spr->set_gfx_region(2); - m_spr->set_gfxdecode_tag(m_gfxdecode); + m_spr->set_pri_cb(FUNC(aerofgt_state::pri_callback)); // sound hardware SPEAKER(config, "lspeaker").front_left(); @@ -423,17 +427,14 @@ ROM_START( aerofgt ) ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code ROM_LOAD16_WORD_SWAP( "1.u4", 0x00000, 0x80000, CRC(6fdff0a2) SHA1(7cc9529b426091027aa3e23586cb7d162376c0ff) ) - ROM_REGION( 0x20000, "soundbank", 0 ) // 128k for the audio CPU + banks + ROM_REGION( 0x20000, "audiocpu", 0 ) // 128k for the audio CPU + banks ROM_LOAD( "2.153", 0x00000, 0x20000, CRC(a1ef64ec) SHA1(fa3e434738bf4e742ad68882c1e914100ce0f761) ) - ROM_REGION( 0x08000, "audiocpu", 0 ) // 32k for the audio CPU - ROM_COPY( "soundbank", 0x00000, 0x00000, 0x08000 ) - - ROM_REGION( 0x100000, "gfx1", 0 ) + ROM_REGION( 0x100000, "tiles", 0 ) ROM_LOAD16_WORD_SWAP( "538a54.124", 0x000000, 0x80000, CRC(4d2c4df2) SHA1(f51c2b3135f0a921ac1a79e63d6878c03cb6254b) ) ROM_LOAD16_WORD_SWAP( "1538a54.124", 0x080000, 0x80000, CRC(286d109e) SHA1(3a5f3d2d89cf58f6ef15e4bd3f570b84e8e695b2) ) - ROM_REGION( 0x400000, "gfx2", 0 ) + ROM_REGION( 0x400000, "sprites", 0 ) ROM_LOAD16_WORD_SWAP( "538a53.u9", 0x000000, 0x100000, CRC(630d8e0b) SHA1(5a0c252ccd53c5199a695909d25ecb4e53dc15b9) ) ROM_LOAD16_WORD_SWAP( "534g8f.u18", 0x200000, 0x080000, CRC(76ce0926) SHA1(5ef4cec215d4dd600d8fcd1bd9a4c09081d59e33) ) diff --git a/src/mame/vsystem/crshrace.cpp b/src/mame/vsystem/crshrace.cpp index ff35caeb8cde5..04031649c792e 100644 --- a/src/mame/vsystem/crshrace.cpp +++ b/src/mame/vsystem/crshrace.cpp @@ -561,22 +561,12 @@ INPUT_PORTS_END -static const gfx_layout tilelayout = -{ - 16,16, - RGN_FRAC(1,1), - 4, - { 0, 1, 2, 3 }, - { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4, - 10*4, 11*4, 8*4, 9*4, 14*4, 15*4, 12*4, 13*4 }, - { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, - 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 }, - 128*8 -}; - static GFXDECODE_START( gfx_crshrace ) GFXDECODE_ENTRY( "chars", 0, gfx_8x8x8_raw, 0, 1 ) - GFXDECODE_ENTRY( "tiles", 0, tilelayout, 256, 16 ) + GFXDECODE_ENTRY( "tiles", 0, gfx_16x16x4_packed_msb, 256, 16 ) +GFXDECODE_END + +static GFXDECODE_START( gfx_crshrace_spr ) GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_lsb, 512, 32 ) GFXDECODE_END @@ -621,10 +611,8 @@ void crshrace_state::crshrace(machine_config &config) // TODO: PCB sports 32 MHz GFXDECODE(config, m_gfxdecode, m_palette, gfx_crshrace); PALETTE(config, m_palette).set_format(palette_device::xGBR_555, 2048); - VSYSTEM_SPR(config, m_spr, 0); + VSYSTEM_SPR(config, m_spr, 0, m_palette, gfx_crshrace_spr); m_spr->set_tile_indirect_cb(FUNC(crshrace_state::tile_callback)); - m_spr->set_gfx_region(2); - m_spr->set_gfxdecode_tag(m_gfxdecode); BUFFERED_SPRITERAM16(config, m_spriteram[0]); BUFFERED_SPRITERAM16(config, m_spriteram[1]); @@ -667,9 +655,9 @@ ROM_START( crshrace ) ROM_LOAD( "h895.ic50", 0x000000, 0x100000, CRC(36ad93c3) SHA1(f68f229dd1a1f8bfd3b8f73b6627f5f00f809d34) ) ROM_REGION( 0x400000, "tiles", 0 ) - ROM_LOAD( "w18.rom-a", 0x000000, 0x100000, CRC(b15df90d) SHA1(56e38e6c40a02553b6b8c5282aa8f16b20779ebf) ) - ROM_LOAD( "w19.rom-b", 0x100000, 0x100000, CRC(28326b93) SHA1(997e9b250b984b012ce1d165add59c741fb18171) ) - ROM_LOAD( "w20.rom-c", 0x200000, 0x100000, CRC(d4056ad1) SHA1(4b45b14aa0766d7aef72f060e1cd28d67690d5fe) ) + ROM_LOAD16_WORD_SWAP( "w18.rom-a", 0x000000, 0x100000, CRC(b15df90d) SHA1(56e38e6c40a02553b6b8c5282aa8f16b20779ebf) ) + ROM_LOAD16_WORD_SWAP( "w19.rom-b", 0x100000, 0x100000, CRC(28326b93) SHA1(997e9b250b984b012ce1d165add59c741fb18171) ) + ROM_LOAD16_WORD_SWAP( "w20.rom-c", 0x200000, 0x100000, CRC(d4056ad1) SHA1(4b45b14aa0766d7aef72f060e1cd28d67690d5fe) ) // 300000-3fffff empty ROM_REGION( 0x400000, "sprites", 0 ) @@ -700,9 +688,9 @@ ROM_START( crshrace2 ) ROM_LOAD( "h895.ic50", 0x000000, 0x100000, CRC(36ad93c3) SHA1(f68f229dd1a1f8bfd3b8f73b6627f5f00f809d34) ) ROM_REGION( 0x400000, "tiles", 0 ) - ROM_LOAD( "w18.rom-a", 0x000000, 0x100000, CRC(b15df90d) SHA1(56e38e6c40a02553b6b8c5282aa8f16b20779ebf) ) - ROM_LOAD( "w19.rom-b", 0x100000, 0x100000, CRC(28326b93) SHA1(997e9b250b984b012ce1d165add59c741fb18171) ) - ROM_LOAD( "w20.rom-c", 0x200000, 0x100000, CRC(d4056ad1) SHA1(4b45b14aa0766d7aef72f060e1cd28d67690d5fe) ) + ROM_LOAD16_WORD_SWAP( "w18.rom-a", 0x000000, 0x100000, CRC(b15df90d) SHA1(56e38e6c40a02553b6b8c5282aa8f16b20779ebf) ) + ROM_LOAD16_WORD_SWAP( "w19.rom-b", 0x100000, 0x100000, CRC(28326b93) SHA1(997e9b250b984b012ce1d165add59c741fb18171) ) + ROM_LOAD16_WORD_SWAP( "w20.rom-c", 0x200000, 0x100000, CRC(d4056ad1) SHA1(4b45b14aa0766d7aef72f060e1cd28d67690d5fe) ) // 300000-3fffff empty ROM_REGION( 0x400000, "sprites", 0 ) @@ -733,9 +721,9 @@ ROM_START( crshrace2a ) ROM_LOAD( "h895.ic50", 0x000000, 0x100000, CRC(36ad93c3) SHA1(f68f229dd1a1f8bfd3b8f73b6627f5f00f809d34) ) ROM_REGION( 0x400000, "tiles", 0 ) // on a riser board - ROM_LOAD( "w18.rom-a", 0x000000, 0x100000, CRC(b15df90d) SHA1(56e38e6c40a02553b6b8c5282aa8f16b20779ebf) ) - ROM_LOAD( "w19.rom-b", 0x100000, 0x100000, CRC(28326b93) SHA1(997e9b250b984b012ce1d165add59c741fb18171) ) - ROM_LOAD( "w20.rom-c", 0x200000, 0x100000, CRC(d4056ad1) SHA1(4b45b14aa0766d7aef72f060e1cd28d67690d5fe) ) + ROM_LOAD16_WORD_SWAP( "w18.rom-a", 0x000000, 0x100000, CRC(b15df90d) SHA1(56e38e6c40a02553b6b8c5282aa8f16b20779ebf) ) + ROM_LOAD16_WORD_SWAP( "w19.rom-b", 0x100000, 0x100000, CRC(28326b93) SHA1(997e9b250b984b012ce1d165add59c741fb18171) ) + ROM_LOAD16_WORD_SWAP( "w20.rom-c", 0x200000, 0x100000, CRC(d4056ad1) SHA1(4b45b14aa0766d7aef72f060e1cd28d67690d5fe) ) // 300000-3fffff empty ROM_REGION( 0x400000, "sprites", 0 ) diff --git a/src/mame/vsystem/f1gp.cpp b/src/mame/vsystem/f1gp.cpp index 411e08a580912..b533ce772595e 100644 --- a/src/mame/vsystem/f1gp.cpp +++ b/src/mame/vsystem/f1gp.cpp @@ -204,14 +204,14 @@ TILE_GET_INFO_MEMBER(f1gp_state::get_roz_tile_info) { int const code = m_rozvideoram[tile_index]; - tileinfo.set(3, code & 0x7ff, code >> 12, 0); + tileinfo.set(1, code & 0x7ff, code >> 12, 0); } TILE_GET_INFO_MEMBER(f1gp2_state::get_roz_tile_info) { int const code = m_rozvideoram[tile_index]; - tileinfo.set(2, (code & 0x7ff) + (m_roz_bank << 11), code >> 12, 0); + tileinfo.set(1, (code & 0x7ff) + (m_roz_bank << 11), code >> 12, 0); } @@ -262,7 +262,7 @@ void f1gp2_state::video_start() void f1gp_state::rozgfxram_w(offs_t offset, uint16_t data, uint16_t mem_mask) { COMBINE_DATA(&m_rozgfxram[offset]); - m_gfxdecode->gfx(3)->mark_dirty(offset / 64); + m_gfxdecode->gfx(1)->mark_dirty(offset / 64); } void f1gp_state::rozvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) @@ -319,13 +319,13 @@ uint32_t f1gp_state::screen_update_f1gp(screen_device &screen, bitmap_ind16 &bit // quick kludge for "continue" screen priority if (m_gfxctrl == 0x00) { - m_spr_old[0]->turbofrc_draw_sprites(m_sprvram[0], m_sprvram[0].bytes(), 0, bitmap, cliprect, screen.priority(), 0x02); - m_spr_old[1]->turbofrc_draw_sprites(m_sprvram[1], m_sprvram[1].bytes(), 0, bitmap, cliprect, screen.priority(), 0x02); + m_spr_old[0]->draw_sprites(m_sprvram[0], m_sprvram[0].bytes(), 0, bitmap, cliprect, screen.priority(), 0x02); + m_spr_old[1]->draw_sprites(m_sprvram[1], m_sprvram[1].bytes(), 0, bitmap, cliprect, screen.priority(), 0x02); } else { - m_spr_old[0]->turbofrc_draw_sprites(m_sprvram[0], m_sprvram[0].bytes(), 0, bitmap, cliprect, screen.priority(), 0x00); - m_spr_old[1]->turbofrc_draw_sprites(m_sprvram[1], m_sprvram[1].bytes(), 0, bitmap, cliprect, screen.priority(), 0x02); + m_spr_old[0]->draw_sprites(m_sprvram[0], m_sprvram[0].bytes(), 0, bitmap, cliprect, screen.priority(), 0x00); + m_spr_old[1]->draw_sprites(m_sprvram[1], m_sprvram[1].bytes(), 0, bitmap, cliprect, screen.priority(), 0x02); } return 0; } @@ -386,8 +386,8 @@ void f1gp_state::f1gpbl_draw_sprites(screen_device &screen,bitmap_ind16 &bitmap, { int const x = (m_spriteram[attr_start + 2] & 0x03ff) - 48; int const y = (256 - (m_spriteram[attr_start + 3 - 4] & 0x03ff)) - 15; - int const flipx = m_spriteram[attr_start + 1] & 0x0800; - int const flipy = m_spriteram[attr_start + 1] & 0x8000; + bool const flipx = BIT(m_spriteram[attr_start + 1], 11); + bool const flipy = BIT(m_spriteram[attr_start + 1], 15); int const color = m_spriteram[attr_start + 1] & 0x000f; int code = m_spriteram[attr_start + 0] & 0x3fff; int const pri = 0; //? @@ -413,7 +413,7 @@ void f1gp_state::f1gpbl_draw_sprites(screen_device &screen,bitmap_ind16 &bitmap, gfx = 0; } - m_gfxdecode->gfx(1 + gfx)->prio_transpen(bitmap, cliprect, + m_gfxdecode->gfx(2 + gfx)->prio_transpen(bitmap, cliprect, code, color, flipx, flipy, @@ -422,7 +422,7 @@ void f1gp_state::f1gpbl_draw_sprites(screen_device &screen,bitmap_ind16 &bitmap, pri ? 0 : 0x2, 15); // wrap around x - m_gfxdecode->gfx(1 + gfx)->prio_transpen(bitmap, cliprect, + m_gfxdecode->gfx(2 + gfx)->prio_transpen(bitmap, cliprect, code, color, flipx, flipy, @@ -746,15 +746,31 @@ INPUT_PORTS_END static GFXDECODE_START( gfx_f1gp ) GFXDECODE_ENTRY( "fgtiles", 0, gfx_8x8x8_raw, 0x000, 1 ) + GFXDECODE_RAM( "rozgfxram", 0, gfx_16x16x4_packed_msb, 0x300, 16 ) +GFXDECODE_END + +static GFXDECODE_START( gfx_f1gp_spr1 ) GFXDECODE_ENTRY( "sprites1", 0, gfx_16x16x4_packed_lsb, 0x100, 16 ) +GFXDECODE_END + +static GFXDECODE_START( gfx_f1gp_spr2 ) GFXDECODE_ENTRY( "sprites2", 0, gfx_16x16x4_packed_lsb, 0x200, 16 ) +GFXDECODE_END + +static GFXDECODE_START( gfx_f1gpbl ) + GFXDECODE_ENTRY( "fgtiles", 0, gfx_8x8x8_raw, 0x000, 1 ) GFXDECODE_RAM( "rozgfxram", 0, gfx_16x16x4_packed_msb, 0x300, 16 ) + GFXDECODE_ENTRY( "sprites1", 0, gfx_16x16x4_packed_lsb, 0x100, 16 ) + GFXDECODE_ENTRY( "sprites2", 0, gfx_16x16x4_packed_lsb, 0x200, 16 ) GFXDECODE_END static GFXDECODE_START( gfx_f1gp2 ) GFXDECODE_ENTRY( "fgtiles", 0, gfx_8x8x8_raw, 0x000, 1 ) + GFXDECODE_ENTRY( "roztiles", 0, gfx_16x16x4_packed_msb, 0x100, 16 ) +GFXDECODE_END + +static GFXDECODE_START( gfx_f1gp2_spr ) GFXDECODE_ENTRY( "sprites1", 0, gfx_16x16x4_packed_lsb, 0x200, 32 ) - GFXDECODE_ENTRY( "sprites2", 0, gfx_16x16x4_packed_msb, 0x100, 16 ) GFXDECODE_END @@ -829,17 +845,13 @@ void f1gp_state::f1gp(machine_config &config) VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified - VSYSTEM_SPR2(config, m_spr_old[0], 0); + VSYSTEM_SPR2(config, m_spr_old[0], 0, m_palette, gfx_f1gp_spr1); m_spr_old[0]->set_tile_indirect_cb(FUNC(f1gp2_state::tile_callback<0>)); - m_spr_old[0]->set_gfx_region(1); m_spr_old[0]->set_pritype(2); - m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); - VSYSTEM_SPR2(config, m_spr_old[1], 0); + VSYSTEM_SPR2(config, m_spr_old[1], 0, m_palette, gfx_f1gp_spr2); m_spr_old[1]->set_tile_indirect_cb(FUNC(f1gp2_state::tile_callback<1>)); - m_spr_old[1]->set_gfx_region(2); m_spr_old[1]->set_pritype(2); - m_spr_old[1]->set_gfxdecode_tag(m_gfxdecode); K053936(config, m_k053936, 0); m_k053936->set_wrap(1); @@ -891,7 +903,7 @@ void f1gp_state::f1gpbl(machine_config &config) screen.set_screen_update(FUNC(f1gp_state::screen_update_f1gpbl)); screen.set_palette(m_palette); - GFXDECODE(config, m_gfxdecode, m_palette, gfx_f1gp); + GFXDECODE(config, m_gfxdecode, m_palette, gfx_f1gpbl); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048); //VSYSTEM_GGA(config, "gga", 0); @@ -920,10 +932,8 @@ void f1gp2_state::f1gp2(machine_config &config) config.device_remove("vsystem_spr_old1"); config.device_remove("vsystem_spr_old2"); - VSYSTEM_SPR(config, m_spr, 0); + VSYSTEM_SPR(config, m_spr, 0, m_palette, gfx_f1gp2_spr); m_spr->set_tile_indirect_cb(FUNC(f1gp2_state::tile_callback<0>)); - m_spr->set_gfx_region(1); - m_spr->set_gfxdecode_tag(m_gfxdecode); m_k053936->set_offsets(-48, -21); } @@ -993,7 +1003,7 @@ ROM_START( f1gpa ) ROM_REGION( 0x20000, "sub", 0 ) // 68000 code ROM_LOAD16_WORD_SWAP( "rom4-a.4", 0x00000, 0x20000, CRC(8e811d36) SHA1(2b806b50a3a307a21894687f16485ace287a7c4c) ) - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) // 64k for the audio CPU + banks ROM_LOAD( "rom5-a.8", 0x00000, 0x20000, CRC(9ea36e35) SHA1(9254dea8362318d8cfbd5e36e476e0e235e6326a) ) ROM_REGION( 0x200000, "fgtiles", 0 ) @@ -1036,7 +1046,7 @@ ROM_START( f1gpb ) // 0F17-A-04 PCB ROM_REGION( 0x20000, "sub", 0 ) // 68000 code ROM_LOAD16_WORD_SWAP( "rom4.4", 0x00000, 0x20000, CRC(8e811d36) SHA1(2b806b50a3a307a21894687f16485ace287a7c4c) ) - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) // 64k for the audio CPU + banks ROM_LOAD( "rom5.8", 0x00000, 0x20000, CRC(9ea36e35) SHA1(9254dea8362318d8cfbd5e36e476e0e235e6326a) ) ROM_REGION( 0x200000, "fgtiles", 0 ) @@ -1137,7 +1147,7 @@ ROM_START( f1gp2 ) ROM_REGION( 0x200000, "sprites1", 0 ) ROM_LOAD( "rom15", 0x000000, 0x200000, CRC(1ac03e2e) SHA1(9073d0ae24364229a993046bd71e403988692993) ) - ROM_REGION( 0x400000, "sprites2", 0 ) + ROM_REGION( 0x400000, "roztiles", 0 ) ROM_LOAD16_WORD_SWAP( "rom11", 0x000000, 0x100000, CRC(b22a2c1f) SHA1(b5e67726be5a8561cd04c3c07895b8518b73b89c) ) ROM_LOAD16_WORD_SWAP( "rom10", 0x100000, 0x100000, CRC(43fcbe23) SHA1(54ab58d904890a0b907e674f855092e974c45edc) ) ROM_LOAD16_WORD_SWAP( "rom9", 0x200000, 0x100000, CRC(1bede8a1) SHA1(325ecc3afb30d281c2c8a56719e83e4dc20545bb) ) diff --git a/src/mame/vsystem/fromance.h b/src/mame/vsystem/fromance.h index 46c3d87fed592..8e73f7da0d40c 100644 --- a/src/mame/vsystem/fromance.h +++ b/src/mame/vsystem/fromance.h @@ -16,7 +16,6 @@ #include "machine/gen_latch.h" #include "sound/msm5205.h" #include "vsystem_gga.h" -#include "vsystem_spr2.h" #include "emupal.h" #include "screen.h" #include "tilemap.h" @@ -80,19 +79,19 @@ class fromance_state : public driver_device optional_device m_sublatch; optional_device m_msm; - /* video-related */ + // video-related std::unique_ptr m_local_videoram[2]; std::unique_ptr m_local_paletteram; emu_timer *m_crtc_timer; - /* misc */ + // misc uint8_t m_portselect = 0; uint8_t m_adpcm_reset = 0; uint8_t m_adpcm_data = 0; uint8_t m_vclk_left = 0; - /* devices */ + // devices uint8_t fromance_busycheck_main_r(); uint8_t fromance_busycheck_sub_r(); void fromance_rombank_w(uint8_t data); diff --git a/src/mame/vsystem/gstriker.cpp b/src/mame/vsystem/gstriker.cpp index 38cf360568fe8..bcf5071d074a2 100644 --- a/src/mame/vsystem/gstriker.cpp +++ b/src/mame/vsystem/gstriker.cpp @@ -282,6 +282,7 @@ class gstriker_state : public driver_device uint16_t vbl_toggle_r(); void vbl_toggle_w(uint16_t data); + uint32_t pri_callback(uint32_t color); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_vblank(int state); @@ -304,14 +305,19 @@ void gstriker_state::video_start() m_bg->set_transparent_pen(0xf); } +uint32_t gstriker_state::pri_callback(uint32_t color) +{ + return BIT(color, 5) ? 0 : GFX_PMASK_2; +} + void gstriker_state::screen_vblank(int state) { // sprites are two frames ahead // TODO: probably all Video System games are (Aero Fighters definitely desyncs wrt background) if(state) { - memcpy(m_buffered_spriteram[0], m_cg10103_vram, 0x2000); memcpy(m_buffered_spriteram[1], m_buffered_spriteram[0], 0x2000); + memcpy(m_buffered_spriteram[0], m_cg10103_vram, 0x2000); } } @@ -319,6 +325,7 @@ void gstriker_state::screen_vblank(int state) uint32_t gstriker_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap.fill(m_mixerregs[8] & 0x07ff, cliprect); // complete guess, causes green behind test grid in twc94 and blue behind title screen on gstriker + screen.priority().fill(0, cliprect); /* [4] AAAA BBBB ---- ---- sprite priority number A/B? @@ -331,15 +338,11 @@ uint32_t gstriker_state::screen_update(screen_device &screen, bitmap_ind16 &bitm m_bg->set_pal_base((m_mixerregs[1] & 0xf000) >> 8); m_tx->set_pal_base((m_mixerregs[2] & 0xf000) >> 8); - // Sandwiched screen/sprite0/score/sprite1. Surely wrong, probably needs sprite orthogonality - m_bg->draw(screen, bitmap, cliprect, 0); - - m_spr->draw_sprites(m_buffered_spriteram[1], 0x2000, screen, bitmap, cliprect, 0x2, 0x0); - - m_tx->draw(screen, bitmap, cliprect, 0); + m_bg->draw(screen, bitmap, cliprect, 1); + m_tx->draw(screen, bitmap, cliprect, 2); - m_spr->draw_sprites(m_buffered_spriteram[1], 0x2000, screen, bitmap, cliprect, 0x2, 0x2); + m_spr->draw_sprites(m_buffered_spriteram[1], 0x2000, screen, bitmap, cliprect); return 0; } @@ -369,6 +372,9 @@ void gstriker_state::sh_bankswitch_w(uint8_t data) static GFXDECODE_START( gfx_gstriker ) GFXDECODE_ENTRY( "fix_tiles", 0, gfx_8x8x4_packed_lsb, 0, 256 ) GFXDECODE_ENTRY( "scroll_tiles", 0, gfx_16x16x4_packed_msb, 0, 256 ) +GFXDECODE_END + +static GFXDECODE_START( gfx_gstriker_spr ) GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_msb, 0, 256 ) GFXDECODE_END @@ -655,11 +661,10 @@ void gstriker_state::base(machine_config &config) m_tx->set_gfxdecode_tag(m_gfxdecode); m_tx->set_gfx_region(0); - VSYSTEM_SPR(config, m_spr, 0); - m_spr->set_gfx_region(2); + VSYSTEM_SPR(config, m_spr, 0, m_palette, gfx_gstriker_spr); + m_spr->set_pri_cb(FUNC(gstriker_state::pri_callback)); m_spr->set_pal_mask(0x1f); m_spr->set_transpen(0); - m_spr->set_gfxdecode_tag(m_gfxdecode); SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); diff --git a/src/mame/vsystem/inufuku.cpp b/src/mame/vsystem/inufuku.cpp index 78a0012984cdc..2bfbff637c227 100644 --- a/src/mame/vsystem/inufuku.cpp +++ b/src/mame/vsystem/inufuku.cpp @@ -73,6 +73,8 @@ LHMN5KU9.U38 / - Priority of tests and sprites seems to be correct, but I may have mistaken. +- Tilemap offset is incorrect in inufuku? + ******************************************************************************/ #include "emu.h" @@ -134,14 +136,15 @@ class inufuku_state : public driver_device // video-related tilemap_t *m_bg_tilemap; tilemap_t *m_tx_tilemap; - int m_bg_scrollx = 0; - int m_bg_scrolly = 0; - int m_tx_scrollx = 0; - int m_tx_scrolly = 0; + s32 m_bg_scrollx = 0; + s32 m_bg_scrolly = 0; + s32 m_tx_scrollx = 0; + s32 m_tx_scrolly = 0; bool m_bg_raster = false; u8 m_bg_palettebank = 0; u8 m_tx_palettebank = 0; - u32 tile_callback( u32 code ); + u32 tile_callback(u32 code); + u32 pri_callback(u32 color); // devices required_device m_maincpu; @@ -261,12 +264,25 @@ void inufuku_state::tx_videoram_w(offs_t offset, u16 data, u16 mem_mask) } -u32 inufuku_state::tile_callback( u32 code ) +u32 inufuku_state::tile_callback(u32 code) { return ((m_sprtileram[code * 2] & 0x0007) << 16) + m_sprtileram[(code * 2) + 1]; } +u32 inufuku_state::pri_callback(u32 color) +{ + switch ((color >> 4) & 3) + { + default: + case 0: return 0x00; + case 3: return 0xfe; + case 2: return 0xfc; + case 1: return 0xf0; + } +} + + /****************************************************************************** Start the video hardware emulation @@ -312,7 +328,7 @@ u32 inufuku_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co m_tx_tilemap->set_scrolly(0, m_tx_scrolly); m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4); - m_spr->draw_sprites( m_sprattrram->buffer(), m_sprattrram->bytes(), screen, bitmap, cliprect ); + m_spr->draw_sprites(m_sprattrram->buffer(), m_sprattrram->bytes(), screen, bitmap, cliprect); return 0; } @@ -489,13 +505,13 @@ INPUT_PORTS_END static GFXDECODE_START( gfx_inufuku ) GFXDECODE_ENTRY( "bgtile", 0, gfx_8x8x8_raw, 0, 4096/256 ) // bg GFXDECODE_ENTRY( "txtile", 0, gfx_8x8x8_raw, 0, 4096/256 ) // text - GFXDECODE_ENTRY( "sprtile", 0, gfx_16x16x4_packed_msb, 0, 4096/16 ) // sprite GFXDECODE_END +static GFXDECODE_START( gfx_inufuku_spr ) + GFXDECODE_ENTRY( "sprtile", 0, gfx_16x16x4_packed_msb, 0, 4096/16 ) // sprite +GFXDECODE_END -static GFXDECODE_START( gfx_3on3dunk ) - GFXDECODE_ENTRY( "bgtile", 0, gfx_8x8x8_raw, 0, 4096/256 ) // bg - GFXDECODE_ENTRY( "txtile", 0, gfx_8x8x8_raw, 0, 4096/256 ) // text +static GFXDECODE_START( gfx_3on3dunk_spr ) GFXDECODE_ENTRY( "sprtile", 0, gfx_16x16x4_packed_lsb, 0, 4096/16 ) // sprite GFXDECODE_END @@ -535,7 +551,7 @@ void inufuku_state::machine_reset() void inufuku_state::inufuku(machine_config &config) { - // basic machine hardware */ + // basic machine hardware M68000(config, m_maincpu, XTAL(32'000'000)/2); // 16.00 MHz m_maincpu->set_addrmap(AS_PROGRAM, &inufuku_state::main_map); m_maincpu->set_vblank_int("screen", FUNC(inufuku_state::irq1_line_hold)); @@ -556,12 +572,10 @@ void inufuku_state::inufuku(machine_config &config) screen.screen_vblank().set(m_sprattrram, FUNC(buffered_spriteram16_device::vblank_copy_rising)); screen.set_palette(m_palette); - VSYSTEM_SPR(config, m_spr, 0); + VSYSTEM_SPR(config, m_spr, 0, m_palette, gfx_inufuku_spr); m_spr->set_offsets(0, 1); // reference videos confirm at least the +1 against tilemaps in 3on3dunk (the highscore header text and black box are meant to be 1 pixel misaligned, although there is currently a priority bug there too) - m_spr->set_pdraw(true); m_spr->set_tile_indirect_cb(FUNC(inufuku_state::tile_callback)); - m_spr->set_gfx_region(2); - m_spr->set_gfxdecode_tag(m_gfxdecode); + m_spr->set_pri_cb(FUNC(inufuku_state::pri_callback)); BUFFERED_SPRITERAM16(config, m_sprattrram); @@ -586,7 +600,7 @@ void inufuku_state::inufuku(machine_config &config) void inufuku_state::_3on3dunk(machine_config &config) { inufuku(config); - m_gfxdecode->set_info(gfx_3on3dunk); + m_spr->set_info(gfx_3on3dunk_spr); } diff --git a/src/mame/vsystem/pipedrm.cpp b/src/mame/vsystem/pipedrm.cpp index e2f78dd7c0b5e..5b5fbbfadc23e 100644 --- a/src/mame/vsystem/pipedrm.cpp +++ b/src/mame/vsystem/pipedrm.cpp @@ -164,6 +164,7 @@ Added Multiple Coin Feature: #include "emu.h" #include "fromance.h" +#include "vsystem_spr2.h" #include "cpu/z80/z80.h" #include "machine/gen_latch.h" @@ -252,12 +253,12 @@ void hatris_state::bankswitch_w(uint8_t data) D2-D0 = program ROM bank select */ - /* set the memory bank on the Z80 using the low 3 bits */ + // set the memory bank on the Z80 using the low 3 bits m_rombank->set_entry(data & 0x7); - /* map to the fromance gfx register */ - fromance_gfxreg_w(((data >> 6) & 0x01) | /* flipscreen */ - ((~data >> 2) & 0x02)); /* videoram select */ + // map to the fromance gfx register + fromance_gfxreg_w(((data >> 6) & 0x01) | // flipscreen + ((~data >> 2) & 0x02)); // videoram select } @@ -302,15 +303,15 @@ uint32_t pipedrm_state::screen_update(screen_device &screen, bitmap_ind16 &bitma { uint8_t* sram = m_spriteram; - /* there seems to be no logical mapping for the X scroll register -- maybe it's gone */ + // there seems to be no logical mapping for the X scroll register -- maybe it's gone m_bg_tilemap->set_scrolly(0, m_scrolly[1]); m_fg_tilemap->set_scrolly(0, m_scrolly[0]); m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - m_spr_old->turbofrc_draw_sprites((uint16_t*)sram, m_spriteram_size, 0, bitmap, cliprect, screen.priority(), 0); - m_spr_old->turbofrc_draw_sprites((uint16_t*)sram, m_spriteram_size, 0, bitmap, cliprect, screen.priority(), 1); + m_spr_old->draw_sprites((uint16_t*)sram, m_spriteram_size, 0, bitmap, cliprect, screen.priority(), 0); + m_spr_old->draw_sprites((uint16_t*)sram, m_spriteram_size, 0, bitmap, cliprect, screen.priority(), 1); return 0; } @@ -388,7 +389,7 @@ void hatris_state::sound_portmap(address_map &map) *************************************/ static INPUT_PORTS_START( pipedrm ) - PORT_START("P1") /* $20 */ + PORT_START("P1") // $20 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) @@ -398,7 +399,7 @@ static INPUT_PORTS_START( pipedrm ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_START("P2") /* $21 */ + PORT_START("P2") // $21 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) @@ -408,7 +409,7 @@ static INPUT_PORTS_START( pipedrm ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_START("SYSTEM") /* $24 */ + PORT_START("SYSTEM") // $24 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) @@ -418,7 +419,7 @@ static INPUT_PORTS_START( pipedrm ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_START("DSW1") /* $22 */ + PORT_START("DSW1") // $22 PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3,4") PORT_DIPSETTING( 0x06, DEF_STR( 5C_1C ) ) PORT_DIPSETTING( 0x07, DEF_STR( 4C_1C ) ) @@ -454,7 +455,7 @@ static INPUT_PORTS_START( pipedrm ) PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C ) ) PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C ) ) - PORT_START("DSW2") /* $23 */ + PORT_START("DSW2") // $23 PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x03, DEF_STR( Normal ) ) @@ -479,7 +480,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( hatris ) - PORT_START("P1") /* $20 */ + PORT_START("P1") // $20 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) @@ -489,7 +490,7 @@ static INPUT_PORTS_START( hatris ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_START("P2") /* $21 */ + PORT_START("P2") // $21 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) @@ -499,7 +500,7 @@ static INPUT_PORTS_START( hatris ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_START("SYSTEM") /* $24 */ + PORT_START("SYSTEM") // $24 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) @@ -509,7 +510,7 @@ static INPUT_PORTS_START( hatris ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("DSW1") /* $22 */ + PORT_START("DSW1") // $22 PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3,4") PORT_DIPSETTING( 0x09, DEF_STR( 5C_1C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 4C_1C ) ) @@ -545,7 +546,7 @@ static INPUT_PORTS_START( hatris ) PORT_DIPSETTING( 0x40, DEF_STR( 1C_5C ) ) PORT_DIPSETTING( 0x50, DEF_STR( 1C_6C ) ) - PORT_START("DSW2") /* $23 */ + PORT_START("DSW2") // $23 PORT_DIPNAME( 0x03, 0x00, "Hat Fall Velocity" ) PORT_DIPLOCATION("SW2:1,2") PORT_DIPSETTING( 0x01, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x00, DEF_STR( Normal ) ) @@ -563,7 +564,7 @@ static INPUT_PORTS_START( hatris ) PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "SW2:8" ) /* Listed as "N.C." */ + PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "SW2:8" ) // Listed as "N.C." INPUT_PORTS_END @@ -599,16 +600,13 @@ static const gfx_layout splayout = }; -static GFXDECODE_START( gfx_pipedrm ) +static GFXDECODE_START( gfx_hatris ) GFXDECODE_ENTRY( "gfx1", 0, bglayout, 0, 128 ) GFXDECODE_ENTRY( "gfx2", 0, bglayout, 0, 128 ) - GFXDECODE_ENTRY( "gfx3", 0, splayout, 1024, 32 ) GFXDECODE_END - -static GFXDECODE_START( gfx_hatris ) - GFXDECODE_ENTRY( "gfx1", 0, bglayout, 0, 128 ) - GFXDECODE_ENTRY( "gfx2", 0, bglayout, 0, 128 ) +static GFXDECODE_START( gfx_pipedrm_spr ) + GFXDECODE_ENTRY( "gfx3", 0, splayout, 1024, 32 ) GFXDECODE_END @@ -620,15 +618,15 @@ GFXDECODE_END void hatris_state::machine_start() { - /* initialize main Z80 bank */ + // initialize main Z80 bank m_rombank->configure_entries(0, 8, memregion("maincpu")->base() + 0x10000, 0x2000); m_rombank->set_entry(0); - /* initialize sound bank */ + // initialize sound bank m_soundbank->configure_entries(0, 2, memregion("sub")->base() + 0x10000, 0x8000); m_soundbank->set_entry(0); - /* video-related elements are saved in video_start */ + // video-related elements are saved in video_start } void hatris_state::machine_reset() @@ -648,7 +646,7 @@ void hatris_state::machine_reset() void pipedrm_state::pipedrm(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware Z80(config, m_maincpu, 12_MHz_XTAL / 2); m_maincpu->set_addrmap(AS_PROGRAM, &pipedrm_state::main_map); m_maincpu->set_addrmap(AS_IO, &pipedrm_state::main_portmap); @@ -658,28 +656,26 @@ void pipedrm_state::pipedrm(machine_config &config) m_subcpu->set_addrmap(AS_PROGRAM, &pipedrm_state::sound_map); m_subcpu->set_addrmap(AS_IO, &pipedrm_state::sound_portmap); - /* 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(2500)); /* not accurate */ + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate m_screen->set_size(44*8, 30*8); m_screen->set_visarea(0*8, 44*8-1, 0*8, 30*8-1); m_screen->set_screen_update(FUNC(pipedrm_state::screen_update)); m_screen->set_palette(m_palette); - GFXDECODE(config, m_gfxdecode, m_palette, gfx_pipedrm); + GFXDECODE(config, m_gfxdecode, m_palette, gfx_hatris); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048); VSYSTEM_GGA(config, m_gga, 14.318181_MHz_XTAL / 2); // divider not verified m_gga->write_cb().set(FUNC(pipedrm_state::fromance_gga_data_w)); - VSYSTEM_SPR2(config, m_spr_old, 0); - m_spr_old->set_gfx_region(2); + VSYSTEM_SPR2(config, m_spr_old, 0, m_palette, gfx_pipedrm_spr); m_spr_old->set_offsets(-13, -6); m_spr_old->set_pritype(3); - m_spr_old->set_gfxdecode_tag(m_gfxdecode); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); @@ -695,7 +691,7 @@ void pipedrm_state::pipedrm(machine_config &config) void hatris_state::hatris(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware Z80(config, m_maincpu, 12_MHz_XTAL / 2); m_maincpu->set_addrmap(AS_PROGRAM, &hatris_state::main_map); m_maincpu->set_addrmap(AS_IO, &hatris_state::main_portmap); @@ -705,10 +701,10 @@ void hatris_state::hatris(machine_config &config) m_subcpu->set_addrmap(AS_PROGRAM, &hatris_state::sound_map); m_subcpu->set_addrmap(AS_IO, &hatris_state::sound_portmap); - /* 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(2500)); /* not accurate */ + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate m_screen->set_size(44*8, 30*8); m_screen->set_visarea(0*8, 44*8-1, 0*8, 30*8-1); m_screen->set_screen_update(FUNC(hatris_state::screen_update_fromance)); @@ -720,7 +716,7 @@ void hatris_state::hatris(machine_config &config) VSYSTEM_GGA(config, m_gga, 14.318181_MHz_XTAL / 2); // divider not verified m_gga->write_cb().set(FUNC(hatris_state::fromance_gga_data_w)); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); @@ -965,7 +961,7 @@ ROM_END void pipedrm_state::init_pipedrm() { const memory_share *share = memshare("palette"); - /* sprite RAM lives at the end of palette RAM */ + // sprite RAM lives at the end of palette RAM m_spriteram = (uint8_t*)share->ptr() + 0xc00; m_spriteram_size = 0x400; m_maincpu->space(AS_PROGRAM).install_ram(0xcc00, 0xcfff, m_spriteram); diff --git a/src/mame/vsystem/pspikes.cpp b/src/mame/vsystem/pspikes.cpp index 9353a016de137..ccd99e8ab035c 100644 --- a/src/mame/vsystem/pspikes.cpp +++ b/src/mame/vsystem/pspikes.cpp @@ -606,8 +606,8 @@ uint32_t pspikes_base_state::screen_update_pspikes(screen_device &screen, bitmap screen.priority().fill(0, cliprect); m_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0); - m_spr_old[0]->turbofrc_draw_sprites(m_spriteram,m_spriteram.bytes(),m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); - m_spr_old[0]->turbofrc_draw_sprites(m_spriteram,m_spriteram.bytes(),m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); + m_spr_old[0]->draw_sprites(m_spriteram,m_spriteram.bytes(),m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); + m_spr_old[0]->draw_sprites(m_spriteram,m_spriteram.bytes(),m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); return 0; } @@ -625,11 +625,11 @@ uint32_t pspikes_sound_cpu_state::screen_update_karatblz(screen_device &screen, m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); // we use the priority buffer so sprites are drawn front to back - m_spr_old[1]->turbofrc_draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); - m_spr_old[1]->turbofrc_draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); + m_spr_old[1]->draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); + m_spr_old[1]->draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); - m_spr_old[0]->turbofrc_draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); - m_spr_old[0]->turbofrc_draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); + m_spr_old[0]->draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); + m_spr_old[0]->draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); return 0; } @@ -650,11 +650,11 @@ uint32_t pspikes_banked_sound_state::screen_update_spinlbrk(screen_device &scree m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 1); // we use the priority buffer so sprites are drawn front to back - m_spr_old[0]->turbofrc_draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); - m_spr_old[0]->turbofrc_draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); + m_spr_old[0]->draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); + m_spr_old[0]->draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); - m_spr_old[1]->turbofrc_draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); - m_spr_old[1]->turbofrc_draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); + m_spr_old[1]->draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); + m_spr_old[1]->draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); return 0; } @@ -676,11 +676,11 @@ uint32_t pspikes_banked_sound_state::screen_update_turbofrc(screen_device &scree m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 1); // we use the priority buffer so sprites are drawn front to back - m_spr_old[1]->turbofrc_draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); //ship - m_spr_old[1]->turbofrc_draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); //intro + m_spr_old[1]->draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); //ship + m_spr_old[1]->draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); //intro - m_spr_old[0]->turbofrc_draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); //enemy - m_spr_old[0]->turbofrc_draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); //enemy + m_spr_old[0]->draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); //enemy + m_spr_old[0]->draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); //enemy return 0; } @@ -1085,8 +1085,8 @@ uint32_t wbbc97_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap m_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); } - m_spr_old[0]->turbofrc_draw_sprites(m_spriteram,m_spriteram.bytes(),m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); - m_spr_old[0]->turbofrc_draw_sprites(m_spriteram,m_spriteram.bytes(),m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); + m_spr_old[0]->draw_sprites(m_spriteram,m_spriteram.bytes(),m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); + m_spr_old[0]->draw_sprites(m_spriteram,m_spriteram.bytes(),m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); return 0; } @@ -2217,6 +2217,9 @@ static const gfx_layout kickball_spritelayout = static GFXDECODE_START( gfx_pspikes ) GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_lsb, 0, 64 ) // colors 0-1023 in 8 banks +GFXDECODE_END + +static GFXDECODE_START( gfx_pspikes_spr ) GFXDECODE_ENTRY( "gfx2", 0, gfx_16x16x4_packed_lsb, 1024, 64 ) // colors 1024-2047 in 4 banks GFXDECODE_END @@ -2230,15 +2233,20 @@ static GFXDECODE_START( gfx_spikes91 ) GFXDECODE_ENTRY( "gfx2", 0, gfx_16x16x4_planar, 1024, 64 ) // colors 1024-2047 in 4 banks GFXDECODE_END -static GFXDECODE_START( gfx_kickball ) - GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_lsb, 0, 64 ) // colors 0-1023 in 8 banks - GFXDECODE_ENTRY( "gfx2", 0, kickball_spritelayout, 1024, 64 ) // colors 1024-2047 in 4 banks +static GFXDECODE_START( gfx_kickball_spr ) + GFXDECODE_ENTRY( "gfx2", 0, kickball_spritelayout, 1024, 64 ) // colors 1024-2047 in 4 banks GFXDECODE_END static GFXDECODE_START( gfx_turbofrc ) GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_lsb, 0, 16 ) GFXDECODE_ENTRY( "gfx2", 0, gfx_8x8x4_packed_lsb, 256, 16 ) +GFXDECODE_END + +static GFXDECODE_START( gfx_turbofrc_spr1 ) GFXDECODE_ENTRY( "spritegfx", 0, gfx_16x16x4_packed_lsb, 512, 16 ) +GFXDECODE_END + +static GFXDECODE_START( gfx_turbofrc_spr2 ) GFXDECODE_ENTRY( "gfx4", 0, gfx_16x16x4_packed_lsb, 768, 16 ) GFXDECODE_END @@ -2295,10 +2303,8 @@ void pspikes_banked_sound_state::pspikes(machine_config &config) GFXDECODE(config, m_gfxdecode, m_palette, gfx_pspikes); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048); - VSYSTEM_SPR2(config, m_spr_old[0], 0); + VSYSTEM_SPR2(config, m_spr_old[0], 0, m_palette, gfx_pspikes_spr); m_spr_old[0]->set_tile_indirect_cb(FUNC(pspikes_banked_sound_state::pspikes_old_tile_callback)); - m_spr_old[0]->set_gfx_region(1); - m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified @@ -2413,13 +2419,11 @@ void pspikes_sound_cpu_state::kickball(machine_config &config) screen.set_screen_update(FUNC(pspikes_sound_cpu_state::screen_update_pspikes)); screen.set_palette(m_palette); - GFXDECODE(config, m_gfxdecode, m_palette, gfx_kickball); + GFXDECODE(config, m_gfxdecode, m_palette, gfx_pspikes); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048); - VSYSTEM_SPR2(config, m_spr_old[0], 0); + VSYSTEM_SPR2(config, m_spr_old[0], 0, m_palette, gfx_kickball_spr); m_spr_old[0]->set_tile_indirect_cb(FUNC(pspikes_sound_cpu_state::pspikes_old_tile_callback)); - m_spr_old[0]->set_gfx_region(1); - m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); //VSYSTEM_GGA(config, "gga", 0); // still accessed as if it exists, in clone hardware? @@ -2461,10 +2465,8 @@ void pspikes_base_state::pspikesc(machine_config &config) //VSYSTEM_GGA(config, "gga", 0); - VSYSTEM_SPR2(config, m_spr_old[0], 0); + VSYSTEM_SPR2(config, m_spr_old[0], 0, m_palette, gfx_pspikes_spr); m_spr_old[0]->set_tile_indirect_cb(FUNC(pspikes_base_state::pspikes_old_tile_callback)); - m_spr_old[0]->set_gfx_region(1); - m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); MCFG_VIDEO_START_OVERRIDE(pspikes_base_state,pspikes) @@ -2501,15 +2503,11 @@ void pspikes_banked_sound_state::karatblz(machine_config &config) VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified - VSYSTEM_SPR2(config, m_spr_old[0], 0); + VSYSTEM_SPR2(config, m_spr_old[0], 0, m_palette, gfx_turbofrc_spr1); m_spr_old[0]->set_tile_indirect_cb(FUNC(pspikes_banked_sound_state::pspikes_old_tile_callback)); - m_spr_old[0]->set_gfx_region(2); - m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); - VSYSTEM_SPR2(config, m_spr_old[1], 0); + VSYSTEM_SPR2(config, m_spr_old[1], 0, m_palette, gfx_turbofrc_spr2); m_spr_old[1]->set_tile_indirect_cb(FUNC(pspikes_banked_sound_state::pspikes_ol2_tile_callback)); - m_spr_old[1]->set_gfx_region(3); - m_spr_old[1]->set_gfxdecode_tag(m_gfxdecode); MCFG_VIDEO_START_OVERRIDE(pspikes_banked_sound_state,karatblz) @@ -2552,15 +2550,11 @@ void karatblzbl_state::karatblzbl(machine_config &config) GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024); - VSYSTEM_SPR2(config, m_spr_old[0], 0); + VSYSTEM_SPR2(config, m_spr_old[0], 0, m_palette, gfx_turbofrc_spr1); m_spr_old[0]->set_tile_indirect_cb(FUNC(karatblzbl_state::pspikes_old_tile_callback)); - m_spr_old[0]->set_gfx_region(2); - m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); - VSYSTEM_SPR2(config, m_spr_old[1], 0); + VSYSTEM_SPR2(config, m_spr_old[1], 0, m_palette, gfx_turbofrc_spr2); m_spr_old[1]->set_tile_indirect_cb(FUNC(karatblzbl_state::pspikes_ol2_tile_callback)); - m_spr_old[1]->set_gfx_region(3); - m_spr_old[1]->set_gfxdecode_tag(m_gfxdecode); //VSYSTEM_GGA(config, "gga", 0); @@ -2606,16 +2600,12 @@ void pspikes_banked_sound_state::spinlbrk(machine_config &config) VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified - VSYSTEM_SPR2(config, m_spr_old[0], 0); + VSYSTEM_SPR2(config, m_spr_old[0], 0, m_palette, gfx_turbofrc_spr1); m_spr_old[0]->set_pritype(1); - m_spr_old[0]->set_gfx_region(2); - m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); - VSYSTEM_SPR2(config, m_spr_old[1], 0); + VSYSTEM_SPR2(config, m_spr_old[1], 0, m_palette, gfx_turbofrc_spr2); m_spr_old[1]->set_tile_indirect_cb(FUNC(pspikes_banked_sound_state::spinbrk_tile_callback)); // rom lookup m_spr_old[1]->set_pritype(1); - m_spr_old[1]->set_gfx_region(3); - m_spr_old[1]->set_gfxdecode_tag(m_gfxdecode); MCFG_VIDEO_START_OVERRIDE(pspikes_banked_sound_state,spinlbrk) @@ -2660,15 +2650,11 @@ void pspikes_banked_sound_state::turbofrc(machine_config &config) VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified - VSYSTEM_SPR2(config, m_spr_old[0], 0); + VSYSTEM_SPR2(config, m_spr_old[0], 0, m_palette, gfx_turbofrc_spr1); m_spr_old[0]->set_tile_indirect_cb(FUNC(pspikes_banked_sound_state::pspikes_old_tile_callback)); - m_spr_old[0]->set_gfx_region(2); - m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); - VSYSTEM_SPR2(config, m_spr_old[1], 0); + VSYSTEM_SPR2(config, m_spr_old[1], 0, m_palette, gfx_turbofrc_spr2); m_spr_old[1]->set_tile_indirect_cb(FUNC(pspikes_banked_sound_state::pspikes_ol2_tile_callback)); - m_spr_old[1]->set_gfx_region(3); - m_spr_old[1]->set_gfxdecode_tag(m_gfxdecode); MCFG_VIDEO_START_OVERRIDE(pspikes_banked_sound_state,turbofrc) @@ -2713,16 +2699,12 @@ void pspikes_banked_sound_state::aerofgtb(machine_config &config) VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified - VSYSTEM_SPR2(config, m_spr_old[0], 0); + VSYSTEM_SPR2(config, m_spr_old[0], 0, m_palette, gfx_turbofrc_spr1); m_spr_old[0]->set_tile_indirect_cb(FUNC(pspikes_banked_sound_state::pspikes_old_tile_callback)); - m_spr_old[0]->set_gfx_region(2); - m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); m_spr_old[0]->set_offsets(3, -1); - VSYSTEM_SPR2(config, m_spr_old[1], 0); + VSYSTEM_SPR2(config, m_spr_old[1], 0, m_palette, gfx_turbofrc_spr2); m_spr_old[1]->set_tile_indirect_cb(FUNC(pspikes_banked_sound_state::pspikes_ol2_tile_callback)); - m_spr_old[1]->set_gfx_region(3); - m_spr_old[1]->set_gfxdecode_tag(m_gfxdecode); m_spr_old[1]->set_offsets(3, -1); MCFG_VIDEO_START_OVERRIDE(pspikes_banked_sound_state,aerofgtb) @@ -2833,10 +2815,8 @@ void wbbc97_state::wbbc97(machine_config &config) //VSYSTEM_GGA(config, "gga", 0); - VSYSTEM_SPR2(config, m_spr_old[0], 0); + VSYSTEM_SPR2(config, m_spr_old[0], 0, m_palette, gfx_pspikes_spr); m_spr_old[0]->set_tile_indirect_cb(FUNC(wbbc97_state::pspikes_old_tile_callback)); - m_spr_old[0]->set_gfx_region(1); - m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); // sound hardware SPEAKER(config, "mono").front_center(); diff --git a/src/mame/vsystem/suprslam.cpp b/src/mame/vsystem/suprslam.cpp index e6429ec2655bb..b30be9a041b91 100644 --- a/src/mame/vsystem/suprslam.cpp +++ b/src/mame/vsystem/suprslam.cpp @@ -205,7 +205,7 @@ TILE_GET_INFO_MEMBER(suprslam_state::get_bg_tile_info) tileno += m_bg_bank; colour = colour >> 12; - tileinfo.set(2, tileno, colour, 0); + tileinfo.set(1, tileno, colour, 0); } @@ -385,24 +385,13 @@ INPUT_PORTS_END /*** GFX DECODE **************************************************************/ -static const gfx_layout suprslam_16x16x4_layout = -{ - 16,16, - RGN_FRAC(1,1), - 4, - { 0,1,2,3 }, - { 8, 12, 0, 4, 24, 28, 16, 20, - 32+8, 32+12, 32+0, 32+4, 32+24,32+28,32+16,32+20}, - { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, - 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 - }, - 16*64 -}; - static GFXDECODE_START( gfx_suprslam ) - GFXDECODE_ENTRY( "fgtiles", 0, gfx_8x8x4_packed_lsb, 0x000, 16 ) - GFXDECODE_ENTRY( "sprites", 0, suprslam_16x16x4_layout, 0x200, 16 ) - GFXDECODE_ENTRY( "bgtiles", 0, suprslam_16x16x4_layout, 0x100, 16 ) + GFXDECODE_ENTRY( "fgtiles", 0, gfx_8x8x4_packed_lsb, 0x000, 16 ) + GFXDECODE_ENTRY( "bgtiles", 0, gfx_16x16x4_packed_msb, 0x100, 16 ) +GFXDECODE_END + +static GFXDECODE_START( gfx_suprslam_spr ) + GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_msb, 0x200, 16 ) GFXDECODE_END @@ -454,10 +443,8 @@ void suprslam_state::suprslam(machine_config &config) PALETTE(config, m_palette).set_format(palette_device::xGBR_555, 0x800); - VSYSTEM_SPR(config, m_spr, 0); + VSYSTEM_SPR(config, m_spr, 0, m_palette, gfx_suprslam_spr); m_spr->set_tile_indirect_cb(FUNC(suprslam_state::tile_callback)); - m_spr->set_gfx_region(1); - m_spr->set_gfxdecode_tag(m_gfxdecode); K053936(config, m_k053936, 0); m_k053936->set_wrap(1); @@ -498,14 +485,14 @@ ROM_START( suprslam ) ROM_LOAD( "eb26ic43.bin", 0x000000, 0x200000, CRC(9dfb0959) SHA1(ba479192a422a55efcf8aa7ff995c914525b4a56) ) ROM_REGION( 0x800000, "sprites", 0 ) // 16x16x4 Sprites GFX - ROM_LOAD( "eb26ic09.bin", 0x000000, 0x200000, CRC(5a415365) SHA1(a59a4ab231980b0540e9a8356a02530217779dbd) ) - ROM_LOAD( "eb26ic10.bin", 0x200000, 0x200000, CRC(a04f3140) SHA1(621ff823d93fecdde801912064ac951727b71677) ) - ROM_LOAD( "eb26_100.bin", 0x400000, 0x200000, CRC(c2ee5eb6) SHA1(4b61e77a0d0f38b542d5e32fa25799a4c85bf651) ) - ROM_LOAD( "eb26_101.bin", 0x600000, 0x200000, CRC(7df654b7) SHA1(3a5ed6ee7cc31566e908b835a065e9bce60389fb) ) + ROM_LOAD16_WORD_SWAP( "eb26ic09.bin", 0x000000, 0x200000, CRC(5a415365) SHA1(a59a4ab231980b0540e9a8356a02530217779dbd) ) + ROM_LOAD16_WORD_SWAP( "eb26ic10.bin", 0x200000, 0x200000, CRC(a04f3140) SHA1(621ff823d93fecdde801912064ac951727b71677) ) + ROM_LOAD16_WORD_SWAP( "eb26_100.bin", 0x400000, 0x200000, CRC(c2ee5eb6) SHA1(4b61e77a0d0f38b542d5e32fa25799a4c85bf651) ) + ROM_LOAD16_WORD_SWAP( "eb26_101.bin", 0x600000, 0x200000, CRC(7df654b7) SHA1(3a5ed6ee7cc31566e908b835a065e9bce60389fb) ) ROM_REGION( 0x400000, "bgtiles", 0 ) // 16x16x4 BG GFX - ROM_LOAD( "eb26ic12.bin", 0x000000, 0x200000, CRC(14561bd7) SHA1(5f69f68a305aba9acb21b844c8aa5b1de60f89ff) ) - ROM_LOAD( "eb26ic36.bin", 0x200000, 0x200000, CRC(92019d89) SHA1(dbf6f8384341707996e4b9e07a3d4f536cf4905b) ) + ROM_LOAD16_WORD_SWAP( "eb26ic12.bin", 0x000000, 0x200000, CRC(14561bd7) SHA1(5f69f68a305aba9acb21b844c8aa5b1de60f89ff) ) + ROM_LOAD16_WORD_SWAP( "eb26ic36.bin", 0x200000, 0x200000, CRC(92019d89) SHA1(dbf6f8384341707996e4b9e07a3d4f536cf4905b) ) ROM_END } // anonymous namespace diff --git a/src/mame/vsystem/taotaido.cpp b/src/mame/vsystem/taotaido.cpp index 8b870553e32fb..b2fbb93b08245 100644 --- a/src/mame/vsystem/taotaido.cpp +++ b/src/mame/vsystem/taotaido.cpp @@ -216,7 +216,7 @@ TILE_GET_INFO_MEMBER(taotaido_state::bg_tile_info) code |= m_bgbank[bank] << 9; - tileinfo.set(1, code, col, 0); + tileinfo.set(0, code, col, 0); } TILEMAP_MAPPER_MEMBER(taotaido_state::tilemap_scan_rows) @@ -548,10 +548,13 @@ INPUT_PORTS_END static GFXDECODE_START( gfx_taotaido ) - GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_lsb, 0x000, 256 ) GFXDECODE_ENTRY( "bgtiles", 0, gfx_16x16x4_packed_lsb, 0x300, 256 ) GFXDECODE_END +static GFXDECODE_START( gfx_taotaido_spr ) + GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_lsb, 0x000, 256 ) +GFXDECODE_END + void taotaido_state::taotaido(machine_config &config) @@ -593,10 +596,8 @@ void taotaido_state::taotaido(machine_config &config) PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x800); - VSYSTEM_SPR(config, m_spr, 0); + VSYSTEM_SPR(config, m_spr, 0, "palette", gfx_taotaido_spr); m_spr->set_tile_indirect_cb(FUNC(taotaido_state::tile_callback)); - m_spr->set_gfx_region(0); - m_spr->set_gfxdecode_tag(m_gfxdecode); // sound hardware SPEAKER(config, "lspeaker").front_left(); diff --git a/src/mame/vsystem/vsystem_spr.cpp b/src/mame/vsystem/vsystem_spr.cpp index 0c716e84e9cec..33f63734af643 100644 --- a/src/mame/vsystem/vsystem_spr.cpp +++ b/src/mame/vsystem/vsystem_spr.cpp @@ -1,8 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Nicola Salmoria, David Haywood // Video System Sprites -// todo: -// update drivers which call multiple priority passes to use the pdrawgfx version (aerofgt, gstriker) // according to gstriker this is probably the Fujitsu CG10103 @@ -17,7 +15,7 @@ // Tecmo World Cup '94 // Tao Taido -/* old notes */ +// old notes /*** Fujitsu CG10103 **********************************************/ @@ -68,16 +66,15 @@ DEFINE_DEVICE_TYPE(VSYSTEM_SPR, vsystem_spr_device, "vsystem_spr", "Video System vsystem_spr_device::vsystem_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, VSYSTEM_SPR, tag, owner, clock) - , m_newtilecb(*this, DEVICE_SELF, FUNC(vsystem_spr_device::tile_callback_noindirect)) + , device_gfx_interface(mconfig, *this) + , m_newtile_cb(*this, DEVICE_SELF, FUNC(vsystem_spr_device::tile_callback_noindirect)) + , m_pri_cb(*this) , m_xoffs(0) , m_yoffs(0) - , m_pdraw(false) , m_pal_mask(0x3f) - , m_gfx_region(-1) , m_transpen(15) , m_pal_base(0) , m_curr_sprite() - , m_gfxdecode(*this, finder_base::DUMMY_TAG) { } @@ -89,7 +86,8 @@ uint32_t vsystem_spr_device::tile_callback_noindirect(uint32_t tile) void vsystem_spr_device::device_start() { // bind our handler - m_newtilecb.resolve(); + m_newtile_cb.resolve(); + m_pri_cb.resolve(); save_item(NAME(m_pal_base)); @@ -102,7 +100,6 @@ void vsystem_spr_device::device_start() save_item(NAME(m_curr_sprite.flipx)); save_item(NAME(m_curr_sprite.flipy)); save_item(NAME(m_curr_sprite.color)); - save_item(NAME(m_curr_sprite.pri)); save_item(NAME(m_curr_sprite.map)); } @@ -142,10 +139,9 @@ void vsystem_spr_device::sprite_attributes::get(uint16_t const *ram) xsize = (ram[1] & 0x0e00) >> 9; zoomx = (ram[1] & 0xf000) >> 12; - flipx = (ram[2] & 0x4000); - flipy = (ram[2] & 0x8000); + flipx = BIT(ram[2], 14); + flipy = BIT(ram[2], 15); color = (ram[2] & 0x3f00) >> 8; - pri = (ram[2] & 0x3000) >> 12; map = (ram[2] & 0x0001) << 16; map |= (ram[3] & 0xffff); @@ -154,68 +150,61 @@ void vsystem_spr_device::sprite_attributes::get(uint16_t const *ram) void vsystem_spr_device::common_sprite_drawgfx(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap) { - gfx_element *gfx = m_gfxdecode->gfx(m_gfx_region); - int priority_mask = 0x00; + gfx_element &sprgfx = *gfx(0); + uint32_t priority_mask = 0x00; m_curr_sprite.oy += m_yoffs; m_curr_sprite.ox += m_xoffs; - if (m_pdraw) - { - switch (m_curr_sprite.pri) - { - default: - case 0: priority_mask = 0x00; break; - case 3: priority_mask = 0xfe; break; - case 2: priority_mask = 0xfc; break; - case 1: priority_mask = 0xf0; break; - } - } + if (!m_pri_cb.isnull()) + priority_mask = m_pri_cb(m_curr_sprite.color); + + m_curr_sprite.color &= m_pal_mask; m_curr_sprite.zoomx = 32 - m_curr_sprite.zoomx; m_curr_sprite.zoomy = 32 - m_curr_sprite.zoomy; - int ystart, yend, yinc; + int const ystart = !m_curr_sprite.flipy ? 0 : m_curr_sprite.ysize; + int const yend = !m_curr_sprite.flipy ? (m_curr_sprite.ysize + 1) : -1; + int const yinc = !m_curr_sprite.flipy ? 1 : -1; - if (!m_curr_sprite.flipy) { ystart = 0; yend = m_curr_sprite.ysize+1; yinc = 1; } - else { ystart = m_curr_sprite.ysize; yend = -1; yinc = -1; } + uint32_t const color = m_curr_sprite.color + m_pal_base; + uint32_t const zx = m_curr_sprite.zoomx << 11; + uint32_t const zy = m_curr_sprite.zoomy << 11; - int ycnt = ystart; - while (ycnt != yend) + for (int ycnt = ystart; ycnt != yend; ycnt += yinc) { - int xstart, xend, xinc; - - if (!m_curr_sprite.flipx) { xstart = 0; xend = m_curr_sprite.xsize+1; xinc = 1; } - else { xstart = m_curr_sprite.xsize; xend = -1; xinc = -1; } + int const xstart = !m_curr_sprite.flipx ? 0 : m_curr_sprite.xsize; + int const xend = !m_curr_sprite.flipx ? (m_curr_sprite.xsize + 1) : -1; + int const xinc = !m_curr_sprite.flipx ? 1 : -1; + auto const yoffs = m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2; - int xcnt = xstart; - while (xcnt != xend) + for (int xcnt = xstart; xcnt != xend; xcnt += xinc) { - int startno = m_newtilecb(m_curr_sprite.map++); - if (m_pdraw) + uint32_t const startno = m_newtile_cb(m_curr_sprite.map++); + auto const xoffs = m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2; + if (!m_pri_cb.isnull()) { - gfx->prio_zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, priority_bitmap, priority_mask, m_transpen); - gfx->prio_zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, -0x200+m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, priority_bitmap, priority_mask, m_transpen); - gfx->prio_zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, -0x200+m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, priority_bitmap, priority_mask, m_transpen); - gfx->prio_zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, -0x200+m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, -0x200+m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, priority_bitmap, priority_mask, m_transpen); + sprgfx.prio_zoom_transpen(bitmap,cliprect, startno, color, m_curr_sprite.flipx, m_curr_sprite.flipy, xoffs, yoffs, zx, zy, priority_bitmap, priority_mask, m_transpen); + sprgfx.prio_zoom_transpen(bitmap,cliprect, startno, color, m_curr_sprite.flipx, m_curr_sprite.flipy, -0x200 + xoffs, yoffs, zx, zy, priority_bitmap, priority_mask, m_transpen); + sprgfx.prio_zoom_transpen(bitmap,cliprect, startno, color, m_curr_sprite.flipx, m_curr_sprite.flipy, xoffs, -0x200 + yoffs, zx, zy, priority_bitmap, priority_mask, m_transpen); + sprgfx.prio_zoom_transpen(bitmap,cliprect, startno, color, m_curr_sprite.flipx, m_curr_sprite.flipy, -0x200 + xoffs, -0x200 + yoffs, zx, zy, priority_bitmap, priority_mask, m_transpen); } else { - gfx->zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, m_transpen); - gfx->zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, -0x200+m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, m_transpen); - gfx->zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, -0x200+m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, m_transpen); - gfx->zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, -0x200+m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, -0x200+m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, m_transpen); + sprgfx.zoom_transpen(bitmap,cliprect, startno, color, m_curr_sprite.flipx, m_curr_sprite.flipy, xoffs, yoffs, zx, zy, m_transpen); + sprgfx.zoom_transpen(bitmap,cliprect, startno, color, m_curr_sprite.flipx, m_curr_sprite.flipy, -0x200 + xoffs, yoffs, zx, zy, m_transpen); + sprgfx.zoom_transpen(bitmap,cliprect, startno, color, m_curr_sprite.flipx, m_curr_sprite.flipy, xoffs, -0x200 + yoffs, zx, zy, m_transpen); + sprgfx.zoom_transpen(bitmap,cliprect, startno, color, m_curr_sprite.flipx, m_curr_sprite.flipy, -0x200 + xoffs, -0x200 + yoffs, zx, zy, m_transpen); } - xcnt+=xinc; } - ycnt+=yinc; } } -void vsystem_spr_device::draw_sprites(uint16_t const *spriteram, int spriteram_bytes, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int prihack_mask, int prihack_val ) +void vsystem_spr_device::draw_sprites(uint16_t const *spriteram, int spriteram_bytes, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { int offs; int end = 0; @@ -223,13 +212,13 @@ void vsystem_spr_device::draw_sprites(uint16_t const *spriteram, int spriteram_b // find the end of the list for (offs = 0; offs < (spriteram_bytes / 16 ); offs++) { - if (spriteram[offs] & 0x4000) break; + if (BIT(spriteram[offs], 14)) break; } end = offs; // decide our drawing order (if we're using pdrawgfx we must go in reverse) int first, last, inc; - if (m_pdraw) + if (!m_pri_cb.isnull()) { first = end - 1; last = -1; @@ -248,24 +237,11 @@ void vsystem_spr_device::draw_sprites(uint16_t const *spriteram, int spriteram_b { if ((spriteram[offs] & 0x8000) == 0x0000) { - int attr_start; - - attr_start = 4 * (spriteram[offs] & 0x03ff); + int const attr_start = 4 * (spriteram[offs] & 0x03ff); m_curr_sprite.get(&spriteram[attr_start]); - m_curr_sprite.color &= m_pal_mask; - - // hack for aero fighters and other which still call us multiple times with different priorities instead of using the pdrawgfx version - if (prihack_mask != -1) - { - if ((m_curr_sprite.pri & prihack_mask) == prihack_val) - common_sprite_drawgfx(bitmap, cliprect, screen.priority()); - } - else - { - common_sprite_drawgfx(bitmap, cliprect, screen.priority()); - } + common_sprite_drawgfx(bitmap, cliprect, screen.priority()); } offs+=inc; diff --git a/src/mame/vsystem/vsystem_spr.h b/src/mame/vsystem/vsystem_spr.h index c91ef54c07530..a6b768d75b543 100644 --- a/src/mame/vsystem/vsystem_spr.h +++ b/src/mame/vsystem/vsystem_spr.h @@ -7,30 +7,35 @@ #pragma once -typedef device_delegate vsystem_tile_indirection_delegate; - /*** CG10103 **********************************************/ -class vsystem_spr_device : public device_t +class vsystem_spr_device : public device_t, public device_gfx_interface { public: + typedef device_delegate vsystem_tile_indirection_delegate; + typedef device_delegate vsystem_pri_delegate; + + vsystem_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template vsystem_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&palette_tag, const gfx_decode_entry *gfxinfo) + : vsystem_spr_device(mconfig, tag, owner, clock) + { + set_info(gfxinfo); + set_palette(std::forward(palette_tag)); + } + // configuration - template void set_gfxdecode_tag(T &&tag) { m_gfxdecode.set_tag(std::forward(tag)); } void set_offsets(int xoffs, int yoffs) { m_xoffs = xoffs; m_yoffs = yoffs; } - void set_pdraw(bool pdraw) { m_pdraw = pdraw; } - template void set_tile_indirect_cb(T &&... args) { m_newtilecb.set(std::forward(args)...); } - void set_gfx_region(int gfx_region) { m_gfx_region = gfx_region; } + template void set_tile_indirect_cb(T &&... args) { m_newtile_cb.set(std::forward(args)...); } + template void set_pri_cb(T &&... args) { m_pri_cb.set(std::forward(args)...); } void set_pal_base(int pal_base) { m_pal_base = pal_base; } void set_pal_mask(int pal_mask) { m_pal_mask = pal_mask; } void set_transpen(int transpen) { m_transpen = transpen; } - vsystem_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - void draw_sprites(uint16_t const *spriteram, int spriteram_bytes, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int prihack_mask = -1, int prihack_val = -1 ); + void draw_sprites(uint16_t const *spriteram, int spriteram_bytes, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); protected: virtual void device_start() override; @@ -42,36 +47,32 @@ class vsystem_spr_device : public device_t sprite_attributes() { } void get(uint16_t const *ram); - int ox = 0; - int xsize = 0; - int zoomx = 0; - int oy = 0; - int ysize = 0; - int zoomy = 0; - int flipx = 0; - int flipy = 0; - int color = 0; - int pri = 0; + int32_t ox = 0; + uint8_t xsize = 0; + int32_t zoomx = 0; + int32_t oy = 0; + uint8_t ysize = 0; + int32_t zoomy = 0; + bool flipx = false; + bool flipy = false; + uint32_t color = 0; uint32_t map = 0; }; uint32_t tile_callback_noindirect(uint32_t tile); void common_sprite_drawgfx(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap); - vsystem_tile_indirection_delegate m_newtilecb; + vsystem_tile_indirection_delegate m_newtile_cb; + vsystem_pri_delegate m_pri_cb; // inline config int m_xoffs, m_yoffs; - bool m_pdraw; uint16_t m_pal_mask; - uint8_t m_gfx_region; uint8_t m_transpen; uint16_t m_pal_base; sprite_attributes m_curr_sprite; - - required_device m_gfxdecode; }; diff --git a/src/mame/vsystem/vsystem_spr2.cpp b/src/mame/vsystem/vsystem_spr2.cpp index aa62f29ce302b..f685365a0fb74 100644 --- a/src/mame/vsystem/vsystem_spr2.cpp +++ b/src/mame/vsystem/vsystem_spr2.cpp @@ -31,13 +31,12 @@ DEFINE_DEVICE_TYPE(VSYSTEM_SPR2, vsystem_spr2_device, "vsystem2_spr", "Video Sys vsystem_spr2_device::vsystem_spr2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, VSYSTEM_SPR2, tag, owner, clock) + , device_gfx_interface(mconfig, *this) , m_newtilecb(*this, DEVICE_SELF, FUNC(vsystem_spr2_device::tile_callback_noindirect)) , m_pritype(0) // hack until we have better handling - , m_gfx_region(0) , m_xoffs(0) , m_yoffs(0) , m_curr_sprite() - , m_gfxdecode(*this, finder_base::DUMMY_TAG) { } @@ -51,6 +50,18 @@ void vsystem_spr2_device::device_start() { // bind our handler m_newtilecb.resolve(); + + save_item(NAME(m_curr_sprite.ox)); + save_item(NAME(m_curr_sprite.xsize)); + save_item(NAME(m_curr_sprite.zoomx)); + save_item(NAME(m_curr_sprite.oy)); + save_item(NAME(m_curr_sprite.ysize)); + save_item(NAME(m_curr_sprite.zoomy)); + save_item(NAME(m_curr_sprite.flipx)); + save_item(NAME(m_curr_sprite.flipy)); + save_item(NAME(m_curr_sprite.color)); + save_item(NAME(m_curr_sprite.pri)); + save_item(NAME(m_curr_sprite.map)); } void vsystem_spr2_device::device_reset() @@ -61,7 +72,7 @@ void vsystem_spr2_device::device_reset() bool vsystem_spr2_device::sprite_attributes::get(uint16_t const *ram) { // sprite is disabled - if (!(ram[2] & 0x0080)) + if (BIT(~ram[2], 7)) return false; oy = (ram[0] & 0x01ff); @@ -71,10 +82,10 @@ bool vsystem_spr2_device::sprite_attributes::get(uint16_t const *ram) zoomx = (ram[1] & 0xf000) >> 12; xsize = (ram[2] & 0x0700) >> 8; - flipx = (ram[2] & 0x0800); + flipx = BIT(ram[2], 11); ysize = (ram[2] & 0x7000) >> 12; - flipy = (ram[2] & 0x8000); + flipy = BIT(ram[2], 15); color = (ram[2] & 0x000f); pri = (ram[2] & 0x0010); @@ -93,34 +104,31 @@ void vsystem_spr2_device::sprite_attributes::handle_xsize_map_inc() } template -void vsystem_spr2_device::turbofrc_draw_sprites_common(uint16_t const *spriteram3, int spriteram3_bytes, int spritepalettebank, BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, int pri_param, bool flip_screen) +void vsystem_spr2_device::draw_sprites_common(uint16_t const *spriteram3, int spriteram3_bytes, int spritepalettebank, BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, int pri_param, bool flip_screen) { - int attr_start, first; - first = 4 * spriteram3[0x1fe]; + int first = 4 * spriteram3[0x1fe]; first &= 0x1ff; - if (first>0x200-4) - first = 0x200-4; + if (first > 0x200 - 4) + first = 0x200 - 4; - int start,end,inc; + int start, end, inc; if (m_pritype == 0 || m_pritype == 1 || m_pritype == 2) // prdrawgfx cases { start = 0x200 - 8; - end = first-4; + end = first - 4; inc = -4; } else // drawgfx cases { start = first; - end = 0x200 -4; + end = 0x200 - 4; inc = 4; } - for (attr_start = start; attr_start != end; attr_start += inc) + for (int attr_start = start; attr_start != end; attr_start += inc) { - int x, y; - if (!m_curr_sprite.get(&spriteram3[attr_start])) continue; @@ -128,7 +136,7 @@ void vsystem_spr2_device::turbofrc_draw_sprites_common(uint16_t const *spriteram m_curr_sprite.ox += m_xoffs; m_curr_sprite.oy += m_yoffs; - int usepri = 0; + uint32_t usepri = 0; // these are still calling the function multiple times to filter out priorities, even if some are also using pdrawgfx(!) if (m_pritype == 0 || m_pritype == 1 || m_pritype == 3) // turbo force, spinlbrk, pipedrm etc. @@ -151,8 +159,8 @@ void vsystem_spr2_device::turbofrc_draw_sprites_common(uint16_t const *spriteram usepri = pri_param; } - bool fx = m_curr_sprite.flipx != 0; - bool fy = m_curr_sprite.flipy != 0; + bool fx = m_curr_sprite.flipx; + bool fy = m_curr_sprite.flipy; if (flip_screen) { m_curr_sprite.ox = 308 - m_curr_sprite.ox; @@ -166,31 +174,34 @@ void vsystem_spr2_device::turbofrc_draw_sprites_common(uint16_t const *spriteram m_curr_sprite.zoomx = 32 - m_curr_sprite.zoomx; m_curr_sprite.zoomy = 32 - m_curr_sprite.zoomy; - for (y = 0; y <= m_curr_sprite.ysize; y++) + uint32_t const zx = m_curr_sprite.zoomx << 11; + uint32_t const zy = m_curr_sprite.zoomy << 11; + + for (int y = 0; y <= m_curr_sprite.ysize; y++) { - int cy = m_curr_sprite.flipy ? (m_curr_sprite.ysize - y) : y; - int sy = ((m_curr_sprite.oy + m_curr_sprite.zoomy * (flip_screen ? -cy : cy) / 2 + 16) & 0x1ff) - 16; + int const cy = m_curr_sprite.flipy ? (m_curr_sprite.ysize - y) : y; + int const sy = ((m_curr_sprite.oy + m_curr_sprite.zoomy * (flip_screen ? -cy : cy) / 2 + 16) & 0x1ff) - 16; - for (x = 0; x <= m_curr_sprite.xsize; x++) + for (int x = 0; x <= m_curr_sprite.xsize; x++) { - int cx = m_curr_sprite.flipx ? (m_curr_sprite.xsize - x) : x; - int sx = ((m_curr_sprite.ox + m_curr_sprite.zoomx * (flip_screen ? -cx : cx) / 2 + 16) & 0x1ff) - 16; + int const cx = m_curr_sprite.flipx ? (m_curr_sprite.xsize - x) : x; + int const sx = ((m_curr_sprite.ox + m_curr_sprite.zoomx * (flip_screen ? -cx : cx) / 2 + 16) & 0x1ff) - 16; - int curr = m_newtilecb(m_curr_sprite.map++); + uint32_t const curr = m_newtilecb(m_curr_sprite.map++); if (m_pritype == 0 || m_pritype == 1 || m_pritype == 2) // pdrawgfx cases { - m_gfxdecode->gfx(m_gfx_region)->prio_zoom_transpen(bitmap,cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x000,sy-0x000, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, priority_bitmap,usepri,15); - m_gfxdecode->gfx(m_gfx_region)->prio_zoom_transpen(bitmap,cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x200,sy-0x000, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, priority_bitmap,usepri,15); - m_gfxdecode->gfx(m_gfx_region)->prio_zoom_transpen(bitmap,cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x000,sy-0x200, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, priority_bitmap,usepri,15); - m_gfxdecode->gfx(m_gfx_region)->prio_zoom_transpen(bitmap,cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x200,sy-0x200, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, priority_bitmap,usepri,15); + gfx(0)->prio_zoom_transpen(bitmap, cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x000,sy-0x000, zx, zy, priority_bitmap, usepri, 15); + gfx(0)->prio_zoom_transpen(bitmap, cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x200,sy-0x000, zx, zy, priority_bitmap, usepri, 15); + gfx(0)->prio_zoom_transpen(bitmap, cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x000,sy-0x200, zx, zy, priority_bitmap, usepri, 15); + gfx(0)->prio_zoom_transpen(bitmap, cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x200,sy-0x200, zx, zy, priority_bitmap, usepri, 15); } else // drawgfx cases (welltris, pipedrm) { - m_gfxdecode->gfx(m_gfx_region)->zoom_transpen(bitmap,cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x000,sy-0x000, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11,15); - m_gfxdecode->gfx(m_gfx_region)->zoom_transpen(bitmap,cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x200,sy-0x000, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11,15); - m_gfxdecode->gfx(m_gfx_region)->zoom_transpen(bitmap,cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x000,sy-0x200, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11,15); - m_gfxdecode->gfx(m_gfx_region)->zoom_transpen(bitmap,cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x200,sy-0x200, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11,15); + gfx(0)->zoom_transpen(bitmap, cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x000, sy-0x000, zx, zy, 15); + gfx(0)->zoom_transpen(bitmap, cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x200, sy-0x000, zx, zy, 15); + gfx(0)->zoom_transpen(bitmap, cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x000, sy-0x200, zx, zy, 15); + gfx(0)->zoom_transpen(bitmap, cliprect, curr, m_curr_sprite.color, fx, fy, sx-0x200, sy-0x200, zx, zy, 15); } } @@ -199,12 +210,12 @@ void vsystem_spr2_device::turbofrc_draw_sprites_common(uint16_t const *spriteram } } -void vsystem_spr2_device::turbofrc_draw_sprites(uint16_t const *spriteram3, int spriteram3_bytes, int spritepalettebank, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, int pri_param, bool flip_screen) +void vsystem_spr2_device::draw_sprites(uint16_t const *spriteram3, int spriteram3_bytes, int spritepalettebank, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, int pri_param, bool flip_screen) { - turbofrc_draw_sprites_common(spriteram3, spriteram3_bytes, spritepalettebank, bitmap, cliprect, priority_bitmap, pri_param, flip_screen); + draw_sprites_common(spriteram3, spriteram3_bytes, spritepalettebank, bitmap, cliprect, priority_bitmap, pri_param, flip_screen); } -void vsystem_spr2_device::turbofrc_draw_sprites(uint16_t const *spriteram3, int spriteram3_bytes, int spritepalettebank, bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, int pri_param, bool flip_screen) +void vsystem_spr2_device::draw_sprites(uint16_t const *spriteram3, int spriteram3_bytes, int spritepalettebank, bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, int pri_param, bool flip_screen) { - turbofrc_draw_sprites_common(spriteram3, spriteram3_bytes, spritepalettebank, bitmap, cliprect, priority_bitmap, pri_param, flip_screen); + draw_sprites_common(spriteram3, spriteram3_bytes, spritepalettebank, bitmap, cliprect, priority_bitmap, pri_param, flip_screen); } diff --git a/src/mame/vsystem/vsystem_spr2.h b/src/mame/vsystem/vsystem_spr2.h index 7f415eb82f833..0f393f9a5b755 100644 --- a/src/mame/vsystem/vsystem_spr2.h +++ b/src/mame/vsystem/vsystem_spr2.h @@ -7,24 +7,28 @@ typedef device_delegate vsystem_tile2_indirection_delegate; -class vsystem_spr2_device : public device_t +class vsystem_spr2_device : public device_t, public device_gfx_interface { public: + vsystem_spr2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template vsystem_spr2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&palette_tag, const gfx_decode_entry *gfxinfo) + : vsystem_spr2_device(mconfig, tag, owner, clock) + { + set_info(gfxinfo); + set_palette(std::forward(palette_tag)); + } + // configuration - template void set_gfxdecode_tag(T &&tag) { m_gfxdecode.set_tag(std::forward(tag)); } template void set_tile_indirect_cb(T &&... args) { m_newtilecb.set(std::forward(args)...); } void set_pritype(int pritype) { m_pritype = pritype; } - void set_gfx_region(int gfx_region) { m_gfx_region = gfx_region; } void set_offsets(int xoffs, int yoffs) { m_xoffs = xoffs; m_yoffs = yoffs; } - vsystem_spr2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - void turbofrc_draw_sprites(uint16_t const *spriteram3, int spriteram3_bytes, int spritepalettebank, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, int pri_param, bool flip_screen = false); - void turbofrc_draw_sprites(uint16_t const *spriteram3, int spriteram3_bytes, int spritepalettebank, bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, int pri_param, bool flip_screen = false); + void draw_sprites(uint16_t const *spriteram3, int spriteram3_bytes, int spritepalettebank, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, int pri_param, bool flip_screen = false); + void draw_sprites(uint16_t const *spriteram3, int spriteram3_bytes, int spritepalettebank, bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, int pri_param, bool flip_screen = false); protected: virtual void device_start() override; @@ -37,32 +41,29 @@ class vsystem_spr2_device : public device_t bool get(uint16_t const *ram); void handle_xsize_map_inc(); - int ox = 0; - int xsize = 0; - int zoomx = 0; - int oy = 0; - int ysize = 0; - int zoomy = 0; - int flipx = 0; - int flipy = 0; - int color = 0; - int pri = 0; + int32_t ox = 0; + uint8_t xsize = 0; + int32_t zoomx = 0; + int32_t oy = 0; + uint8_t ysize = 0; + int32_t zoomy = 0; + bool flipx = false; + bool flipy = false; + uint32_t color = 0; + uint32_t pri = 0; uint32_t map = 0; }; uint32_t tile_callback_noindirect(uint32_t tile); template - void turbofrc_draw_sprites_common(uint16_t const *spriteram3, int spriteram3_bytes, int spritepalettebank, BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, int pri_param, bool flip_screen); + void draw_sprites_common(uint16_t const *spriteram3, int spriteram3_bytes, int spritepalettebank, BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, int pri_param, bool flip_screen); vsystem_tile2_indirection_delegate m_newtilecb; int m_pritype; - int m_gfx_region; int m_xoffs, m_yoffs; sprite_attributes m_curr_sprite; - - required_device m_gfxdecode; }; diff --git a/src/mame/vsystem/welltris.cpp b/src/mame/vsystem/welltris.cpp index eb6b92aad3a4c..6b88e26d2c410 100644 --- a/src/mame/vsystem/welltris.cpp +++ b/src/mame/vsystem/welltris.cpp @@ -485,7 +485,7 @@ uint32_t welltris_state::screen_update(screen_device &screen, bitmap_ind16 &bitm draw_background(bitmap, cliprect); m_char_tilemap->draw(screen, bitmap, cliprect, 0, 0); - m_spr_old->turbofrc_draw_sprites(m_spriteram, m_spriteram.bytes(), m_spritepalettebank, bitmap, cliprect, screen.priority(), 0); + m_spr_old->draw_sprites(m_spriteram, m_spriteram.bytes(), m_spritepalettebank, bitmap, cliprect, screen.priority(), 0); return 0; } @@ -522,7 +522,7 @@ void welltris_state::main_map(address_map &map) map(0xfff004, 0xfff005).portr("P3"); // left side controls map(0xfff004, 0xfff007).w(FUNC(welltris_state::scrollreg_w)); map(0xfff006, 0xfff007).portr("P4"); // right side controls - map(0xfff008, 0xfff009).portr("SYSTEM"); // bit 5 tested at start of IRQ 1 */ + map(0xfff008, 0xfff009).portr("SYSTEM"); // bit 5 tested at start of IRQ 1 map(0xfff009, 0xfff009).w(m_soundlatch, FUNC(generic_latch_8_device::write)); map(0xfff00a, 0xfff00b).portr("EXTRA"); // P3+P4 coin + start buttons map(0xfff00c, 0xfff00d).portr("DSW1"); @@ -800,22 +800,12 @@ INPUT_PORTS_END -static const gfx_layout spritelayout = -{ - 16,16, - RGN_FRAC(1,2), - 4, - { 0, 1, 2, 3 }, - { 1*4, 0*4, 3*4, 2*4, RGN_FRAC(1,2)+1*4, RGN_FRAC(1,2)+0*4, RGN_FRAC(1,2)+3*4, RGN_FRAC(1,2)+2*4, - 5*4, 4*4, 7*4, 6*4, RGN_FRAC(1,2)+5*4, RGN_FRAC(1,2)+4*4, RGN_FRAC(1,2)+7*4, RGN_FRAC(1,2)+6*4 }, - { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, - 8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 }, - 64*8 -}; - static GFXDECODE_START( gfx_welltris ) GFXDECODE_ENTRY( "chars", 0, gfx_8x8x4_packed_lsb, 16* 0, 4*16 ) - GFXDECODE_ENTRY( "sprites", 0, spritelayout, 16*96, 2*16 ) +GFXDECODE_END + +static GFXDECODE_START( gfx_welltris_spr ) + GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_lsb, 16*96, 2*16 ) GFXDECODE_END @@ -859,10 +849,8 @@ void welltris_state::welltris(machine_config &config) VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified - VSYSTEM_SPR2(config, m_spr_old, 0); - m_spr_old->set_gfx_region(1); + VSYSTEM_SPR2(config, m_spr_old, 0, "palette", gfx_welltris_spr); m_spr_old->set_pritype(-1); - m_spr_old->set_gfxdecode_tag(m_gfxdecode); // sound hardware SPEAKER(config, "mono").front_center(); @@ -905,8 +893,8 @@ ROM_START( welltris ) ROM_LOAD( "lh534j12.77", 0x000000, 0x80000, CRC(b61a8b74) SHA1(e17f7355375bdc166ef8131f7de9dbda5453f570) ) ROM_REGION( 0x80000, "sprites", 0 ) - ROM_LOAD( "046.93", 0x000000, 0x40000, CRC(31d96d77) SHA1(5613ef9e9e38406b4e64fc8983ea50b57613923e) ) - ROM_LOAD( "048.94", 0x040000, 0x40000, CRC(bb4643da) SHA1(38d54f8c3dba09b528df05d748ab5bdf5d028453) ) + ROM_LOAD32_WORD( "046.93", 0x000000, 0x40000, CRC(31d96d77) SHA1(5613ef9e9e38406b4e64fc8983ea50b57613923e) ) + ROM_LOAD32_WORD( "048.94", 0x000002, 0x40000, CRC(bb4643da) SHA1(38d54f8c3dba09b528df05d748ab5bdf5d028453) ) ROM_REGION( 0x100000, "ymsnd:adpcma", 0 ) ROM_LOAD( "lh534j09.123", 0x00000, 0x80000, CRC(6c2ce9a5) SHA1(a4011ecfb505191c9934ba374933cd11b331d55a) ) @@ -931,8 +919,8 @@ ROM_START( welltrisj ) ROM_LOAD( "lh534j12.77", 0x000000, 0x80000, CRC(b61a8b74) SHA1(e17f7355375bdc166ef8131f7de9dbda5453f570) ) ROM_REGION( 0x80000, "sprites", 0 ) - ROM_LOAD( "046.93", 0x000000, 0x40000, CRC(31d96d77) SHA1(5613ef9e9e38406b4e64fc8983ea50b57613923e) ) - ROM_LOAD( "048.94", 0x040000, 0x40000, CRC(bb4643da) SHA1(38d54f8c3dba09b528df05d748ab5bdf5d028453) ) + ROM_LOAD32_WORD( "046.93", 0x000000, 0x40000, CRC(31d96d77) SHA1(5613ef9e9e38406b4e64fc8983ea50b57613923e) ) + ROM_LOAD32_WORD( "048.94", 0x000002, 0x40000, CRC(bb4643da) SHA1(38d54f8c3dba09b528df05d748ab5bdf5d028453) ) ROM_REGION( 0x100000, "ymsnd:adpcma", 0 ) ROM_LOAD( "lh534j09.123", 0x00000, 0x80000, CRC(6c2ce9a5) SHA1(a4011ecfb505191c9934ba374933cd11b331d55a) ) @@ -959,8 +947,8 @@ ROM_START( quiz18k ) ROM_LOAD( "ic79.bin", 0x100000, 0x80000, CRC(d721e169) SHA1(33ec819c4e7b4dbab41756af9eca857107d96c8b) ) ROM_REGION( 0x100000, "sprites", 0 ) - ROM_LOAD( "ic93.bin", 0x000000, 0x80000, CRC(4d387c5e) SHA1(e77aea06b9b2dc8ada5618aaf83bb80f63670363) ) - ROM_LOAD( "ic94.bin", 0x080000, 0x80000, CRC(6be2f164) SHA1(6a3ca63d6238d587a50718d2a6c76f01932c76c3) ) + ROM_LOAD32_WORD( "ic93.bin", 0x000000, 0x80000, CRC(4d387c5e) SHA1(e77aea06b9b2dc8ada5618aaf83bb80f63670363) ) + ROM_LOAD32_WORD( "ic94.bin", 0x000002, 0x80000, CRC(6be2f164) SHA1(6a3ca63d6238d587a50718d2a6c76f01932c76c3) ) ROM_REGION( 0x140000, "ymsnd:adpcma", 0 ) ROM_LOAD( "ic123.bin", 0x00000, 0x80000, CRC(ee4995cf) SHA1(1b47938ddc87709f8d118b86fe62602972c77ced) )