(MESS) pegasus : fixed decryption of all roms in the software list.

All items can be used via the fullpath. Xbasic, forth and pascal now work.
Loading via the software list however is still broken for multipart roms.
This commit is contained in:
Robbbert 2015-04-12 11:22:14 +10:00
parent c3928ffceb
commit 677c140c89

View File

@ -65,16 +65,16 @@ public:
, m_io_keyboard(*this, "KEY") , m_io_keyboard(*this, "KEY")
{ } { }
DECLARE_READ8_MEMBER( pegasus_keyboard_r ); DECLARE_READ8_MEMBER(pegasus_keyboard_r);
DECLARE_READ8_MEMBER( pegasus_protection_r ); DECLARE_READ8_MEMBER(pegasus_protection_r);
DECLARE_READ8_MEMBER( pegasus_pcg_r ); DECLARE_READ8_MEMBER(pegasus_pcg_r);
DECLARE_WRITE8_MEMBER( pegasus_controls_w ); DECLARE_WRITE8_MEMBER(pegasus_controls_w);
DECLARE_WRITE8_MEMBER( pegasus_keyboard_w ); DECLARE_WRITE8_MEMBER(pegasus_keyboard_w);
DECLARE_WRITE8_MEMBER( pegasus_pcg_w ); DECLARE_WRITE8_MEMBER(pegasus_pcg_w);
DECLARE_READ_LINE_MEMBER( pegasus_keyboard_irq ); DECLARE_READ_LINE_MEMBER(pegasus_keyboard_irq);
DECLARE_READ_LINE_MEMBER( pegasus_cassette_r ); DECLARE_READ_LINE_MEMBER(pegasus_cassette_r);
DECLARE_WRITE_LINE_MEMBER( pegasus_cassette_w ); DECLARE_WRITE_LINE_MEMBER(pegasus_cassette_w);
DECLARE_WRITE_LINE_MEMBER( pegasus_firq_clr ); DECLARE_WRITE_LINE_MEMBER(pegasus_firq_clr);
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_DRIVER_INIT(pegasus); DECLARE_DRIVER_INIT(pegasus);
TIMER_DEVICE_CALLBACK_MEMBER(pegasus_firq); TIMER_DEVICE_CALLBACK_MEMBER(pegasus_firq);
@ -93,7 +93,7 @@ private:
virtual void machine_reset(); virtual void machine_reset();
virtual void machine_start(); virtual void machine_start();
virtual void video_start(); virtual void video_start();
void pegasus_decrypt_rom(UINT8 *ROM, bool force_decrypt); void pegasus_decrypt_rom(UINT8 *ROM);
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<cassette_image_device> m_cass; required_device<cassette_image_device> m_cass;
required_device<pia6821_device> m_pia_s; required_device<pia6821_device> m_pia_s;
@ -383,16 +383,24 @@ static GFXDECODE_START( pegasus )
GFXDECODE_END GFXDECODE_END
/* An encrypted single rom starts with 02, decrypted with 20. Not sure what // An encrypted single rom starts with 02, decrypted with 20.
multipart roms will have. */ // The 2nd and 3rd part of a multi-rom set will have no obvious byte,
void pegasus_state::pegasus_decrypt_rom(UINT8 *ROM, bool force_decrypt) // so we check the first 4 bytes for a signature, and decrypt if found.
void pegasus_state::pegasus_decrypt_rom(UINT8 *ROM)
{ {
bool doit = FALSE;
UINT8 b; UINT8 b;
UINT16 j; UINT16 j;
dynamic_buffer temp_copy; dynamic_buffer temp_copy;
temp_copy.resize(0x1000); temp_copy.resize(0x1000);
if (ROM[0] == 0x02 || force_decrypt) if (ROM[0] == 0x02) doit = TRUE;
if (ROM[0] == 0x1e && ROM[1] == 0xfa && ROM[2] == 0x60 && ROM[3] == 0x71) doit = TRUE; // xbasic 2nd rom
if (ROM[0] == 0x72 && ROM[1] == 0x62 && ROM[2] == 0xc6 && ROM[3] == 0x36) doit = TRUE; // xbasic 3rd rom
if (ROM[0] == 0xf0 && ROM[1] == 0x40 && ROM[2] == 0xce && ROM[3] == 0x80) doit = TRUE; // forth 2nd rom (both sets)
if (ROM[0] == 0x80 && ROM[1] == 0x06 && ROM[2] == 0x68 && ROM[3] == 0x14) doit = TRUE; // pascal 2nd rom
if (doit)
{ {
for (int i = 0; i < 0x1000; i++) for (int i = 0; i < 0x1000; i++)
{ {
@ -436,7 +444,7 @@ int pegasus_state::load_cart(device_image_interface &image, generic_slot_device
slot->common_load_rom(slot->get_rom_base(), size, any_socket ? "rom" : reg_tag); slot->common_load_rom(slot->get_rom_base(), size, any_socket ? "rom" : reg_tag);
// raw images have to be decrypted (in particular the ones from softlist) // raw images have to be decrypted (in particular the ones from softlist)
pegasus_decrypt_rom(slot->get_rom_base(), image.software_entry() != NULL); pegasus_decrypt_rom(slot->get_rom_base());
return IMAGE_INIT_PASS; return IMAGE_INIT_PASS;
} }
@ -468,7 +476,7 @@ DRIVER_INIT_MEMBER(pegasus_state, pegasus)
{ {
// decrypt monitor // decrypt monitor
UINT8 *base = memregion("maincpu")->base() + 0xf000; UINT8 *base = memregion("maincpu")->base() + 0xf000;
pegasus_decrypt_rom(base, FALSE); pegasus_decrypt_rom(base);
} }
static MACHINE_CONFIG_START( pegasus, pegasus_state ) static MACHINE_CONFIG_START( pegasus, pegasus_state )