src/mess/drivers/pc6001.c
| r5910 | r5911 | |
| 59 | 59 | === |
| 60 | 60 | |
| 61 | 61 | irq vector 00: writes 0x00 to [$fa19] |
| 62 | | irq vector 02: (A = 0, B = 0) tests ppi port c, does something with ay ports (plus more?) |
| 62 | irq vector 02: (A = 0, B = 0) tests ppi port c, does something with ay ports (plus more?) ;keyboard data ready, no kanji lock, no caps lock |
| 63 | 63 | irq vector 04: uart irq |
| 64 | 64 | irq vector 06: operates with $fa28, $fa2e, $fd1b |
| 65 | | irq vector 08: tests ppi port c, puts port A to $fa1d,puts 0x02 to [$fa19] |
| 65 | irq vector 08: tests ppi port c, puts port A to $fa1d,puts 0x02 to [$fa19] ;tape data ready |
| 66 | 66 | irq vector 0A: writes 0x00 to [$fa19] |
| 67 | 67 | irq vector 0C: writes 0x00 to [$fa19] |
| 68 | 68 | irq vector 0E: same as 2, (A = 0x03, B = 0x00) |
| 69 | 69 | irq vector 10: same as 2, (A = 0x03, B = 0x00) |
| 70 | | irq vector 12: writes 0x10 to [$fa19] |
| 70 | irq vector 12: writes 0x10 to [$fa19] ;end of tape reached |
| 71 | 71 | irq vector 14: same as 2, (A = 0x00, B = 0x01) |
| 72 | | irq vector 16: tests ppi port c, writes the result to $feca. |
| 72 | irq vector 16: tests ppi port c, writes the result to $feca. ;vblank |
| 73 | 73 | |
| 74 | 74 | |
| 75 | 75 | ****************************************************************************/ |
| r5910 | r5911 | |
| 83 | 83 | |
| 84 | 84 | static UINT8 *pc6001_ram; |
| 85 | 85 | static UINT8 *pc6001_video_ram; |
| 86 | static UINT8 irq_vector = 0x00; |
| 87 | static UINT8 cas_switch,sys_latch; |
| 86 | 88 | |
| 87 | 89 | static WRITE8_HANDLER ( pc6001_system_latch_w ) |
| 88 | 90 | { |
| 89 | 91 | UINT16 startaddr[] = {0xC000, 0xE000, 0x8000, 0xA000 }; |
| 90 | 92 | |
| 91 | 93 | pc6001_video_ram = pc6001_ram + startaddr[(data >> 1) & 0x03] - 0x8000; |
| 94 | |
| 95 | if((!(sys_latch & 8)) && data & 0x8) |
| 96 | cas_switch = 1; |
| 97 | |
| 98 | sys_latch = data; |
| 92 | 99 | } |
| 93 | 100 | |
| 94 | 101 | |
| r5910 | r5911 | |
| 96 | 103 | { |
| 97 | 104 | UINT8 result = 0x00; |
| 98 | 105 | UINT8 val = pc6001_video_ram [(scanline / 12) * 0x20 + pos]; |
| 106 | |
| 99 | 107 | if (val & 0x01) { |
| 100 | 108 | result |= M6847_INV; |
| 101 | 109 | } |
| 110 | if (!(val & 0x20)) |
| 111 | result |= M6847_AG | M6847_GM1; //TODO |
| 112 | |
| 102 | 113 | result |= M6847_INTEXT; // always use external ROM |
| 103 | 114 | return result; |
| 104 | 115 | } |
| r5910 | r5911 | |
| 276 | 287 | PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") |
| 277 | 288 | INPUT_PORTS_END |
| 278 | 289 | |
| 279 | | static UINT8 irq_vector = 0x00; |
| 280 | | |
| 281 | 290 | static INTERRUPT_GEN( pc6001_interrupt ) |
| 282 | 291 | { |
| 283 | 292 | irq_vector = 0x16; |
| r5910 | r5911 | |
| 307 | 316 | { |
| 308 | 317 | return 0; |
| 309 | 318 | } |
| 319 | |
| 310 | 320 | static WRITE8_DEVICE_HANDLER (pc6001_8255_porta_w ) |
| 311 | 321 | { |
| 312 | | // logerror("pc6001_8255_porta_w %02x\n",data); |
| 322 | if(data != 0x06) |
| 323 | printf("pc6001_8255_porta_w %02x\n",data); |
| 313 | 324 | } |
| 314 | 325 | |
| 315 | 326 | static READ8_DEVICE_HANDLER (pc6001_8255_portb_r ) |
| 316 | 327 | { |
| 317 | 328 | return 0; |
| 318 | 329 | } |
| 330 | |
| 319 | 331 | static WRITE8_DEVICE_HANDLER (pc6001_8255_portb_w ) |
| 320 | 332 | { |
| 321 | 333 | //logerror("pc6001_8255_portb_w %02x\n",data); |
| r5910 | r5911 | |
| 379 | 391 | return 0; |
| 380 | 392 | } |
| 381 | 393 | |
| 394 | static TIMER_CALLBACK(cassette_callback) |
| 395 | { |
| 396 | UINT8 *gfx_data = memory_region(machine, "cas"); |
| 397 | static int i; |
| 398 | |
| 399 | if(cas_switch == 1) |
| 400 | { |
| 401 | cur_keycode = gfx_data[i++]; |
| 402 | //popmessage("%04x",i); |
| 403 | if(i >= 1) |
| 404 | { |
| 405 | i = 0; |
| 406 | cas_switch = 0; |
| 407 | irq_vector = 0x12; |
| 408 | cputag_set_input_line(machine,"maincpu", 0, ASSERT_LINE); |
| 409 | } |
| 410 | else |
| 411 | { |
| 412 | irq_vector = 0x08; |
| 413 | cputag_set_input_line(machine,"maincpu", 0, ASSERT_LINE); |
| 414 | } |
| 415 | } |
| 416 | } |
| 417 | |
| 382 | 418 | static TIMER_CALLBACK(keyboard_callback) |
| 383 | 419 | { |
| 384 | 420 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| r5910 | r5911 | |
| 387 | 423 | UINT32 key3 = input_port_read(machine,"key3"); |
| 388 | 424 | static UINT32 old_key1,old_key2,old_key3; |
| 389 | 425 | |
| 390 | | if((key1 != old_key1) || (key2 != old_key2) || (key3 != old_key3)) |
| 426 | if(cas_switch == 0) |
| 391 | 427 | { |
| 392 | | cur_keycode = check_keyboard_press(space->machine); |
| 393 | | irq_vector = 0x02; |
| 394 | | cputag_set_input_line(machine,"maincpu", 0, ASSERT_LINE); |
| 395 | | old_key1 = key1; |
| 396 | | old_key2 = key2; |
| 397 | | old_key3 = key3; |
| 428 | if((key1 != old_key1) || (key2 != old_key2) || (key3 != old_key3)) |
| 429 | { |
| 430 | cur_keycode = check_keyboard_press(space->machine); |
| 431 | irq_vector = 0x02; |
| 432 | cputag_set_input_line(machine,"maincpu", 0, ASSERT_LINE); |
| 433 | old_key1 = key1; |
| 434 | old_key2 = key2; |
| 435 | old_key3 = key3; |
| 436 | } |
| 398 | 437 | } |
| 399 | 438 | } |
| 400 | 439 | |
| r5910 | r5911 | |
| 405 | 444 | |
| 406 | 445 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"),pc6001_irq_callback); |
| 407 | 446 | timer_pulse(machine, ATTOTIME_IN_HZ(240), NULL, 0, keyboard_callback); |
| 447 | timer_pulse(machine, ATTOTIME_IN_HZ(100), NULL, 0, cassette_callback); |
| 448 | cas_switch = 0; |
| 408 | 449 | } |
| 409 | 450 | |
| 410 | 451 | |
| r5910 | r5911 | |
| 452 | 493 | |
| 453 | 494 | ROM_REGION( 0x1000, "gfx1", 0 ) |
| 454 | 495 | ROM_LOAD( "cgrom60.60", 0x0000, 0x1000, CRC(b0142d32) SHA1(9570495b10af5b1785802681be94b0ea216a1e26) ) |
| 496 | |
| 497 | ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF ) |
| 498 | // ROM_LOAD( "ax7 demo.cas", 0x0000, 0x2ef1, CRC(1) SHA1(1) ) |
| 455 | 499 | ROM_END |
| 456 | 500 | |
| 457 | 501 | ROM_START( pc6001a ) |
| r5910 | r5911 | |
| 460 | 504 | |
| 461 | 505 | ROM_REGION( 0x1000, "gfx1", 0 ) |
| 462 | 506 | ROM_LOAD( "cgrom60.60a", 0x0000, 0x1000, CRC(49c21d08) SHA1(9454d6e2066abcbd051bad9a29a5ca27b12ec897) ) |
| 507 | |
| 508 | ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF ) |
| 463 | 509 | ROM_END |
| 464 | 510 | |
| 465 | 511 | ROM_START( pc6001m2 ) |
| r5910 | r5911 | |
| 472 | 518 | ROM_LOAD( "cgrom60.62", 0x0000, 0x2000, CRC(81eb5d95) SHA1(53d8ae9599306ff23bf95208d2f6cc8fed3fc39f) ) |
| 473 | 519 | ROM_LOAD( "cgrom60m.62", 0x2000, 0x2000, CRC(3ce48c33) SHA1(f3b6c63e83a17d80dde63c6e4d86adbc26f84f79) ) |
| 474 | 520 | ROM_LOAD( "kanjirom.62", 0x4000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) ) |
| 521 | |
| 522 | ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF ) |
| 475 | 523 | ROM_END |
| 476 | 524 | |
| 477 | 525 | ROM_START( pc6001sr ) |
| r5910 | r5911 | |
| 482 | 530 | |
| 483 | 531 | ROM_REGION( 0x4000, "gfx1", 0 ) |
| 484 | 532 | ROM_LOAD( "cgrom68.64", 0x0000, 0x4000, CRC(73bc3256) SHA1(5f80d62a95331dc39b2fb448a380fd10083947eb) ) |
| 533 | |
| 534 | ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF ) |
| 485 | 535 | ROM_END |
| 486 | 536 | |
| 487 | 537 | ROM_START( pc6600 ) /* Variant of pc6001m2 */ |
| r5910 | r5911 | |
| 493 | 543 | ROM_LOAD( "cgrom60.66", 0x0000, 0x2000, CRC(d2434f29) SHA1(a56d76f5cbdbcdb8759abe601eab68f01b0a8fe8) ) |
| 494 | 544 | ROM_LOAD( "cgrom66.66", 0x2000, 0x2000, CRC(3ce48c33) SHA1(f3b6c63e83a17d80dde63c6e4d86adbc26f84f79) ) |
| 495 | 545 | ROM_LOAD( "kanjirom.66", 0x4000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) ) |
| 546 | |
| 547 | ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF ) |
| 496 | 548 | ROM_END |
| 497 | 549 | |
| 498 | 550 | /* There exists an alternative (incomplete?) dump, consisting of more .68 pieces, but it's been probably created for emulators: |
| r5910 | r5911 | |
| 507 | 559 | |
| 508 | 560 | ROM_REGION( 0x4000, "gfx1", 0 ) |
| 509 | 561 | ROM_LOAD( "cgrom68.68", 0x0000, 0x4000, CRC(73bc3256) SHA1(5f80d62a95331dc39b2fb448a380fd10083947eb) ) |
| 562 | |
| 563 | ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF ) |
| 510 | 564 | ROM_END |
| 511 | 565 | |
| 512 | 566 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |