Previous 15994 Revisions Next

r4276 Wednesday 18th February, 2009 at 09:32:19 UTC by Dirk Best
[EINSTEIN] Updated to use the new centronics interface
[docs]messnew.txt
[src/mess/drivers]einstein.c

src/mess/drivers/einstein.c
r4275r4276
8686#include "cpu/z80/z80.h"
8787#include "cpu/z80/z80daisy.h"
8888#include "machine/wd17xx.h"
89#include "machine/centroni.h"
89#include "machine/ctronics.h"
9090#include "machine/msm8251.h"
9191#include "devices/dsk.h"
9292#include "devices/basicdsk.h"
93#include "devices/printer.h"
9493#include "sound/ay8910.h"
9594#include "video/mc6845.h"
9695
r4275r4276
438437   z80ctc_trg3_w
439438};
440439
440
441441static void einstein_pio_ardy(const device_config *device, int state)
442442{
443   int handshake;
444
445   handshake = 0;
446
447   /* strobe is inverted state of ardy */
448   if (state != 0)
449      handshake = CENTRONICS_STROBE;
450
451   /* ardy is connected to strobe */
452   centronics_write_handshake(device->machine,0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET);
453   centronics_write_handshake(device->machine,0, handshake, CENTRONICS_STROBE);
443   const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics");
444   centronics_strobe_w(printer, state);
454445}
455446
456447static WRITE8_DEVICE_HANDLER( einstein_pio_port_a_w )
457448{
458   centronics_write_data(device->machine,0,data);
449   const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics");
450   centronics_data_w(printer, 0, data);
459451}
460452
461453
r4275r4276
860852
861853static READ8_HANDLER(einstein_key_int_r)
862854{
863   int centronics_handshake;
855   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
864856   int data;
865857
866858   /* clear key int. a read of this I/O port will do this or a reset */
r4275r4276
868860
869861   einstein_update_interrupts(space->machine);
870862
871   centronics_write_handshake(space->machine,0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET);
872   centronics_handshake = centronics_read_handshake(space->machine,0);
873
874863   /* bit 7: 0=shift pressed */
875864   /* bit 6: 0=control pressed */
876865   /* bit 5: 0=graph pressed */
r4275r4276
881870   /* bit 0: fire 0 */
882871   data = ((input_port_read(space->machine, "EXTRA") & 0x07)<<5) | (input_port_read(space->machine, "BUTTONS") & 0x03) | 0x01c;
883872
884   /* error? */
885   if (centronics_handshake & CENTRONICS_NO_ERROR)
886   {
887      /* if CENTRONICS_NO_ERROR flag set there is no error */
873   data |= centronics_fault_r(printer) << 4;
874   data |= centronics_pe_r(printer) << 3;
875   data |= centronics_busy_r(printer) << 2;
888876
889      /* no error */
890      data |= (1<<4);
891   }
892
893   /* no paper? */
894   if ((centronics_handshake & CENTRONICS_NO_PAPER)==0)
895   {
896      /* if CENTRONICS_NO_PAPER flag set there is no paper */
897
898      /* has paper */
899      data |= (1<<3);
900   }
901
902   if ((centronics_handshake & CENTRONICS_NOT_BUSY)==0)
903   {
904      /*  if CENTRONICS_NOT_BUSY flag set then not busy */
905
906      /* busy */
907      data |= (1<<2);
908   }
909
910877   logerror("key int r: %02x\n",data);
911878
912879   return data;
r4275r4276
13601327
13611328
13621329
1363
1364static void einstein_printer_handshake_in(running_machine *machine,int number, int data, int mask)
1365{
1366   if (mask & CENTRONICS_ACKNOWLEDGE)
1367   {
1368      if (data & CENTRONICS_ACKNOWLEDGE)
1369      {
1370         /* /ack into /astb */
1371         z80pio_astb_w( einstein_z80pio, 0);
1372      }
1373      else
1374      {
1375         z80pio_astb_w( einstein_z80pio, 1);
1376      }
1377   }
1378}
1379
1380static const CENTRONICS_CONFIG einstein_cent_config[1]={
1381   {
1382      PRINTER_CENTRONICS,
1383      einstein_printer_handshake_in
1384   },
1385};
1386
1387
13881330/* when Z80 acknowledges int, /IORQ and /M1 will be low */
13891331/* this allows I057 octal latch to output data onto the bus */
13901332static IRQ_CALLBACK(einstein_cpu_acknowledge_int)
r4275r4276
14571399   /* the input to channel 0 and 1 of the ctc is a 2 MHz clock */
14581400   einstein_ctc_trigger = 0;
14591401   timer_pulse(machine, ATTOTIME_IN_HZ(2000000), (void *)devtag_get_device(machine, Z80CTC, "z80ctc"), 0, einstein_ctc_trigger_callback);
1460
1461   centronics_config(machine, 0, einstein_cent_config);
1462   /* assumption: select is tied low */
1463   centronics_write_handshake(machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET);
1464
14651402}
14661403
14671404static MACHINE_RESET( einstein2 )
r4275r4276
16091546   NULL
16101547};
16111548
1549static const centronics_interface einstein_centronics_config =
1550{
1551   FALSE,
1552   DEVCB_DEVICE_LINE(Z80PIO, "z80pio", z80pio_astb_w),
1553   DEVCB_NULL,
1554   DEVCB_NULL
1555};
1556
16121557/*
16131558    0: 126 (127) horizontal total
16141559    1: 80 horizontal displayed
r4275r4276
17391684   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
17401685
17411686   /* printer */
1742   MDRV_PRINTER_ADD("printer")
1687   MDRV_CENTRONICS_ADD("centronics", einstein_centronics_config)
17431688
17441689   /* uart */
17451690   MDRV_MSM8251_ADD("uart", default_msm8251_interface)
1746   
1691
17471692   MDRV_WD177X_ADD("wd177x", default_wd17xx_interface )
17481693MACHINE_DRIVER_END
17491694
docs/messnew.txt
r4275r4276
3434
3535- [CPC family] Updated all drivers to use the mc6845 device.  [Wilbert Pol]
3636
37- [EINSTEIN] Updated to use the new centronics interface.  [Dirk Best]
38
3739- [FAMICOM] Fixed 0.129 regression; once again allows you to run with only a
3840  floppy image and no cart.  (bug #1760) [Fabio Priuli]
3941

Previous 15994 Revisions Next


© 1998-2018 The MESS Team