summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/mame/drivers/popeye.cpp145
-rw-r--r--src/mame/includes/popeye.h17
-rw-r--r--src/mame/video/popeye.cpp448
3 files changed, 283 insertions, 327 deletions
diff --git a/src/mame/drivers/popeye.cpp b/src/mame/drivers/popeye.cpp
index c3af33ae48a..716eb7f8dce 100644
--- a/src/mame/drivers/popeye.cpp
+++ b/src/mame/drivers/popeye.cpp
@@ -115,6 +115,37 @@ NETLIST_END()
+void popeye_state::driver_start()
+{
+ save_item(NAME(m_prot0));
+ save_item(NAME(m_prot1));
+ save_item(NAME(m_prot_shift));
+}
+
+DRIVER_INIT_MEMBER(popeye_state, tnx1)
+{
+ uint8_t *rom = memregion("maincpu")->base();
+ int len = memregion("maincpu")->bytes();
+
+ /* decrypt the program ROMs */
+ std::vector<uint8_t> buffer(len);
+ for (int i = 0;i < len; i++)
+ buffer[i] = bitswap<8>(rom[bitswap<16>(i,15,14,13,12,11,10,8,7,0,1,2,4,5,9,3,6) ^ 0xfc],3,4,2,5,1,6,0,7);
+ memcpy(rom,&buffer[0],len);
+}
+
+DRIVER_INIT_MEMBER(popeye_state,tpp2)
+{
+ uint8_t *rom = memregion("maincpu")->base();
+ int len = memregion("maincpu")->bytes();
+
+ /* decrypt the program ROMs */
+ std::vector<uint8_t> buffer(len);
+ for (int i = 0;i < len; i++)
+ buffer[i] = bitswap<8>(rom[bitswap<16>(i,15,14,13,12,11,10,8,7,6,3,9,5,4,2,1,0) ^ 0x3f],3,4,2,5,1,6,0,7);
+ memcpy(rom,&buffer[0],len);
+}
+
INTERRUPT_GEN_MEMBER(popeye_state::popeye_interrupt)
{
m_field ^= 1;
@@ -430,7 +461,7 @@ static const gfx_layout spritelayout =
static GFXDECODE_START( popeye )
GFXDECODE_SCALE( "gfx1", 0, charlayout, 16, 16, 2, 2 ) /* chars */
- GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 16+16*2, 64 ) /* sprites */
+ GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 16+16*2, 8 ) /* sprites */
GFXDECODE_END
@@ -458,11 +489,11 @@ MACHINE_CONFIG_START(popeye_state::tnx1)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(32*16, 32*16)
MCFG_SCREEN_VISIBLE_AREA(0*16, 32*16-1, 2*16, 30*16-1)
- MCFG_SCREEN_UPDATE_DRIVER(popeye_state, screen_update_popeye)
+ MCFG_SCREEN_UPDATE_DRIVER(popeye_state, screen_update_tnx1)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", popeye)
- MCFG_PALETTE_ADD("palette", 16+16*2+64*4)
+ MCFG_PALETTE_ADD("palette", 16+16*2+8*4)
MCFG_PALETTE_INIT_OWNER(popeye_state, tnx1)
/* sound hardware */
@@ -475,6 +506,9 @@ MACHINE_CONFIG_START(popeye_state::tnx1)
MACHINE_CONFIG_END
MACHINE_CONFIG_DERIVED(popeye_state::tpp1, tnx1)
+ MCFG_SCREEN_MODIFY("screen")
+ MCFG_SCREEN_UPDATE_DRIVER(popeye_state, screen_update_tpp1)
+
MCFG_PALETTE_MODIFY("palette")
MCFG_PALETTE_INIT_OWNER(popeye_state,tpp1)
@@ -550,9 +584,9 @@ ROM_START( skyskipr )
ROM_LOAD( "tnx1-t.4a", 0x0000, 0x0020, CRC(98846924) SHA1(89688d05c4c2d6f389da4e9c0c13e0f022f2d376) ) /* background palette */
ROM_LOAD( "tnx1-t.1a", 0x0020, 0x0020, CRC(c2bca435) SHA1(e7d3e68d153d646eaf12b263d58b07da2615399c) ) /* char palette */
- ROM_REGION( 0x0200, "sprpal", 0 )
- ROM_LOAD( "tnx1-t.3a", 0x0000, 0x0100, CRC(8abf9de4) SHA1(6e5500639a2dca3c288619fb8bdd120eb49bf8e0) ) /* sprite palette - low 4 bits */
- ROM_LOAD( "tnx1-t.2a", 0x0100, 0x0100, CRC(aa7ff322) SHA1(522d21854aa11e24f3679163354ae4fb35619eff) ) /* sprite palette - high 4 bits */
+ ROM_REGION( 0x0100, "sprpal", 0 )
+ ROM_LOAD_NIB_LOW( "tnx1-t.3a", 0x0000, 0x0100, CRC(8abf9de4) SHA1(6e5500639a2dca3c288619fb8bdd120eb49bf8e0) ) /* sprite palette - low 4 bits */
+ ROM_LOAD_NIB_HIGH( "tnx1-t.2a", 0x0000, 0x0100, CRC(aa7ff322) SHA1(522d21854aa11e24f3679163354ae4fb35619eff) ) /* sprite palette - high 4 bits */
ROM_REGION( 0x0100, "timing", 0 )
ROM_LOAD( "tnx1-t.3j", 0x0000, 0x0100, CRC(1c5c8dea) SHA1(5738303b2a9c79b7d06bcf20fdb4d9b29f6e2d96) ) /* video timing prom */
@@ -586,9 +620,9 @@ ROM_START( popeye )
ROM_LOAD( "tpp2-c.4a", 0x0000, 0x0020, CRC(375e1602) SHA1(d84159a0af5db577821c43712bc733329a43af80) ) /* background palette */
ROM_LOAD( "tpp2-c.3a", 0x0020, 0x0020, CRC(e950bea1) SHA1(0b48082fe79d9fcdca7e80caff1725713d0c3163) ) /* char palette */
- ROM_REGION( 0x0200, "sprpal", 0 )
- ROM_LOAD( "tpp2-c.5b", 0x0000, 0x0100, CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
- ROM_LOAD( "tpp2-c.5a", 0x0100, 0x0100, CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
+ ROM_REGION( 0x0100, "sprpal", 0 )
+ ROM_LOAD_NIB_LOW( "tpp2-c.5b", 0x0000, 0x0100, CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
+ ROM_LOAD_NIB_HIGH( "tpp2-c.5a", 0x0000, 0x0100, CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
ROM_REGION( 0x0100, "timing", 0 )
ROM_LOAD( "tpp2-v.7j", 0x0000, 0x0100, CRC(a4655e2e) SHA1(2a620932fccb763c6c667278c0914f31b9f00ddf) ) /* video timing prom */
@@ -615,9 +649,9 @@ ROM_START( popeyeu )
ROM_LOAD( "tpp2-c.4a", 0x0000, 0x0020, CRC(375e1602) SHA1(d84159a0af5db577821c43712bc733329a43af80) ) /* background palette */
ROM_LOAD( "tpp2-c.3a", 0x0020, 0x0020, CRC(e950bea1) SHA1(0b48082fe79d9fcdca7e80caff1725713d0c3163) ) /* char palette */
- ROM_REGION( 0x0200, "sprpal", 0 )
- ROM_LOAD( "tpp2-c.5b", 0x0000, 0x0100, CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
- ROM_LOAD( "tpp2-c.5a", 0x0100, 0x0100, CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
+ ROM_REGION( 0x0100, "sprpal", 0 )
+ ROM_LOAD_NIB_LOW( "tpp2-c.5b", 0x0000, 0x0100, CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
+ ROM_LOAD_NIB_HIGH( "tpp2-c.5a", 0x0000, 0x0100, CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
ROM_REGION( 0x0100, "timing", 0 )
ROM_LOAD( "tpp2-v.7j", 0x0000, 0x0100, CRC(a4655e2e) SHA1(2a620932fccb763c6c667278c0914f31b9f00ddf) ) /* video timing prom */
@@ -644,9 +678,9 @@ ROM_START( popeyef )
ROM_LOAD( "tpp2-c.4a", 0x0000, 0x0020, CRC(375e1602) SHA1(d84159a0af5db577821c43712bc733329a43af80) ) /* background palette */
ROM_LOAD( "tpp2-c.3a", 0x0020, 0x0020, CRC(e950bea1) SHA1(0b48082fe79d9fcdca7e80caff1725713d0c3163) ) /* char palette */
- ROM_REGION( 0x0200, "sprpal", 0 )
- ROM_LOAD( "tpp2-c.5b", 0x0000, 0x0100, CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
- ROM_LOAD( "tpp2-c.5a", 0x0100, 0x0100, CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
+ ROM_REGION( 0x0100, "sprpal", 0 )
+ ROM_LOAD_NIB_LOW( "tpp2-c.5b", 0x0000, 0x0100, CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
+ ROM_LOAD_NIB_HIGH( "tpp2-c.5a", 0x0000, 0x0100, CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
ROM_REGION( 0x0100, "timing", 0 )
ROM_LOAD( "tpp2-v.7j", 0x0000, 0x0100, CRC(a4655e2e) SHA1(2a620932fccb763c6c667278c0914f31b9f00ddf) ) /* video timing prom */
@@ -669,13 +703,13 @@ ROM_START( popeyebl )
ROM_LOAD( "v-1j", 0x4000, 0x2000, CRC(7e864668) SHA1(8e275dbb1c586f4ebca7548db05246ef0f56d7b1) )
ROM_LOAD( "v-1k", 0x6000, 0x2000, CRC(49e1d170) SHA1(bd51a4e34ce8109f26954760156e3cf05fb9db57) )
- ROM_REGION( 0x40, "proms", 0 )
+ ROM_REGION( 0x40, "proms", ROMREGION_INVERT )
ROM_LOAD( "popeye.pr1", 0x0000, 0x0020, CRC(d138e8a4) SHA1(eba7f870ccab72105593007f5cd7e0b863912402) ) /* background palette */
ROM_LOAD( "popeye.pr2", 0x0020, 0x0020, CRC(0f364007) SHA1(b77d71df391a9ac9e778e84475627e72de2b8507) ) /* char palette */
- ROM_REGION( 0x0200, "sprpal", 0 )
- ROM_LOAD( "popeye.pr3", 0x0000, 0x0100, CRC(ca4d7b6a) SHA1(ec979fffea9db5a327a5270241e376c21516e343) ) /* sprite palette - low 4 bits */
- ROM_LOAD( "popeye.pr4", 0x0100, 0x0100, CRC(cab9bc53) SHA1(e63ba8856190187996e405f6fcee254c8ca6e81f) ) /* sprite palette - high 4 bits */
+ ROM_REGION( 0x0100, "sprpal", ROMREGION_INVERT )
+ ROM_LOAD_NIB_LOW( "popeye.pr3", 0x0000, 0x0100, CRC(ca4d7b6a) SHA1(ec979fffea9db5a327a5270241e376c21516e343) ) /* sprite palette - low 4 bits */
+ ROM_LOAD_NIB_HIGH( "popeye.pr4", 0x0000, 0x0100, CRC(cab9bc53) SHA1(e63ba8856190187996e405f6fcee254c8ca6e81f) ) /* sprite palette - high 4 bits */
ROM_REGION( 0x0020, "blprot", 0 )
ROM_LOAD( "po_d1-e1.bin", 0x0000, 0x0020, CRC(8de22998) SHA1(e3a232ff85fb207afbe23049a65e828420589342) ) /* protection PROM */
@@ -698,13 +732,13 @@ ROM_START( popeyeb2 )
ROM_LOAD( "8.6s.2764", 0x4000, 0x2000, CRC(7e864668) SHA1(8e275dbb1c586f4ebca7548db05246ef0f56d7b1) )
ROM_LOAD( "9.6u.2764", 0x6000, 0x2000, CRC(49e1d170) SHA1(bd51a4e34ce8109f26954760156e3cf05fb9db57) )
- ROM_REGION( 0x40, "proms", 0 )
+ ROM_REGION( 0x40, "proms", ROMREGION_INVERT )
ROM_LOAD( "6.2u.18s030", 0x0000, 0x0020, CRC(d138e8a4) SHA1(eba7f870ccab72105593007f5cd7e0b863912402) ) /* background palette */
ROM_LOAD( "5.2t.18s030", 0x0020, 0x0020, CRC(0f364007) SHA1(b77d71df391a9ac9e778e84475627e72de2b8507) ) /* char palette */
- ROM_REGION( 0x0200, "sprpal", 0 )
- ROM_LOAD( "3.2r.24s10", 0x0000, 0x0100, CRC(3d7aa7b1) SHA1(aea11f558487ccfa6f0218fdf4020ddaa2f635f8) ) /* sprite palette - low 4 bits */
- ROM_LOAD( "4.2s.24s10", 0x0100, 0x0100, CRC(cab9bc53) SHA1(e63ba8856190187996e405f6fcee254c8ca6e81f) ) /* sprite palette - high 4 bits */
+ ROM_REGION( 0x0100, "sprpal", ROMREGION_INVERT )
+ ROM_LOAD_NIB_LOW( "3.2r.24s10", 0x0000, 0x0100, CRC(3d7aa7b1) SHA1(aea11f558487ccfa6f0218fdf4020ddaa2f635f8) ) /* sprite palette - low 4 bits */
+ ROM_LOAD_NIB_HIGH( "4.2s.24s10", 0x0000, 0x0100, CRC(cab9bc53) SHA1(e63ba8856190187996e405f6fcee254c8ca6e81f) ) /* sprite palette - high 4 bits */
ROM_REGION( 0x0020, "blprot", 0 )
ROM_LOAD( "po_d1-e1.bin", 0x0000, 0x0020, BAD_DUMP CRC(8de22998) SHA1(e3a232ff85fb207afbe23049a65e828420589342) ) /* protection PROM */
@@ -738,9 +772,9 @@ ROM_START( popeyeb3 )
ROM_LOAD( "tpp2-c.4a", 0x0000, 0x0020, BAD_DUMP CRC(375e1602) SHA1(d84159a0af5db577821c43712bc733329a43af80) ) /* background palette */
ROM_LOAD( "tpp2-c.3a", 0x0020, 0x0020, BAD_DUMP CRC(e950bea1) SHA1(0b48082fe79d9fcdca7e80caff1725713d0c3163) ) /* char palette */
- ROM_REGION( 0x0200, "sprpal", 0 )
- ROM_LOAD( "tpp2-c.5b", 0x0000, 0x0100, BAD_DUMP CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
- ROM_LOAD( "tpp2-c.5a", 0x0100, 0x0100, BAD_DUMP CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
+ ROM_REGION( 0x0100, "sprpal", 0 )
+ ROM_LOAD_NIB_LOW( "tpp2-c.5b", 0x0000, 0x0100, BAD_DUMP CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
+ ROM_LOAD_NIB_HIGH( "tpp2-c.5a", 0x0000, 0x0100, BAD_DUMP CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
ROM_REGION( 0x0100, "timing", 0 )
ROM_LOAD( "tpp2-v.7j", 0x0000, 0x0100, BAD_DUMP CRC(a4655e2e) SHA1(2a620932fccb763c6c667278c0914f31b9f00ddf) ) /* video timing prom */
@@ -767,12 +801,12 @@ ROM_START( popeyej )
ROM_LOAD( "TPP1-E.5E.2763", 0x6000, 0x2000, CRC(49e1d170) SHA1(bd51a4e34ce8109f26954760156e3cf05fb9db57) )
ROM_REGION( 0x40, "proms", 0 )
- ROM_LOAD( "TPP1-T.4A.82S123", 0x0000, 0x0020, CRC(375e1602) SHA1(d84159a0af5db577821c43712bc733329a43af80) ) /* background palette */
- ROM_LOAD( "TPP1-T.1A.82S123", 0x0020, 0x0020, CRC(e950bea1) SHA1(0b48082fe79d9fcdca7e80caff1725713d0c3163) ) /* char palette */
+ ROM_LOAD( "TPP1-T.4A.82S123", 0x0000, 0x0020, CRC(375e1602) SHA1(d84159a0af5db577821c43712bc733329a43af80) ) /* background palette */
+ ROM_LOAD( "TPP1-T.1A.82S123", 0x0020, 0x0020, CRC(e950bea1) SHA1(0b48082fe79d9fcdca7e80caff1725713d0c3163) ) /* char palette */
- ROM_REGION( 0x0200, "sprpal", 0 )
- ROM_LOAD( "TPP1-T.3A.82S129", 0x0000, 0x0100, CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
- ROM_LOAD( "TPP1-T.2A.82S129", 0x0100, 0x0100, CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
+ ROM_REGION( 0x0100, "sprpal", 0 )
+ ROM_LOAD_NIB_LOW( "TPP1-T.3A.82S129", 0x0000, 0x0100, CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
+ ROM_LOAD_NIB_HIGH( "TPP1-T.2A.82S129", 0x0000, 0x0100, CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
ROM_REGION( 0x0100, "timing", 0 )
ROM_LOAD( "TPP1-T.3J.82S129", 0x0000, 0x0100, CRC(a4655e2e) SHA1(2a620932fccb763c6c667278c0914f31b9f00ddf) ) /* video timing prom */
@@ -801,57 +835,18 @@ ROM_START( popeyejo )
ROM_LOAD( "tpp1-e.5e.bin", 0x6000, 0x2000, CRC(7355ff16) SHA1(15d3cb701ad360a36c26eb5c34b2e89b5972ba82) )
ROM_REGION( 0x40, "proms", 0 )
- ROM_LOAD( "TPP1-T.4A.82S123", 0x0000, 0x0020, CRC(375e1602) SHA1(d84159a0af5db577821c43712bc733329a43af80) ) /* background palette */
- ROM_LOAD( "TPP1-T.1A.82S123", 0x0020, 0x0020, CRC(e950bea1) SHA1(0b48082fe79d9fcdca7e80caff1725713d0c3163) ) /* char palette */
+ ROM_LOAD( "TPP1-T.4A.82S123", 0x0000, 0x0020, CRC(375e1602) SHA1(d84159a0af5db577821c43712bc733329a43af80) ) /* background palette */
+ ROM_LOAD( "TPP1-T.1A.82S123", 0x0020, 0x0020, CRC(e950bea1) SHA1(0b48082fe79d9fcdca7e80caff1725713d0c3163) ) /* char palette */
- ROM_REGION( 0x0200, "sprpal", 0 )
- ROM_LOAD( "TPP1-T.3A.82S129", 0x0000, 0x0100, CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
- ROM_LOAD( "TPP1-T.2A.82S129", 0x0100, 0x0100, CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
+ ROM_REGION( 0x0100, "sprpal", 0 )
+ ROM_LOAD_NIB_LOW( "TPP1-T.3A.82S129", 0x0000, 0x0100, CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
+ ROM_LOAD_NIB_HIGH( "TPP1-T.2A.82S129", 0x0000, 0x0100, CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
ROM_REGION( 0x0100, "timing", 0 )
ROM_LOAD( "TPP1-T.3J.82S129", 0x0000, 0x0100, CRC(a4655e2e) SHA1(2a620932fccb763c6c667278c0914f31b9f00ddf) ) /* video timing prom */
ROM_END
-DRIVER_INIT_MEMBER(popeye_state,tnx1)
-{
- uint8_t *rom = memregion("maincpu")->base();
- int len = memregion("maincpu")->bytes();
-
- /* decrypt the program ROMs */
- {
- std::vector<uint8_t> buffer(len);
- int i;
- for (i = 0;i < len; i++)
- buffer[i] = bitswap<8>(rom[bitswap<16>(i,15,14,13,12,11,10,8,7,0,1,2,4,5,9,3,6) ^ 0xfc],3,4,2,5,1,6,0,7);
- memcpy(rom,&buffer[0],len);
- }
-
- save_item(NAME(m_prot0));
- save_item(NAME(m_prot1));
- save_item(NAME(m_prot_shift));
-}
-
-DRIVER_INIT_MEMBER(popeye_state,tpp2)
-{
- uint8_t *rom = memregion("maincpu")->base();
- int len = memregion("maincpu")->bytes();
-
- /* decrypt the program ROMs */
- {
- std::vector<uint8_t> buffer(len);
- int i;
- for (i = 0;i < len; i++)
- buffer[i] = bitswap<8>(rom[bitswap<16>(i,15,14,13,12,11,10,8,7,6,3,9,5,4,2,1,0) ^ 0x3f],3,4,2,5,1,6,0,7);
- memcpy(rom,&buffer[0],len);
- }
-
- save_item(NAME(m_prot0));
- save_item(NAME(m_prot1));
- save_item(NAME(m_prot_shift));
-}
-
-
GAME( 1981, skyskipr, 0, tnx1, skyskipr, popeye_state, tnx1, ROT0, "Nintendo", "Sky Skipper", MACHINE_SUPPORTS_SAVE )
GAME( 1982, popeye, 0, tpp2, popeye, popeye_state, tpp2, ROT0, "Nintendo", "Popeye (revision D)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, popeyeu, popeye, tpp2, popeye, popeye_state, tpp2, ROT0, "Nintendo", "Popeye (revision D not protected)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/includes/popeye.h b/src/mame/includes/popeye.h
index ff4cf82d56a..d74e76b332d 100644
--- a/src/mame/includes/popeye.h
+++ b/src/mame/includes/popeye.h
@@ -1,3 +1,5 @@
+#include "machine/eepromser.h"
+
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria, Couriersud
// thanks-to: Marc Lafontaine
@@ -29,13 +31,10 @@ public:
required_region_ptr<uint8_t> m_color_prom;
required_region_ptr<uint8_t> m_color_prom_spr;
- std::unique_ptr<uint8_t[]> m_bitmapram;
+ uint8_t m_bitmapram[0x1000];
std::unique_ptr<bitmap_ind16> m_sprite_bitmap;
- std::unique_ptr<bitmap_ind16> m_background_bitmap;
- uint8_t m_invertmask;
- uint8_t m_bitmap_type;
tilemap_t *m_fg_tilemap;
- uint8_t m_lastflip;
+ uint8_t m_last_palette;
int m_field;
DECLARE_READ8_MEMBER(protection_r);
@@ -49,17 +48,17 @@ public:
DECLARE_DRIVER_INIT(tnx1);
DECLARE_DRIVER_INIT(tpp2);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
+ virtual void driver_start() override;
virtual void video_start() override;
DECLARE_PALETTE_INIT(tpp1);
DECLARE_VIDEO_START(tpp1);
DECLARE_PALETTE_INIT(popeyebl);
DECLARE_PALETTE_INIT(tnx1);
- uint32_t screen_update_popeye(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update_tnx1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update_tpp1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(popeye_interrupt);
DECLARE_CUSTOM_INPUT_MEMBER( pop_field_r );
- void convert_color_prom(const uint8_t *color_prom);
- void set_background_palette(int bank);
- void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void update_palette();
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_field(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/video/popeye.cpp b/src/mame/video/popeye.cpp
index 402b8941f9a..b42279fecd6 100644
--- a/src/mame/video/popeye.cpp
+++ b/src/mame/video/popeye.cpp
@@ -13,10 +13,6 @@
#include "video/resnet.h"
#include "includes/popeye.h"
-static const size_t popeye_bitmapram_size = 0x2000; // 8k nybbles packed into 4k ram chip
-
-enum { TYPE_TNX1, TYPE_TPP1 };
-
#define USE_NEW_COLOR (1)
// Only enable USE_INTERLACE if you can ensure the game is rendered at an
@@ -67,18 +63,18 @@ static const res_net_decode_info popeye_7051_decode_info =
/* R, G, B, */
{ 0, 0, 0 }, /* offsets */
{ 0, 3, 6 }, /* shifts */
- {0x07,0x07,0x03 } /* masks */
+ {0x07,0x07,0x03 } /* masks */
};
static const res_net_decode_info popeye_7052_decode_info =
{
- 2, /* there may be two proms needed to construct color */
+ 1, /* two 4 bit proms */
0, /* start at 0 */
- 255, /* end at 255 */
- /* R, G, B, R, G, B */
- { 0, 0, 0, 256, 256, 256}, /* offsets */
- { 0, 3, 0, 0, -1, 2}, /* shifts */
- {0x07,0x01,0x00,0x00,0x06,0x03} /* masks */
+ 31, /* end at 31 (banked) */
+ /* R, G, B */
+ { 0, 0, 0}, /* offsets */
+ { 0, 3, 6}, /* shifts */
+ {0x07,0x07,0x03} /* masks */
};
static const res_net_info popeye_7051_txt_net_info =
@@ -113,54 +109,6 @@ static const res_net_info popeye_7052_obj_net_info =
};
-void popeye_state::convert_color_prom(const uint8_t *color_prom)
-{
- int i;
-
- /* palette entries 0-15 are used by the background and changed at runtime */
- /* palette entries 16-48 are used by tiles and changed at runtime */
-
- color_prom += 64;
-
-#if USE_NEW_COLOR
- /* sprites */
- std::vector<rgb_t> rgb;
- uint8_t cpi[512];
-
- for (i=0; i<512; i++)
- cpi[i] = m_color_prom_spr[i] ^ m_invertmask;
-
- compute_res_net_all(rgb, &cpi[0], popeye_7052_decode_info, popeye_7052_obj_net_info);
- m_palette->set_pen_colors(48, rgb);
-#else
- for (i = 0;i < 256;i++)
- {
- int bit0,bit1,bit2,r,g,b;
-
-
- /* red component */
- bit0 = ((m_color_prom_spr[0] ^ m_invertmask) >> 0) & 0x01;
- bit1 = ((m_color_prom_spr[0] ^ m_invertmask) >> 1) & 0x01;
- bit2 = ((m_color_prom_spr[0] ^ m_invertmask) >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = ((m_color_prom_spr[0] ^ m_invertmask) >> 3) & 0x01;
- bit1 = ((m_color_prom_spr[256] ^ m_invertmask) >> 0) & 0x01;
- bit2 = ((m_color_prom_spr[256] ^ m_invertmask) >> 1) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = 0;
- bit1 = ((m_color_prom_spr[256] ^ m_invertmask) >> 2) & 0x01;
- bit2 = ((m_color_prom_spr[256] ^ m_invertmask) >> 3) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- m_palette->set_pen_color(48+i,rgb_t(r,g,b));
-
- m_color_prom_spr++;
- }
-#endif
-}
-
PALETTE_INIT_MEMBER(popeye_state, tpp1)
{
/* Two of the PROM address pins are tied together */
@@ -170,9 +118,9 @@ PALETTE_INIT_MEMBER(popeye_state, tpp1)
m_color_prom[i + 0x20] = m_color_prom[color + 0x20];
}
- m_invertmask = (USE_NEW_COLOR) ? 0x00 : 0xff;
+ m_last_palette = -1;
- convert_color_prom(m_color_prom);
+ update_palette();
}
PALETTE_INIT_MEMBER(popeye_state,popeyebl)
@@ -184,9 +132,9 @@ PALETTE_INIT_MEMBER(popeye_state,popeyebl)
m_color_prom[i + 0x20] = m_color_prom[color + 0x20];
}
- m_invertmask = (USE_NEW_COLOR) ? 0xff : 0x00;
+ m_last_palette = -1;
- convert_color_prom(m_color_prom);
+ update_palette();
}
PALETTE_INIT_MEMBER(popeye_state, tnx1)
@@ -196,168 +144,169 @@ PALETTE_INIT_MEMBER(popeye_state, tnx1)
{
int color = (i & 0x3f) | ((i & 0x20) << 1);
m_color_prom_spr[i] = m_color_prom_spr[color];
- m_color_prom_spr[i+0x100] = m_color_prom_spr[color+0x100];
}
- m_invertmask = (USE_NEW_COLOR) ? 0x00 : 0xff;
+ m_last_palette = -1;
- convert_color_prom(m_color_prom);
+ update_palette();
}
-
-
-
-void popeye_state::set_background_palette(int bank)
+void popeye_state::update_palette()
{
- int i;
- uint8_t *color_prom = m_color_prom + 16 * bank;
+ if ((*m_palettebank ^ m_last_palette) & 0x08)
+ {
+ uint8_t *color_prom = m_color_prom + 16 * ((*m_palettebank & 0x08) >> 3);
#if USE_NEW_COLOR
- uint8_t cpi[16];
- std::vector<rgb_t> rgb;
- for (i=0; i<16; i++)
- cpi[i] = color_prom[i] ^ m_invertmask;
-
- compute_res_net_all(rgb, &cpi[0], popeye_7051_decode_info, popeye_7051_bck_net_info);
- m_palette->set_pen_colors(0, rgb);
+ std::vector<rgb_t> rgb;
+ compute_res_net_all(rgb, color_prom, popeye_7051_decode_info, popeye_7051_bck_net_info);
+ m_palette->set_pen_colors(0, rgb);
#else
- for (i = 0;i < 16;i++)
- {
- int bit0,bit1,bit2;
- int r,g,b;
-
- /* red component */
- bit0 = ((color_prom[0] ^ m_invertmask) >> 0) & 0x01;
- bit1 = ((color_prom[0] ^ m_invertmask) >> 1) & 0x01;
- bit2 = ((color_prom[0] ^ m_invertmask) >> 2) & 0x01;
- r = 0x1c * bit0 + 0x31 * bit1 + 0x47 * bit2;
- /* green component */
- bit0 = ((color_prom[0] ^ m_invertmask) >> 3) & 0x01;
- bit1 = ((color_prom[0] ^ m_invertmask) >> 4) & 0x01;
- bit2 = ((color_prom[0] ^ m_invertmask) >> 5) & 0x01;
- g = 0x1c * bit0 + 0x31 * bit1 + 0x47 * bit2;
- /* blue component */
- bit0 = 0;
- bit1 = ((color_prom[0] ^ m_invertmask) >> 6) & 0x01;
- bit2 = ((color_prom[0] ^ m_invertmask) >> 7) & 0x01;
- if (m_bitmap_type == TYPE_TNX1)
+ for (int i = 0; i < 16; i++)
{
- /* Sky Skipper has different weights */
- bit0 = bit1;
- bit1 = 0;
+ /* red component */
+ int bit0 = (~color_prom[i] >> 0) & 0x01;
+ int bit1 = (~color_prom[i] >> 1) & 0x01;
+ int bit2 = (~color_prom[i] >> 2) & 0x01;
+ int r = 0x1c * bit0 + 0x31 * bit1 + 0x47 * bit2;
+ /* green component */
+ bit0 = (~color_prom[i] >> 3) & 0x01;
+ bit1 = (~color_prom[i] >> 4) & 0x01;
+ bit2 = (~color_prom[i] >> 5) & 0x01;
+ int g = 0x1c * bit0 + 0x31 * bit1 + 0x47 * bit2;
+ /* blue component */
+ bit0 = 0;
+ bit1 = (~color_prom[i] >> 6) & 0x01;
+ bit2 = (~color_prom[i] >> 7) & 0x01;
+ //if (m_bitmap_type == TYPE_TNX1)
+ //{
+ // /* Sky Skipper has different weights */
+ // bit0 = bit1;
+ // bit1 = 0;
+ //}
+ int b = 0x1c * bit0 + 0x31 * bit1 + 0x47 * bit2;
+
+ m_palette->set_pen_color(i, rgb_t(r, g, b));
}
- b = 0x1c * bit0 + 0x31 * bit1 + 0x47 * bit2;
-
- m_palette->set_pen_color(i,rgb_t(r,g,b));
-
- color_prom++;
- }
#endif
+ }
- color_prom = m_color_prom + 32 + 16 * bank;
+ if ((*m_palettebank ^ m_last_palette) & 0x08)
+ {
+ uint8_t *color_prom = m_color_prom + 32 + 16 * ((*m_palettebank & 0x08) >> 3);
- /* characters */
+ /* characters */
#if USE_NEW_COLOR
- for (i = 0; i < 16; i++)
- {
- int prom_offs = i;
- int r, g, b;
- r = compute_res_net(((color_prom[prom_offs] ^ m_invertmask) >> 0) & 0x07, 0, popeye_7051_txt_net_info);
- g = compute_res_net(((color_prom[prom_offs] ^ m_invertmask) >> 3) & 0x07, 1, popeye_7051_txt_net_info);
- b = compute_res_net(((color_prom[prom_offs] ^ m_invertmask) >> 6) & 0x03, 2, popeye_7051_txt_net_info);
- m_palette->set_pen_color(16 + (2 * i) + 0,rgb_t(0,0,0));
- m_palette->set_pen_color(16 + (2 * i) + 1,rgb_t(r,g,b));
+ for (int i = 0; i < 16; i++)
+ {
+ int r = compute_res_net((color_prom[i] >> 0) & 0x07, 0, popeye_7051_txt_net_info);
+ int g = compute_res_net((color_prom[i] >> 3) & 0x07, 1, popeye_7051_txt_net_info);
+ int b = compute_res_net((color_prom[i] >> 6) & 0x03, 2, popeye_7051_txt_net_info);
+ m_palette->set_pen_color(16 + (2 * i) + 0, rgb_t(0, 0, 0));
+ m_palette->set_pen_color(16 + (2 * i) + 1, rgb_t(r, g, b));
+ }
+#else
+ for (int i = 0; i < 16; i++)
+ {
+ /* red component */
+ int bit0 = (~color_prom[i] >> 0) & 0x01;
+ int bit1 = (~color_prom[i] >> 1) & 0x01;
+ int bit2 = (~color_prom[i] >> 2) & 0x01;
+ int r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ /* green component */
+ bit0 = (~color_prom[i] >> 3) & 0x01;
+ bit1 = (~color_prom[i] >> 4) & 0x01;
+ bit2 = (~color_prom[i] >> 5) & 0x01;
+ int g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ /* blue component */
+ bit0 = 0;
+ bit1 = (~color_prom[i] >> 6) & 0x01;
+ bit2 = (~color_prom[i] >> 7) & 0x01;
+ int b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ m_palette->set_pen_color(16 + (2 * i) + 1, rgb_t(r, g, b));
+ }
+#endif
}
-#else
- for (i = 0;i < 16;i++)
+ if ((*m_palettebank ^ m_last_palette) & 0x07)
{
- int prom_offs = i;
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = ((color_prom[prom_offs] ^ m_invertmask) >> 0) & 0x01;
- bit1 = ((color_prom[prom_offs] ^ m_invertmask) >> 1) & 0x01;
- bit2 = ((color_prom[prom_offs] ^ m_invertmask) >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = ((color_prom[prom_offs] ^ m_invertmask) >> 3) & 0x01;
- bit1 = ((color_prom[prom_offs] ^ m_invertmask) >> 4) & 0x01;
- bit2 = ((color_prom[prom_offs] ^ m_invertmask) >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = 0;
- bit1 = ((color_prom[prom_offs] ^ m_invertmask) >> 6) & 0x01;
- bit2 = ((color_prom[prom_offs] ^ m_invertmask) >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- m_palette->set_pen_color(16 + (2 * i) + 1,rgb_t(r,g,b));
- }
+ uint8_t *color_prom = m_color_prom_spr + 32 * (*m_palettebank & 0x07);
+
+#if USE_NEW_COLOR
+ /* sprites */
+ std::vector<rgb_t> rgb;
+ compute_res_net_all(rgb, color_prom, popeye_7052_decode_info, popeye_7052_obj_net_info);
+ m_palette->set_pen_colors(48, rgb);
+#else
+ for (int i = 0; i < 32; i++)
+ {
+ int bit0, bit1, bit2, r, g, b;
+
+ /* red component */
+ bit0 = (~color_prom[i] >> 0) & 0x01;
+ bit1 = (~color_prom[i] >> 1) & 0x01;
+ bit2 = (~color_prom[i] >> 2) & 0x01;
+ r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ /* green component */
+ bit0 = (~color_prom[i] >> 3) & 0x01;
+ bit1 = (~color_prom[i] >> 4) & 0x01;
+ bit2 = (~color_prom[i] >> 5) & 0x01;
+ g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ /* blue component */
+ bit0 = 0;
+ bit1 = (~color_prom[i] >> 6) & 0x01;
+ bit2 = (~color_prom[i] >> 7) & 0x01;
+ b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ m_palette->set_pen_color(48 + i, rgb_t(r, g, b));
+ }
#endif
-}
+ }
-WRITE8_MEMBER(popeye_state::popeye_videoram_w)
-{
- m_videoram[offset] = data;
- m_fg_tilemap->mark_tile_dirty(offset);
+ m_last_palette = *m_palettebank;
}
-WRITE8_MEMBER(popeye_state::popeye_colorram_w)
+WRITE8_MEMBER(popeye_state::tnx1_bitmap_w)
{
- m_colorram[offset] = data;
- m_fg_tilemap->mark_tile_dirty(offset);
+ // TODO: confirm the memory layout
+ bool lsn = (data & 0x80) == 0;
+ if (lsn)
+ {
+ m_bitmapram[offset] = (m_bitmapram[offset] & 0xf0) | (data & 0xf);
+ }
+ else
+ {
+ m_bitmapram[offset] = (m_bitmapram[offset] & 0x0f) | (data << 4);
+ }
}
WRITE8_MEMBER(popeye_state::tpp2_bitmap_w)
{
- int sx,sy,x,y,colour;
-
- m_bitmapram[offset] = data & 0xf;
-
- if (m_bitmap_type == TYPE_TNX1)
+ // TODO: confirm the memory layout
+ bool lsn = (offset & 0x40) == 0;
+ offset = (offset & 0x3f) | ((offset & ~0x7f) >> 1);
+ if (lsn)
{
- sx = 8 * (offset % 128);
- sy = 8 * (offset / 128);
-
- if (flip_screen())
- sy = 512-8 - sy;
-
- colour = data & 0x0f;
- for (y = 0; y < 8; y++)
- {
- for (x = 0; x < 8; x++)
- {
- m_background_bitmap->pix16(sy+y, sx+x) = colour;
- }
- }
+ m_bitmapram[offset] = (m_bitmapram[offset] & 0xf0) | (data & 0xf);
}
else
{
- sx = 8 * (offset % 64);
- sy = 4 * (offset / 64);
-
- if (flip_screen())
- sy = 512-4 - sy;
-
- colour = data & 0x0f;
- for (y = 0; y < 4; y++)
- {
- for (x = 0; x < 8; x++)
- {
- m_background_bitmap->pix16(sy+y, sx+x) = colour;
- }
- }
+ m_bitmapram[offset] = (m_bitmapram[offset] & 0x0f) | (data << 4);
}
}
-WRITE8_MEMBER(popeye_state::tnx1_bitmap_w)
+WRITE8_MEMBER(popeye_state::popeye_videoram_w)
{
- offset = ((offset & 0xfc0) << 1) | (offset & 0x03f);
- if (data & 0x80)
- offset |= 0x40;
+ m_videoram[offset] = data;
+ m_fg_tilemap->mark_tile_dirty(offset);
+}
- tpp2_bitmap_w(space,offset,data);
+WRITE8_MEMBER(popeye_state::popeye_colorram_w)
+{
+ m_colorram[offset] = data;
+ m_fg_tilemap->mark_tile_dirty(offset);
}
TILE_GET_INFO_MEMBER(popeye_state::get_fg_tile_info)
@@ -370,76 +319,36 @@ TILE_GET_INFO_MEMBER(popeye_state::get_fg_tile_info)
void popeye_state::video_start()
{
- m_bitmapram = std::make_unique<uint8_t[]>(popeye_bitmapram_size);
- m_background_bitmap = std::make_unique<bitmap_ind16>(1024,1024); /* actually 1024x512 but not rolling over vertically? */
- m_sprite_bitmap = std::make_unique<bitmap_ind16>(512, 512); // TODO: figure out the right size
-
- m_bitmap_type = TYPE_TNX1;
+ m_sprite_bitmap = std::make_unique<bitmap_ind16>(512, 512);
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(popeye_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_fg_tilemap->set_transparent_pen(0);
- m_lastflip = 0;
m_field = 0;
save_item(NAME(m_field));
- save_item(NAME(m_lastflip));
- save_item(NAME(*m_background_bitmap));
+ save_item(NAME(m_last_palette));
save_item(NAME(*m_sprite_bitmap));
- save_pointer(NAME(m_bitmapram.get()), popeye_bitmapram_size);
+ save_item(NAME(m_bitmapram));
}
VIDEO_START_MEMBER(popeye_state,tpp1)
{
- m_bitmapram = std::make_unique<uint8_t[]>(popeye_bitmapram_size);
- m_background_bitmap = std::make_unique<bitmap_ind16>(512,1024); /* actually 512x512 but not rolling over vertically? */
- m_sprite_bitmap = std::make_unique<bitmap_ind16>(512, 512); // TODO: figure out the right size
-
- m_bitmap_type = TYPE_TPP1;
+ m_sprite_bitmap = std::make_unique<bitmap_ind16>(512, 512);
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(popeye_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_fg_tilemap->set_transparent_pen(0);
- m_lastflip = 0;
m_field = 0;
save_item(NAME(m_field));
- save_item(NAME(m_lastflip));
- save_item(NAME(*m_background_bitmap));
+ save_item(NAME(m_last_palette));
save_item(NAME(*m_sprite_bitmap));
- save_pointer(NAME(m_bitmapram.get()), popeye_bitmapram_size);
-}
-
-void popeye_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- int offs;
- address_space &space = m_maincpu->space(AS_PROGRAM);
-
- if (m_lastflip != flip_screen())
- {
- for (offs = 0;offs < popeye_bitmapram_size;offs++)
- tpp2_bitmap_w(space,offs,m_bitmapram[offs]);
-
- m_lastflip = flip_screen();
- }
-
- set_background_palette((*m_palettebank & 0x08) >> 3);
-
- /* copy the background graphics */
- int scrollx = 2 * (456 - (m_background_pos[0] | (m_background_pos[2] << 8)));
- int scrolly = 2 * (256 - m_background_pos[1]);
-
- if (flip_screen())
- {
- scrolly = -scrolly;
- }
-
- copyscrollbitmap(bitmap,*m_background_bitmap,1,&scrollx,1,&scrolly,cliprect);
+ save_item(NAME(m_bitmapram));
}
void popeye_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- gfx_element *gfx = m_gfxdecode->gfx(1);
m_sprite_bitmap->fill(0, cliprect);
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
@@ -479,7 +388,7 @@ void popeye_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
*/
struct attribute_memory *a = &attributes[m_spriteram[offs] >> 2];
- a->sx = (2 * m_spriteram[offs]) - 8;
+ a->sx = m_spriteram[offs] * 2;
a->row = row;
a->code = ((m_spriteram[offs + 2] & 0x7f)
+ ((m_spriteram[offs + 3] & 0x10) << 3)
@@ -495,22 +404,22 @@ void popeye_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
struct attribute_memory *a = &attributes[i];
if (a->color != 0)
{
- const uint8_t color = a->color + ((*m_palettebank & 0x07) << 3);
- const pen_t *pal = &m_palette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors()));
+ gfx_element *gfx = m_gfxdecode->gfx(1);
+ const pen_t *pal = &m_palette->pen(gfx->colorbase() + gfx->granularity() * (a->color % gfx->colors()));
const uint8_t *source_base = gfx->get_data(a->code % gfx->elements());
const uint8_t *source = source_base + (a->row ^ a->flipy) * gfx->rowbytes();
for (int x = 0; x < 16; x++)
{
- uint16_t p = source[x ^ a->flipx];
- if (p) p = pal[p];
-
- int px = a->sx + x;
+ int px = a->sx + x - 8;
if (px >= 0 && px < 512)
{
if (flip_screen())
px ^= 0x1ff;
+ uint16_t p = source[x ^ a->flipx];
+ if (p) p = pal[p];
+
m_sprite_bitmap->pix(y, px) = p;
}
}
@@ -531,9 +440,62 @@ void popeye_state::draw_field(bitmap_ind16 &bitmap, const rectangle &cliprect)
bitmap.pix(y, x) = 0;
}
-uint32_t popeye_state::screen_update_popeye(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t popeye_state::screen_update_tnx1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ update_palette();
+
+ for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ {
+ int sy = y;
+ if (flip_screen())
+ sy ^= 0x1ff;
+
+ sy -= 0x200 - (2 * m_background_pos[1]);
+ if (sy < 0)
+ sy = 0; // TODO: find out exactly where the data is fetched from
+
+ for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
+ {
+ // TODO: confirm the memory layout
+ int sx = x + (2 * (m_background_pos[0] | ((m_background_pos[2] & 1) << 8))) + 0x70;
+ int shift = (sx & 0x200) / 0x80;
+
+ bitmap.pix16(y, x) = (m_bitmapram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf;
+ }
+ }
+
+ draw_sprites(bitmap, cliprect);
+ m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+#if USE_INTERLACE
+ draw_field(bitmap, cliprect);
+#endif
+ return 0;
+}
+
+uint32_t popeye_state::screen_update_tpp1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- draw_background(bitmap, cliprect);
+ update_palette();
+
+ for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ {
+ int sy = y;
+ if (flip_screen())
+ sy ^= 0x1ff;
+
+ sy -= 0x200 - (2 * m_background_pos[1]);
+ if (sy < 0)
+ sy = 0; // TODO: find out exactly where the data is fetched from
+
+ for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
+ {
+ // TODO: confirm the memory layout
+ int sx = x + (2 * m_background_pos[0]) + 0x70;
+ int shift = (sy & 4);
+
+ bitmap.pix16(y, x) = (m_bitmapram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf;
+ }
+ }
+
draw_sprites(bitmap, cliprect);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
#if USE_INTERLACE