Previous 199869 Revisions Next

r37127 Sunday 12th April, 2015 at 01:22:14 UTC by Robbbert
(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.
[src/mame/drivers]cardline.c
[src/mess/drivers]pegasus.c

trunk/src/mame/drivers/cardline.c
r245638r245639
2222#include "emu.h"
2323#include "cpu/mcs51/mcs51.h"
2424#include "sound/okim6295.h"
25#include "video/mc6845.h"
2625
2726#include "cardline.lh"
2827
29#define MASTER_CLOCK XTAL_12MHz
3028
3129class cardline_state : public driver_device
3230{
r245638r245639
143141   AM_RANGE(0x2008, 0x2008) AM_NOP
144142   AM_RANGE(0x2080, 0x213f) AM_NOP
145143   AM_RANGE(0x2400, 0x2400) AM_DEVREADWRITE("oki", okim6295_device, read, write)
146   AM_RANGE(0x2800, 0x2800) AM_DEVWRITE("crtc", mc6845_device, address_w)
147   AM_RANGE(0x2801, 0x2801) AM_DEVWRITE("crtc", mc6845_device, register_w)
144   AM_RANGE(0x2800, 0x2801) AM_NOP
148145   AM_RANGE(0x2840, 0x2840) AM_NOP
149146   AM_RANGE(0x2880, 0x2880) AM_NOP
150147   AM_RANGE(0x3003, 0x3003) AM_NOP
r245638r245639
236233static MACHINE_CONFIG_START( cardline, cardline_state )
237234
238235   /* basic machine hardware */
239   MCFG_CPU_ADD("maincpu", I80C32, MASTER_CLOCK)
236   MCFG_CPU_ADD("maincpu", I80C32,12000000)
240237   MCFG_MCS51_PORT1_CONFIG(0x10)
241238   MCFG_CPU_PROGRAM_MAP(mem_prg)
242239   MCFG_CPU_IO_MAP(mem_io)
r245638r245639
255252   MCFG_PALETTE_ADD("palette", 512)
256253   MCFG_PALETTE_INIT_OWNER(cardline_state, cardline)
257254
258   MCFG_MC6845_ADD("crtc", MC6845, "screen", MASTER_CLOCK/8)   /* divisor guessed - result is 56 Hz */
259   MCFG_MC6845_SHOW_BORDER_AREA(false)
260   MCFG_MC6845_CHAR_WIDTH(8)
261
262255   MCFG_DEFAULT_LAYOUT(layout_cardline)
263256
264257   /* sound hardware */
trunk/src/mess/drivers/pegasus.c
r245638r245639
6565      , m_io_keyboard(*this, "KEY")
6666   { }
6767
68   DECLARE_READ8_MEMBER( pegasus_keyboard_r );
69   DECLARE_READ8_MEMBER( pegasus_protection_r );
70   DECLARE_READ8_MEMBER( pegasus_pcg_r );
71   DECLARE_WRITE8_MEMBER( pegasus_controls_w );
72   DECLARE_WRITE8_MEMBER( pegasus_keyboard_w );
73   DECLARE_WRITE8_MEMBER( pegasus_pcg_w );
74   DECLARE_READ_LINE_MEMBER( pegasus_keyboard_irq );
75   DECLARE_READ_LINE_MEMBER( pegasus_cassette_r );
76   DECLARE_WRITE_LINE_MEMBER( pegasus_cassette_w );
77   DECLARE_WRITE_LINE_MEMBER( pegasus_firq_clr );
68   DECLARE_READ8_MEMBER(pegasus_keyboard_r);
69   DECLARE_READ8_MEMBER(pegasus_protection_r);
70   DECLARE_READ8_MEMBER(pegasus_pcg_r);
71   DECLARE_WRITE8_MEMBER(pegasus_controls_w);
72   DECLARE_WRITE8_MEMBER(pegasus_keyboard_w);
73   DECLARE_WRITE8_MEMBER(pegasus_pcg_w);
74   DECLARE_READ_LINE_MEMBER(pegasus_keyboard_irq);
75   DECLARE_READ_LINE_MEMBER(pegasus_cassette_r);
76   DECLARE_WRITE_LINE_MEMBER(pegasus_cassette_w);
77   DECLARE_WRITE_LINE_MEMBER(pegasus_firq_clr);
7878   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7979   DECLARE_DRIVER_INIT(pegasus);
8080   TIMER_DEVICE_CALLBACK_MEMBER(pegasus_firq);
r245638r245639
9393   virtual void machine_reset();
9494   virtual void machine_start();
9595   virtual void video_start();
96   void pegasus_decrypt_rom(UINT8 *ROM, bool force_decrypt);
96   void pegasus_decrypt_rom(UINT8 *ROM);
9797   required_device<cpu_device> m_maincpu;
9898   required_device<cassette_image_device> m_cass;
9999   required_device<pia6821_device> m_pia_s;
r245638r245639
383383GFXDECODE_END
384384
385385
386/* An encrypted single rom starts with 02, decrypted with 20. Not sure what
387    multipart roms will have. */
388void pegasus_state::pegasus_decrypt_rom(UINT8 *ROM, bool force_decrypt)
386// An encrypted single rom starts with 02, decrypted with 20.
387// The 2nd and 3rd part of a multi-rom set will have no obvious byte,
388// so we check the first 4 bytes for a signature, and decrypt if found.
389void pegasus_state::pegasus_decrypt_rom(UINT8 *ROM)
389390{
391   bool doit = FALSE;
390392   UINT8 b;
391393   UINT16 j;
392394   dynamic_buffer temp_copy;
393395   temp_copy.resize(0x1000);
394396
395   if (ROM[0] == 0x02 || force_decrypt)
397   if (ROM[0] == 0x02) doit = TRUE;
398   if (ROM[0] == 0x1e && ROM[1] == 0xfa && ROM[2] == 0x60 && ROM[3] == 0x71) doit = TRUE; // xbasic 2nd rom
399   if (ROM[0] == 0x72 && ROM[1] == 0x62 && ROM[2] == 0xc6 && ROM[3] == 0x36) doit = TRUE; // xbasic 3rd rom
400   if (ROM[0] == 0xf0 && ROM[1] == 0x40 && ROM[2] == 0xce && ROM[3] == 0x80) doit = TRUE; // forth 2nd rom (both sets)
401   if (ROM[0] == 0x80 && ROM[1] == 0x06 && ROM[2] == 0x68 && ROM[3] == 0x14) doit = TRUE; // pascal 2nd rom
402
403   if (doit)
396404   {
397405      for (int i = 0; i < 0x1000; i++)
398406      {
r245638r245639
436444   slot->common_load_rom(slot->get_rom_base(), size, any_socket ? "rom" : reg_tag);
437445
438446   // raw images have to be decrypted (in particular the ones from softlist)
439   pegasus_decrypt_rom(slot->get_rom_base(), image.software_entry() != NULL);
447   pegasus_decrypt_rom(slot->get_rom_base());
440448
441449   return IMAGE_INIT_PASS;
442450}
r245638r245639
468476{
469477   // decrypt monitor
470478   UINT8 *base = memregion("maincpu")->base() + 0xf000;
471   pegasus_decrypt_rom(base, FALSE);
479   pegasus_decrypt_rom(base);
472480}
473481
474482static MACHINE_CONFIG_START( pegasus, pegasus_state )


Previous 199869 Revisions Next


© 1997-2024 The MAME Team