diff --git a/src/mame/drivers/glass.cpp b/src/mame/drivers/glass.cpp index a0d2865508f..e6b01d1b103 100644 --- a/src/mame/drivers/glass.cpp +++ b/src/mame/drivers/glass.cpp @@ -53,29 +53,22 @@ INTERRUPT_GEN_MEMBER(glass_state::interrupt) static const gfx_layout glass_tilelayout16 = { 16,16, /* 16x16 tiles */ - 0x100000/32, /* number of tiles */ + RGN_FRAC(1,2), /* number of tiles */ 4, /* 4 bpp */ - { 3*0x100000*8, 2*0x100000*8, 1*0x100000*8, 0*0x100000*8 }, - { - 0, 1, 2, 3, 4, 5, 6, 7, - 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 - }, - { - 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, - 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 - }, - 32*8 + { RGN_FRAC(1,2)+8, RGN_FRAC(1,2), 8, 0 }, + { STEP8(0,1), STEP8(8*2*16,1), }, + { STEP16(0,8*2) }, + 8*2*16*2 }; static GFXDECODE_START( gfx_glass ) - GFXDECODE_ENTRY( "gfx1", 0x000000, glass_tilelayout16, 0, 64 ) + GFXDECODE_ENTRY( "gfx", 0x000000, glass_tilelayout16, 0, 64 ) GFXDECODE_END -WRITE16_MEMBER(glass_state::OKIM6295_bankswitch_w) +WRITE8_MEMBER(glass_state::oki_bankswitch_w) { - if (ACCESSING_BITS_0_7) - membank("okibank")->set_entry(data & 0x0f); + m_okibank->set_entry(data & 0x0f); } WRITE16_MEMBER(glass_state::coin_w) @@ -125,7 +118,7 @@ void glass_state::glass_map(address_map &map) map(0x700006, 0x700007).portr("P2"); map(0x700008, 0x700009).w(FUNC(glass_state::blitter_w)); // serial blitter map(0x70000a, 0x70000b).select(0x000070).w(FUNC(glass_state::coin_w)); // Coin Counters/Lockout - map(0x70000c, 0x70000d).w(FUNC(glass_state::OKIM6295_bankswitch_w)); // OKI6295 bankswitch + map(0x70000d, 0x70000d).w(FUNC(glass_state::oki_bankswitch_w)); // OKI6295 bankswitch map(0x70000f, 0x70000f).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // OKI6295 status register map(0xfec000, 0xfeffff).ram().share("shareram"); // Work RAM (partially shared with DS5002FP) } @@ -213,22 +206,18 @@ INPUT_PORTS_END void glass_state::machine_start() { - membank("okibank")->configure_entries(0, 16, memregion("oki")->base(), 0x10000); + m_okibank->configure_entries(0, 16, memregion("oki")->base(), 0x10000); save_item(NAME(m_cause_interrupt)); save_item(NAME(m_current_bit)); - save_item(NAME(m_current_command)); - save_item(NAME(m_blitter_serial_buffer)); + save_item(NAME(m_blitter_command)); } void glass_state::machine_reset() { m_cause_interrupt = 1; m_current_bit = 0; - m_current_command = 0; - - for (int i = 0; i < 5; i++) - m_blitter_serial_buffer[i] = 0; + m_blitter_command = 0; } MACHINE_CONFIG_START(glass_state::glass) @@ -286,14 +275,11 @@ ROM_START( glass ) /* Version 1.1 */ DS5002FP_SET_RPCTL( 0x00 ) DS5002FP_SET_CRCR( 0x80 ) - ROM_REGION( 0x400000, "gfx1", ROMREGION_ERASE00 ) /* Graphics */ - /* 0x000000-0x3fffff filled in later in the DRIVER_INIT */ - - ROM_REGION( 0x400000, "gfx2", 0 ) /* Graphics */ + ROM_REGION( 0x400000, "gfx", 0 ) /* Graphics */ ROM_LOAD( "h13.bin", 0x000000, 0x200000, CRC(13ab7f31) SHA1(468424f74d6cccd1b445a9f20e2d24bc46d61ed6) ) ROM_LOAD( "h11.bin", 0x200000, 0x200000, CRC(c6ac41c8) SHA1(22408ef1e35c66d0fba0c72972c46fad891d1193) ) - ROM_REGION( 0x100000, "gfx3", 0 ) /* 16 bitmaps (320x200, indexed colors) */ + ROM_REGION( 0x100000, "bmap", 0 ) /* 16 bitmaps (320x200, indexed colors) */ ROM_LOAD( "h9.bin", 0x000000, 0x100000, CRC(b9492557) SHA1(3f5c0d696d65e1cd492763dfa749c813dd56a9bf) ) ROM_REGION( 0x100000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ @@ -315,14 +301,11 @@ ROM_START( glass10 ) /* Version 1.0 */ DS5002FP_SET_RPCTL( 0x00 ) DS5002FP_SET_CRCR( 0x80 ) - ROM_REGION( 0x400000, "gfx1", ROMREGION_ERASE00 ) /* Graphics */ - /* 0x000000-0x3fffff filled in later in the DRIVER_INIT */ - - ROM_REGION( 0x400000, "gfx2", 0 ) /* Graphics */ + ROM_REGION( 0x400000, "gfx", 0 ) /* Graphics */ ROM_LOAD( "h13.bin", 0x000000, 0x200000, CRC(13ab7f31) SHA1(468424f74d6cccd1b445a9f20e2d24bc46d61ed6) ) ROM_LOAD( "h11.bin", 0x200000, 0x200000, CRC(c6ac41c8) SHA1(22408ef1e35c66d0fba0c72972c46fad891d1193) ) - ROM_REGION( 0x100000, "gfx3", 0 ) /* 16 bitmaps (320x200, indexed colors) */ + ROM_REGION( 0x100000, "bmap", 0 ) /* 16 bitmaps (320x200, indexed colors) */ ROM_LOAD( "h9.bin", 0x000000, 0x100000, CRC(b9492557) SHA1(3f5c0d696d65e1cd492763dfa749c813dd56a9bf) ) ROM_REGION( 0x100000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ @@ -344,14 +327,11 @@ ROM_START( glass10a ) /* Title screen shows "GLASS" and under that "Break Editio DS5002FP_SET_RPCTL( 0x00 ) DS5002FP_SET_CRCR( 0x80 ) - ROM_REGION( 0x400000, "gfx1", ROMREGION_ERASE00 ) /* Graphics */ - /* 0x000000-0x3fffff filled in later in the DRIVER_INIT */ - - ROM_REGION( 0x400000, "gfx2", 0 ) /* Graphics */ + ROM_REGION( 0x400000, "gfx", 0 ) /* Graphics */ ROM_LOAD( "h13.bin", 0x000000, 0x200000, CRC(13ab7f31) SHA1(468424f74d6cccd1b445a9f20e2d24bc46d61ed6) ) ROM_LOAD( "h11.bin", 0x200000, 0x200000, CRC(c6ac41c8) SHA1(22408ef1e35c66d0fba0c72972c46fad891d1193) ) - ROM_REGION( 0x100000, "gfx3", 0 ) /* 16 bitmaps (320x200, indexed colors) */ + ROM_REGION( 0x100000, "bmap", 0 ) /* 16 bitmaps (320x200, indexed colors) */ ROM_LOAD( "h9.bin", 0x000000, 0x100000, CRC(b9492557) SHA1(3f5c0d696d65e1cd492763dfa749c813dd56a9bf) ) ROM_REGION( 0x100000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ @@ -364,14 +344,11 @@ ROM_START( glasskr ) ROM_LOAD16_BYTE( "glassk.c23", 0x000000, 0x080000, CRC(6ee19376) SHA1(8a8fdeebe094bd3e29c35cf59584e3cab708732d) ) ROM_LOAD16_BYTE( "glassk.c22", 0x000001, 0x080000, CRC(bd546568) SHA1(bcd5e7591f4e68c9470999b8a0ef1ee4392c907c) ) - ROM_REGION( 0x400000, "gfx1", ROMREGION_ERASE00 ) /* Graphics */ - /* 0x000000-0x3fffff filled in later in the DRIVER_INIT */ - - ROM_REGION( 0x400000, "gfx2", 0 ) /* Graphics */ + ROM_REGION( 0x400000, "gfx", 0 ) /* Graphics */ ROM_LOAD( "h13.bin", 0x000000, 0x200000, CRC(13ab7f31) SHA1(468424f74d6cccd1b445a9f20e2d24bc46d61ed6) ) ROM_LOAD( "h11.bin", 0x200000, 0x200000, CRC(c6ac41c8) SHA1(22408ef1e35c66d0fba0c72972c46fad891d1193) ) - ROM_REGION( 0x100000, "gfx3", 0 ) /* 16 bitmaps (320x200, indexed colors) */ + ROM_REGION( 0x100000, "bmap", 0 ) /* 16 bitmaps (320x200, indexed colors) */ ROM_LOAD( "glassk.h9", 0x000000, 0x100000, CRC(d499be4c) SHA1(204f754813be687e8dc00bfe7b5dbc4857ac8738) ) ROM_REGION( 0x100000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ @@ -379,53 +356,6 @@ ROM_START( glasskr ) /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */ ROM_END -/*************************************************************************** - - Split even/odd bytes from ROMs in 16 bit mode to different memory areas - -***************************************************************************/ - -void glass_state::ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 ) -{ - int i; - - /* get a pointer to the source data */ - uint8_t *src = (uint8_t *)memregion(src_reg)->base(); - - /* get a pointer to the destination data */ - uint8_t *dst = (uint8_t *)memregion(dst_reg)->base(); - - /* fill destination areas with the proper data */ - for (i = 0; i < length / 2; i++) - { - dst[dest1 + i] = src[start + i * 2 + 0]; - dst[dest2 + i] = src[start + i * 2 + 1]; - } -} - - -void glass_state::init_glass() -{ - /* - For "gfx2" we have this memory map: - 0x000000-0x1fffff ROM H13 - 0x200000-0x3fffff ROM H11 - - and we are going to construct this one for "gfx1": - 0x000000-0x0fffff ROM H13 even bytes - 0x100000-0x1fffff ROM H13 odd bytes - 0x200000-0x2fffff ROM H11 even bytes - 0x300000-0x3fffff ROM H11 odd bytes - */ - - /* split ROM H13 */ - ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0200000, 0x0000000, 0x0100000); - - /* split ROM H11 */ - ROM16_split_gfx("gfx2", "gfx1", 0x0200000, 0x0200000, 0x0200000, 0x0300000); - -} - /* ALL versions of Glass contain the 'Break Edition' string (it just seems to be part of the title?) @@ -436,7 +366,7 @@ void glass_state::init_glass() The unprotected version appears to be a Korean set, is censored, and has different girl pictures. */ -GAME( 1994, glass, 0, glass_ds5002fp, glass, glass_state, init_glass, ROT0, "OMK / Gaelco", "Glass (Ver 1.1, Break Edition, Checksum 49D5E66B, Version 1994)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) -GAME( 1994, glasskr, glass, glass, glass, glass_state, init_glass, ROT0, "OMK / Gaelco (Promat license)", "Glass (Ver 1.1, Break Edition, Checksum D419AB69, Version 1994) (censored, unprotected)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) // promat stickers on program roms -GAME( 1993, glass10, glass, glass_ds5002fp, glass, glass_state, init_glass, ROT0, "OMK / Gaelco", "Glass (Ver 1.0, Break Edition, Checksum C5513F3C)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) -GAME( 1993, glass10a, glass, glass_ds5002fp, glass, glass_state, init_glass, ROT0, "OMK / Gaelco", "Glass (Ver 1.0, Break Edition, Checksum D3864FDB)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1994, glass, 0, glass_ds5002fp, glass, glass_state, empty_init, ROT0, "OMK / Gaelco", "Glass (Ver 1.1, Break Edition, Checksum 49D5E66B, Version 1994)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1994, glasskr, glass, glass, glass, glass_state, empty_init, ROT0, "OMK / Gaelco (Promat license)", "Glass (Ver 1.1, Break Edition, Checksum D419AB69, Version 1994) (censored, unprotected)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) // promat stickers on program roms +GAME( 1993, glass10, glass, glass_ds5002fp, glass, glass_state, empty_init, ROT0, "OMK / Gaelco", "Glass (Ver 1.0, Break Edition, Checksum C5513F3C)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1993, glass10a, glass, glass_ds5002fp, glass, glass_state, empty_init, ROT0, "OMK / Gaelco", "Glass (Ver 1.0, Break Edition, Checksum D3864FDB)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/includes/glass.h b/src/mame/includes/glass.h index b36e62d673b..4c159306386 100644 --- a/src/mame/includes/glass.h +++ b/src/mame/includes/glass.h @@ -22,14 +22,15 @@ public: m_vregs(*this, "vregs"), m_spriteram(*this, "spriteram"), m_shareram(*this, "shareram"), - m_pant{ nullptr, nullptr } + m_bmap(*this, "bmap"), + m_okibank(*this, "okibank"), + m_pant{ nullptr, nullptr }, + m_blitter_command(0) { } void glass(machine_config &config); void glass_ds5002fp(machine_config &config); - void init_glass(); - private: /* devices */ required_device m_maincpu; @@ -42,6 +43,9 @@ private: required_shared_ptr m_vregs; required_shared_ptr m_spriteram; required_shared_ptr m_shareram; + required_region_ptr m_bmap; + + required_memory_bank m_okibank; /* video-related */ tilemap_t *m_pant[2]; @@ -49,14 +53,13 @@ private: /* misc */ int m_current_bit; - int m_current_command; int m_cause_interrupt; - int m_blitter_serial_buffer[5]; + int m_blitter_command; DECLARE_WRITE8_MEMBER(shareram_w); DECLARE_READ8_MEMBER(shareram_r); DECLARE_WRITE16_MEMBER(clr_int_w); - DECLARE_WRITE16_MEMBER(OKIM6295_bankswitch_w); + DECLARE_WRITE8_MEMBER(oki_bankswitch_w); DECLARE_WRITE16_MEMBER(coin_w); DECLARE_WRITE16_MEMBER(blitter_w); DECLARE_WRITE16_MEMBER(vram_w); @@ -70,12 +73,10 @@ private: virtual void machine_reset() override; virtual void video_start() override; - TILE_GET_INFO_MEMBER(get_tile_info_screen0); - TILE_GET_INFO_MEMBER(get_tile_info_screen1); + template TILE_GET_INFO_MEMBER(get_tile_info); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(interrupt); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 ); void glass_map(address_map &map); void mcu_hostmem_map(address_map &map); void oki_map(address_map &map); diff --git a/src/mame/video/glass.cpp b/src/mame/video/glass.cpp index 87913b717a6..9006aa42ca8 100644 --- a/src/mame/video/glass.cpp +++ b/src/mame/video/glass.cpp @@ -33,20 +33,11 @@ 1 | xxxxxxxx -------- | not used */ -TILE_GET_INFO_MEMBER(glass_state::get_tile_info_screen0) +template +TILE_GET_INFO_MEMBER(glass_state::get_tile_info) { - int data = m_videoram[tile_index << 1]; - int data2 = m_videoram[(tile_index << 1) + 1]; - int code = ((data & 0x03) << 14) | ((data & 0x0fffc) >> 2); - - SET_TILE_INFO_MEMBER(0, code, 0x20 + (data2 & 0x1f), TILE_FLIPYX((data2 & 0xc0) >> 6)); -} - - -TILE_GET_INFO_MEMBER(glass_state::get_tile_info_screen1) -{ - int data = m_videoram[(0x1000 / 2) + (tile_index << 1)]; - int data2 = m_videoram[(0x1000 / 2) + (tile_index << 1) + 1]; + int data = m_videoram[(Layer * 0x1000 / 2) + (tile_index << 1)]; + int data2 = m_videoram[(Layer * 0x1000 / 2) + (tile_index << 1) + 1]; int code = ((data & 0x03) << 14) | ((data & 0x0fffc) >> 2); SET_TILE_INFO_MEMBER(0, code, 0x20 + (data2 & 0x1f), TILE_FLIPYX((data2 & 0xc0) >> 6)); @@ -69,26 +60,20 @@ TILE_GET_INFO_MEMBER(glass_state::get_tile_info_screen1) WRITE16_MEMBER(glass_state::blitter_w) { - m_blitter_serial_buffer[m_current_bit] = data & 0x01; + m_blitter_command = ((m_blitter_command << 1) | (data & 0x01)) & 0x1f; m_current_bit++; if (m_current_bit == 5) { - m_current_command = (m_blitter_serial_buffer[0] << 4) | - (m_blitter_serial_buffer[1] << 3) | - (m_blitter_serial_buffer[2] << 2) | - (m_blitter_serial_buffer[3] << 1) | - (m_blitter_serial_buffer[4] << 0); m_current_bit = 0; /* fill the screen bitmap with the current picture */ { int i, j; - uint8_t *gfx = (uint8_t *)memregion("gfx3")->base(); - gfx = gfx + (m_current_command & 0x07) * 0x10000 + (m_current_command & 0x08) * 0x10000 + 0x140; + uint8_t *gfx = m_bmap + (m_blitter_command & 0x07) * 0x10000 + (m_blitter_command & 0x08) * 0x10000 + 0x140; - if ((m_current_command & 0x18) != 0) + if ((m_blitter_command & 0x18) != 0) { for (j = 0; j < 200; j++) { @@ -127,8 +112,8 @@ WRITE16_MEMBER(glass_state::vram_w) void glass_state::video_start() { - m_pant[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(glass_state::get_tile_info_screen0),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); - m_pant[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(glass_state::get_tile_info_screen1),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); + m_pant[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(glass_state::get_tile_info<0>),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); + m_pant[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(glass_state::get_tile_info<1>),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); m_screen_bitmap = std::make_unique(320, 200); save_item(NAME(*m_screen_bitmap));