Previous 15994 Revisions Next

r3904 Saturday 20th December, 2008 at 09:15:34 UTC by Miodrag Milanović
Removed some deprecat.h dependency
[src/mess/drivers]atarist.c bw2.c einstein.c exidy.c nc.c pcw16.c sg1000.c sord.c super80.c
[src/mess/includes]pclpt.h
[src/mess/machine]centroni.c centroni.h oric.c pc.c pclpt.c thomson.c

src/mess/includes/pclpt.h
r3903r3904
3535
3636/* line definitions in centroni.h */
3737/* only those lines in mask are modified */
38void pc_lpt_handshake_in(int nr, int data, int mask);
38void pc_lpt_handshake_in(running_machine *machine,int nr, int data, int mask);
3939
4040READ8_HANDLER ( pc_parallelport0_r );
4141READ8_HANDLER ( pc_parallelport1_r );
src/mess/machine/thomson.c
r3903r3904
748748
749749
750750
751static void to7_io_ack ( int n, int data, int mask )
751static void to7_io_ack ( running_machine *machine, int n, int data, int mask )
752752{
753753   /* acknowledge from centronics printer to PIA */
754754   int ack = (data & CENTRONICS_ACKNOWLEDGE) ? 1 : 0;
r3903r3904
784784   if ( to7_io_mode(space->machine) == TO7_IO_RS232 )
785785      cts = to7_io_line.input_state & SERIAL_STATE_CTS ? 0 : 1;
786786   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;
788788
789789   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 ));
790790
r3903r3904
799799
800800   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 ));
801801
802   centronics_write_data( 0, data );
802   centronics_write_data( space->machine, 0, data );
803803}
804804
805805
r3903r3904
810810
811811   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 ));
812812
813   centronics_write_handshake( 0, data ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE );
813   centronics_write_handshake( space->machine, 0, data ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE );
814814}
815815
816816
r3903r3904
841841static void thom_centronics_reset( running_machine *machine )
842842{
843843   centronics_write_handshake
844      ( 0,
844      ( machine, 0,
845845        CENTRONICS_SELECT | CENTRONICS_NOT_BUSY | CENTRONICS_STROBE,
846846        CENTRONICS_SELECT | CENTRONICS_NO_RESET | CENTRONICS_NOT_BUSY |
847847        CENTRONICS_STROBE | CENTRONICS_ACKNOWLEDGE );
848848
849   centronics_write_handshake ( 0, CENTRONICS_NO_RESET, CENTRONICS_NO_RESET );
849   centronics_write_handshake ( machine, 0, CENTRONICS_NO_RESET, CENTRONICS_NO_RESET );
850850}
851851
852852
r3903r3904
870870{
871871   LOG (( "to7_io_init: CC 90-323 serial / parallel extension\n" ));
872872   pia_config( machine, THOM_PIA_IO, &to7_io );
873   centronics_config( 0, &to7_centronics );
873   centronics_config( machine, 0, &to7_centronics );
874874   serial_connection_init( &to7_io_line );
875875   serial_connection_set_in_callback( &to7_io_line, to7_io_in_cb );
876876}
r3903r3904
29392939   UINT8 a = pia_get_output_a( THOM_PIA_SYS );
29402940   UINT8 b = pia_get_output_b( THOM_PIA_SYS );
29412941   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 );
29442944
29452945   LOG_IO(( "$%04x %f to9_update_centronics: data=$%02X strobe=%i\n",
29462946        cpu_get_previouspc( machine->cpu[0] ), attotime_to_double(timer_get_time(machine)), data,
r3903r3904
30603060   /* subsystems */
30613061   thom_irq_init(machine);
30623062   pia_config( machine, THOM_PIA_SYS, &to9_sys );
3063   centronics_config( 0, &to9_centronics );
3063   centronics_config( machine, 0, &to9_centronics );
30643064   to7_game_init(machine);
30653065   to9_floppy_init( machine, mem + 0xe000, mem + 0x40000 );
30663066   to9_kbd_init(machine);
r3903r3904
39133913{
39143914   int lightpen = (input_port_read(device->machine, "lightpen_button") & 1) ? 2 : 0;
39153915   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;
39173917   int lock = to8_kbd_caps ? 0 : 8; /* undocumented! */
39183918   return lightpen | cass | dtr | lock;
39193919}
r3903r3904
40274027   /* subsystems */
40284028   thom_irq_init(machine);
40294029   pia_config( machine, THOM_PIA_SYS, &to8_sys );
4030   centronics_config( 0, &to9_centronics );
4030   centronics_config( machine, 0, &to9_centronics );
40314031   to7_game_init(machine);
40324032   to8_floppy_init(machine);
40334033   to8_kbd_init(machine);
r3903r3904
41034103{
41044104   int lightpen = (input_port_read(device->machine, "lightpen_button") & 1) ? 2 : 0;
41054105   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;
41074107   return lightpen | cass | dtr;
41084108}
41094109
r3903r3904
41884188   /* subsystems */
41894189   thom_irq_init(machine);
41904190   pia_config( machine, THOM_PIA_SYS, &to9p_sys );
4191   centronics_config( 0, &to9_centronics );
4191   centronics_config( machine, 0, &to9_centronics );
41924192   to7_game_init(machine);
41934193   to8_floppy_init( machine );
41944194   to9_kbd_init(machine);
r3903r3904
43984398{
43994399   /* centronics data */
44004400   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 );
44024402}
44034403
44044404
44054405
44064406static READ8_HANDLER ( mo6_game_cb1_in )
44074407{
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;
44094409   /* note: printer busy signal replaces button */
44104410   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 ));
44114411   return dtr;
r3903r3904
44174417{
44184418   /* centronics strobe */
44194419   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 );
44214421}
44224422
44234423
r3903r3904
47724772   /* subsystems */
47734773   thom_irq_init(machine);
47744774   pia_config( machine, THOM_PIA_SYS, &mo6_sys );
4775   centronics_config( 0, &to9_centronics );
4775   centronics_config( machine, 0, &to9_centronics );
47764776   mo6_game_init(machine);
47774777   to7_floppy_init( machine, mem + 0x30000 );
47784778   to9_palette_init(machine);
r3903r3904
48664866   {
48674867
48684868   case 1:
4869      return centronics_read_data( 0 );
4869      return centronics_read_data( space->machine, 0 );
48704870
48714871   case 3:
48724872      /* TODO: understand other bits */
4873      if ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY )
4873      if ( centronics_read_handshake( space->machine, 0 ) & CENTRONICS_NOT_BUSY )
48744874         return 0;
48754875      else
48764876         return 0x80;
r3903r3904
48894889   {
48904890
48914891   case 1:
4892      centronics_write_data( 0, data );
4892      centronics_write_data( space->machine, 0, data );
48934893      break;
48944894
48954895   case 3:
48964896      /* 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 );
48984898      break;
48994899
49004900   default:
r3903r3904
50395039   /* subsystems */
50405040   thom_irq_init(machine);
50415041   pia_config( machine, THOM_PIA_SYS, &mo5nr_sys );
5042   centronics_config( 0, &to9_centronics );
5042   centronics_config( machine, 0, &to9_centronics );
50435043   mo5nr_game_init(machine);
50445044   to7_floppy_init( machine, mem + 0x30000 );
50455045   to9_palette_init(machine);
src/mess/machine/oric.c
r3903r3904
1919
2020#include <stdio.h>
2121#include "driver.h"
22#include "deprecat.h"
2322#include "includes/oric.h"
2423#include "machine/wd17xx.h"
2524#include "machine/6522via.h"
r3903r3904
247246   if (oric_psg_control==0)
248247   {
249248      /* if psg not selected, write to printer */
250      centronics_write_data(0,data);
249      centronics_write_data(device->machine,0,data);
251250   }
252251}
253252
r3903r3904
342341   }
343342
344343   /* 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);
347346
348347   oric_psg_connection_refresh(device->machine);
349348   previous_portb_data = data;
350349
351350}
352351
353static void oric_printer_handshake_in(int number, int data, int mask)
352static void oric_printer_handshake_in(running_machine *machine,int number, int data, int mask)
354353{
355354   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");
357356
358357   acknowledge = 1;
359358
r3903r3904
11481147
11491148    timer_pulse(machine, ATTOTIME_IN_HZ(4800), NULL, 0, oric_refresh_tape);
11501149
1151   centronics_config(0, oric_cent_config);
1150   centronics_config(machine, 0, oric_cent_config);
11521151   /* 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);
11541153    via_ca1_w(via_0, 0, 1);
11551154}
11561155
src/mess/machine/pclpt.c
r3903r3904
6868   {
6969      case 0:
7070         if (This->device->write_data)
71            This->device->write_data(n, data);
71            This->device->write_data(machine, n, data);
7272         This->data = data;
7373         LPT_LOG(1,"LPT_data_w",("LPT%d $%02x\n", n, data));
7474         break;
r3903r3904
8484            if (data&CONTROL_NO_RESET) lines|=CENTRONICS_NO_RESET;
8585            if (data&CONTROL_AUTOLINEFEED) lines|=CENTRONICS_AUTOLINEFEED;
8686            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
8888                                 |CENTRONICS_NO_RESET
8989                                 |CENTRONICS_AUTOLINEFEED
9090                                 |CENTRONICS_STROBE);
r3903r3904
103103   {
104104      case 0:
105105         if (This->device->read_data)
106            data=This->device->read_data(n);
106            data=This->device->read_data(machine,n);
107107         else
108108            data = This->data;
109109         LPT_LOG(1,"LPT_data_r",("LPT%d $%02x\n", n, data));
110110         break;
111111      case 1:
112112         if (This->device&&This->device->handshake_in) {
113            int lines=This->device->handshake_in(n);
113            int lines=This->device->handshake_in(machine,n);
114114            data=0;
115115            if (lines&CENTRONICS_NOT_BUSY) data|=STATUS_NOT_BUSY;
116116            if (lines&CENTRONICS_ACKNOWLEDGE) data|=STATUS_ACKNOWLEDGE;
r3903r3904
139139   return data;
140140}
141141
142void pc_lpt_handshake_in(int nr, int data, int mask)
142void pc_lpt_handshake_in(running_machine *machine,int nr, int data, int mask)
143143{
144144   PC_LPT *This=LPT+nr;
145145   int neu=(data&mask)|(This->status&~mask);
src/mess/machine/centroni.c
r3903r3904
55*/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "centroni.h"
109#include "devices/printer.h"
1110
r3903r3904
3635
3736static TIMER_CALLBACK(centronics_timer_callback);
3837
39void centronics_config(int nr, const CENTRONICS_CONFIG *config)
38void centronics_config(running_machine *machine,int nr, const CENTRONICS_CONFIG *config)
4039{
4140   CENTRONICS *This=cent+nr;
4241   This->config=config;
43   This->timer = timer_alloc(Machine, centronics_timer_callback, NULL);
42   This->timer = timer_alloc(machine, centronics_timer_callback, NULL);
4443}
4544
46void centronics_write_data(int nr, UINT8 data)
45void centronics_write_data(running_machine *machine,int nr, UINT8 data)
4746{
4847   CENTRONICS *This=cent+nr;
4948   This->data=data;
5049}
5150
52UINT8 centronics_read_data(int nr)
51UINT8 centronics_read_data(running_machine *machine,int nr)
5352{
5453   CENTRONICS *This=cent+nr;
5554   return This->data;
r3903r3904
6867
6968   /* if callback is specified, call it with the new state of the outputs from the printer */
7069   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);
7271
7372   /* phase 2: schedule ack end */
7473   if ( This->control & CENTRONICS_ACKNOWLEDGE )
r3903r3904
115114   return device_list_find_by_tag(machine->config->devicelist, PRINTER, tag);
116115}
117116
118void centronics_write_handshake(int nr, int data, int mask)
117void centronics_write_handshake(running_machine *machine,int nr, int data, int mask)
119118{
120119   CENTRONICS *This=cent+nr;
121120   const device_config *device;
r3903r3904
133132         timer_adjust_oneshot(This->timer, ATTOTIME_IN_USEC(5), nr);
134133
135134         /* output */
136         device = printer_device(Machine, nr);
135         device = printer_device(machine, nr);
137136         if (device != NULL)
138137            printer_output(device, This->data);
139138      }
r3903r3904
142141   This->control=neu;
143142}
144143
145int centronics_read_handshake(int nr)
144int centronics_read_handshake(running_machine *machine,int nr)
146145{
147146   CENTRONICS *This=cent+nr;
148147   UINT8 data=0;
r3903r3904
161160
162161   data |= CENTRONICS_NO_ERROR;
163162
164   device = printer_device(Machine, nr);
163   device = printer_device(machine, nr);
165164   if ((device == NULL) || !printer_is_ready(device))
166165      data |= CENTRONICS_NO_PAPER;
167166
src/mess/machine/centroni.h
r3903r3904
2121} PRINTER_TYPE;
2222
2323typedef 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);
2828} CENTRONICS_DEVICE;
2929
3030
r3903r3904
4343
4444typedef struct {
4545   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);
4747} CENTRONICS_CONFIG;
4848
4949
5050/*----------- defined in machine/centroni.c -----------*/
5151
52void centronics_config(int nr, const CENTRONICS_CONFIG *config);
52void centronics_config(running_machine *machine,int nr, const CENTRONICS_CONFIG *config);
5353
54void centronics_write_data(int nr, UINT8 data);
55void centronics_write_handshake(int nr, int data, int mask);
56UINT8 centronics_read_data(int nr);
57int centronics_read_handshake(int nr);
54void centronics_write_data(running_machine *machine,int nr, UINT8 data);
55void centronics_write_handshake(running_machine *machine,int nr, int data, int mask);
56UINT8 centronics_read_data(running_machine *machine,int nr);
57int centronics_read_handshake(running_machine *machine,int nr);
5858
5959extern const CENTRONICS_DEVICE CENTRONICS_PRINTER_DEVICE;
6060
src/mess/machine/pc.c
r3903r3904
11731173   pc_hdc_setup(machine, set_hdc_int_func);
11741174
11751175   pc_lpt_config(0, lpt_config);
1176   centronics_config(0, cent_config);
1176   centronics_config(machine, 0, cent_config);
11771177   pc_lpt_set_device(0, &CENTRONICS_PRINTER_DEVICE);
11781178   pc_lpt_config(1, lpt_config+1);
1179   centronics_config(1, cent_config+1);
1179   centronics_config(machine, 1, cent_config+1);
11801180   pc_lpt_set_device(1, &CENTRONICS_PRINTER_DEVICE);
11811181   pc_lpt_config(2, lpt_config+2);
1182   centronics_config(2, cent_config+2);
1182   centronics_config(machine, 2, cent_config+2);
11831183   pc_lpt_set_device(2, &CENTRONICS_PRINTER_DEVICE);
11841184
11851185   /* serial mouse */
src/mess/drivers/nc.c
r3903r3904
9494 ******************************************************************************/
9595
9696#include "driver.h"
97#include "deprecat.h"
9897#include "includes/nc.h"
9998#include "includes/serial.h"   /* for serial data transfers */
10099#include "machine/msm8251.h"   /* for NC100 uart */
r3903r3904
122121receive clock and transmit clock inputs */
123122static emu_timer *nc_serial_timer;
124123
125static void nc_printer_update(int);
124static void nc_printer_update(running_machine *machine,int);
126125
127126UINT8 nc_type;
128127
r3903r3904
793792static WRITE8_HANDLER(nc_uart_control_w)
794793{
795794   /* update printer state */
796   nc_printer_update(data);
795   nc_printer_update(space->machine, data);
797796
798797   /* on/off changed state? */
799798   if (((nc_uart_control ^ data) & (1<<3))!=0)
r3903r3904
818817static WRITE8_HANDLER(nc_printer_data_w)
819818{
820819   LOG(("printer write %02x\n",data));
821   centronics_write_data(0,data);
820   centronics_write_data(space->machine, 0,data);
822821}
823822
824823/* same for nc100 and nc200 */
825static void   nc_printer_update(int port0x030)
824static void   nc_printer_update(running_machine *machine,int port0x030)
826825{
827826   int handshake = 0;
828827
r3903r3904
831830      handshake = CENTRONICS_STROBE;
832831   }
833832   /* 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);
836835}
837836
838837/********************************************************************************************************/
r3903r3904
935934   nc100_rxrdy_callback
936935};
937936
938static void nc100_printer_handshake_in(int number, int data, int mask)
937static void nc100_printer_handshake_in(running_machine *machine,int number, int data, int mask)
939938{
940939   nc_irq_status &= ~(1<<2);
941940
r3903r3904
947946      }
948947   }
949948   /* trigger an int if the irq is set */
950   nc_update_interrupts(Machine);
949   nc_update_interrupts(machine);
951950}
952951
953952static const CENTRONICS_CONFIG nc100_cent_config[1]={
r3903r3904
968967
969968    nc_common_init_machine(machine);
970969
971   centronics_config(0, nc100_cent_config);
970   centronics_config(machine, 0, nc100_cent_config);
972971   /* 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);
974973
975974   nc_common_open_stream_for_reading(machine);
976975
r3903r3904
10421041
10431042
10441043   /* 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);
10461045
1047   printer_handshake = centronics_read_handshake(0);
1046   printer_handshake = centronics_read_handshake(space->machine, 0);
10481047
10491048   nc_card_battery_status |=(1<<1);
10501049
r3903r3904
12471246}
12481247#endif
12491248
1250static void nc200_printer_handshake_in(int number, int data, int mask)
1249static void nc200_printer_handshake_in(running_machine *machine,int number, int data, int mask)
12511250{
12521251   nc_irq_status &= ~(1<<0);
12531252
r3903r3904
12591258      }
12601259   }
12611260   /* trigger an int if the irq is set */
1262   nc_update_interrupts(Machine);
1261   nc_update_interrupts(machine);
12631262}
12641263
12651264static const CENTRONICS_CONFIG nc200_cent_config[1]={
r3903r3904
13791378
13801379   nc200_uart_interrupt_irq = 0;
13811380
1382   centronics_config(0, nc200_cent_config);
1381   centronics_config(machine, 0, nc200_cent_config);
13831382   /* 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);
13851384
13861385   nc_common_open_stream_for_reading(machine);
13871386   if (file)
r3903r3904
14701469   int printer_handshake;
14711470
14721471   /* 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);
14741473
1475   printer_handshake = centronics_read_handshake(0);
1474   printer_handshake = centronics_read_handshake(space->machine, 0);
14761475
14771476   nc200_printer_status |=(1<<0);
14781477
src/mess/drivers/sord.c
r3903r3904
351351   if (cassette_input(cassette_device_image(space->machine)) >=0)
352352      data |=(1<<0);
353353
354   printer_handshake = centronics_read_handshake(0);
354   printer_handshake = centronics_read_handshake(space->machine, 0);
355355
356356   /* if printer is not online, it is busy */
357357   if ((printer_handshake & CENTRONICS_ONLINE)!=0)
r3903r3904
394394   cassette_output(cassette_device_image(space->machine), (data & (1<<0)) ? -1.0 : 1.0);
395395
396396   /* 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);
399399
400400   logerror("sys write: %02x\n",data);
401401}
r3903r3904
403403static WRITE8_HANDLER(sord_printer_w)
404404{
405405//  logerror("centronics w: %02x\n",data);
406   centronics_write_data(0,data);
406   centronics_write_data(space->machine, 0,data);
407407}
408408
409409static ADDRESS_MAP_START( sord_m5_io , ADDRESS_SPACE_IO, 8)
r3903r3904
469469   /* should be done in a special callback to work properly! */
470470   memory_set_bankptr(machine, 1, memory_region(machine, "user1"));
471471
472   centronics_config(0, sordm5_cent_config);
472   centronics_config(machine, 0, sordm5_cent_config);
473473   /* 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);
475475}
476476
477477/* 2008-05 FP:
src/mess/drivers/pcw16.c
r3903r3904
13611361   pc_fdc_init(machine, &pcw16_fdc_interface);
13621362
13631363   pc_lpt_config(0, &lpt_config);
1364   centronics_config(0, &cent_config);
1364   centronics_config(machine, 0, &cent_config);
13651365   pc_lpt_set_device(0, &CENTRONICS_PRINTER_DEVICE);
13661366
13671367   /* initialise mouse */
src/mess/drivers/super80.c
r3903r3904
454454   The most commonly used I/O range is DC-DE (DC = centronics, DD = serial data, DE = serial control
455455   All the home-brew roms use this, except for super80e which uses BC-BE (which we don't support yet). */
456456
457static void super80_printer_handshake_in(int number, int data, int mask)
457static void super80_printer_handshake_in(running_machine *machine,int number, int data, int mask)
458458{
459459   if (mask & CENTRONICS_ACKNOWLEDGE)
460460   {
r3903r3904
523523static WRITE8_HANDLER( super80_dc_w )
524524{
525525   /* 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);
530530}
531531
532532static UINT8 last_data;
r3903r3904
10001000static MACHINE_RESET( super80 )
10011001{
10021002   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);
10041004   /* 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);
10061006   timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, super80_reset);
10071007   memory_set_bank(machine, 1, 1);
10081008}
src/mess/drivers/atarist.c
r3903r3904
12991299   // 0x08 = RTS
13001300   // 0x10 = DTR
13011301
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);
13031303
13041304   // 0x40 = General Purpose Output
13051305   // 0x80 = Reserved
r3903r3904
13071307
13081308static WRITE8_HANDLER( ym2149_port_b_w )
13091309{
1310   centronics_write_data(0, data);
1310   centronics_write_data(space->machine,0, data);
13111311}
13121312
13131313static const ay8910_interface ym2149_interface =
r3903r3904
13721372
13731373   atarist_state *state = device->machine->driver_data;
13741374
1375   UINT8 data = (centronics_read_handshake(0) & CENTRONICS_NOT_BUSY) >> 7;
1375   UINT8 data = (centronics_read_handshake(device->machine,0) & CENTRONICS_NOT_BUSY) >> 7;
13761376
13771377   mc68901_tai_w(device, data & 0x01);
13781378
r3903r3904
14991499   atarist_configure_memory(machine);
15001500
15011501   /* configure devices */
1502   centronics_config(0, atarist_centronics_config);
1502   centronics_config(machine, 0, atarist_centronics_config);
15031503
15041504   /* set CPU interrupt callback */
15051505   cpu_set_irq_callback(machine->cpu[0], atarist_int_ack);
r3903r3904
15421542
15431543   atarist_state *state = device->machine->driver_data;
15441544
1545   UINT8 data = (centronics_read_handshake(0) & CENTRONICS_NOT_BUSY) >> 7;
1545   UINT8 data = (centronics_read_handshake(device->machine,0) & CENTRONICS_NOT_BUSY) >> 7;
15461546
15471547   data |= (state->acia_irq << 4);
15481548   data |= (state->fdc_irq << 5);
r3903r3904
15941594   atarist_configure_memory(machine);
15951595
15961596   /* configure devices */
1597   centronics_config(0, atarist_centronics_config);
1597   centronics_config(machine, 0, atarist_centronics_config);
15981598   
15991599   /* set CPU interrupt callback */
16001600   cpu_set_irq_callback(machine->cpu[0], atarist_int_ack);
r3903r3904
16691669   // 0x08 = RTS
16701670   // 0x10 = DTR
16711671
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);
16731673
16741674   // 0x40 = IDE RESET
16751675   // 0x80 = FDD_DENSE_SEL
r3903r3904
17181718
17191719   atarist_state *state = device->machine->driver_data;
17201720
1721   UINT8 data = (centronics_read_handshake(0) & CENTRONICS_NOT_BUSY) >> 7;
1721   UINT8 data = (centronics_read_handshake(device->machine,0) & CENTRONICS_NOT_BUSY) >> 7;
17221722
17231723   data |= (state->acia_irq << 4);
17241724   data |= (state->fdc_irq << 5);
r3903r3904
17481748   stbook_configure_memory(machine);
17491749
17501750   /* configure devices */
1751   centronics_config(0, atarist_centronics_config);
1751   centronics_config(machine, 0, atarist_centronics_config);
17521752   rp5c15_init(machine, &rtc_intf);
17531753
17541754   /* set CPU interrupt callback */
src/mess/drivers/sg1000.c
r3903r3904
610610
611611   sg1000_state *state = device->machine->driver_data;
612612
613   int centronics_handshake = centronics_read_handshake(1);
613   int centronics_handshake = centronics_read_handshake(device->machine,1);
614614   int busy = 0;
615615
616616   if ((centronics_handshake & CENTRONICS_NOT_BUSY) == 0)
r3903r3904
636636        PB7     Data output to Centronics printer
637637    */
638638
639   centronics_write_data(1, data);
639   centronics_write_data(device->machine, 1, data);
640640}
641641
642642static WRITE8_DEVICE_HANDLER( sf7000_ppi8255_c_w )
r3903r3904
672672   memory_set_bank(device->machine, 1, (data & 0x40) >> 6);
673673
674674   /* printer strobe */
675   centronics_write_handshake(1, (data & 0x80) ? 0 : CENTRONICS_STROBE, CENTRONICS_STROBE);
675   centronics_write_handshake(device->machine, 1, (data & 0x80) ? 0 : CENTRONICS_STROBE, CENTRONICS_STROBE);
676676}
677677
678678static const ppi8255_interface sf7000_ppi8255_intf[2] =
r3903r3904
736736   floppy_drive_set_index_pulse_callback(image_from_devtype_and_index(IO_FLOPPY, 0), sf7000_fdc_index_callback);
737737
738738   /* configure PPI */
739   centronics_config(1, sf7000_centronics_config);
739   centronics_config(machine, 1, sf7000_centronics_config);
740740
741741   /* configure memory banking */
742742   memory_configure_bank(machine, 1, 0, 1, memory_region(machine, "main"), 0);
src/mess/drivers/exidy.c
r3903r3904
309309   }
310310}
311311
312static void exidy_printer_handshake_in(int number, int data, int mask)
312static void exidy_printer_handshake_in(running_machine *machine,int number, int data, int mask)
313313{
314314   if (mask & CENTRONICS_ACKNOWLEDGE)
315315   {
r3903r3904
356356
357357   exidy_ay31015 = device_list_find_by_tag( machine->config->devicelist, AY31015, "ay_3_1015" );
358358
359   centronics_config(0, exidy_cent_config);
359   centronics_config(machine, 0, exidy_cent_config);
360360   /* 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);
362362   exidy_fe_port_w(space, 0, 0);
363363
364364   timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, exidy_reset);
r3903r3904
513513
514514      case 2: /* Centronics 7-bit printer */
515515         /* 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);
519519         break;
520520
521521      case 4: /* 8-bit parallel output */
522522         /* 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);
527527         break;
528528   }
529529}
src/mess/drivers/bw2.c
r3903r3904
404404   }
405405
406406   /* 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);
409409}
410410
411411static READ8_DEVICE_HANDLER( bw2_ppi8255_b_r )
r3903r3904
473473   UINT8 data = 0;
474474
475475   /* 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;
478478
479479   data |= state->mfdbk << 5;
480480   
r3903r3904
552552
553553static WRITE8_HANDLER( bw2_centronics_data_w )
554554{
555   centronics_write_data(0, data);
555   centronics_write_data(space->machine,0, data);
556556}
557557
558558/* Video */
r3903r3904
598598   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
599599
600600
601   centronics_config(0, bw2_centronics_config);
601   centronics_config(machine,0, bw2_centronics_config);
602602
603603   wd17xx_set_density(fdc,DEN_MFM_LO);
604604
src/mess/drivers/einstein.c
r3903r3904
452452      handshake = CENTRONICS_STROBE;
453453
454454   /* 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);
457457}
458458
459459static WRITE8_DEVICE_HANDLER( einstein_pio_port_a_w )
460460{
461   centronics_write_data(0,data);
461   centronics_write_data(device->machine,0,data);
462462}
463463
464464
r3903r3904
874874
875875   einstein_update_interrupts(space->machine);
876876
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);
879879
880880   /* bit 7: 0=shift pressed */
881881   /* bit 6: 0=control pressed */
r3903r3904
13671367
13681368
13691369
1370static void einstein_printer_handshake_in(int number, int data, int mask)
1370static void einstein_printer_handshake_in(running_machine *machine,int number, int data, int mask)
13711371{
13721372   if (mask & CENTRONICS_ACKNOWLEDGE)
13731373   {
r3903r3904
14641464   einstein_ctc_trigger = 0;
14651465   timer_pulse(machine, ATTOTIME_IN_HZ(2000000), (void *)device_list_find_by_tag(machine->config->devicelist, Z80CTC, "z80ctc"), 0, einstein_ctc_trigger_callback);
14661466
1467   centronics_config(0, einstein_cent_config);
1467   centronics_config(machine, 0, einstein_cent_config);
14681468   /* 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);
14701470
14711471}
14721472

Previous 15994 Revisions Next


© 1998-2018 The MESS Team