src/mess/drivers/exidy.c
| r4263 | r4264 | |
| 132 | 132 | of the tape during playback. |
| 133 | 133 | |
| 134 | 134 | The sorcerer has a UART device used by the serial interface and the cassette system. |
| 135 | | So far, it has been tested to work at 300 baud. |
| 136 | 135 | |
| 136 | |
| 137 | 137 | ********************************************************************************/ |
| 138 | 138 | |
| 139 | 139 | #include "driver.h" |
| r4263 | r4264 | |
| 141 | 141 | #include "sound/speaker.h" |
| 142 | 142 | #include "sound/wave.h" |
| 143 | 143 | #include "includes/exidy.h" |
| 144 | | #include "machine/centroni.h" |
| 144 | #include "machine/ctronics.h" |
| 145 | 145 | #include "machine/wd17xx.h" |
| 146 | 146 | #include "devices/basicdsk.h" |
| 147 | 147 | #include "devices/cassette.h" |
| r4263 | r4264 | |
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | | static void exidy_printer_handshake_in(running_machine *machine,int number, int data, int mask) |
| 315 | | { |
| 316 | | if (mask & CENTRONICS_ACKNOWLEDGE) |
| 317 | | { |
| 318 | | if (data & CENTRONICS_ACKNOWLEDGE) |
| 319 | | { |
| 320 | | } |
| 321 | | } |
| 322 | | } |
| 323 | 314 | |
| 324 | | static const CENTRONICS_CONFIG exidy_cent_config[1]={ |
| 325 | | { |
| 326 | | PRINTER_CENTRONICS, |
| 327 | | exidy_printer_handshake_in |
| 328 | | }, |
| 329 | | }; |
| 330 | | |
| 331 | | |
| 332 | 315 | /* after the first 4 bytes have been read from ROM, switch the ram back in */ |
| 333 | 316 | static TIMER_CALLBACK( exidy_reset ) |
| 334 | 317 | { |
| r4263 | r4264 | |
| 358 | 341 | |
| 359 | 342 | exidy_ay31015 = devtag_get_device(machine, AY31015, "ay_3_1015"); |
| 360 | 343 | |
| 361 | | centronics_config(machine, 0, exidy_cent_config); |
| 362 | | /* assumption: select is tied low */ |
| 363 | | centronics_write_handshake(machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 364 | 344 | exidy_fe_port_w(space, 0, 0); |
| 365 | 345 | |
| 366 | 346 | timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, exidy_reset); |
| r4263 | r4264 | |
| 506 | 486 | |
| 507 | 487 | static WRITE8_HANDLER(exidy_ff_port_w) |
| 508 | 488 | { |
| 489 | const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics"); |
| 509 | 490 | /* reading the config switch */ |
| 510 | 491 | switch (input_port_read(space->machine, "CONFIG") & 0x06) |
| 511 | 492 | { |
| r4263 | r4264 | |
| 515 | 496 | |
| 516 | 497 | case 2: /* Centronics 7-bit printer */ |
| 517 | 498 | /* bit 7 = strobe, bit 6..0 = data */ |
| 518 | | centronics_write_handshake(space->machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 519 | | centronics_write_handshake(space->machine, 0, (~data>>7) & 0x01, CENTRONICS_STROBE); |
| 520 | | centronics_write_data(space->machine, 0, data & 0x7f); |
| 499 | centronics_strobe_w(printer, (~data>>7) & 0x01); |
| 500 | centronics_data_w(printer, 0, data & 0x7f); |
| 521 | 501 | break; |
| 522 | 502 | |
| 523 | 503 | case 4: /* 8-bit parallel output */ |
| 524 | 504 | /* hardware strobe driven from port select, bit 7..0 = data */ |
| 525 | | centronics_write_handshake(space->machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 526 | | centronics_write_handshake(space->machine, 0, 1, CENTRONICS_STROBE); |
| 527 | | centronics_write_data(space->machine, 0, data); |
| 528 | | centronics_write_handshake(space->machine, 0, 0, CENTRONICS_STROBE); |
| 505 | centronics_strobe_w(printer, 1); |
| 506 | centronics_data_w(printer, 0, data); |
| 507 | centronics_strobe_w(printer, 0); |
| 529 | 508 | break; |
| 530 | 509 | } |
| 531 | 510 | } |
| r4263 | r4264 | |
| 574 | 553 | return data; |
| 575 | 554 | } |
| 576 | 555 | |
| 577 | | static const device_config *printer_device(running_machine *machine) |
| 578 | | { |
| 579 | | return devtag_get_device(machine, PRINTER, "printer"); |
| 580 | | } |
| 581 | | |
| 582 | 556 | static READ8_HANDLER(exidy_ff_port_r) |
| 583 | 557 | { |
| 584 | 558 | /* The use of the parallel port as a general purpose port is not emulated. |
| r4263 | r4264 | |
| 586 | 560 | This uses bit 7. The other bits have been set high (=nothing plugged in). |
| 587 | 561 | This fixes those games that use a joystick. */ |
| 588 | 562 | |
| 563 | const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics"); |
| 589 | 564 | UINT8 data=0x7f; |
| 590 | 565 | |
| 591 | 566 | /* bit 7 = printer busy |
| 592 | 567 | 0 = printer is not busy */ |
| 593 | 568 | |
| 594 | | if (printer_is_ready(printer_device(space->machine))==0 ) |
| 595 | | data |= 0x80; |
| 569 | data |= centronics_busy_r(printer) << 7; |
| 596 | 570 | |
| 597 | 571 | return data; |
| 598 | 572 | } |
| r4263 | r4264 | |
| 820 | 794 | MDRV_AY31015_ADD( "ay_3_1015", exidy_ay31015_config ) |
| 821 | 795 | |
| 822 | 796 | /* printer */ |
| 823 | | MDRV_PRINTER_ADD("printer") |
| 797 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 824 | 798 | |
| 825 | 799 | /* quickload */ |
| 826 | 800 | MDRV_Z80BIN_QUICKLOAD_ADD(exidy, 2) |