trunk/src/mame/drivers/cardline.c
| r245638 | r245639 | |
| 22 | 22 | #include "emu.h" |
| 23 | 23 | #include "cpu/mcs51/mcs51.h" |
| 24 | 24 | #include "sound/okim6295.h" |
| 25 | | #include "video/mc6845.h" |
| 26 | 25 | |
| 27 | 26 | #include "cardline.lh" |
| 28 | 27 | |
| 29 | | #define MASTER_CLOCK XTAL_12MHz |
| 30 | 28 | |
| 31 | 29 | class cardline_state : public driver_device |
| 32 | 30 | { |
| r245638 | r245639 | |
| 143 | 141 | AM_RANGE(0x2008, 0x2008) AM_NOP |
| 144 | 142 | AM_RANGE(0x2080, 0x213f) AM_NOP |
| 145 | 143 | 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 |
| 148 | 145 | AM_RANGE(0x2840, 0x2840) AM_NOP |
| 149 | 146 | AM_RANGE(0x2880, 0x2880) AM_NOP |
| 150 | 147 | AM_RANGE(0x3003, 0x3003) AM_NOP |
| r245638 | r245639 | |
| 236 | 233 | static MACHINE_CONFIG_START( cardline, cardline_state ) |
| 237 | 234 | |
| 238 | 235 | /* basic machine hardware */ |
| 239 | | MCFG_CPU_ADD("maincpu", I80C32, MASTER_CLOCK) |
| 236 | MCFG_CPU_ADD("maincpu", I80C32,12000000) |
| 240 | 237 | MCFG_MCS51_PORT1_CONFIG(0x10) |
| 241 | 238 | MCFG_CPU_PROGRAM_MAP(mem_prg) |
| 242 | 239 | MCFG_CPU_IO_MAP(mem_io) |
| r245638 | r245639 | |
| 255 | 252 | MCFG_PALETTE_ADD("palette", 512) |
| 256 | 253 | MCFG_PALETTE_INIT_OWNER(cardline_state, cardline) |
| 257 | 254 | |
| 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 | | |
| 262 | 255 | MCFG_DEFAULT_LAYOUT(layout_cardline) |
| 263 | 256 | |
| 264 | 257 | /* sound hardware */ |
trunk/src/mess/drivers/pegasus.c
| r245638 | r245639 | |
| 65 | 65 | , m_io_keyboard(*this, "KEY") |
| 66 | 66 | { } |
| 67 | 67 | |
| 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); |
| 78 | 78 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 79 | 79 | DECLARE_DRIVER_INIT(pegasus); |
| 80 | 80 | TIMER_DEVICE_CALLBACK_MEMBER(pegasus_firq); |
| r245638 | r245639 | |
| 93 | 93 | virtual void machine_reset(); |
| 94 | 94 | virtual void machine_start(); |
| 95 | 95 | virtual void video_start(); |
| 96 | | void pegasus_decrypt_rom(UINT8 *ROM, bool force_decrypt); |
| 96 | void pegasus_decrypt_rom(UINT8 *ROM); |
| 97 | 97 | required_device<cpu_device> m_maincpu; |
| 98 | 98 | required_device<cassette_image_device> m_cass; |
| 99 | 99 | required_device<pia6821_device> m_pia_s; |
| r245638 | r245639 | |
| 383 | 383 | GFXDECODE_END |
| 384 | 384 | |
| 385 | 385 | |
| 386 | | /* An encrypted single rom starts with 02, decrypted with 20. Not sure what |
| 387 | | multipart roms will have. */ |
| 388 | | void 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. |
| 389 | void pegasus_state::pegasus_decrypt_rom(UINT8 *ROM) |
| 389 | 390 | { |
| 391 | bool doit = FALSE; |
| 390 | 392 | UINT8 b; |
| 391 | 393 | UINT16 j; |
| 392 | 394 | dynamic_buffer temp_copy; |
| 393 | 395 | temp_copy.resize(0x1000); |
| 394 | 396 | |
| 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) |
| 396 | 404 | { |
| 397 | 405 | for (int i = 0; i < 0x1000; i++) |
| 398 | 406 | { |
| r245638 | r245639 | |
| 436 | 444 | slot->common_load_rom(slot->get_rom_base(), size, any_socket ? "rom" : reg_tag); |
| 437 | 445 | |
| 438 | 446 | // 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()); |
| 440 | 448 | |
| 441 | 449 | return IMAGE_INIT_PASS; |
| 442 | 450 | } |
| r245638 | r245639 | |
| 468 | 476 | { |
| 469 | 477 | // decrypt monitor |
| 470 | 478 | UINT8 *base = memregion("maincpu")->base() + 0xf000; |
| 471 | | pegasus_decrypt_rom(base, FALSE); |
| 479 | pegasus_decrypt_rom(base); |
| 472 | 480 | } |
| 473 | 481 | |
| 474 | 482 | static MACHINE_CONFIG_START( pegasus, pegasus_state ) |