summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2019-08-26 21:20:36 +0200
committer Ivan Vangelista <mesgnet@yahoo.it>2019-08-26 21:20:36 +0200
commitd93b7387270b17ad2b14b78d0cbc1fde7106eb59 (patch)
tree8c5910e832174c42ae9e4288ca5119e7abaeef83
parent1cfe376e69b88516636061d79abe969531e59508 (diff)
clones promoted to working
------------------------------------------ Lovely Cards (encrypted) [Team Europe, Roberto Fresca, Ivan Vangelista] some bitswaps aren't 100% verified and are marked as such, the game seems to run fine though (nw)
-rw-r--r--src/mame/drivers/lvcards.cpp83
-rw-r--r--src/mame/includes/lvcards.h10
-rw-r--r--src/mame/video/lvcards.cpp2
3 files changed, 87 insertions, 8 deletions
diff --git a/src/mame/drivers/lvcards.cpp b/src/mame/drivers/lvcards.cpp
index f24aa5ef24d..a658d559e20 100644
--- a/src/mame/drivers/lvcards.cpp
+++ b/src/mame/drivers/lvcards.cpp
@@ -69,7 +69,7 @@ TODO:
- What do the control ports do? Payout?
- Input ports need to be cleaned up
-- NVRAM does not work for lvcards?
+- NVRAM does not work for lvcards? In lvcardsa it works
***************************************************************************/
@@ -182,6 +182,12 @@ void lvcards_state::lvcards_io_map(address_map &map)
map(0x00, 0x01).w("aysnd", FUNC(ay8910_device::data_address_w));
}
+void lvcards_state::lvcardsa_decrypted_opcodes_map(address_map &map)
+{
+ map(0x0000, 0x5fff).rom().share("decrypted_opcodes");
+ map(0xc000, 0xdfff).rom().region("maincpu", 0xc000);
+}
+
void lvpoker_state::lvpoker_map(address_map &map)
{
map(0x0000, 0x5fff).rom();
@@ -488,6 +494,14 @@ void lvcards_state::lvcards(machine_config &config)
aysnd.add_route(ALL_OUTPUTS, "mono", 0.25);
}
+void lvcards_state::lvcardsa(machine_config &config)
+{
+ lvcards(config);
+
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
+ m_maincpu->set_addrmap(AS_OPCODES, &lvpoker_state::lvcardsa_decrypted_opcodes_map);
+}
+
void lvpoker_state::lvpoker(machine_config &config)
{
lvcards(config);
@@ -623,7 +637,66 @@ ROM_START( ponttehk )
ROM_LOAD( "pon24s10.001", 0x0200, 0x0100, CRC(c64ecee8) SHA1(80c9ec21e135235f7f2d41ce7900cf3904123823) ) /* blue component */
ROM_END
-GAME( 1985, lvcards, 0, lvcards, lvcards, lvcards_state, empty_init, ROT0, "Tehkan", "Lovely Cards", 0 )
-GAME( 1985, lvcardsa, lvcards, lvcards, lvcards, lvcards_state, empty_init, ROT0, "Tehkan", "Lovely Cards (encrypted)", MACHINE_NOT_WORKING )
-GAME( 1985, lvpoker, lvcards, lvpoker, lvpoker, lvpoker_state, empty_init, ROT0, "Tehkan", "Lovely Poker [BET]", 0 )
-GAME( 1985, ponttehk, 0, ponttehk, ponttehk, lvpoker_state, empty_init, ROT0, "Tehkan", "Pontoon (Tehkan)", 0 )
+void lvcards_state::init_lvcardsa()
+{
+ uint8_t *ROM = memregion("maincpu")->base();
+
+ for (int i = 0; i < 0x6000; i++)
+ {
+ uint8_t x = ROM[i];
+
+ switch (i & 0x1111)
+ {
+ case 0x0000: x = bitswap<8>(x ^ 0xa8, 7, 6, 3, 4, 5, 2, 1, 0); break; // xor and swap ok
+ case 0x0001: x = bitswap<8>(x ^ 0xa8, 3, 6, 5, 4, 7, 2, 1, 0); break; // xor and swap ok
+ case 0x0010: x = bitswap<8>(x ^ 0x28, 5, 6, 3, 4, 7, 2, 1, 0); break; // xor and swap ok
+ case 0x0011: x = bitswap<8>(x ^ 0xa8, 7, 6, 5, 4, 3, 2, 1, 0); break; // xor ok, no swap?
+ case 0x0100: x = bitswap<8>(x ^ 0xa8, 3, 6, 5, 4, 7, 2, 1, 0); break; // xor ok, 5-7 unverified
+ case 0x0101: x = bitswap<8>(x ^ 0xa8, 3, 6, 5, 4, 7, 2, 1, 0); break; // xor and swap ok
+ case 0x0110: x = bitswap<8>(x ^ 0x28, 5, 6, 3, 4, 7, 2, 1, 0); break; // xor and swap ok
+ case 0x0111: x = bitswap<8>(x ^ 0xa8, 7, 6, 3, 4, 5, 2, 1, 0); break; // xor ok, 3-5 unverified
+ case 0x1000: x = bitswap<8>(x ^ 0xa8, 7, 6, 3, 4, 5, 2, 1, 0); break; // xor and swap ok
+ case 0x1001: x = bitswap<8>(x ^ 0x28, 5, 6, 7, 4, 3, 2, 1, 0); break; // xor ok, 3-5 unverified
+ case 0x1010: x = bitswap<8>(x ^ 0xa8, 3, 6, 5, 4, 7, 2, 1, 0); break; // xor and swap ok
+ case 0x1011: x = bitswap<8>(x ^ 0xa8, 3, 6, 5, 4, 7, 2, 1, 0); break; // xor ok, 3-5 unverified
+ case 0x1100: x = bitswap<8>(x ^ 0xa8, 3, 6, 5, 4, 7, 2, 1, 0); break; // xor ok, 3-5 unverified
+ case 0x1101: x = bitswap<8>(x ^ 0xa8, 7, 6, 3, 4, 5, 2, 1, 0); break; // xor ok, 5-7 unverified
+ case 0x1110: x = bitswap<8>(x ^ 0x28, 5, 6, 7, 4, 3, 2, 1, 0); break; // xor ok, 3-5 unverified
+ case 0x1111: x = bitswap<8>(x ^ 0xa8, 3, 6, 5, 4, 7, 2, 1, 0); break; // xor and swap ok
+ }
+
+ m_decrypted_opcodes[i] = x;
+ }
+
+ for (int A = 0; A < 0x6000; A++)
+ {
+ uint8_t x = ROM[A];
+
+ switch(A & 0x1111)
+ {
+ case 0x0000: x = bitswap<8>(x ^ 0xa8, 3, 6, 5, 4, 7, 2, 1, 0); break; // xor and swap ok
+ case 0x0001: x = bitswap<8>(x ^ 0xa8, 3, 6, 5, 4, 7, 2, 1, 0); break; // xor and swap ok
+ case 0x0010: x = bitswap<8>(x ^ 0x28, 5, 6, 3, 4, 7, 2, 1, 0); break; // xor and swap ok
+ case 0x0011: x = bitswap<8>(x ^ 0xa8, 7, 6, 5, 4, 3, 2, 1, 0); break; // xor ok, no swap?
+ case 0x0100: x = bitswap<8>(x ^ 0xa8, 3, 6, 7, 4, 5, 2, 1, 0); break; // xor and swap ok
+ case 0x0101: x = bitswap<8>(x ^ 0xa8, 3, 6, 5, 4, 7, 2, 1, 0); break; // xor and swap ok
+ case 0x0110: x = bitswap<8>(x ^ 0x28, 5, 6, 3, 4, 7, 2, 1, 0); break; // xor and swap ok
+ case 0x0111: x = bitswap<8>(x ^ 0xa8, 7, 6, 3, 4, 5, 2, 1, 0); break; // xor and swap ok
+ case 0x1000: x = bitswap<8>(x ^ 0xa8, 3, 6, 5, 4, 7, 2, 1, 0); break; // xor and swap ok
+ case 0x1001: x = bitswap<8>(x ^ 0x28, 5, 6, 7, 4, 3, 2, 1, 0); break; // xor and swap ok
+ case 0x1010: x = bitswap<8>(x ^ 0x28, 5, 6, 7, 4, 3, 2, 1, 0); break; // xor and swap ok
+ case 0x1011: x = bitswap<8>(x ^ 0xa8, 3, 6, 5, 4, 7, 2, 1, 0); break; // xor and swap ok
+ case 0x1100: x = bitswap<8>(x ^ 0xa8, 7, 6, 3, 4, 5, 2, 1, 0); break; // xor and swap ok
+ case 0x1101: x = bitswap<8>(x ^ 0x28, 5, 6, 7, 4, 3, 2, 1, 0); break; // xor and swap ok
+ case 0x1110: x = bitswap<8>(x ^ 0xa8, 3, 6, 5, 4, 7, 2, 1, 0); break; // xor and swap ok
+ case 0x1111: x = bitswap<8>(x ^ 0xa8, 7, 6, 3, 4, 5, 2, 1, 0); break; // xor and swap ok
+ }
+
+ ROM[A] = x;
+ }
+}
+
+GAME( 1985, lvcards, 0, lvcards, lvcards, lvcards_state, empty_init, ROT0, "Tehkan", "Lovely Cards", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, lvcardsa, lvcards, lvcardsa, lvcards, lvcards_state, init_lvcardsa, ROT0, "Tehkan", "Lovely Cards (encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, lvpoker, lvcards, lvpoker, lvpoker, lvpoker_state, empty_init, ROT0, "Tehkan", "Lovely Poker [BET]", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, ponttehk, 0, ponttehk, ponttehk, lvpoker_state, empty_init, ROT0, "Tehkan", "Pontoon (Tehkan)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/includes/lvcards.h b/src/mame/includes/lvcards.h
index 90e553d57c1..1f5e15f91f9 100644
--- a/src/mame/includes/lvcards.h
+++ b/src/mame/includes/lvcards.h
@@ -16,10 +16,14 @@ public:
m_maincpu(*this, "maincpu"),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
- m_gfxdecode(*this, "gfxdecode")
+ m_gfxdecode(*this, "gfxdecode"),
+ m_decrypted_opcodes(*this, "decrypted_opcodes")
{ }
void lvcards(machine_config &config);
+ void lvcardsa(machine_config &config);
+
+ void init_lvcardsa();
protected:
virtual void video_start() override;
@@ -32,13 +36,15 @@ protected:
private:
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
+ required_device<gfxdecode_device> m_gfxdecode;
+ optional_shared_ptr<uint8_t> m_decrypted_opcodes;
tilemap_t *m_bg_tilemap;
TILE_GET_INFO_MEMBER(get_bg_tile_info);
void lvcards_palette(palette_device &palette) const;
uint32_t screen_update_lvcards(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- required_device<gfxdecode_device> m_gfxdecode;
void lvcards_io_map(address_map &map);
void lvcards_map(address_map &map);
+ void lvcardsa_decrypted_opcodes_map(address_map &map);
};
diff --git a/src/mame/video/lvcards.cpp b/src/mame/video/lvcards.cpp
index 73cd04be87a..0434e209fea 100644
--- a/src/mame/video/lvcards.cpp
+++ b/src/mame/video/lvcards.cpp
@@ -2,7 +2,7 @@
// copyright-holders:Zsolt Vasvari, Curt Coder
/***************************************************************************
- video.c
+ video/lvcards.cpp
Functions to emulate the video hardware of the machine.