src/mess/machine/c16.c
| r3245 | r3246 | |
| 68 | 68 | static UINT8 *c16_memory_28000; |
| 69 | 69 | static UINT8 *c16_memory_2c000; |
| 70 | 70 | |
| 71 | | static UINT8 read_cfg0(running_machine *machine) |
| 72 | | { |
| 73 | | UINT8 result; |
| 74 | | switch(mame_get_phase(machine)) |
| 75 | | { |
| 76 | | case MAME_PHASE_RESET: |
| 77 | | case MAME_PHASE_RUNNING: |
| 78 | | result = input_port_read(machine, "CFG0"); |
| 79 | | break; |
| 71 | int has_c1551 = 0, has_vc1541 = 0, has_iec8 = 0, has_iec9 = 0; // Notice that iec8 & iec9 have never been implemented |
| 80 | 72 | |
| 81 | | default: |
| 82 | | result = 0x00; |
| 83 | | break; |
| 84 | | } |
| 85 | | return result; |
| 86 | | } |
| 87 | | |
| 88 | 73 | static UINT8 read_cfg1(running_machine *machine) |
| 89 | 74 | { |
| 90 | 75 | UINT8 result; |
| r3245 | r3246 | |
| 444 | 429 | |
| 445 | 430 | static void c16_common_driver_init (running_machine *machine) |
| 446 | 431 | { |
| 447 | | #ifdef VC1541 |
| 448 | 432 | VC1541_CONFIG vc1541= { 1, 8 }; |
| 449 | | #endif |
| 450 | 433 | C1551_CONFIG config= { 1 }; |
| 451 | 434 | UINT8 *rom; |
| 452 | 435 | |
| r3245 | r3246 | |
| 457 | 440 | c16_select_roms (machine, 0, 0); |
| 458 | 441 | c16_switch_to_rom (machine, 0, 0); |
| 459 | 442 | |
| 460 | | if ((read_cfg0(machine) & 0xc0 ) == 0x40) /* C1551 */ |
| 443 | if (has_c1551) /* C1551 */ |
| 461 | 444 | { |
| 462 | 445 | tpi6525[2].a.read = c1551x_0_read_data; |
| 463 | 446 | tpi6525[2].a.output = c1551x_0_write_data; |
| r3245 | r3246 | |
| 495 | 478 | memset(mess_ram + (0xfdc0 % mess_ram_size), 0xff, 0x40); |
| 496 | 479 | |
| 497 | 480 | memset(mess_ram + (0xfd40 % mess_ram_size), 0xff, 0x20); |
| 498 | | |
| 499 | | if ((read_cfg0(machine) & 0xc0 ) == 0x40) /* C1551 */ |
| 481 | |
| 482 | if (has_c1551) /* C1551 */ |
| 500 | 483 | c1551_config (0, 0, &config); |
| 501 | 484 | |
| 502 | | #ifdef VC1541 |
| 503 | | if ((read_cfg0(machine) & 0xc0 ) == 0x80) /* VC1541 */ |
| 485 | if (has_vc1541) /* VC1541 */ |
| 504 | 486 | vc1541_config (0, 0, &vc1541); |
| 505 | | #endif |
| 506 | 487 | } |
| 507 | 488 | |
| 508 | 489 | void c16_driver_init(running_machine *machine) |
| r3245 | r3246 | |
| 512 | 493 | ted7360_set_dma (ted7360_dma_read, ted7360_dma_read_rom); |
| 513 | 494 | } |
| 514 | 495 | |
| 496 | |
| 497 | DRIVER_INIT( c16 ) |
| 498 | { |
| 499 | c16_driver_init(machine); |
| 500 | } |
| 501 | |
| 502 | DRIVER_INIT( c16c ) |
| 503 | { |
| 504 | has_c1551 = 1; |
| 505 | c16_driver_init(machine); |
| 506 | } |
| 507 | |
| 508 | DRIVER_INIT( c16v ) |
| 509 | { |
| 510 | has_vc1541 = 1; |
| 511 | c16_driver_init(machine); |
| 512 | } |
| 513 | |
| 514 | |
| 515 | 515 | MACHINE_RESET( c16 ) |
| 516 | 516 | { |
| 517 | 517 | tpi6525_2_reset(); |
| r3245 | r3246 | |
| 562 | 562 | ted7360_set_dma (ted7360_dma_read, ted7360_dma_read_rom); |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | | if ((read_cfg0(machine) & 0x38 ) == 0x08 || (read_cfg0(machine) & 0xc0 ) == 0x40) /* IEC8 on || C1551 */ |
| 565 | if (has_c1551 || has_iec8) /* IEC8 on || C1551 */ |
| 566 | 566 | { |
| 567 | 567 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfee0, 0xfeff, 0, 0, tpi6525_2_port_w); |
| 568 | 568 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfee0, 0xfeff, 0, 0, tpi6525_2_port_r); |
| r3245 | r3246 | |
| 572 | 572 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfee0, 0xfeff, 0, 0, SMH_NOP); |
| 573 | 573 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfee0, 0xfeff, 0, 0, SMH_NOP); |
| 574 | 574 | } |
| 575 | | if ((read_cfg0(machine) & 0x07 ) == 0x01) /* IEC9 on */ |
| 575 | if (has_iec9) /* IEC9 on */ |
| 576 | 576 | { |
| 577 | 577 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfec0, 0xfedf, 0, 0, tpi6525_3_port_w); |
| 578 | 578 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfec0, 0xfedf, 0, 0, tpi6525_3_port_r); |
| r3245 | r3246 | |
| 586 | 586 | cbm_drive_0_config (SERIAL, 8); |
| 587 | 587 | cbm_drive_1_config (SERIAL, 9); |
| 588 | 588 | |
| 589 | | if ((read_cfg0(machine) & 0xc0 ) == 0x40) /* c1551 */ |
| 589 | if (has_c1551) /* c1551 */ |
| 590 | 590 | c1551_reset (); |
| 591 | 591 | |
| 592 | | #ifdef VC1541 |
| 593 | | if ((read_cfg0(machine) & 0xc0 ) == 0x80) /* VC1541 */ |
| 592 | if (has_vc1541) /* VC1541 */ |
| 594 | 593 | vc1541_reset (); |
| 595 | | #endif |
| 596 | 594 | |
| 597 | 595 | cbm_serial_reset_write (0); |
| 598 | 596 | } |
| r3245 | r3246 | |
| 611 | 609 | |
| 612 | 610 | /* Shift Lock is mapped on Left/Right Shift */ |
| 613 | 611 | if ((i == 1) && (input_port_read(machine, "SPECIAL") & 0x80)) |
| 614 | | value |= 0x80; |
| 612 | value &= ~0x80; |
| 615 | 613 | |
| 616 | 614 | keyline[i] = value; |
| 617 | 615 | } |
src/mess/drivers/c16.c
| r3245 | r3246 | |
| 285 | 285 | |
| 286 | 286 | /* no real floppy */ |
| 287 | 287 | |
| 288 | | PORT_INCLUDE( c16_config ) /* DSW0, CFG0, CFG1 */ |
| 288 | PORT_INCLUDE( c16_config ) /* DSW0, CFG1 */ |
| 289 | 289 | INPUT_PORTS_END |
| 290 | 290 | |
| 291 | 291 | |
| 292 | | static INPUT_PORTS_START( c16c ) |
| 293 | | PORT_INCLUDE( c16 ) |
| 294 | | |
| 295 | | /* c1551 floppy */ |
| 296 | | |
| 297 | | PORT_MODIFY("CFG0") |
| 298 | | PORT_BIT( 0x38, 0x10, IPT_UNUSED ) |
| 299 | | PORT_BIT( 0x07, 0x00, IPT_UNUSED ) |
| 300 | | INPUT_PORTS_END |
| 301 | | |
| 302 | | |
| 303 | | static INPUT_PORTS_START( c16v ) |
| 304 | | PORT_INCLUDE( c16 ) |
| 305 | | |
| 306 | | /* vc1541 floppy */ |
| 307 | | |
| 308 | | PORT_MODIFY("CFG0") |
| 309 | | PORT_BIT( 0x38, 0x10, IPT_UNUSED ) |
| 310 | | PORT_BIT( 0x07, 0x00, IPT_UNUSED ) |
| 311 | | INPUT_PORTS_END |
| 312 | | |
| 313 | | |
| 314 | 292 | static INPUT_PORTS_START( plus4 ) |
| 315 | 293 | PORT_INCLUDE( c16 ) |
| 316 | 294 | |
| r3245 | r3246 | |
| 335 | 313 | INPUT_PORTS_END |
| 336 | 314 | |
| 337 | 315 | |
| 338 | | static INPUT_PORTS_START (plus4c) |
| 339 | | PORT_INCLUDE( plus4 ) |
| 340 | 316 | |
| 341 | | /* c1551 floppy */ |
| 342 | | |
| 343 | | PORT_MODIFY("CFG0") |
| 344 | | PORT_BIT( 0x38, 0x10, IPT_UNUSED ) |
| 345 | | PORT_BIT( 0x07, 0x00, IPT_UNUSED ) |
| 346 | | PORT_MODIFY("CFG1") |
| 347 | | PORT_BIT( 0x10, 0x10, IPT_UNUSED ) /* ntsc */ |
| 348 | | PORT_BIT( 0x0c, 0x04, IPT_UNUSED ) /* plus4 */ |
| 349 | | INPUT_PORTS_END |
| 350 | | |
| 351 | | |
| 352 | | static INPUT_PORTS_START (plus4v) |
| 353 | | PORT_INCLUDE( plus4 ) |
| 354 | | |
| 355 | | /* vc1541 floppy */ |
| 356 | | |
| 357 | | PORT_MODIFY("CFG0") |
| 358 | | PORT_BIT( 0x38, 0x20, IPT_UNUSED ) |
| 359 | | PORT_BIT( 0x07, 0x00, IPT_UNUSED ) |
| 360 | | PORT_MODIFY("CFG1") |
| 361 | | PORT_BIT( 0x10, 0x10, IPT_UNUSED ) /* ntsc */ |
| 362 | | PORT_BIT( 0x0c, 0x04, IPT_UNUSED ) /* plus4 */ |
| 363 | | INPUT_PORTS_END |
| 364 | | |
| 365 | | |
| 366 | 317 | #if 0 |
| 367 | 318 | static INPUT_PORTS_START (c364) |
| 368 | 319 | PORT_INCLUDE( plus4 ) |
| r3245 | r3246 | |
| 455 | 406 | |
| 456 | 407 | static MACHINE_DRIVER_START( c16v ) |
| 457 | 408 | MDRV_IMPORT_FROM( c16 ) |
| 458 | | // MDRV_IMPORT_FROM( cpu_vc1541 ) |
| 409 | MDRV_IMPORT_FROM( cpu_vc1541 ) |
| 459 | 410 | #ifdef CPU_SYNC |
| 460 | 411 | MDRV_INTERLEAVE(1) |
| 461 | 412 | #else |
| r3245 | r3246 | |
| 490 | 441 | |
| 491 | 442 | static MACHINE_DRIVER_START( plus4v ) |
| 492 | 443 | MDRV_IMPORT_FROM( plus4 ) |
| 493 | | // MDRV_IMPORT_FROM( cpu_vc1541 ) |
| 444 | MDRV_IMPORT_FROM( cpu_vc1541 ) |
| 494 | 445 | |
| 495 | 446 | MDRV_SCREEN_MODIFY("main") |
| 496 | 447 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| r3245 | r3246 | |
| 630 | 581 | ROM_END |
| 631 | 582 | |
| 632 | 583 | |
| 633 | | |
| 634 | 584 | /************************************* |
| 635 | 585 | * |
| 636 | | * Generic driver initialization |
| 637 | | * |
| 638 | | *************************************/ |
| 639 | | |
| 640 | | |
| 641 | | static DRIVER_INIT( c16 ) |
| 642 | | { |
| 643 | | c16_driver_init(machine); |
| 644 | | } |
| 645 | | |
| 646 | | static DRIVER_INIT( plus4 ) |
| 647 | | { |
| 648 | | c16_driver_init(machine); |
| 649 | | } |
| 650 | | |
| 651 | | |
| 652 | | /************************************* |
| 653 | | * |
| 654 | 586 | * System configuration(s) |
| 655 | 587 | * |
| 656 | 588 | *************************************/ |
| r3245 | r3246 | |
| 707 | 639 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 708 | 640 | |
| 709 | 641 | COMP( 1984, c16, 0, 0, c16, c16, c16, c16, "Commodore Business Machines Co.", "Commodore 16 (PAL)", 0) |
| 710 | | COMP( 1984, c16c, c16, 0, c16c, c16c, c16, c16c, "Commodore Business Machines Co.", "Commodore 16 (PAL, 1551)", 0 ) |
| 711 | | COMP( 1984, c16v, c16, 0, c16v, c16v, c16, c16v, "Commodore Business Machines Co.", "Commodore 16 (PAL, VC1541)", GAME_NOT_WORKING) |
| 642 | COMP( 1984, c16c, c16, 0, c16c, c16, c16c, c16c, "Commodore Business Machines Co.", "Commodore 16 (PAL, 1551)", 0 ) |
| 643 | COMP( 1984, c16v, c16, 0, c16v, c16, c16v, c16v, "Commodore Business Machines Co.", "Commodore 16 (PAL, VC1541)", GAME_NOT_WORKING) |
| 712 | 644 | COMP( 1984, c16hun, c16, 0, c16, c16, c16, c16, "Commodore Business Machines Co.", "Commodore 16 Novotrade (PAL, Hungary)", 0) |
| 713 | 645 | |
| 714 | 646 | COMP( 1984, c116, c16, 0, c16, c16, c16, c16, "Commodore Business Machines Co.", "Commodore 116 (PAL)", 0) |
| 715 | | COMP( 1984, c116c, c16, 0, c16c, c16c, c16, c16c, "Commodore Business Machines Co.", "Commodore 116 (PAL, 1551)", 0 ) |
| 716 | | COMP( 1984, c116v, c16, 0, c16v, c16v, c16, c16v, "Commodore Business Machines Co.", "Commodore 116 (PAL, VC1541)", GAME_NOT_WORKING) |
| 647 | COMP( 1984, c116c, c16, 0, c16c, c16, c16c, c16c, "Commodore Business Machines Co.", "Commodore 116 (PAL, 1551)", 0 ) |
| 648 | COMP( 1984, c116v, c16, 0, c16v, c16, c16v, c16v, "Commodore Business Machines Co.", "Commodore 116 (PAL, VC1541)", GAME_NOT_WORKING) |
| 717 | 649 | |
| 718 | | COMP( 1984, plus4, c16, 0, plus4, plus4, plus4, plus, "Commodore Business Machines Co.", "Commodore Plus/4 (NTSC)", 0) |
| 719 | | COMP( 1984, plus4c, c16, 0, plus4c, plus4c, plus4, plusc, "Commodore Business Machines Co.", "Commodore Plus/4 (NTSC, 1551)", 0 ) |
| 720 | | COMP( 1984, plus4v, c16, 0, plus4v, plus4v, plus4, plusv, "Commodore Business Machines Co.", "Commodore Plus/4 (NTSC, VC1541)", GAME_NOT_WORKING) |
| 650 | COMP( 1984, plus4, c16, 0, plus4, plus4, c16, plus, "Commodore Business Machines Co.", "Commodore Plus/4 (NTSC)", 0) |
| 651 | COMP( 1984, plus4c, c16, 0, plus4c, plus4, c16c, plusc, "Commodore Business Machines Co.", "Commodore Plus/4 (NTSC, 1551)", 0 ) |
| 652 | COMP( 1984, plus4v, c16, 0, plus4v, plus4, c16v, plusv, "Commodore Business Machines Co.", "Commodore Plus/4 (NTSC, VC1541)", GAME_NOT_WORKING) |
| 721 | 653 | |
| 722 | 654 | COMP( 1984, c232, c16, 0, c16, c16, c16, c16, "Commodore Business Machines Co.", "Commodore 232 (Prototype)", 0) |
| 723 | | COMP( 1984, c264, c16, 0, c16, plus4, plus4, plus, "Commodore Business Machines Co.", "Commodore 264 (Prototype)", 0) |
| 724 | | COMP( 1984, c364, c16, 0, c364, plus4, plus4, plusv, "Commodore Business Machines Co.", "Commodore V364 (Prototype)", GAME_IMPERFECT_SOUND) |
| 655 | COMP( 1984, c264, c16, 0, c16, plus4, c16, plus, "Commodore Business Machines Co.", "Commodore 264 (Prototype)", 0) |
| 656 | COMP( 1984, c364, c16, 0, c364, plus4, c16, plusv, "Commodore Business Machines Co.", "Commodore V364 (Prototype)", GAME_IMPERFECT_SOUND) |