From 9f38859425953920a814e2e143af41ee38c2a87f Mon Sep 17 00:00:00 2001 From: cam900 Date: Fri, 17 Aug 2018 23:27:54 +0900 Subject: [PATCH] dcheese.cpp Cleanups (#3859) * dcheese.cpp : Correct palette size, Reduce some runtime tag lookups, Cleanup naming etc... * dcheese.cpp : Minor const'd values --- src/mame/drivers/dcheese.cpp | 56 +++++++++++++------------- src/mame/includes/dcheese.h | 21 ++++++---- src/mame/video/dcheese.cpp | 77 +++++++++++++++++------------------- 3 files changed, 77 insertions(+), 77 deletions(-) diff --git a/src/mame/drivers/dcheese.cpp b/src/mame/drivers/dcheese.cpp index 6bd867b1216..702698379cc 100644 --- a/src/mame/drivers/dcheese.cpp +++ b/src/mame/drivers/dcheese.cpp @@ -154,9 +154,9 @@ WRITE8_MEMBER(dcheese_state::sound_control_w) WRITE8_MEMBER(dcheese_state::bsmt_data_w) { /* writes come in pairs; even bytes latch, odd bytes write */ - if (offset % 2 == 0) + if ((offset & 1) == 0) { - m_bsmt->write_reg(offset / 2); + m_bsmt->write_reg(offset >> 1); m_sound_msb_latch = data; } else @@ -177,13 +177,13 @@ void dcheese_state::main_cpu_map(address_map &map) map(0x000000, 0x03ffff).rom(); map(0x100000, 0x10ffff).ram(); map(0x200000, 0x200001).portr("200000").w("watchdog", FUNC(watchdog_timer_device::reset16_w)); - map(0x220000, 0x220001).portr("220000").w(FUNC(dcheese_state::madmax_blitter_color_w)); + map(0x220000, 0x220001).portr("220000").w(FUNC(dcheese_state::blitter_color_w)); map(0x240000, 0x240001).portr("240000").w(FUNC(dcheese_state::eeprom_control_w)); - map(0x260000, 0x26001f).w(FUNC(dcheese_state::madmax_blitter_xparam_w)); - map(0x280000, 0x28001f).w(FUNC(dcheese_state::madmax_blitter_yparam_w)); - map(0x2a0000, 0x2a003f).rw(FUNC(dcheese_state::madmax_blitter_vidparam_r), FUNC(dcheese_state::madmax_blitter_vidparam_w)); + map(0x260000, 0x26001f).w(FUNC(dcheese_state::blitter_xparam_w)); + map(0x280000, 0x28001f).w(FUNC(dcheese_state::blitter_yparam_w)); + map(0x2a0000, 0x2a003f).rw(FUNC(dcheese_state::blitter_vidparam_r), FUNC(dcheese_state::blitter_vidparam_w)); map(0x2e0001, 0x2e0001).w(m_soundlatch, FUNC(generic_latch_8_device::write)); - map(0x300000, 0x300001).w(FUNC(dcheese_state::madmax_blitter_unknown_w)); + map(0x300000, 0x300001).w(FUNC(dcheese_state::blitter_unknown_w)); } @@ -197,8 +197,8 @@ void dcheese_state::main_cpu_map(address_map &map) void dcheese_state::sound_cpu_map(address_map &map) { map.unmap_value_high(); - map(0x0000, 0x07ff).rw(FUNC(dcheese_state::sound_status_r), FUNC(dcheese_state::sound_control_w)); - map(0x0800, 0x0fff).r(m_soundlatch, FUNC(generic_latch_8_device::read)); + map(0x0000, 0x0000).mirror(0x07ff).rw(FUNC(dcheese_state::sound_status_r), FUNC(dcheese_state::sound_control_w)); + map(0x0800, 0x0800).mirror(0x07ff).r(m_soundlatch, FUNC(generic_latch_8_device::read)); map(0x1000, 0x10ff).mirror(0x0700).w(FUNC(dcheese_state::bsmt_data_w)); map(0x1800, 0x1fff).ram(); map(0x2000, 0xffff).rom(); @@ -398,7 +398,7 @@ MACHINE_CONFIG_START(dcheese_state::dcheese) MCFG_SCREEN_UPDATE_DRIVER(dcheese_state, screen_update_dcheese) MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD("palette", 65534) + MCFG_PALETTE_ADD("palette", 65536) MCFG_PALETTE_INIT_OWNER(dcheese_state, dcheese) /* sound hardware */ @@ -447,7 +447,7 @@ ROM_START( dcheese ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* M6809 */ ROM_LOAD( "dchez.102", 0x8000, 0x8000, CRC(5d110061) SHA1(10d852a408a75979b8e8843afc7b39737ca2c6c8) ) - ROM_REGION( 0x100000, "gfx1", 0 ) + ROM_REGION( 0x100000, "gfx", 0 ) ROM_LOAD( "dchez.123", 0x00000, 0x40000, CRC(2293dd9a) SHA1(3f0550c2a6f59a233c5b1010cecdb19404170dc0) ) ROM_LOAD( "dchez.127", 0x40000, 0x40000, CRC(372f9d67) SHA1(74f73f0344bfb890b5e457fcde3d82c9106e7edd) ) ROM_LOAD( "dchez.125", 0x80000, 0x40000, CRC(ddf28bab) SHA1(0f3bc86d0db7afebf8c6094b8337e5f343a82f29) ) @@ -478,7 +478,7 @@ ROM_START( dcheese ) ROM_RELOAD( 0x3c0000, 0x20000 ) ROM_RELOAD( 0x3e0000, 0x20000 ) - ROM_REGION16_LE( 0x20000, "user1", 0 ) + ROM_REGION16_LE( 0x20000, "palrom", 0 ) ROM_LOAD16_BYTE( "dchez.144", 0x00000, 0x10000, CRC(52c96252) SHA1(46de465c25e4602aa360336315b3c8e1a9a0b5f3) ) ROM_LOAD16_BYTE( "dchez.145", 0x00001, 0x10000, CRC(a11b92d0) SHA1(265f93cb3657910aabca21ed8afbb55bdc86a964) ) ROM_END @@ -492,7 +492,7 @@ ROM_START( lottof2 ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* M6809 */ ROM_LOAD( "u102.r10", 0x8000, 0x8000, CRC(fcb34c81) SHA1(f80cef85d0f4218c88c01b238f10eff2c6241d33) ) - ROM_REGION( 0x100000, "gfx1", 0 ) + ROM_REGION( 0x100000, "gfx", 0 ) ROM_LOAD( "u123.r10", 0x00000, 0x40000, CRC(dbcdb5aa) SHA1(7473c5e0fc1a40a39e148277b4094fe1338d988c) ) ROM_LOAD( "u127.r10", 0x40000, 0x40000, CRC(029ffed9) SHA1(63ba56277745ebea7c2c2b3738790cd2f4ddbe00) ) ROM_LOAD( "u125.r10", 0x80000, 0x40000, CRC(c70cf1c6) SHA1(eb5f0c5f7485d92ce569ad915b9f5c3c48338172) ) @@ -528,7 +528,7 @@ ROM_START( lottof2 ) ROM_RELOAD( 0x3c0000, 0x20000 ) ROM_RELOAD( 0x3e0000, 0x20000 ) - ROM_REGION16_LE( 0x20000, "user1", 0 ) + ROM_REGION16_LE( 0x20000, "palrom", 0 ) ROM_LOAD16_BYTE( "u144.r10", 0x00000, 0x10000, CRC(3b9d5d9e) SHA1(b3fbfeb41c62c689a825dfe9487917a927a71f58) ) ROM_LOAD16_BYTE( "u145.r10", 0x00001, 0x10000, CRC(e5a022a4) SHA1(567a37d24b36ca01a2ac3c40a0392cf97b1eb948) ) ROM_END @@ -542,7 +542,7 @@ ROM_START( fredmem ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* M6809 */ ROM_LOAD( "prog.102", 0x00000, 0x10000, CRC(b1526a1a) SHA1(456c44a0a908b3cd054b7c6741d7a1033c9b12fb) ) /* Sound Program 6809 code at U102 */ - ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_REGION( 0x200000, "gfx", 0 ) ROM_LOAD( "art-rom.123", 0x000000, 0x80000, CRC(48133505) SHA1(60f69b053e67256928db57e0a5335bbd5a72ddfc) ) /* Graphics / Art at U123 */ ROM_LOAD( "art-rom.125", 0x080000, 0x80000, CRC(8181e154) SHA1(4d16b84ad52d8e3d3bcad3fdf5f8da23df198d46) ) /* Graphics / Art at U125 */ ROM_LOAD( "art-rom.127", 0x100000, 0x80000, CRC(93095f3b) SHA1(de746829e04bf153024e94e6ef0ceffb1eae2b14) ) /* Graphics / Art at U127 */ @@ -558,7 +558,7 @@ ROM_START( fredmem ) ROM_LOAD( "arom3", 0x300000, 0x80000, CRC(411900b0) SHA1(ddc5b387c89baab0fd5c654f3768c6e27972c06a) ) ROM_RELOAD( 0x380000, 0x80000 ) - ROM_REGION16_LE( 0x20000, "user1", 0 ) + ROM_REGION16_LE( 0x20000, "palrom", 0 ) ROM_LOAD16_BYTE( "0.144", 0x00000, 0x10000, CRC(793c4bda) SHA1(5a8a2981b48922f4d9e617a9bf9ef6a47ab702b7) ) /* Palette - 0 at U144 */ ROM_LOAD16_BYTE( "1.145", 0x00001, 0x10000, CRC(fe2c3521) SHA1(896e53427c7831620ca565be9c0b76aabc36b9f4) ) /* Palette - 1 at U145 */ @@ -575,7 +575,7 @@ ROM_START( fredmemus ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* M6809 */ ROM_LOAD( "prog.102", 0x00000, 0x10000, CRC(b1526a1a) SHA1(456c44a0a908b3cd054b7c6741d7a1033c9b12fb) ) /* Sound Program 6809 code at U102 */ - ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_REGION( 0x200000, "gfx", 0 ) ROM_LOAD( "art-rom.123", 0x000000, 0x80000, CRC(48133505) SHA1(60f69b053e67256928db57e0a5335bbd5a72ddfc) ) /* Graphics / Art at U123 */ ROM_LOAD( "art-rom.125", 0x080000, 0x80000, CRC(8181e154) SHA1(4d16b84ad52d8e3d3bcad3fdf5f8da23df198d46) ) /* Graphics / Art at U125 */ ROM_LOAD( "art-rom.127", 0x100000, 0x80000, CRC(93095f3b) SHA1(de746829e04bf153024e94e6ef0ceffb1eae2b14) ) /* Graphics / Art at U127 */ @@ -591,7 +591,7 @@ ROM_START( fredmemus ) ROM_LOAD( "arom3", 0x300000, 0x80000, CRC(411900b0) SHA1(ddc5b387c89baab0fd5c654f3768c6e27972c06a) ) ROM_RELOAD( 0x380000, 0x80000 ) - ROM_REGION16_LE( 0x20000, "user1", 0 ) + ROM_REGION16_LE( 0x20000, "palrom", 0 ) ROM_LOAD16_BYTE( "0.144", 0x00000, 0x10000, CRC(793c4bda) SHA1(5a8a2981b48922f4d9e617a9bf9ef6a47ab702b7) ) /* Palette - 0 at U144 */ ROM_LOAD16_BYTE( "1.145", 0x00001, 0x10000, CRC(fe2c3521) SHA1(896e53427c7831620ca565be9c0b76aabc36b9f4) ) /* Palette - 1 at U145 */ @@ -607,7 +607,7 @@ ROM_START( fredmemuk ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* M6809 */ ROM_LOAD( "prog.102", 0x00000, 0x10000, CRC(b1526a1a) SHA1(456c44a0a908b3cd054b7c6741d7a1033c9b12fb) ) /* Sound Program 6809 code at U102 */ - ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_REGION( 0x200000, "gfx", 0 ) ROM_LOAD( "art-rom.123", 0x000000, 0x80000, CRC(48133505) SHA1(60f69b053e67256928db57e0a5335bbd5a72ddfc) ) /* Graphics / Art at U123 */ ROM_LOAD( "art-rom.125", 0x080000, 0x80000, CRC(8181e154) SHA1(4d16b84ad52d8e3d3bcad3fdf5f8da23df198d46) ) /* Graphics / Art at U125 */ ROM_LOAD( "art-rom.127", 0x100000, 0x80000, CRC(93095f3b) SHA1(de746829e04bf153024e94e6ef0ceffb1eae2b14) ) /* Graphics / Art at U127 */ @@ -623,7 +623,7 @@ ROM_START( fredmemuk ) ROM_LOAD( "arom3", 0x300000, 0x80000, CRC(411900b0) SHA1(ddc5b387c89baab0fd5c654f3768c6e27972c06a) ) ROM_RELOAD( 0x380000, 0x80000 ) - ROM_REGION16_LE( 0x20000, "user1", 0 ) + ROM_REGION16_LE( 0x20000, "palrom", 0 ) ROM_LOAD16_BYTE( "0.144", 0x00000, 0x10000, CRC(793c4bda) SHA1(5a8a2981b48922f4d9e617a9bf9ef6a47ab702b7) ) /* Palette - 0 at U144 */ ROM_LOAD16_BYTE( "1.145", 0x00001, 0x10000, CRC(fe2c3521) SHA1(896e53427c7831620ca565be9c0b76aabc36b9f4) ) /* Palette - 1 at U145 */ @@ -640,7 +640,7 @@ ROM_START( fredmemj ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* M6809 */ ROM_LOAD( "prog.102", 0x00000, 0x10000, CRC(b1526a1a) SHA1(456c44a0a908b3cd054b7c6741d7a1033c9b12fb) ) /* Sound Program 6809 code at U102 */ - ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_REGION( 0x200000, "gfx", 0 ) ROM_LOAD( "art-rom.123", 0x000000, 0x80000, CRC(48133505) SHA1(60f69b053e67256928db57e0a5335bbd5a72ddfc) ) /* Graphics / Art at U123 */ ROM_LOAD( "art-rom_japan.125", 0x080000, 0x80000, CRC(7bfd9b92) SHA1(306f276cf4574587fb4421c2b214522ee2b53774) ) /* Graphics / Art at U125 */ ROM_LOAD( "art-rom.127", 0x100000, 0x80000, CRC(93095f3b) SHA1(de746829e04bf153024e94e6ef0ceffb1eae2b14) ) /* Graphics / Art at U127 */ @@ -656,7 +656,7 @@ ROM_START( fredmemj ) ROM_LOAD( "arom3", 0x300000, 0x80000, CRC(411900b0) SHA1(ddc5b387c89baab0fd5c654f3768c6e27972c06a) ) ROM_RELOAD( 0x380000, 0x80000 ) - ROM_REGION16_LE( 0x20000, "user1", 0 ) + ROM_REGION16_LE( 0x20000, "palrom", 0 ) ROM_LOAD16_BYTE( "0.144", 0x00000, 0x10000, CRC(793c4bda) SHA1(5a8a2981b48922f4d9e617a9bf9ef6a47ab702b7) ) /* Palette - 0 at U144 */ ROM_LOAD16_BYTE( "1.145", 0x00001, 0x10000, CRC(fe2c3521) SHA1(896e53427c7831620ca565be9c0b76aabc36b9f4) ) /* Palette - 1 at U145 */ @@ -672,7 +672,7 @@ ROM_START( fredmemc ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* M6809 */ ROM_LOAD( "prog.102", 0x00000, 0x10000, CRC(b1526a1a) SHA1(456c44a0a908b3cd054b7c6741d7a1033c9b12fb) ) /* Sound Program 6809 code at U102 */ - ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_REGION( 0x200000, "gfx", 0 ) ROM_LOAD( "art-rom.123", 0x000000, 0x80000, CRC(48133505) SHA1(60f69b053e67256928db57e0a5335bbd5a72ddfc) ) /* Graphics / Art at U123 */ ROM_LOAD( "art-rom.125.mandarin", 0x080000, 0x80000, CRC(780c06fa) SHA1(34aa420fb8a628b8cb92b0975e602d8c676c608a) ) /* Graphics / Art at U125 */ ROM_LOAD( "art-rom.127", 0x100000, 0x80000, CRC(93095f3b) SHA1(de746829e04bf153024e94e6ef0ceffb1eae2b14) ) /* Graphics / Art at U127 */ @@ -688,7 +688,7 @@ ROM_START( fredmemc ) ROM_LOAD( "arom3", 0x300000, 0x80000, CRC(411900b0) SHA1(ddc5b387c89baab0fd5c654f3768c6e27972c06a) ) ROM_RELOAD( 0x380000, 0x80000 ) - ROM_REGION16_LE( 0x20000, "user1", 0 ) + ROM_REGION16_LE( 0x20000, "palrom", 0 ) ROM_LOAD16_BYTE( "0.144", 0x00000, 0x10000, CRC(793c4bda) SHA1(5a8a2981b48922f4d9e617a9bf9ef6a47ab702b7) ) /* Palette - 0 at U144 */ ROM_LOAD16_BYTE( "1.145", 0x00001, 0x10000, CRC(fe2c3521) SHA1(896e53427c7831620ca565be9c0b76aabc36b9f4) ) /* Palette - 1 at U145 */ @@ -704,7 +704,7 @@ ROM_START( fredmesp ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* M6809 */ ROM_LOAD( "prog.102", 0x00000, 0x10000, CRC(b1526a1a) SHA1(456c44a0a908b3cd054b7c6741d7a1033c9b12fb) ) /* Sound Program 6809 code at U102 */ - ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_REGION( 0x200000, "gfx", 0 ) ROM_LOAD( "art-rom.123", 0x000000, 0x80000, CRC(48133505) SHA1(60f69b053e67256928db57e0a5335bbd5a72ddfc) ) /* Graphics / Art at U123 */ ROM_LOAD( "art-rom.125.spanish", 0x080000, 0x80000, CRC(3ee88ec8) SHA1(24f3d548fe47b92d68904e1cd6233f75b109772c) ) /* Graphics / Art at U125 */ ROM_LOAD( "art-rom.127", 0x100000, 0x80000, CRC(93095f3b) SHA1(de746829e04bf153024e94e6ef0ceffb1eae2b14) ) /* Graphics / Art at U127 */ @@ -720,7 +720,7 @@ ROM_START( fredmesp ) ROM_LOAD( "arom3", 0x300000, 0x80000, CRC(411900b0) SHA1(ddc5b387c89baab0fd5c654f3768c6e27972c06a) ) ROM_RELOAD( 0x380000, 0x80000 ) - ROM_REGION16_LE( 0x20000, "user1", 0 ) + ROM_REGION16_LE( 0x20000, "palrom", 0 ) ROM_LOAD16_BYTE( "0.144", 0x00000, 0x10000, CRC(793c4bda) SHA1(5a8a2981b48922f4d9e617a9bf9ef6a47ab702b7) ) /* Palette - 0 at U144 */ ROM_LOAD16_BYTE( "1.145", 0x00001, 0x10000, CRC(fe2c3521) SHA1(896e53427c7831620ca565be9c0b76aabc36b9f4) ) /* Palette - 1 at U145 */ @@ -738,7 +738,7 @@ ROM_START( cecmatch ) ROM_LOAD( "prog.102", 0x00000, 0x8000, CRC(d452ccf4) SHA1(7de9a4f39bf0ba448fe4ebeb459e98a1910a66be) ) /* Sound Program 6809 code at U102 */ ROM_RELOAD(0x8000,0x8000) - ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF ) + ROM_REGION( 0x100000, "gfx", ROMREGION_ERASEFF ) ROM_LOAD( "art-rom.123", 0x000000, 0x40000, CRC(1bab1a52) SHA1(f713ba1bc755c41d38d9846444d753c9c7fb1f9d) ) /* Graphics / Art at U123 */ ROM_LOAD( "art-rom.127", 0x040000, 0x40000, CRC(dc9be2ca) SHA1(d5059a49a3aad309e242c9c4791d10aa5ecd5d1a) ) /* Graphics / Art at U127 */ ROM_LOAD( "art-rom.125", 0x080000, 0x40000, CRC(7abe18d9) SHA1(c5a582ded7c1b0a02847b342111c64ac0ccb70c2) ) /* Graphics / Art at U125 */ @@ -761,7 +761,7 @@ ROM_START( cecmatch ) ROM_RELOAD( 0x380000, 0x40000 ) ROM_RELOAD( 0x3c0000, 0x40000 ) - ROM_REGION16_LE( 0x20000, "user1", 0 ) + ROM_REGION16_LE( 0x20000, "palrom", 0 ) ROM_LOAD16_BYTE( "0.144", 0x00000, 0x10000, CRC(69b3cc85) SHA1(05f7204ac961274b5d2f42cc6c0d06e5fa146aef)) /* Palette - 0 at U144 */ ROM_LOAD16_BYTE( "1.145", 0x00001, 0x10000, CRC(e64a8511) SHA1(0e3a1fe936c841b8acfb150bf63e564b1dec2363) ) /* Palette - 1 at U145 */ ROM_END diff --git a/src/mame/includes/dcheese.h b/src/mame/includes/dcheese.h index 2961646c9d4..8827249f50d 100644 --- a/src/mame/includes/dcheese.h +++ b/src/mame/includes/dcheese.h @@ -15,8 +15,10 @@ class dcheese_state : public driver_device { public: - dcheese_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + dcheese_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_palrom(*this, "palrom"), + m_gfxrom(*this, "gfx"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_screen(*this, "screen"), @@ -35,6 +37,9 @@ private: TIMER_SIGNAL_IRQ }; + required_region_ptr m_palrom; + required_region_ptr m_gfxrom; + /* video-related */ uint16_t m_blitter_color[2]; uint16_t m_blitter_xparam[16]; @@ -61,12 +66,12 @@ private: DECLARE_READ8_MEMBER(sound_status_r); DECLARE_WRITE8_MEMBER(sound_control_w); DECLARE_WRITE8_MEMBER(bsmt_data_w); - DECLARE_WRITE16_MEMBER(madmax_blitter_color_w); - DECLARE_WRITE16_MEMBER(madmax_blitter_xparam_w); - DECLARE_WRITE16_MEMBER(madmax_blitter_yparam_w); - DECLARE_WRITE16_MEMBER(madmax_blitter_vidparam_w); - DECLARE_WRITE16_MEMBER(madmax_blitter_unknown_w); - DECLARE_READ16_MEMBER(madmax_blitter_vidparam_r); + DECLARE_WRITE16_MEMBER(blitter_color_w); + DECLARE_WRITE16_MEMBER(blitter_xparam_w); + DECLARE_WRITE16_MEMBER(blitter_yparam_w); + DECLARE_WRITE16_MEMBER(blitter_vidparam_w); + DECLARE_WRITE16_MEMBER(blitter_unknown_w); + DECLARE_READ16_MEMBER(blitter_vidparam_r); virtual void machine_start() override; virtual void video_start() override; DECLARE_PALETTE_INIT(dcheese); diff --git a/src/mame/video/dcheese.cpp b/src/mame/video/dcheese.cpp index 741aa8bcbcb..96ef8ba4c3b 100644 --- a/src/mame/video/dcheese.cpp +++ b/src/mame/video/dcheese.cpp @@ -29,14 +29,11 @@ PALETTE_INIT_MEMBER(dcheese_state, dcheese) { - const uint16_t *src = (uint16_t *)memregion("user1")->base(); - int i; - /* really 65536 colors, but they don't use the later ones so we can stay */ /* within MAME's limits */ - for (i = 0; i < 65534; i++) + for (int i = 0; i < 65536; i++) { - int data = *src++; + int data = m_palrom[i]; palette.set_pen_color(i, pal6bit(data >> 0), pal5bit(data >> 6), pal5bit(data >> 11)); } } @@ -127,7 +124,7 @@ uint32_t dcheese_state::screen_update_dcheese(screen_device &screen, bitmap_ind1 for (y = cliprect.min_y; y <= cliprect.max_y; y++) { uint16_t *dest = &bitmap.pix16(y); - uint16_t *src = &m_dstbitmap->pix16((y + m_blitter_vidparam[0x28/2]) % DSTBITMAP_HEIGHT); + uint16_t *src = &m_dstbitmap->pix16((y + m_blitter_vidparam[0x28/2]) & 0x1ff); for (x = cliprect.min_x; x <= cliprect.max_x; x++) dest[x] = src[x]; @@ -149,7 +146,7 @@ void dcheese_state::do_clear( ) /* clear the requested scanlines */ for (y = m_blitter_vidparam[0x2c/2]; y < m_blitter_vidparam[0x2a/2]; y++) - memset(&m_dstbitmap->pix16(y % DSTBITMAP_HEIGHT), 0, DSTBITMAP_WIDTH * 2); + memset(&m_dstbitmap->pix16(y & 0x1ff), 0, DSTBITMAP_WIDTH * 2); /* signal an IRQ when done (timing is just a guess) */ m_signal_irq_timer->adjust(m_screen->scan_period(), 1); @@ -158,49 +155,47 @@ void dcheese_state::do_clear( ) void dcheese_state::do_blit( ) { - int32_t srcminx = m_blitter_xparam[0] << 12; - int32_t srcmaxx = m_blitter_xparam[1] << 12; - int32_t srcminy = m_blitter_yparam[0] << 12; - int32_t srcmaxy = m_blitter_yparam[1] << 12; - int32_t srcx = ((m_blitter_xparam[2] & 0x0fff) | ((m_blitter_xparam[3] & 0x0fff) << 12)) << 7; - int32_t srcy = ((m_blitter_yparam[2] & 0x0fff) | ((m_blitter_yparam[3] & 0x0fff) << 12)) << 7; - int32_t dxdx = (int32_t)(((m_blitter_xparam[4] & 0x0fff) | ((m_blitter_xparam[5] & 0x0fff) << 12)) << 12) >> 12; - int32_t dxdy = (int32_t)(((m_blitter_xparam[6] & 0x0fff) | ((m_blitter_xparam[7] & 0x0fff) << 12)) << 12) >> 12; - int32_t dydx = (int32_t)(((m_blitter_yparam[4] & 0x0fff) | ((m_blitter_yparam[5] & 0x0fff) << 12)) << 12) >> 12; - int32_t dydy = (int32_t)(((m_blitter_yparam[6] & 0x0fff) | ((m_blitter_yparam[7] & 0x0fff) << 12)) << 12) >> 12; - uint8_t *src = memregion("gfx1")->base(); - uint32_t pagemask = (memregion("gfx1")->bytes() - 1) / 0x40000; - int xstart = m_blitter_xparam[14]; - int xend = m_blitter_xparam[15] + 1; - int ystart = m_blitter_yparam[14]; - int yend = m_blitter_yparam[15]; - int color = (m_blitter_color[0] << 8) & 0xff00; - int mask = (m_blitter_color[0] >> 8) & 0x00ff; - int opaque = (dxdx | dxdy | dydx | dydy) == 0; /* bit of a hack for fredmem */ - int x, y; + int32_t const srcminx = m_blitter_xparam[0] << 12; + int32_t const srcmaxx = m_blitter_xparam[1] << 12; + int32_t const srcminy = m_blitter_yparam[0] << 12; + int32_t const srcmaxy = m_blitter_yparam[1] << 12; + int32_t const srcx = ((m_blitter_xparam[2] & 0x0fff) | ((m_blitter_xparam[3] & 0x0fff) << 12)) << 7; + int32_t const srcy = ((m_blitter_yparam[2] & 0x0fff) | ((m_blitter_yparam[3] & 0x0fff) << 12)) << 7; + int32_t const dxdx = (int32_t)(((m_blitter_xparam[4] & 0x0fff) | ((m_blitter_xparam[5] & 0x0fff) << 12)) << 12) >> 12; + int32_t const dxdy = (int32_t)(((m_blitter_xparam[6] & 0x0fff) | ((m_blitter_xparam[7] & 0x0fff) << 12)) << 12) >> 12; + int32_t const dydx = (int32_t)(((m_blitter_yparam[4] & 0x0fff) | ((m_blitter_yparam[5] & 0x0fff) << 12)) << 12) >> 12; + int32_t const dydy = (int32_t)(((m_blitter_yparam[6] & 0x0fff) | ((m_blitter_yparam[7] & 0x0fff) << 12)) << 12) >> 12; + uint32_t const pagemask = m_gfxrom.mask() >> 18; + int const xstart = m_blitter_xparam[14]; + int const xend = m_blitter_xparam[15] + 1; + int const ystart = m_blitter_yparam[14]; + int const yend = m_blitter_yparam[15]; + int const color = (m_blitter_color[0] << 8) & 0xff00; + int const mask = (m_blitter_color[0] >> 8) & 0x00ff; + int const opaque = (dxdx | dxdy | dydx | dydy) == 0; /* bit of a hack for fredmem */ /* loop over target rows */ - for (y = ystart; y <= yend; y++) + for (int y = ystart; y <= yend; y++) { - uint16_t *dst = &m_dstbitmap->pix16(y % DSTBITMAP_HEIGHT); + uint16_t *dst = &m_dstbitmap->pix16(y & 0x1ff); /* loop over target columns */ - for (x = xstart; x <= xend; x++) + for (int x = xstart; x <= xend; x++) { /* compute current X/Y positions */ - int sx = (srcx + dxdx * (x - xstart) + dxdy * (y - ystart)) & 0xffffff; - int sy = (srcy + dydx * (x - xstart) + dydy * (y - ystart)) & 0xffffff; + int const sx = (srcx + dxdx * (x - xstart) + dxdy * (y - ystart)) & 0xffffff; + int const sy = (srcy + dydx * (x - xstart) + dydy * (y - ystart)) & 0xffffff; /* clip to source cliprect */ if (sx >= srcminx && sx <= srcmaxx && sy >= srcminy && sy <= srcmaxy) { /* page comes from bit 22 of Y and bit 21 of X */ - int page = (((sy >> 21) & 2) | ((sx >> 21) & 1) | ((sx >> 20) & 4)) & pagemask; - int pix = src[0x40000 * page + ((sy >> 12) & 0x1ff) * 512 + ((sx >> 12) & 0x1ff)]; + int const page = (((sy >> 21) & 2) | ((sx >> 21) & 1) | ((sx >> 20) & 4)) & pagemask; + int const pix = m_gfxrom[(page << 18) | (((sy >> 12) & 0x1ff) << 9) | ((sx >> 12) & 0x1ff)]; /* only non-zero pixels get written */ if (pix | opaque) - dst[x % DSTBITMAP_WIDTH] = (pix & mask) | color; + dst[x & 0x1ff] = (pix & mask) | color; } } } @@ -234,25 +229,25 @@ void dcheese_state::do_blit( ) * *************************************/ -WRITE16_MEMBER(dcheese_state::madmax_blitter_color_w) +WRITE16_MEMBER(dcheese_state::blitter_color_w) { COMBINE_DATA(&m_blitter_color[offset]); } -WRITE16_MEMBER(dcheese_state::madmax_blitter_xparam_w) +WRITE16_MEMBER(dcheese_state::blitter_xparam_w) { COMBINE_DATA(&m_blitter_xparam[offset]); } -WRITE16_MEMBER(dcheese_state::madmax_blitter_yparam_w) +WRITE16_MEMBER(dcheese_state::blitter_yparam_w) { COMBINE_DATA(&m_blitter_yparam[offset]); } -WRITE16_MEMBER(dcheese_state::madmax_blitter_vidparam_w) +WRITE16_MEMBER(dcheese_state::blitter_vidparam_w) { COMBINE_DATA(&m_blitter_vidparam[offset]); @@ -296,14 +291,14 @@ WRITE16_MEMBER(dcheese_state::madmax_blitter_vidparam_w) } -WRITE16_MEMBER(dcheese_state::madmax_blitter_unknown_w) +WRITE16_MEMBER(dcheese_state::blitter_unknown_w) { /* written to just before the blitter command register is written */ logerror("%06X:write to %06X = %04X & %04X\n", m_maincpu->pc(), 0x300000 + 2 * offset, data, mem_mask); } -READ16_MEMBER(dcheese_state::madmax_blitter_vidparam_r) +READ16_MEMBER(dcheese_state::blitter_vidparam_r) { /* analog inputs seem to be hooked up here -- might not actually map to blitter */ if (offset == 0x02/2)