src/mess/machine/c16.c
| r7304 | r7305 | |
| 13 | 13 | #include "cpu/m6502/m6502.h" |
| 14 | 14 | #include "sound/sid6581.h" |
| 15 | 15 | |
| 16 | | #include "machine/6525tpi.h" |
| 17 | 16 | #include "video/ted7360.h" |
| 18 | 17 | #include "machine/cbmiec.h" |
| 19 | 18 | |
| r7304 | r7305 | |
| 66 | 65 | static UINT8 *c16_memory_28000; |
| 67 | 66 | static UINT8 *c16_memory_2c000; |
| 68 | 67 | |
| 69 | | static int has_c1551, has_vc1541, has_iec8, has_iec9; // Notice that iec8 & iec9 have never been implemented |
| 70 | | |
| 71 | 68 | static UINT8 read_cfg1( running_machine *machine ) |
| 72 | 69 | { |
| 73 | 70 | UINT8 result; |
| r7304 | r7305 | |
| 451 | 448 | c16_memory_24000 = rom + 0x24000; |
| 452 | 449 | c16_memory_28000 = rom + 0x28000; |
| 453 | 450 | c16_memory_2c000 = rom + 0x2c000; |
| 454 | | |
| 455 | | /* need to recognice non available tia6523's (iec8/9) */ |
| 456 | | memset(messram_get_ptr(devtag_get_device(machine, "messram")) + (0xfdc0 % messram_get_size(devtag_get_device(machine, "messram"))), 0xff, 0x40); |
| 457 | | |
| 458 | | memset(messram_get_ptr(devtag_get_device(machine, "messram")) + (0xfd40 % messram_get_size(devtag_get_device(machine, "messram"))), 0xff, 0x20); |
| 459 | | |
| 460 | | //removed if (has_c1551) /* C1551 */ |
| 461 | | //removed c1551_config(machine, "cpu_c1551"); |
| 462 | | |
| 463 | | //removed if (has_vc1541) /* VC1541 */ |
| 464 | | //removed cbm_drive_config(machine, type_1541, 0, 0, "cpu_vc1540", 8); |
| 465 | 451 | } |
| 466 | 452 | |
| 467 | 453 | static void c16_driver_init( running_machine *machine ) |
| r7304 | r7305 | |
| 482 | 468 | |
| 483 | 469 | DRIVER_INIT( c16 ) |
| 484 | 470 | { |
| 485 | | has_c1551 = 0; |
| 486 | | has_vc1541 = 0; |
| 487 | | has_iec8 = 0; |
| 488 | | has_iec9 = 0; |
| 489 | 471 | c16_driver_init(machine); |
| 490 | 472 | } |
| 491 | 473 | |
| 492 | 474 | DRIVER_INIT( c16c ) |
| 493 | 475 | { |
| 494 | | has_c1551 = 1; |
| 495 | | has_vc1541 = 0; |
| 496 | | has_iec8 = 0; |
| 497 | | has_iec9 = 0; |
| 498 | 476 | c16_driver_init(machine); |
| 499 | 477 | } |
| 500 | 478 | |
| 501 | 479 | DRIVER_INIT( c16v ) |
| 502 | 480 | { |
| 503 | | has_c1551 = 0; |
| 504 | | has_vc1541 = 1; |
| 505 | | has_iec8 = 0; |
| 506 | | has_iec9 = 0; |
| 507 | 481 | c16_driver_init(machine); |
| 508 | 482 | } |
| 509 | 483 | |
| r7304 | r7305 | |
| 558 | 532 | |
| 559 | 533 | ted7360_set_dma (ted7360_dma_read, ted7360_dma_read_rom); |
| 560 | 534 | } |
| 561 | | |
| 562 | | if (has_c1551 || has_iec8) /* IEC8 on || C1551 */ |
| 563 | | { |
| 564 | | running_device *tpi = devtag_get_device(machine, "tpi6535_tpi_2"); |
| 565 | | memory_install_write8_device_handler(space, tpi, 0xfee0, 0xfeff, 0, 0, tpi6525_w); |
| 566 | | memory_install_read8_device_handler(space, tpi, 0xfee0, 0xfeff, 0, 0, tpi6525_r); |
| 567 | | } |
| 568 | | else |
| 569 | | { |
| 570 | | memory_nop_readwrite(space, 0xfee0, 0xfeff, 0, 0); |
| 571 | | } |
| 572 | | if (has_iec9) /* IEC9 on */ |
| 573 | | { |
| 574 | | running_device *tpi = devtag_get_device(machine, "tpi6535_tpi_3"); |
| 575 | | memory_install_write8_device_handler(space, tpi, 0xfec0, 0xfedf, 0, 0, tpi6525_w); |
| 576 | | memory_install_read8_device_handler(space, tpi, 0xfec0, 0xfedf, 0, 0, tpi6525_r); |
| 577 | | } |
| 578 | | else |
| 579 | | { |
| 580 | | memory_nop_readwrite(space, 0xfec0, 0xfedf, 0, 0); |
| 581 | | } |
| 582 | | //removed if (has_c1551) /* c1551 */ |
| 583 | | //removed { |
| 584 | | //removed c1551_drive_reset(); |
| 585 | | //removed } |
| 586 | | //removed if (has_vc1541) /* vc1541 */ |
| 587 | | //removed { |
| 588 | | //removed cbm_drive_reset(machine); |
| 589 | | //removed } |
| 590 | | //removed else /* simulated drives */ |
| 591 | | //removed { |
| 592 | | //removed cbm_drive_0_config(SERIAL, 8); |
| 593 | | //removed cbm_drive_1_config(SERIAL, 9); |
| 594 | | //removed } |
| 595 | 535 | } |
| 596 | 536 | |
| 597 | 537 | |
src/mess/drivers/c16.c
| r7304 | r7305 | |
| 99 | 99 | - Once we can add / remove devices, we shall only support c16, c116 and plus/4, |
| 100 | 100 | removing the separated drivers for different floppy drives |
| 101 | 101 | |
| 102 | | * Floppy drives: |
| 103 | | |
| 104 | | - Drives 8 & 9 supported, but limited compatibility. Real disk emulation is |
| 105 | | needed. |
| 106 | | |
| 107 | 102 | * Other Peripherals: |
| 108 | 103 | |
| 109 | 104 | - Lightpen support is unfinished |
| r7304 | r7305 | |
| 121 | 116 | #include "cpu/m6502/m6502.h" |
| 122 | 117 | #include "sound/sid6581.h" |
| 123 | 118 | |
| 124 | | #include "machine/6525tpi.h" |
| 125 | 119 | #include "machine/cbmipt.h" |
| 126 | 120 | #include "video/ted7360.h" |
| 127 | 121 | #include "devices/messram.h" |
| r7304 | r7305 | |
| 195 | 189 | AM_RANGE(0x8000, 0xbfff) AM_WRITE( c16_write_8000) /*configured in c16_common_init */ |
| 196 | 190 | AM_RANGE(0xc000, 0xfcff) AM_WRITE( c16_write_c000) /*configured in c16_common_init */ |
| 197 | 191 | AM_RANGE(0xfd40, 0xfd5f) AM_DEVREADWRITE("sid6581", sid6581_r, sid6581_w) /* sidcard, eoroidpro ... */ |
| 198 | | AM_RANGE(0xfec0, 0xfedf) AM_READWRITE(c16_iec9_port_r, c16_iec9_port_w) /*configured in c16_common_init */ |
| 199 | | AM_RANGE(0xfee0, 0xfeff) AM_READWRITE(c16_iec8_port_r, c16_iec8_port_w) /*configured in c16_common_init */ |
| 200 | 192 | AM_RANGE(0xff20, 0xff3d) AM_WRITE( c16_write_ff20) /*configure in c16_common_init */ |
| 201 | 193 | AM_RANGE(0xff40, 0xffff) AM_WRITE( c16_write_ff40) /*configure in c16_common_init */ |
| 202 | 194 | #endif |
| r7304 | r7305 | |
| 214 | 206 | AM_RANGE(0xfdd0, 0xfddf) AM_WRITE( c16_select_roms) /* rom chips selection */ |
| 215 | 207 | #if 0 |
| 216 | 208 | AM_RANGE(0xfd40, 0xfd5f) AM_DEVREADWRITE("sid6581", sid6581_r, sid6581_w) /* sidcard, eoroidpro ... */ |
| 217 | | AM_RANGE(0xfec0, 0xfedf) AM_READWRITE(c16_iec9_port_r, c16_iec9_port_w) /*configured in c16_common_init */ |
| 218 | | AM_RANGE(0xfee0, 0xfeff) AM_READWRITE(c16_iec8_port_r, c16_iec8_port_w) /*configured in c16_common_init */ |
| 219 | 209 | #endif |
| 220 | 210 | AM_RANGE(0xff00, 0xff1f) AM_READWRITE(ted7360_port_r, ted7360_port_w) |
| 221 | 211 | AM_RANGE(0xff20, 0xffff) AM_READ_BANK("bank8") |
| r7304 | r7305 | |
| 238 | 228 | AM_RANGE(0xfdd0, 0xfddf) AM_WRITE( c16_select_roms) /* rom chips selection */ |
| 239 | 229 | #if 0 |
| 240 | 230 | AM_RANGE(0xfd40, 0xfd5f) AM_DEVREADWRITE("sid6581", sid6581_r, sid6581_w) /* sidcard, eoroidpro ... */ |
| 241 | | AM_RANGE(0xfec0, 0xfedf) AM_READWRITE(c16_iec9_port_r, c16_iec9_port_w) /*configured in c16_common_init */ |
| 242 | | AM_RANGE(0xfee0, 0xfeff) AM_READWRITE(c16_iec8_port_r, c16_iec8_port_w) /*configured in c16_common_init */ |
| 243 | 231 | #endif |
| 244 | 232 | AM_RANGE(0xff00, 0xff1f) AM_READWRITE(ted7360_port_r, ted7360_port_w) |
| 245 | 233 | AM_RANGE(0xff20, 0xffff) AM_READ_BANK("bank8") |
| r7304 | r7305 | |
| 294 | 282 | |
| 295 | 283 | PORT_INCLUDE( c16_controls ) /* JOY0, JOY1 */ |
| 296 | 284 | |
| 297 | | /* no real floppy */ |
| 298 | | |
| 299 | 285 | PORT_INCLUDE( c16_config ) /* DSW0, CFG1 */ |
| 300 | 286 | INPUT_PORTS_END |
| 301 | 287 | |
| r7304 | r7305 | |
| 303 | 289 | static INPUT_PORTS_START( plus4 ) |
| 304 | 290 | PORT_INCLUDE( c16 ) |
| 305 | 291 | |
| 306 | | /* no real floppy */ |
| 307 | | |
| 308 | 292 | PORT_MODIFY( "ROW0" ) |
| 309 | 293 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0xA3) |
| 310 | 294 | PORT_MODIFY( "ROW5" ) |
| r7304 | r7305 | |
| 329 | 313 | static INPUT_PORTS_START (c364) |
| 330 | 314 | PORT_INCLUDE( plus4 ) |
| 331 | 315 | |
| 332 | | /* no real floppy */ |
| 333 | | |
| 334 | 316 | PORT_MODIFY("CFG1") |
| 335 | 317 | PORT_BIT( 0x10, 0x10, IPT_UNUSED ) /* ntsc */ |
| 336 | 318 | PORT_BIT( 0x0c, 0x08, IPT_UNUSED ) /* 364 */ |
| r7304 | r7305 | |
| 365 | 347 | * |
| 366 | 348 | *************************************/ |
| 367 | 349 | |
| 368 | | static const tpi6525_interface c16_tpi6525_tpi_2_intf = |
| 369 | | { |
| 370 | | NULL, //removed c1551_0_read_data, |
| 371 | | NULL, //removed c1551_0_read_status, |
| 372 | | NULL, //removed c1551_0_read_handshake, |
| 373 | | NULL, //removed c1551_0_write_data, |
| 374 | | NULL, |
| 375 | | NULL, //removed c1551_0_write_handshake, |
| 376 | | NULL, |
| 377 | | NULL, |
| 378 | | NULL |
| 379 | | }; |
| 380 | | |
| 381 | | static const tpi6525_interface c16_tpi6525_tpi_2_c1551_intf = |
| 382 | | { |
| 383 | | NULL, //removed c1551x_read_data, |
| 384 | | NULL, //removed c1551x_read_status, |
| 385 | | NULL, //removed c1551x_read_handshake, |
| 386 | | NULL, //removed c1551x_write_data, |
| 387 | | NULL, |
| 388 | | NULL, //removed c1551x_write_handshake, |
| 389 | | NULL, |
| 390 | | NULL, |
| 391 | | NULL |
| 392 | | }; |
| 393 | | |
| 394 | | static const tpi6525_interface c16_tpi6525_tpi_3_intf = |
| 395 | | { |
| 396 | | NULL, //removed c1551_1_read_data, |
| 397 | | NULL, //removed c1551_1_read_status, |
| 398 | | NULL, //removed c1551_1_read_handshake, |
| 399 | | NULL, //removed c1551_1_write_data, |
| 400 | | NULL, |
| 401 | | NULL, //removed c1551_1_write_handshake, |
| 402 | | NULL, |
| 403 | | NULL, |
| 404 | | NULL |
| 405 | | }; |
| 406 | | |
| 407 | 350 | static const m6502_interface c16_m7501_interface = |
| 408 | 351 | { |
| 409 | 352 | NULL, /* read_indexed_func */ |
| r7304 | r7305 | |
| 427 | 370 | |
| 428 | 371 | static MACHINE_DRIVER_START( c16 ) |
| 429 | 372 | /* basic machine hardware */ |
| 430 | | MDRV_CPU_ADD("maincpu", M7501, 1400000) /* 7.8336 MHz */ |
| 373 | MDRV_CPU_ADD("maincpu", M7501, XTAL_17_73447MHz/20) |
| 431 | 374 | MDRV_CPU_PROGRAM_MAP(c16_map) |
| 432 | 375 | MDRV_CPU_CONFIG( c16_m7501_interface ) |
| 433 | 376 | MDRV_CPU_VBLANK_INT("screen", c16_frame_interrupt) |
| r7304 | r7305 | |
| 462 | 405 | /* cassette */ |
| 463 | 406 | MDRV_CASSETTE_ADD( "cassette", cbm_cassette_config ) |
| 464 | 407 | |
| 465 | | /* tpi */ |
| 466 | | MDRV_TPI6525_ADD("tpi6535_tpi_2", c16_tpi6525_tpi_2_intf) |
| 467 | | MDRV_TPI6525_ADD("tpi6535_tpi_3", c16_tpi6525_tpi_3_intf) |
| 468 | | |
| 469 | 408 | MDRV_IMPORT_FROM(c16_cartslot) |
| 470 | 409 | |
| 471 | 410 | /* IEC serial bus */ |
| r7304 | r7305 | |
| 481 | 420 | static MACHINE_DRIVER_START( c16c ) |
| 482 | 421 | MDRV_IMPORT_FROM( c16 ) |
| 483 | 422 | |
| 484 | | /* c16c uses 'real' floppy drive emulation from machine/vc1541.c... |
| 485 | | still in progress, atm */ |
| 486 | | MDRV_DEVICE_REMOVE("tpi6535_tpi_2") |
| 487 | | MDRV_TPI6525_ADD("tpi6535_tpi_2", c16_tpi6525_tpi_2_c1551_intf) |
| 423 | //MDRV_C1551_ADD("c1551", "maincpu", 8) |
| 488 | 424 | |
| 489 | | /* emulation code currently supports only one drive */ |
| 490 | | MDRV_DEVICE_REMOVE("tpi6535_tpi_3") |
| 491 | | |
| 492 | | //removed MDRV_IMPORT_FROM( cpu_c1551 ) |
| 493 | 425 | #ifdef CPU_SYNC |
| 494 | 426 | MDRV_QUANTUM_TIME(HZ(60)) |
| 495 | 427 | #else |
| r7304 | r7305 | |
| 510 | 442 | #else |
| 511 | 443 | MDRV_QUANTUM_TIME(HZ(300000)) |
| 512 | 444 | #endif |
| 513 | | |
| 514 | | /* no c1551 in this driver */ |
| 515 | | MDRV_DEVICE_REMOVE("tpi6535_tpi_2") |
| 516 | | MDRV_DEVICE_REMOVE("tpi6535_tpi_3") |
| 517 | 445 | MACHINE_DRIVER_END |
| 518 | 446 | |
| 519 | 447 | |
| 520 | 448 | static MACHINE_DRIVER_START( plus4 ) |
| 521 | 449 | MDRV_IMPORT_FROM( c16 ) |
| 522 | | MDRV_CPU_REPLACE( "maincpu", M7501, 1200000) |
| 450 | MDRV_CPU_REPLACE( "maincpu", M7501, XTAL_14_31818MHz/16) |
| 523 | 451 | MDRV_CPU_PROGRAM_MAP(plus4_map) |
| 524 | 452 | MDRV_CPU_CONFIG( c16_m7501_interface ) |
| 525 | 453 | MDRV_SCREEN_MODIFY("screen") |
| r7304 | r7305 | |
| 536 | 464 | static MACHINE_DRIVER_START( plus4c ) |
| 537 | 465 | MDRV_IMPORT_FROM( plus4 ) |
| 538 | 466 | |
| 539 | | /* plus4c uses 'real' floppy drive emulation from machine/vc1541.c... |
| 540 | | still in progress, atm */ |
| 541 | | MDRV_DEVICE_REMOVE("tpi6535_tpi_2") |
| 542 | | MDRV_TPI6525_ADD("tpi6535_tpi_2", c16_tpi6525_tpi_2_c1551_intf) |
| 467 | //MDRV_C1551_ADD("c1551", "maincpu", 8) |
| 543 | 468 | |
| 544 | | /* emulation code currently supports only one drive */ |
| 545 | | MDRV_DEVICE_REMOVE("tpi6535_tpi_3") |
| 546 | | |
| 547 | | //removed MDRV_IMPORT_FROM( cpu_c1551 ) |
| 548 | | |
| 549 | 469 | MDRV_SCREEN_MODIFY("screen") |
| 550 | 470 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 551 | 471 | #ifdef CPU_SYNC |
| r7304 | r7305 | |
| 571 | 491 | #else |
| 572 | 492 | MDRV_QUANTUM_TIME(HZ(300000)) |
| 573 | 493 | #endif |
| 574 | | |
| 575 | | /* no c1551 in this driver */ |
| 576 | | MDRV_DEVICE_REMOVE("tpi6535_tpi_2") |
| 577 | | MDRV_DEVICE_REMOVE("tpi6535_tpi_3") |
| 578 | 494 | MACHINE_DRIVER_END |
| 579 | 495 | |
| 580 | 496 | |
| r7304 | r7305 | |
| 599 | 515 | * ROM definition(s) |
| 600 | 516 | * |
| 601 | 517 | *************************************/ |
| 602 | | #define C1551_ROM( cpu ) \ |
| 603 | | ROM_REGION( 0x10000, cpu, 0 ) \ |
| 604 | | ROM_LOAD( "318008-01.u4", 0xc000, 0x4000, CRC(6d16d024) SHA1(fae3c788ad9a6cc2dbdfbcf6c0264b2ca921d55e) ) |
| 605 | | |
| 606 | 518 | ROM_START( c232 ) |
| 607 | 519 | ROM_REGION( 0x40000, "maincpu", 0 ) |
| 608 | 520 | ROM_LOAD( "318006-01.bin", 0x10000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) |
| r7304 | r7305 | |
| 646 | 558 | ROMX_LOAD( "318004-03.bin", 0x14000, 0x4000, CRC(77bab934) SHA1(97814dab9d757fe5a3a61d357a9a81da588a9783), ROM_BIOS(2) ) |
| 647 | 559 | ROM_SYSTEM_BIOS( 2, "rev4", "rev. 4" ) |
| 648 | 560 | ROMX_LOAD( "318004-04.bin", 0x14000, 0x4000, CRC(be54ed79) SHA1(514ad3c29d01a2c0a3b143d9c1d4143b1912b793), ROM_BIOS(3) ) |
| 649 | | |
| 650 | | C1551_ROM("cpu_c1551") |
| 651 | 561 | ROM_END |
| 652 | 562 | |
| 653 | 563 | ROM_START( c16v ) |
| r7304 | r7305 | |
| 688 | 598 | |
| 689 | 599 | ROM_LOAD( "317053-01.bin", 0x18000, 0x4000, CRC(4fd1d8cb) SHA1(3b69f6e7cb4c18bb08e203fb18b7dabfa853390f) ) |
| 690 | 600 | ROM_LOAD( "317054-01.bin", 0x1c000, 0x4000, CRC(109de2fc) SHA1(0ad7ac2db7da692d972e586ca0dfd747d82c7693) ) |
| 691 | | |
| 692 | | C1551_ROM("cpu_c1551") |
| 693 | 601 | ROM_END |
| 694 | 602 | |
| 695 | 603 | ROM_START( plus4v ) |
| r7304 | r7305 | |
| 711 | 619 | |
| 712 | 620 | COMP( 1984, c16, 0, 0, c16, c16, c16, "Commodore Business Machines Co.", "Commodore 16 (PAL)", 0) |
| 713 | 621 | COMP( 1984, c16c, c16, 0, c16c, c16, c16c, "Commodore Business Machines Co.", "Commodore 16 (PAL, 1551)", 0 ) |
| 714 | | COMP( 1984, c16v, c16, 0, c16v, c16, c16v, "Commodore Business Machines Co.", "Commodore 16 (PAL, VC1541)", GAME_NOT_WORKING) |
| 622 | COMP( 1984, c16v, c16, 0, c16v, c16, c16v, "Commodore Business Machines Co.", "Commodore 16 (PAL, VC1541)", 0) |
| 715 | 623 | COMP( 1984, c16hun, c16, 0, c16, c16, c16, "Commodore Business Machines Co.", "Commodore 16 Novotrade (PAL, Hungary)", 0) |
| 716 | 624 | |
| 717 | 625 | COMP( 1984, c116, c16, 0, c16, c16, c16, "Commodore Business Machines Co.", "Commodore 116 (PAL)", 0) |
| 718 | 626 | COMP( 1984, c116c, c16, 0, c16c, c16, c16c, "Commodore Business Machines Co.", "Commodore 116 (PAL, 1551)", 0 ) |
| 719 | | COMP( 1984, c116v, c16, 0, c16v, c16, c16v, "Commodore Business Machines Co.", "Commodore 116 (PAL, VC1541)", GAME_NOT_WORKING) |
| 627 | COMP( 1984, c116v, c16, 0, c16v, c16, c16v, "Commodore Business Machines Co.", "Commodore 116 (PAL, VC1541)", 0) |
| 720 | 628 | |
| 721 | 629 | COMP( 1984, plus4, c16, 0, plus4, plus4, c16, "Commodore Business Machines Co.", "Commodore Plus/4 (NTSC)", 0) |
| 722 | 630 | COMP( 1984, plus4c, c16, 0, plus4c, plus4, c16c, "Commodore Business Machines Co.", "Commodore Plus/4 (NTSC, 1551)", 0 ) |
| 723 | | COMP( 1984, plus4v, c16, 0, plus4v, plus4, c16v, "Commodore Business Machines Co.", "Commodore Plus/4 (NTSC, VC1541)", GAME_NOT_WORKING) |
| 631 | COMP( 1984, plus4v, c16, 0, plus4v, plus4, c16v, "Commodore Business Machines Co.", "Commodore Plus/4 (NTSC, VC1541)", 0) |
| 724 | 632 | |
| 725 | 633 | COMP( 1984, c232, c16, 0, c16, c16, c16, "Commodore Business Machines Co.", "Commodore 232 (Prototype)", 0) |
| 726 | 634 | COMP( 1984, c264, c16, 0, c264, plus4, c16, "Commodore Business Machines Co.", "Commodore 264 (Prototype)", 0) |