src/mess/machine/thomson.c
| r3903 | r3904 | |
| 748 | 748 | |
| 749 | 749 | |
| 750 | 750 | |
| 751 | | static void to7_io_ack ( int n, int data, int mask ) |
| 751 | static void to7_io_ack ( running_machine *machine, int n, int data, int mask ) |
| 752 | 752 | { |
| 753 | 753 | /* acknowledge from centronics printer to PIA */ |
| 754 | 754 | int ack = (data & CENTRONICS_ACKNOWLEDGE) ? 1 : 0; |
| r3903 | r3904 | |
| 784 | 784 | if ( to7_io_mode(space->machine) == TO7_IO_RS232 ) |
| 785 | 785 | cts = to7_io_line.input_state & SERIAL_STATE_CTS ? 0 : 1; |
| 786 | 786 | else |
| 787 | | cts = ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY ) ? 1 : 0; |
| 787 | cts = ( centronics_read_handshake( space->machine, 0 ) & CENTRONICS_NOT_BUSY ) ? 1 : 0; |
| 788 | 788 | |
| 789 | 789 | LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), to7_io_mode(space->machine), cts, dsr, rd )); |
| 790 | 790 | |
| r3903 | r3904 | |
| 799 | 799 | |
| 800 | 800 | LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data )); |
| 801 | 801 | |
| 802 | | centronics_write_data( 0, data ); |
| 802 | centronics_write_data( space->machine, 0, data ); |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | |
| r3903 | r3904 | |
| 810 | 810 | |
| 811 | 811 | LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data )); |
| 812 | 812 | |
| 813 | | centronics_write_handshake( 0, data ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE ); |
| 813 | centronics_write_handshake( space->machine, 0, data ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE ); |
| 814 | 814 | } |
| 815 | 815 | |
| 816 | 816 | |
| r3903 | r3904 | |
| 841 | 841 | static void thom_centronics_reset( running_machine *machine ) |
| 842 | 842 | { |
| 843 | 843 | centronics_write_handshake |
| 844 | | ( 0, |
| 844 | ( machine, 0, |
| 845 | 845 | CENTRONICS_SELECT | CENTRONICS_NOT_BUSY | CENTRONICS_STROBE, |
| 846 | 846 | CENTRONICS_SELECT | CENTRONICS_NO_RESET | CENTRONICS_NOT_BUSY | |
| 847 | 847 | CENTRONICS_STROBE | CENTRONICS_ACKNOWLEDGE ); |
| 848 | 848 | |
| 849 | | centronics_write_handshake ( 0, CENTRONICS_NO_RESET, CENTRONICS_NO_RESET ); |
| 849 | centronics_write_handshake ( machine, 0, CENTRONICS_NO_RESET, CENTRONICS_NO_RESET ); |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | 852 | |
| r3903 | r3904 | |
| 870 | 870 | { |
| 871 | 871 | LOG (( "to7_io_init: CC 90-323 serial / parallel extension\n" )); |
| 872 | 872 | pia_config( machine, THOM_PIA_IO, &to7_io ); |
| 873 | | centronics_config( 0, &to7_centronics ); |
| 873 | centronics_config( machine, 0, &to7_centronics ); |
| 874 | 874 | serial_connection_init( &to7_io_line ); |
| 875 | 875 | serial_connection_set_in_callback( &to7_io_line, to7_io_in_cb ); |
| 876 | 876 | } |
| r3903 | r3904 | |
| 2939 | 2939 | UINT8 a = pia_get_output_a( THOM_PIA_SYS ); |
| 2940 | 2940 | UINT8 b = pia_get_output_b( THOM_PIA_SYS ); |
| 2941 | 2941 | UINT8 data = (a & 0xfe) | (b & 1); |
| 2942 | | centronics_write_data( 0, data ); |
| 2943 | | centronics_write_handshake( 0, (b & 2) ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE ); |
| 2942 | centronics_write_data( machine, 0, data ); |
| 2943 | centronics_write_handshake( machine, 0, (b & 2) ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE ); |
| 2944 | 2944 | |
| 2945 | 2945 | LOG_IO(( "$%04x %f to9_update_centronics: data=$%02X strobe=%i\n", |
| 2946 | 2946 | cpu_get_previouspc( machine->cpu[0] ), attotime_to_double(timer_get_time(machine)), data, |
| r3903 | r3904 | |
| 3060 | 3060 | /* subsystems */ |
| 3061 | 3061 | thom_irq_init(machine); |
| 3062 | 3062 | pia_config( machine, THOM_PIA_SYS, &to9_sys ); |
| 3063 | | centronics_config( 0, &to9_centronics ); |
| 3063 | centronics_config( machine, 0, &to9_centronics ); |
| 3064 | 3064 | to7_game_init(machine); |
| 3065 | 3065 | to9_floppy_init( machine, mem + 0xe000, mem + 0x40000 ); |
| 3066 | 3066 | to9_kbd_init(machine); |
| r3903 | r3904 | |
| 3913 | 3913 | { |
| 3914 | 3914 | int lightpen = (input_port_read(device->machine, "lightpen_button") & 1) ? 2 : 0; |
| 3915 | 3915 | int cass = to7_get_cassette(device->machine) ? 0x80 : 0; |
| 3916 | | int dtr = (centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY) ? 0 : 0x40; |
| 3916 | int dtr = (centronics_read_handshake( device->machine, 0 ) & CENTRONICS_NOT_BUSY) ? 0 : 0x40; |
| 3917 | 3917 | int lock = to8_kbd_caps ? 0 : 8; /* undocumented! */ |
| 3918 | 3918 | return lightpen | cass | dtr | lock; |
| 3919 | 3919 | } |
| r3903 | r3904 | |
| 4027 | 4027 | /* subsystems */ |
| 4028 | 4028 | thom_irq_init(machine); |
| 4029 | 4029 | pia_config( machine, THOM_PIA_SYS, &to8_sys ); |
| 4030 | | centronics_config( 0, &to9_centronics ); |
| 4030 | centronics_config( machine, 0, &to9_centronics ); |
| 4031 | 4031 | to7_game_init(machine); |
| 4032 | 4032 | to8_floppy_init(machine); |
| 4033 | 4033 | to8_kbd_init(machine); |
| r3903 | r3904 | |
| 4103 | 4103 | { |
| 4104 | 4104 | int lightpen = (input_port_read(device->machine, "lightpen_button") & 1) ? 2 : 0; |
| 4105 | 4105 | int cass = to7_get_cassette(device->machine) ? 0x80 : 0; |
| 4106 | | int dtr = (centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY) ? 0 : 0x40; |
| 4106 | int dtr = (centronics_read_handshake( device->machine, 0 ) & CENTRONICS_NOT_BUSY) ? 0 : 0x40; |
| 4107 | 4107 | return lightpen | cass | dtr; |
| 4108 | 4108 | } |
| 4109 | 4109 | |
| r3903 | r3904 | |
| 4188 | 4188 | /* subsystems */ |
| 4189 | 4189 | thom_irq_init(machine); |
| 4190 | 4190 | pia_config( machine, THOM_PIA_SYS, &to9p_sys ); |
| 4191 | | centronics_config( 0, &to9_centronics ); |
| 4191 | centronics_config( machine, 0, &to9_centronics ); |
| 4192 | 4192 | to7_game_init(machine); |
| 4193 | 4193 | to8_floppy_init( machine ); |
| 4194 | 4194 | to9_kbd_init(machine); |
| r3903 | r3904 | |
| 4398 | 4398 | { |
| 4399 | 4399 | /* centronics data */ |
| 4400 | 4400 | LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data )); |
| 4401 | | centronics_write_data( 0, data ); |
| 4401 | centronics_write_data( space->machine, 0, data ); |
| 4402 | 4402 | } |
| 4403 | 4403 | |
| 4404 | 4404 | |
| 4405 | 4405 | |
| 4406 | 4406 | static READ8_HANDLER ( mo6_game_cb1_in ) |
| 4407 | 4407 | { |
| 4408 | | int dtr = ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY ) ? 0 : 1; |
| 4408 | int dtr = ( centronics_read_handshake( space->machine, 0 ) & CENTRONICS_NOT_BUSY ) ? 0 : 1; |
| 4409 | 4409 | /* note: printer busy signal replaces button */ |
| 4410 | 4410 | LOG (( "$%04x %f mo6_game_cb1_in: CENTRONICS get dtr=%i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), dtr )); |
| 4411 | 4411 | return dtr; |
| r3903 | r3904 | |
| 4417 | 4417 | { |
| 4418 | 4418 | /* centronics strobe */ |
| 4419 | 4419 | LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data )); |
| 4420 | | centronics_write_handshake( 0, data ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE ); |
| 4420 | centronics_write_handshake( space->machine, 0, data ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE ); |
| 4421 | 4421 | } |
| 4422 | 4422 | |
| 4423 | 4423 | |
| r3903 | r3904 | |
| 4772 | 4772 | /* subsystems */ |
| 4773 | 4773 | thom_irq_init(machine); |
| 4774 | 4774 | pia_config( machine, THOM_PIA_SYS, &mo6_sys ); |
| 4775 | | centronics_config( 0, &to9_centronics ); |
| 4775 | centronics_config( machine, 0, &to9_centronics ); |
| 4776 | 4776 | mo6_game_init(machine); |
| 4777 | 4777 | to7_floppy_init( machine, mem + 0x30000 ); |
| 4778 | 4778 | to9_palette_init(machine); |
| r3903 | r3904 | |
| 4866 | 4866 | { |
| 4867 | 4867 | |
| 4868 | 4868 | case 1: |
| 4869 | | return centronics_read_data( 0 ); |
| 4869 | return centronics_read_data( space->machine, 0 ); |
| 4870 | 4870 | |
| 4871 | 4871 | case 3: |
| 4872 | 4872 | /* TODO: understand other bits */ |
| 4873 | | if ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY ) |
| 4873 | if ( centronics_read_handshake( space->machine, 0 ) & CENTRONICS_NOT_BUSY ) |
| 4874 | 4874 | return 0; |
| 4875 | 4875 | else |
| 4876 | 4876 | return 0x80; |
| r3903 | r3904 | |
| 4889 | 4889 | { |
| 4890 | 4890 | |
| 4891 | 4891 | case 1: |
| 4892 | | centronics_write_data( 0, data ); |
| 4892 | centronics_write_data( space->machine, 0, data ); |
| 4893 | 4893 | break; |
| 4894 | 4894 | |
| 4895 | 4895 | case 3: |
| 4896 | 4896 | /* TODO: understand other bits */ |
| 4897 | | centronics_write_handshake( 0, ( data & 8 ) ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE ); |
| 4897 | centronics_write_handshake( space->machine, 0, ( data & 8 ) ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE ); |
| 4898 | 4898 | break; |
| 4899 | 4899 | |
| 4900 | 4900 | default: |
| r3903 | r3904 | |
| 5039 | 5039 | /* subsystems */ |
| 5040 | 5040 | thom_irq_init(machine); |
| 5041 | 5041 | pia_config( machine, THOM_PIA_SYS, &mo5nr_sys ); |
| 5042 | | centronics_config( 0, &to9_centronics ); |
| 5042 | centronics_config( machine, 0, &to9_centronics ); |
| 5043 | 5043 | mo5nr_game_init(machine); |
| 5044 | 5044 | to7_floppy_init( machine, mem + 0x30000 ); |
| 5045 | 5045 | to9_palette_init(machine); |
src/mess/machine/oric.c
| r3903 | r3904 | |
| 19 | 19 | |
| 20 | 20 | #include <stdio.h> |
| 21 | 21 | #include "driver.h" |
| 22 | | #include "deprecat.h" |
| 23 | 22 | #include "includes/oric.h" |
| 24 | 23 | #include "machine/wd17xx.h" |
| 25 | 24 | #include "machine/6522via.h" |
| r3903 | r3904 | |
| 247 | 246 | if (oric_psg_control==0) |
| 248 | 247 | { |
| 249 | 248 | /* if psg not selected, write to printer */ |
| 250 | | centronics_write_data(0,data); |
| 249 | centronics_write_data(device->machine,0,data); |
| 251 | 250 | } |
| 252 | 251 | } |
| 253 | 252 | |
| r3903 | r3904 | |
| 342 | 341 | } |
| 343 | 342 | |
| 344 | 343 | /* assumption: select is tied low */ |
| 345 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 346 | | centronics_write_handshake(0, printer_handshake, CENTRONICS_STROBE); |
| 344 | centronics_write_handshake(device->machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 345 | centronics_write_handshake(device->machine, 0, printer_handshake, CENTRONICS_STROBE); |
| 347 | 346 | |
| 348 | 347 | oric_psg_connection_refresh(device->machine); |
| 349 | 348 | previous_portb_data = data; |
| 350 | 349 | |
| 351 | 350 | } |
| 352 | 351 | |
| 353 | | static void oric_printer_handshake_in(int number, int data, int mask) |
| 352 | static void oric_printer_handshake_in(running_machine *machine,int number, int data, int mask) |
| 354 | 353 | { |
| 355 | 354 | int acknowledge; |
| 356 | | const device_config *via_0 = device_list_find_by_tag(Machine->config->devicelist, VIA6522, "via6522_0"); |
| 355 | const device_config *via_0 = device_list_find_by_tag(machine->config->devicelist, VIA6522, "via6522_0"); |
| 357 | 356 | |
| 358 | 357 | acknowledge = 1; |
| 359 | 358 | |
| r3903 | r3904 | |
| 1148 | 1147 | |
| 1149 | 1148 | timer_pulse(machine, ATTOTIME_IN_HZ(4800), NULL, 0, oric_refresh_tape); |
| 1150 | 1149 | |
| 1151 | | centronics_config(0, oric_cent_config); |
| 1150 | centronics_config(machine, 0, oric_cent_config); |
| 1152 | 1151 | /* assumption: select is tied low */ |
| 1153 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1152 | centronics_write_handshake(machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1154 | 1153 | via_ca1_w(via_0, 0, 1); |
| 1155 | 1154 | } |
| 1156 | 1155 | |
src/mess/machine/pclpt.c
| r3903 | r3904 | |
| 68 | 68 | { |
| 69 | 69 | case 0: |
| 70 | 70 | if (This->device->write_data) |
| 71 | | This->device->write_data(n, data); |
| 71 | This->device->write_data(machine, n, data); |
| 72 | 72 | This->data = data; |
| 73 | 73 | LPT_LOG(1,"LPT_data_w",("LPT%d $%02x\n", n, data)); |
| 74 | 74 | break; |
| r3903 | r3904 | |
| 84 | 84 | if (data&CONTROL_NO_RESET) lines|=CENTRONICS_NO_RESET; |
| 85 | 85 | if (data&CONTROL_AUTOLINEFEED) lines|=CENTRONICS_AUTOLINEFEED; |
| 86 | 86 | if (data&CONTROL_STROBE) lines|=CENTRONICS_STROBE; |
| 87 | | This->device->handshake_out(n, lines, CENTRONICS_SELECT |
| 87 | This->device->handshake_out(machine, n, lines, CENTRONICS_SELECT |
| 88 | 88 | |CENTRONICS_NO_RESET |
| 89 | 89 | |CENTRONICS_AUTOLINEFEED |
| 90 | 90 | |CENTRONICS_STROBE); |
| r3903 | r3904 | |
| 103 | 103 | { |
| 104 | 104 | case 0: |
| 105 | 105 | if (This->device->read_data) |
| 106 | | data=This->device->read_data(n); |
| 106 | data=This->device->read_data(machine,n); |
| 107 | 107 | else |
| 108 | 108 | data = This->data; |
| 109 | 109 | LPT_LOG(1,"LPT_data_r",("LPT%d $%02x\n", n, data)); |
| 110 | 110 | break; |
| 111 | 111 | case 1: |
| 112 | 112 | if (This->device&&This->device->handshake_in) { |
| 113 | | int lines=This->device->handshake_in(n); |
| 113 | int lines=This->device->handshake_in(machine,n); |
| 114 | 114 | data=0; |
| 115 | 115 | if (lines&CENTRONICS_NOT_BUSY) data|=STATUS_NOT_BUSY; |
| 116 | 116 | if (lines&CENTRONICS_ACKNOWLEDGE) data|=STATUS_ACKNOWLEDGE; |
| r3903 | r3904 | |
| 139 | 139 | return data; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | | void pc_lpt_handshake_in(int nr, int data, int mask) |
| 142 | void pc_lpt_handshake_in(running_machine *machine,int nr, int data, int mask) |
| 143 | 143 | { |
| 144 | 144 | PC_LPT *This=LPT+nr; |
| 145 | 145 | int neu=(data&mask)|(This->status&~mask); |
src/mess/machine/centroni.c
| r3903 | r3904 | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | | #include "deprecat.h" |
| 9 | 8 | #include "centroni.h" |
| 10 | 9 | #include "devices/printer.h" |
| 11 | 10 | |
| r3903 | r3904 | |
| 36 | 35 | |
| 37 | 36 | static TIMER_CALLBACK(centronics_timer_callback); |
| 38 | 37 | |
| 39 | | void centronics_config(int nr, const CENTRONICS_CONFIG *config) |
| 38 | void centronics_config(running_machine *machine,int nr, const CENTRONICS_CONFIG *config) |
| 40 | 39 | { |
| 41 | 40 | CENTRONICS *This=cent+nr; |
| 42 | 41 | This->config=config; |
| 43 | | This->timer = timer_alloc(Machine, centronics_timer_callback, NULL); |
| 42 | This->timer = timer_alloc(machine, centronics_timer_callback, NULL); |
| 44 | 43 | } |
| 45 | 44 | |
| 46 | | void centronics_write_data(int nr, UINT8 data) |
| 45 | void centronics_write_data(running_machine *machine,int nr, UINT8 data) |
| 47 | 46 | { |
| 48 | 47 | CENTRONICS *This=cent+nr; |
| 49 | 48 | This->data=data; |
| 50 | 49 | } |
| 51 | 50 | |
| 52 | | UINT8 centronics_read_data(int nr) |
| 51 | UINT8 centronics_read_data(running_machine *machine,int nr) |
| 53 | 52 | { |
| 54 | 53 | CENTRONICS *This=cent+nr; |
| 55 | 54 | return This->data; |
| r3903 | r3904 | |
| 68 | 67 | |
| 69 | 68 | /* if callback is specified, call it with the new state of the outputs from the printer */ |
| 70 | 69 | if (This->config->handshake_out) |
| 71 | | This->config->handshake_out(nr, This->control, This->new_control_mask); |
| 70 | This->config->handshake_out(machine, nr, This->control, This->new_control_mask); |
| 72 | 71 | |
| 73 | 72 | /* phase 2: schedule ack end */ |
| 74 | 73 | if ( This->control & CENTRONICS_ACKNOWLEDGE ) |
| r3903 | r3904 | |
| 115 | 114 | return device_list_find_by_tag(machine->config->devicelist, PRINTER, tag); |
| 116 | 115 | } |
| 117 | 116 | |
| 118 | | void centronics_write_handshake(int nr, int data, int mask) |
| 117 | void centronics_write_handshake(running_machine *machine,int nr, int data, int mask) |
| 119 | 118 | { |
| 120 | 119 | CENTRONICS *This=cent+nr; |
| 121 | 120 | const device_config *device; |
| r3903 | r3904 | |
| 133 | 132 | timer_adjust_oneshot(This->timer, ATTOTIME_IN_USEC(5), nr); |
| 134 | 133 | |
| 135 | 134 | /* output */ |
| 136 | | device = printer_device(Machine, nr); |
| 135 | device = printer_device(machine, nr); |
| 137 | 136 | if (device != NULL) |
| 138 | 137 | printer_output(device, This->data); |
| 139 | 138 | } |
| r3903 | r3904 | |
| 142 | 141 | This->control=neu; |
| 143 | 142 | } |
| 144 | 143 | |
| 145 | | int centronics_read_handshake(int nr) |
| 144 | int centronics_read_handshake(running_machine *machine,int nr) |
| 146 | 145 | { |
| 147 | 146 | CENTRONICS *This=cent+nr; |
| 148 | 147 | UINT8 data=0; |
| r3903 | r3904 | |
| 161 | 160 | |
| 162 | 161 | data |= CENTRONICS_NO_ERROR; |
| 163 | 162 | |
| 164 | | device = printer_device(Machine, nr); |
| 163 | device = printer_device(machine, nr); |
| 165 | 164 | if ((device == NULL) || !printer_is_ready(device)) |
| 166 | 165 | data |= CENTRONICS_NO_PAPER; |
| 167 | 166 | |
src/mess/machine/centroni.h
| r3903 | r3904 | |
| 21 | 21 | } PRINTER_TYPE; |
| 22 | 22 | |
| 23 | 23 | typedef struct { |
| 24 | | UINT8 (*read_data)(int nr); |
| 25 | | void (*write_data)(int nr, UINT8 data); |
| 26 | | int (*handshake_in)(int nr); |
| 27 | | void (*handshake_out)(int nr, int data, int mask); |
| 24 | UINT8 (*read_data)(running_machine *machine,int nr); |
| 25 | void (*write_data)(running_machine *machine,int nr, UINT8 data); |
| 26 | int (*handshake_in)(running_machine *machine,int nr); |
| 27 | void (*handshake_out)(running_machine *machine,int nr, int data, int mask); |
| 28 | 28 | } CENTRONICS_DEVICE; |
| 29 | 29 | |
| 30 | 30 | |
| r3903 | r3904 | |
| 43 | 43 | |
| 44 | 44 | typedef struct { |
| 45 | 45 | PRINTER_TYPE type; |
| 46 | | void (*handshake_out)(int n, int data, int mask); |
| 46 | void (*handshake_out)(running_machine *machine,int n, int data, int mask); |
| 47 | 47 | } CENTRONICS_CONFIG; |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | /*----------- defined in machine/centroni.c -----------*/ |
| 51 | 51 | |
| 52 | | void centronics_config(int nr, const CENTRONICS_CONFIG *config); |
| 52 | void centronics_config(running_machine *machine,int nr, const CENTRONICS_CONFIG *config); |
| 53 | 53 | |
| 54 | | void centronics_write_data(int nr, UINT8 data); |
| 55 | | void centronics_write_handshake(int nr, int data, int mask); |
| 56 | | UINT8 centronics_read_data(int nr); |
| 57 | | int centronics_read_handshake(int nr); |
| 54 | void centronics_write_data(running_machine *machine,int nr, UINT8 data); |
| 55 | void centronics_write_handshake(running_machine *machine,int nr, int data, int mask); |
| 56 | UINT8 centronics_read_data(running_machine *machine,int nr); |
| 57 | int centronics_read_handshake(running_machine *machine,int nr); |
| 58 | 58 | |
| 59 | 59 | extern const CENTRONICS_DEVICE CENTRONICS_PRINTER_DEVICE; |
| 60 | 60 | |
src/mess/drivers/nc.c
| r3903 | r3904 | |
| 94 | 94 | ******************************************************************************/ |
| 95 | 95 | |
| 96 | 96 | #include "driver.h" |
| 97 | | #include "deprecat.h" |
| 98 | 97 | #include "includes/nc.h" |
| 99 | 98 | #include "includes/serial.h" /* for serial data transfers */ |
| 100 | 99 | #include "machine/msm8251.h" /* for NC100 uart */ |
| r3903 | r3904 | |
| 122 | 121 | receive clock and transmit clock inputs */ |
| 123 | 122 | static emu_timer *nc_serial_timer; |
| 124 | 123 | |
| 125 | | static void nc_printer_update(int); |
| 124 | static void nc_printer_update(running_machine *machine,int); |
| 126 | 125 | |
| 127 | 126 | UINT8 nc_type; |
| 128 | 127 | |
| r3903 | r3904 | |
| 793 | 792 | static WRITE8_HANDLER(nc_uart_control_w) |
| 794 | 793 | { |
| 795 | 794 | /* update printer state */ |
| 796 | | nc_printer_update(data); |
| 795 | nc_printer_update(space->machine, data); |
| 797 | 796 | |
| 798 | 797 | /* on/off changed state? */ |
| 799 | 798 | if (((nc_uart_control ^ data) & (1<<3))!=0) |
| r3903 | r3904 | |
| 818 | 817 | static WRITE8_HANDLER(nc_printer_data_w) |
| 819 | 818 | { |
| 820 | 819 | LOG(("printer write %02x\n",data)); |
| 821 | | centronics_write_data(0,data); |
| 820 | centronics_write_data(space->machine, 0,data); |
| 822 | 821 | } |
| 823 | 822 | |
| 824 | 823 | /* same for nc100 and nc200 */ |
| 825 | | static void nc_printer_update(int port0x030) |
| 824 | static void nc_printer_update(running_machine *machine,int port0x030) |
| 826 | 825 | { |
| 827 | 826 | int handshake = 0; |
| 828 | 827 | |
| r3903 | r3904 | |
| 831 | 830 | handshake = CENTRONICS_STROBE; |
| 832 | 831 | } |
| 833 | 832 | /* assumption: select is tied low */ |
| 834 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 835 | | centronics_write_handshake(0, handshake, CENTRONICS_STROBE); |
| 833 | centronics_write_handshake(machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 834 | centronics_write_handshake(machine, 0, handshake, CENTRONICS_STROBE); |
| 836 | 835 | } |
| 837 | 836 | |
| 838 | 837 | /********************************************************************************************************/ |
| r3903 | r3904 | |
| 935 | 934 | nc100_rxrdy_callback |
| 936 | 935 | }; |
| 937 | 936 | |
| 938 | | static void nc100_printer_handshake_in(int number, int data, int mask) |
| 937 | static void nc100_printer_handshake_in(running_machine *machine,int number, int data, int mask) |
| 939 | 938 | { |
| 940 | 939 | nc_irq_status &= ~(1<<2); |
| 941 | 940 | |
| r3903 | r3904 | |
| 947 | 946 | } |
| 948 | 947 | } |
| 949 | 948 | /* trigger an int if the irq is set */ |
| 950 | | nc_update_interrupts(Machine); |
| 949 | nc_update_interrupts(machine); |
| 951 | 950 | } |
| 952 | 951 | |
| 953 | 952 | static const CENTRONICS_CONFIG nc100_cent_config[1]={ |
| r3903 | r3904 | |
| 968 | 967 | |
| 969 | 968 | nc_common_init_machine(machine); |
| 970 | 969 | |
| 971 | | centronics_config(0, nc100_cent_config); |
| 970 | centronics_config(machine, 0, nc100_cent_config); |
| 972 | 971 | /* assumption: select is tied low */ |
| 973 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 972 | centronics_write_handshake(machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 974 | 973 | |
| 975 | 974 | nc_common_open_stream_for_reading(machine); |
| 976 | 975 | |
| r3903 | r3904 | |
| 1042 | 1041 | |
| 1043 | 1042 | |
| 1044 | 1043 | /* assumption: select is tied low */ |
| 1045 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1044 | centronics_write_handshake(space->machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1046 | 1045 | |
| 1047 | | printer_handshake = centronics_read_handshake(0); |
| 1046 | printer_handshake = centronics_read_handshake(space->machine, 0); |
| 1048 | 1047 | |
| 1049 | 1048 | nc_card_battery_status |=(1<<1); |
| 1050 | 1049 | |
| r3903 | r3904 | |
| 1247 | 1246 | } |
| 1248 | 1247 | #endif |
| 1249 | 1248 | |
| 1250 | | static void nc200_printer_handshake_in(int number, int data, int mask) |
| 1249 | static void nc200_printer_handshake_in(running_machine *machine,int number, int data, int mask) |
| 1251 | 1250 | { |
| 1252 | 1251 | nc_irq_status &= ~(1<<0); |
| 1253 | 1252 | |
| r3903 | r3904 | |
| 1259 | 1258 | } |
| 1260 | 1259 | } |
| 1261 | 1260 | /* trigger an int if the irq is set */ |
| 1262 | | nc_update_interrupts(Machine); |
| 1261 | nc_update_interrupts(machine); |
| 1263 | 1262 | } |
| 1264 | 1263 | |
| 1265 | 1264 | static const CENTRONICS_CONFIG nc200_cent_config[1]={ |
| r3903 | r3904 | |
| 1379 | 1378 | |
| 1380 | 1379 | nc200_uart_interrupt_irq = 0; |
| 1381 | 1380 | |
| 1382 | | centronics_config(0, nc200_cent_config); |
| 1381 | centronics_config(machine, 0, nc200_cent_config); |
| 1383 | 1382 | /* assumption: select is tied low */ |
| 1384 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1383 | centronics_write_handshake(machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1385 | 1384 | |
| 1386 | 1385 | nc_common_open_stream_for_reading(machine); |
| 1387 | 1386 | if (file) |
| r3903 | r3904 | |
| 1470 | 1469 | int printer_handshake; |
| 1471 | 1470 | |
| 1472 | 1471 | /* assumption: select is tied low */ |
| 1473 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1472 | centronics_write_handshake(space->machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1474 | 1473 | |
| 1475 | | printer_handshake = centronics_read_handshake(0); |
| 1474 | printer_handshake = centronics_read_handshake(space->machine, 0); |
| 1476 | 1475 | |
| 1477 | 1476 | nc200_printer_status |=(1<<0); |
| 1478 | 1477 | |
src/mess/drivers/sord.c
| r3903 | r3904 | |
| 351 | 351 | if (cassette_input(cassette_device_image(space->machine)) >=0) |
| 352 | 352 | data |=(1<<0); |
| 353 | 353 | |
| 354 | | printer_handshake = centronics_read_handshake(0); |
| 354 | printer_handshake = centronics_read_handshake(space->machine, 0); |
| 355 | 355 | |
| 356 | 356 | /* if printer is not online, it is busy */ |
| 357 | 357 | if ((printer_handshake & CENTRONICS_ONLINE)!=0) |
| r3903 | r3904 | |
| 394 | 394 | cassette_output(cassette_device_image(space->machine), (data & (1<<0)) ? -1.0 : 1.0); |
| 395 | 395 | |
| 396 | 396 | /* assumption: select is tied low */ |
| 397 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 398 | | centronics_write_handshake(0, handshake, CENTRONICS_STROBE); |
| 397 | centronics_write_handshake(space->machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 398 | centronics_write_handshake(space->machine, 0, handshake, CENTRONICS_STROBE); |
| 399 | 399 | |
| 400 | 400 | logerror("sys write: %02x\n",data); |
| 401 | 401 | } |
| r3903 | r3904 | |
| 403 | 403 | static WRITE8_HANDLER(sord_printer_w) |
| 404 | 404 | { |
| 405 | 405 | // logerror("centronics w: %02x\n",data); |
| 406 | | centronics_write_data(0,data); |
| 406 | centronics_write_data(space->machine, 0,data); |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | static ADDRESS_MAP_START( sord_m5_io , ADDRESS_SPACE_IO, 8) |
| r3903 | r3904 | |
| 469 | 469 | /* should be done in a special callback to work properly! */ |
| 470 | 470 | memory_set_bankptr(machine, 1, memory_region(machine, "user1")); |
| 471 | 471 | |
| 472 | | centronics_config(0, sordm5_cent_config); |
| 472 | centronics_config(machine, 0, sordm5_cent_config); |
| 473 | 473 | /* assumption: select is tied low */ |
| 474 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 474 | centronics_write_handshake(machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | /* 2008-05 FP: |
src/mess/drivers/super80.c
| r3903 | r3904 | |
| 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(int number, int data, int mask) |
| 457 | static void super80_printer_handshake_in(running_machine *machine,int number, int data, int mask) |
| 458 | 458 | { |
| 459 | 459 | if (mask & CENTRONICS_ACKNOWLEDGE) |
| 460 | 460 | { |
| r3903 | r3904 | |
| 523 | 523 | static WRITE8_HANDLER( super80_dc_w ) |
| 524 | 524 | { |
| 525 | 525 | /* hardware strobe driven from port select, bit 7..0 = data */ |
| 526 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 527 | | centronics_write_handshake(0, 1, CENTRONICS_STROBE); |
| 528 | | centronics_write_data(0, data); |
| 529 | | centronics_write_handshake(0, 0, CENTRONICS_STROBE); |
| 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); |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | static UINT8 last_data; |
| r3903 | r3904 | |
| 1000 | 1000 | static MACHINE_RESET( super80 ) |
| 1001 | 1001 | { |
| 1002 | 1002 | super80_z80pio = device_list_find_by_tag( machine->config->devicelist, Z80PIO, "z80pio" ); |
| 1003 | | centronics_config(0, super80_cent_config); |
| 1003 | centronics_config(machine,0, super80_cent_config); |
| 1004 | 1004 | /* assumption: select is tied low */ |
| 1005 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1005 | centronics_write_handshake(machine,0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1006 | 1006 | timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, super80_reset); |
| 1007 | 1007 | memory_set_bank(machine, 1, 1); |
| 1008 | 1008 | } |
src/mess/drivers/atarist.c
| r3903 | r3904 | |
| 1299 | 1299 | // 0x08 = RTS |
| 1300 | 1300 | // 0x10 = DTR |
| 1301 | 1301 | |
| 1302 | | centronics_write_handshake(0, BIT(data, 5) ? 0 : CENTRONICS_STROBE, CENTRONICS_STROBE); |
| 1302 | centronics_write_handshake(space->machine,0, BIT(data, 5) ? 0 : CENTRONICS_STROBE, CENTRONICS_STROBE); |
| 1303 | 1303 | |
| 1304 | 1304 | // 0x40 = General Purpose Output |
| 1305 | 1305 | // 0x80 = Reserved |
| r3903 | r3904 | |
| 1307 | 1307 | |
| 1308 | 1308 | static WRITE8_HANDLER( ym2149_port_b_w ) |
| 1309 | 1309 | { |
| 1310 | | centronics_write_data(0, data); |
| 1310 | centronics_write_data(space->machine,0, data); |
| 1311 | 1311 | } |
| 1312 | 1312 | |
| 1313 | 1313 | static const ay8910_interface ym2149_interface = |
| r3903 | r3904 | |
| 1372 | 1372 | |
| 1373 | 1373 | atarist_state *state = device->machine->driver_data; |
| 1374 | 1374 | |
| 1375 | | UINT8 data = (centronics_read_handshake(0) & CENTRONICS_NOT_BUSY) >> 7; |
| 1375 | UINT8 data = (centronics_read_handshake(device->machine,0) & CENTRONICS_NOT_BUSY) >> 7; |
| 1376 | 1376 | |
| 1377 | 1377 | mc68901_tai_w(device, data & 0x01); |
| 1378 | 1378 | |
| r3903 | r3904 | |
| 1499 | 1499 | atarist_configure_memory(machine); |
| 1500 | 1500 | |
| 1501 | 1501 | /* configure devices */ |
| 1502 | | centronics_config(0, atarist_centronics_config); |
| 1502 | centronics_config(machine, 0, atarist_centronics_config); |
| 1503 | 1503 | |
| 1504 | 1504 | /* set CPU interrupt callback */ |
| 1505 | 1505 | cpu_set_irq_callback(machine->cpu[0], atarist_int_ack); |
| r3903 | r3904 | |
| 1542 | 1542 | |
| 1543 | 1543 | atarist_state *state = device->machine->driver_data; |
| 1544 | 1544 | |
| 1545 | | UINT8 data = (centronics_read_handshake(0) & CENTRONICS_NOT_BUSY) >> 7; |
| 1545 | UINT8 data = (centronics_read_handshake(device->machine,0) & CENTRONICS_NOT_BUSY) >> 7; |
| 1546 | 1546 | |
| 1547 | 1547 | data |= (state->acia_irq << 4); |
| 1548 | 1548 | data |= (state->fdc_irq << 5); |
| r3903 | r3904 | |
| 1594 | 1594 | atarist_configure_memory(machine); |
| 1595 | 1595 | |
| 1596 | 1596 | /* configure devices */ |
| 1597 | | centronics_config(0, atarist_centronics_config); |
| 1597 | centronics_config(machine, 0, atarist_centronics_config); |
| 1598 | 1598 | |
| 1599 | 1599 | /* set CPU interrupt callback */ |
| 1600 | 1600 | cpu_set_irq_callback(machine->cpu[0], atarist_int_ack); |
| r3903 | r3904 | |
| 1669 | 1669 | // 0x08 = RTS |
| 1670 | 1670 | // 0x10 = DTR |
| 1671 | 1671 | |
| 1672 | | centronics_write_handshake(0, (data & 0x20) ? 0 : CENTRONICS_STROBE, CENTRONICS_STROBE); |
| 1672 | centronics_write_handshake(space->machine, 0, (data & 0x20) ? 0 : CENTRONICS_STROBE, CENTRONICS_STROBE); |
| 1673 | 1673 | |
| 1674 | 1674 | // 0x40 = IDE RESET |
| 1675 | 1675 | // 0x80 = FDD_DENSE_SEL |
| r3903 | r3904 | |
| 1718 | 1718 | |
| 1719 | 1719 | atarist_state *state = device->machine->driver_data; |
| 1720 | 1720 | |
| 1721 | | UINT8 data = (centronics_read_handshake(0) & CENTRONICS_NOT_BUSY) >> 7; |
| 1721 | UINT8 data = (centronics_read_handshake(device->machine,0) & CENTRONICS_NOT_BUSY) >> 7; |
| 1722 | 1722 | |
| 1723 | 1723 | data |= (state->acia_irq << 4); |
| 1724 | 1724 | data |= (state->fdc_irq << 5); |
| r3903 | r3904 | |
| 1748 | 1748 | stbook_configure_memory(machine); |
| 1749 | 1749 | |
| 1750 | 1750 | /* configure devices */ |
| 1751 | | centronics_config(0, atarist_centronics_config); |
| 1751 | centronics_config(machine, 0, atarist_centronics_config); |
| 1752 | 1752 | rp5c15_init(machine, &rtc_intf); |
| 1753 | 1753 | |
| 1754 | 1754 | /* set CPU interrupt callback */ |
src/mess/drivers/exidy.c
| r3903 | r3904 | |
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | | static void exidy_printer_handshake_in(int number, int data, int mask) |
| 312 | static void exidy_printer_handshake_in(running_machine *machine,int number, int data, int mask) |
| 313 | 313 | { |
| 314 | 314 | if (mask & CENTRONICS_ACKNOWLEDGE) |
| 315 | 315 | { |
| r3903 | r3904 | |
| 356 | 356 | |
| 357 | 357 | exidy_ay31015 = device_list_find_by_tag( machine->config->devicelist, AY31015, "ay_3_1015" ); |
| 358 | 358 | |
| 359 | | centronics_config(0, exidy_cent_config); |
| 359 | centronics_config(machine, 0, exidy_cent_config); |
| 360 | 360 | /* assumption: select is tied low */ |
| 361 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 361 | centronics_write_handshake(machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 362 | 362 | exidy_fe_port_w(space, 0, 0); |
| 363 | 363 | |
| 364 | 364 | timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, exidy_reset); |
| r3903 | r3904 | |
| 513 | 513 | |
| 514 | 514 | case 2: /* Centronics 7-bit printer */ |
| 515 | 515 | /* bit 7 = strobe, bit 6..0 = data */ |
| 516 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 517 | | centronics_write_handshake(0, (~data>>7) & 0x01, CENTRONICS_STROBE); |
| 518 | | centronics_write_data(0, data & 0x7f); |
| 516 | centronics_write_handshake(space->machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 517 | centronics_write_handshake(space->machine, 0, (~data>>7) & 0x01, CENTRONICS_STROBE); |
| 518 | centronics_write_data(space->machine, 0, data & 0x7f); |
| 519 | 519 | break; |
| 520 | 520 | |
| 521 | 521 | case 4: /* 8-bit parallel output */ |
| 522 | 522 | /* hardware strobe driven from port select, bit 7..0 = data */ |
| 523 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 524 | | centronics_write_handshake(0, 1, CENTRONICS_STROBE); |
| 525 | | centronics_write_data(0, data); |
| 526 | | centronics_write_handshake(0, 0, CENTRONICS_STROBE); |
| 523 | centronics_write_handshake(space->machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 524 | centronics_write_handshake(space->machine, 0, 1, CENTRONICS_STROBE); |
| 525 | centronics_write_data(space->machine, 0, data); |
| 526 | centronics_write_handshake(space->machine, 0, 0, CENTRONICS_STROBE); |
| 527 | 527 | break; |
| 528 | 528 | } |
| 529 | 529 | } |
src/mess/drivers/bw2.c
| r3903 | r3904 | |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /* assumption: select is tied low */ |
| 407 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT | CENTRONICS_NO_RESET); |
| 408 | | centronics_write_handshake(0, BIT(data, 7) ? 0 : CENTRONICS_STROBE, CENTRONICS_STROBE); |
| 407 | centronics_write_handshake(device->machine,0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT | CENTRONICS_NO_RESET); |
| 408 | centronics_write_handshake(device->machine,0, BIT(data, 7) ? 0 : CENTRONICS_STROBE, CENTRONICS_STROBE); |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | static READ8_DEVICE_HANDLER( bw2_ppi8255_b_r ) |
| r3903 | r3904 | |
| 473 | 473 | UINT8 data = 0; |
| 474 | 474 | |
| 475 | 475 | /* assumption: select is tied low */ |
| 476 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT | CENTRONICS_NO_RESET); |
| 477 | | data = ((centronics_read_handshake(0) & CENTRONICS_NOT_BUSY) == 0) ? 0x10 : 0; |
| 476 | centronics_write_handshake(device->machine,0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT | CENTRONICS_NO_RESET); |
| 477 | data = ((centronics_read_handshake(device->machine,0) & CENTRONICS_NOT_BUSY) == 0) ? 0x10 : 0; |
| 478 | 478 | |
| 479 | 479 | data |= state->mfdbk << 5; |
| 480 | 480 | |
| r3903 | r3904 | |
| 552 | 552 | |
| 553 | 553 | static WRITE8_HANDLER( bw2_centronics_data_w ) |
| 554 | 554 | { |
| 555 | | centronics_write_data(0, data); |
| 555 | centronics_write_data(space->machine,0, data); |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | /* Video */ |
| r3903 | r3904 | |
| 598 | 598 | device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x"); |
| 599 | 599 | |
| 600 | 600 | |
| 601 | | centronics_config(0, bw2_centronics_config); |
| 601 | centronics_config(machine,0, bw2_centronics_config); |
| 602 | 602 | |
| 603 | 603 | wd17xx_set_density(fdc,DEN_MFM_LO); |
| 604 | 604 | |
src/mess/drivers/einstein.c
| r3903 | r3904 | |
| 452 | 452 | handshake = CENTRONICS_STROBE; |
| 453 | 453 | |
| 454 | 454 | /* ardy is connected to strobe */ |
| 455 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 456 | | centronics_write_handshake(0, handshake, CENTRONICS_STROBE); |
| 455 | centronics_write_handshake(device->machine,0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 456 | centronics_write_handshake(device->machine,0, handshake, CENTRONICS_STROBE); |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | static WRITE8_DEVICE_HANDLER( einstein_pio_port_a_w ) |
| 460 | 460 | { |
| 461 | | centronics_write_data(0,data); |
| 461 | centronics_write_data(device->machine,0,data); |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | |
| r3903 | r3904 | |
| 874 | 874 | |
| 875 | 875 | einstein_update_interrupts(space->machine); |
| 876 | 876 | |
| 877 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 878 | | centronics_handshake = centronics_read_handshake(0); |
| 877 | centronics_write_handshake(space->machine,0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 878 | centronics_handshake = centronics_read_handshake(space->machine,0); |
| 879 | 879 | |
| 880 | 880 | /* bit 7: 0=shift pressed */ |
| 881 | 881 | /* bit 6: 0=control pressed */ |
| r3903 | r3904 | |
| 1367 | 1367 | |
| 1368 | 1368 | |
| 1369 | 1369 | |
| 1370 | | static void einstein_printer_handshake_in(int number, int data, int mask) |
| 1370 | static void einstein_printer_handshake_in(running_machine *machine,int number, int data, int mask) |
| 1371 | 1371 | { |
| 1372 | 1372 | if (mask & CENTRONICS_ACKNOWLEDGE) |
| 1373 | 1373 | { |
| r3903 | r3904 | |
| 1464 | 1464 | einstein_ctc_trigger = 0; |
| 1465 | 1465 | timer_pulse(machine, ATTOTIME_IN_HZ(2000000), (void *)device_list_find_by_tag(machine->config->devicelist, Z80CTC, "z80ctc"), 0, einstein_ctc_trigger_callback); |
| 1466 | 1466 | |
| 1467 | | centronics_config(0, einstein_cent_config); |
| 1467 | centronics_config(machine, 0, einstein_cent_config); |
| 1468 | 1468 | /* assumption: select is tied low */ |
| 1469 | | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1469 | centronics_write_handshake(machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1470 | 1470 | |
| 1471 | 1471 | } |
| 1472 | 1472 | |