src/mess/drivers/pegasus.c
| r10532 | r10533 | |
| 23 | 23 | Basic cassettes are loaded in the usual way, that is, start Basic, |
| 24 | 24 | type LOAD, press Enter. When done, RUN or LIST as needed. |
| 25 | 25 | |
| 26 | The Aamber Pegasus uses a MCM66710P, which is functionally |
| 27 | equivalent to the MCM6571. |
| 28 | |
| 29 | Note that datasheet is incorrect for the number "9". |
| 30 | The first byte is really 0x3E rather than 0x3F, confirmed on real |
| 31 | hardware. |
| 32 | |
| 26 | 33 | TO DO: |
| 27 | 34 | - Identify which rom slots the multi-rom programs should be fitted to. |
| 28 | 35 | - Work on the other non-working programs |
| r10532 | r10533 | |
| 31 | 38 | #define ADDRESS_MAP_MODERN |
| 32 | 39 | |
| 33 | 40 | #include "emu.h" |
| 34 | | #include "includes/pegasus.h" |
| 41 | #include "cpu/m6809/m6809.h" |
| 42 | #include "machine/6821pia.h" |
| 43 | #include "imagedev/cartslot.h" |
| 44 | #include "imagedev/cassette.h" |
| 35 | 45 | |
| 46 | class pegasus_state : public driver_device |
| 47 | { |
| 48 | public: |
| 49 | pegasus_state(running_machine &machine, const driver_device_config_base &config) |
| 50 | : driver_device(machine, config), |
| 51 | m_maincpu(*this, "maincpu"), |
| 52 | m_cass(*this, "cassette"), |
| 53 | m_pia_s(*this, "pia_s"), |
| 54 | m_pia_u(*this, "pia_u") |
| 55 | { } |
| 56 | |
| 57 | required_device<cpu_device> m_maincpu; |
| 58 | required_device<device_t> m_cass; |
| 59 | required_device<device_t> m_pia_s; |
| 60 | required_device<device_t> m_pia_u; |
| 61 | DECLARE_READ8_MEMBER( pegasus_keyboard_r ); |
| 62 | DECLARE_READ8_MEMBER( pegasus_protection_r ); |
| 63 | DECLARE_READ8_MEMBER( pegasus_pcg_r ); |
| 64 | DECLARE_WRITE8_MEMBER( pegasus_controls_w ); |
| 65 | DECLARE_WRITE8_MEMBER( pegasus_keyboard_w ); |
| 66 | DECLARE_WRITE8_MEMBER( pegasus_pcg_w ); |
| 67 | DECLARE_READ_LINE_MEMBER( pegasus_keyboard_irq ); |
| 68 | DECLARE_READ_LINE_MEMBER( pegasus_cassette_r ); |
| 69 | DECLARE_WRITE_LINE_MEMBER( pegasus_cassette_w ); |
| 70 | DECLARE_WRITE_LINE_MEMBER( pegasus_firq_clr ); |
| 71 | UINT8 m_kbd_row; |
| 72 | UINT8 m_kbd_irq; |
| 73 | UINT8 *m_pcgram; |
| 74 | UINT8 *m_videoram; |
| 75 | UINT8 *FNT; |
| 76 | UINT8 m_control_bits; |
| 77 | }; |
| 78 | |
| 36 | 79 | static TIMER_DEVICE_CALLBACK( pegasus_firq ) |
| 37 | 80 | { |
| 38 | 81 | device_t *cpu = timer.machine->device( "maincpu" ); |
| r10532 | r10533 | |
| 262 | 305 | NULL |
| 263 | 306 | }; |
| 264 | 307 | |
| 308 | |
| 309 | static VIDEO_START( pegasus ) |
| 310 | { |
| 311 | pegasus_state *state = machine->driver_data<pegasus_state>(); |
| 312 | state->FNT = machine->region("chargen")->base(); |
| 313 | } |
| 314 | |
| 315 | static const UINT8 mcm6571a_shift[] = |
| 316 | { |
| 317 | 0,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0, |
| 318 | 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, |
| 319 | 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, |
| 320 | 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0, |
| 321 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 322 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 323 | 0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0, |
| 324 | 1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0 |
| 325 | }; |
| 326 | |
| 327 | |
| 328 | static VIDEO_UPDATE( pegasus ) |
| 329 | { |
| 330 | pegasus_state *state = screen->machine->driver_data<pegasus_state>(); |
| 331 | UINT8 y,ra,chr,gfx,inv; |
| 332 | UINT16 sy=0,ma=0,x; |
| 333 | UINT8 pcg_mode = state->m_control_bits & 2; |
| 334 | |
| 335 | for(y = 0; y < 16; y++ ) |
| 336 | { |
| 337 | for(ra = 0; ra < 16; ra++ ) |
| 338 | { |
| 339 | UINT16 *p = BITMAP_ADDR16(bitmap, sy++, 0); |
| 340 | |
| 341 | for(x = ma; x < ma + 32; x++ ) |
| 342 | { |
| 343 | inv = 0xff; |
| 344 | gfx = 0; |
| 345 | chr = state->m_videoram[x]; |
| 346 | |
| 347 | if (BIT(chr, 7)) |
| 348 | { |
| 349 | inv = 0; |
| 350 | chr &= 0x7f; |
| 351 | } |
| 352 | |
| 353 | if (pcg_mode) |
| 354 | { |
| 355 | gfx = state->m_pcgram[(chr << 4) | ra] ^ inv; |
| 356 | } |
| 357 | else |
| 358 | if (mcm6571a_shift[chr]) |
| 359 | { |
| 360 | if (ra < 3) |
| 361 | gfx = inv; |
| 362 | else |
| 363 | gfx = state->FNT[(chr<<4) | (ra-3) ] ^ inv; |
| 364 | } |
| 365 | else |
| 366 | { |
| 367 | if (ra < 10) |
| 368 | gfx = state->FNT[(chr<<4) | ra ] ^ inv; |
| 369 | else |
| 370 | gfx = inv; |
| 371 | } |
| 372 | |
| 373 | /* Display a scanline of a character */ |
| 374 | *p++ = BIT(gfx, 7) ? 1 : 0; |
| 375 | *p++ = BIT(gfx, 6) ? 1 : 0; |
| 376 | *p++ = BIT(gfx, 5) ? 1 : 0; |
| 377 | *p++ = BIT(gfx, 4) ? 1 : 0; |
| 378 | *p++ = BIT(gfx, 3) ? 1 : 0; |
| 379 | *p++ = BIT(gfx, 2) ? 1 : 0; |
| 380 | *p++ = BIT(gfx, 1) ? 1 : 0; |
| 381 | *p++ = BIT(gfx, 0) ? 1 : 0; |
| 382 | } |
| 383 | } |
| 384 | ma+=32; |
| 385 | } |
| 386 | return 0; |
| 387 | } |
| 388 | |
| 389 | /* F4 Character Displayer */ |
| 390 | static const gfx_layout pegasus_charlayout = |
| 391 | { |
| 392 | 8, 16, /* text = 7 x 9, pcg = 8 x 16 */ |
| 393 | 128, /* 128 characters */ |
| 394 | 1, /* 1 bits per pixel */ |
| 395 | { 0 }, /* no bitplanes */ |
| 396 | /* x offsets */ |
| 397 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 398 | /* y offsets */ |
| 399 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, |
| 400 | 8*16 /* every char takes 16 bytes */ |
| 401 | }; |
| 402 | |
| 403 | static GFXDECODE_START( pegasus ) |
| 404 | GFXDECODE_ENTRY( "chargen", 0x0000, pegasus_charlayout, 0, 1 ) |
| 405 | GFXDECODE_ENTRY( "pcg", 0x0000, pegasus_charlayout, 0, 1 ) |
| 406 | GFXDECODE_END |
| 407 | |
| 408 | |
| 265 | 409 | /* An encrypted single rom starts with 02, decrypted with 20. Not sure what |
| 266 | 410 | multipart roms will have. */ |
| 267 | 411 | static void pegasus_decrypt_rom( running_machine *machine, UINT16 addr ) |
| r10532 | r10533 | |
| 344 | 488 | |
| 345 | 489 | static MACHINE_CONFIG_START( pegasus, pegasus_state ) |
| 346 | 490 | /* basic machine hardware */ |
| 347 | | MCFG_CPU_ADD("maincpu", M6809E, XTAL_4MHz) // actually a 6809C |
| 491 | MCFG_CPU_ADD("maincpu", M6809E, XTAL_4MHz) // actually a 6809C - 4MHZ clock coming in, 1MHZ internally |
| 348 | 492 | MCFG_CPU_PROGRAM_MAP(pegasus_mem) |
| 349 | 493 | |
| 350 | 494 | MCFG_TIMER_ADD_PERIODIC("pegasus_firq", pegasus_firq, attotime::from_hz(400)) // controls accuracy of the clock (ctrl-P) |
| r10532 | r10533 | |
| 357 | 501 | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 358 | 502 | MCFG_SCREEN_SIZE(32*8, 16*16) |
| 359 | 503 | MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 0, 16*16-1) |
| 504 | MCFG_GFXDECODE(pegasus) |
| 360 | 505 | MCFG_PALETTE_LENGTH(2) |
| 361 | 506 | MCFG_PALETTE_INIT(black_and_white) |
| 507 | MCFG_VIDEO_START(pegasus) |
| 362 | 508 | MCFG_VIDEO_UPDATE(pegasus) |
| 363 | 509 | |
| 364 | 510 | /* devices */ |
| r10532 | r10533 | |
| 408 | 554 | ROM_SYSTEM_BIOS(7, "23ar2569", "Monitor 2.3A r2569") |
| 409 | 555 | ROMX_LOAD( "mon23a_2569.bin", 0xf000, 0x1000, CRC(248e62c9) SHA1(adbde27e69b38b29ff89bacf28d0240a8e5d90f3), ROM_BIOS(8) ) |
| 410 | 556 | |
| 557 | ROM_REGION( 0x800, "chargen", 0 ) |
| 558 | ROM_LOAD( "6571.bin", 0x0000, 0x0800, CRC(5a25144b) SHA1(7b9fee0c8ef2605b85d12b6d9fe8feb82418c63a) ) |
| 559 | |
| 411 | 560 | ROM_REGION( 0x800, "pcg", ROMREGION_ERASEFF ) |
| 412 | 561 | ROM_END |
| 413 | 562 | |