src/mess/drivers/super80.c
| r4261 | r4262 | |
| 10 | 10 | #include "devices/cassette.h" |
| 11 | 11 | #include "devices/z80bin.h" |
| 12 | 12 | #include "sound/speaker.h" |
| 13 | | #include "machine/centroni.h" |
| 13 | #include "machine/ctronics.h" |
| 14 | 14 | #include "devices/printer.h" |
| 15 | 15 | |
| 16 | 16 | static UINT8 super80_mhz=2; /* state of bit 2 of port F0 */ |
| r4261 | r4262 | |
| 454 | 454 | The most commonly used I/O range is DC-DE (DC = centronics, DD = serial data, DE = serial control |
| 455 | 455 | All the home-brew roms use this, except for super80e which uses BC-BE (which we don't support yet). */ |
| 456 | 456 | |
| 457 | | static void super80_printer_handshake_in(running_machine *machine,int number, int data, int mask) |
| 458 | | { |
| 459 | | if (mask & CENTRONICS_ACKNOWLEDGE) |
| 460 | | { |
| 461 | | if (data & CENTRONICS_ACKNOWLEDGE) |
| 462 | | { |
| 463 | | } |
| 464 | | } |
| 465 | | } |
| 466 | | |
| 467 | | static const CENTRONICS_CONFIG super80_cent_config[1]={ |
| 468 | | { |
| 469 | | PRINTER_CENTRONICS, |
| 470 | | super80_printer_handshake_in |
| 471 | | }, |
| 472 | | }; |
| 473 | | |
| 474 | | static const device_config *printer_device(running_machine *machine) |
| 475 | | { |
| 476 | | return devtag_get_device(machine, PRINTER, "printer"); |
| 477 | | } |
| 478 | | |
| 479 | | |
| 480 | 457 | /**************************** I/O PORTS *****************************************************************/ |
| 481 | 458 | |
| 482 | 459 | static READ8_HANDLER( super80v_11_r ) |
| r4261 | r4262 | |
| 489 | 466 | |
| 490 | 467 | static READ8_HANDLER( super80_dc_r ) |
| 491 | 468 | { |
| 469 | const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics"); |
| 492 | 470 | UINT8 data=0x7f; |
| 493 | 471 | |
| 494 | 472 | /* bit 7 = printer busy |
| 495 | 473 | 0 = printer is not busy */ |
| 496 | 474 | |
| 497 | | if (printer_is_ready(printer_device(space->machine))==0 ) |
| 498 | | data |= 0x80; |
| 475 | data |= centronics_busy_r(printer) << 7; |
| 499 | 476 | |
| 500 | 477 | return data; |
| 501 | 478 | } |
| r4261 | r4262 | |
| 523 | 500 | static WRITE8_HANDLER( super80_dc_w ) |
| 524 | 501 | { |
| 525 | 502 | /* hardware strobe driven from port select, bit 7..0 = data */ |
| 526 | | centronics_write_handshake(space->machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 527 | | centronics_write_handshake(space->machine, 0, 1, CENTRONICS_STROBE); |
| 528 | | centronics_write_data(space->machine, 0, data); |
| 529 | | centronics_write_handshake(space->machine, 0, 0, CENTRONICS_STROBE); |
| 503 | const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics"); |
| 504 | centronics_strobe_w(printer, 1); |
| 505 | centronics_data_w(printer, 0, data); |
| 506 | centronics_strobe_w(printer, 0); |
| 530 | 507 | } |
| 531 | 508 | |
| 532 | 509 | static UINT8 last_data; |
| r4261 | r4262 | |
| 1000 | 977 | static MACHINE_RESET( super80 ) |
| 1001 | 978 | { |
| 1002 | 979 | super80_z80pio = devtag_get_device(machine, Z80PIO, "z80pio"); |
| 1003 | | centronics_config(machine,0, super80_cent_config); |
| 1004 | | /* assumption: select is tied low */ |
| 1005 | | centronics_write_handshake(machine,0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1006 | 980 | timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, super80_reset); |
| 1007 | 981 | memory_set_bank(machine, 1, 1); |
| 1008 | 982 | } |
| r4261 | r4262 | |
| 1058 | 1032 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 1059 | 1033 | |
| 1060 | 1034 | /* printer */ |
| 1061 | | MDRV_PRINTER_ADD("printer") |
| 1035 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 1062 | 1036 | |
| 1063 | 1037 | /* quickload */ |
| 1064 | 1038 | MDRV_Z80BIN_QUICKLOAD_ADD(default, 1) |
| r4261 | r4262 | |
| 1118 | 1092 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 1119 | 1093 | |
| 1120 | 1094 | /* printer */ |
| 1121 | | MDRV_PRINTER_ADD("printer") |
| 1095 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 1122 | 1096 | |
| 1123 | 1097 | /* quickload */ |
| 1124 | 1098 | MDRV_Z80BIN_QUICKLOAD_ADD(default, 1) |