Previous 15994 Revisions Next

r4244 Wednesday 11th February, 2009 at 08:23:46 UTC by Curt Coder
[Z80DART] Refactored to use devcb.
[ABC77] Refactored to use devcb.
[docs]messnew.txt
[src/mess/drivers]abc80x.c mtx.c newbrain.c
[src/mess/machine]abc77.c abc77.h abcbus.c conkort.c conkort.h e0516.c e0516.h mtx.c z80dart.c z80dart.h
[src/mess/video]abc800.c abc802.c abc806.c

src/mess/video/abc800.c
r4243r4244
114114{
115115   abc800_state *state = device->machine->driver_data;
116116
117   z80dart_ri_w(state->z80dart, 1, vsync);
117   z80dart_rib_w(state->z80dart, vsync);
118118}
119119
120120/* MC6845 Interfaces */
src/mess/video/abc802.c
r4243r4244
195195   }
196196
197197   /* signal _DEW to DART */
198   z80dart_ri_w(state->z80dart, 1, !vsync);
198   z80dart_rib_w(state->z80dart, !vsync);
199199}
200200
201201/* MC6845 Interfaces */
src/mess/video/abc806.c
r4243r4244
360360      if (state->d_vsync != vsync)
361361      {
362362         /* signal _DEW to DART */
363         z80dart_ri_w(state->z80dart, 1, !vsync);
363         z80dart_rib_w(state->z80dart, !vsync);
364364      }
365365
366366      state->d_vsync = vsync;
src/mess/machine/conkort.c
r4243r4244
9494#include "machine/wd17xx.h"
9595#include "machine/abcbus.h"
9696
97/***************************************************************************
98    PARAMETERS
99***************************************************************************/
100
101#define Z80_TAG      "5a"
102#define Z80PIO_TAG   "3a"
103#define Z80DMA_TAG   "z80dma"
104#define WD1791_TAG   "wd1791"
105#define SAB1793_TAG   "sab1793"
106
107/***************************************************************************
108    TYPE DEFINITIONS
109***************************************************************************/
110
97111typedef struct _slow_t slow_t;
98112struct _slow_t
99113{
r4243r4244
105119   /* devices */
106120   const device_config *cpu;
107121   const device_config *z80pio;
122   const device_config *wd1791;
108123};
109124
110125typedef struct _fast_t fast_t;
r4243r4244
117132   /* devices */
118133   const device_config *cpu;
119134   const device_config *z80dma;
135   const device_config *wd1793;
120136};
121137
138/***************************************************************************
139    INLINE FUNCTIONS
140***************************************************************************/
141
122142INLINE slow_t *get_safe_token_slow(const device_config *device)
123143{
124144   assert(device != NULL);
125145   assert(device->token != NULL);
126
127146   return (slow_t *)device->token;
128147}
129148
r4243r4244
131150{
132151   assert(device != NULL);
133152   assert(device->token != NULL);
134
135153   return (fast_t *)device->token;
136154}
137155
r4243r4244
147165   return get_safe_token_fast(device);
148166}
149167
150static const device_config *get_floppy_image(running_machine *machine, int drive)
168INLINE const device_config *get_floppy_image(running_machine *machine, int drive)
151169{
152170   return image_from_devtype_and_index(machine, IO_FLOPPY, drive);
153171}
154172
173/***************************************************************************
174    IMPLEMENTATION
175***************************************************************************/
155176
156177/* Slow Controller */
157178
r4243r4244
229250
230251static WRITE8_HANDLER( slow_ctrl_w )
231252{
232   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x");
233253   /*
234254
235255      bit      description
r4243r4244
245265
246266   */
247267
268   slow_t *conkort = get_safe_token_machine_slow(space->machine);
269
248270   /* drive selection */
249   if (!BIT(data, 0)) wd17xx_set_drive(fdc,0);
250   if (!BIT(data, 1)) wd17xx_set_drive(fdc,1);
251//   if (!BIT(data, 2)) wd17xx_set_drive(fdc,2);
271   if (!BIT(data, 0)) wd17xx_set_drive(conkort->wd1791, 0);
272   if (!BIT(data, 1)) wd17xx_set_drive(conkort->wd1791, 1);
273//   if (!BIT(data, 2)) wd17xx_set_drive(conkort->wd1791, 2);
252274
253275   /* motor enable */
254276   floppy_drive_set_motor_state(get_floppy_image(space->machine, 0), !BIT(data, 3));
r4243r4244
257279   floppy_drive_set_ready_state(get_floppy_image(space->machine, 1), 1, 1);
258280
259281   /* disk side selection */
260   wd17xx_set_side(fdc,!BIT(data, 4));
282   wd17xx_set_side(conkort->wd1791,!BIT(data, 4));
261283
262284   if (!BIT(data, 7))
263285   {
264286      /* FDC master reset */
265      wd17xx_reset(fdc);
287      wd17xx_reset(conkort->wd1791);
266288   }
267289}
268290
r4243r4244
411433
412434static ADDRESS_MAP_START( slow_io_map, ADDRESS_SPACE_IO, 8 )
413435   ADDRESS_MAP_GLOBAL_MASK(0xff)
414   AM_RANGE(0x7c, 0x7f) AM_DEVREADWRITE(Z80PIO, CONKORT_Z80PIO_TAG, z80pio_alt_r, z80pio_alt_w)
415   AM_RANGE(0xbc, 0xbf) AM_DEVREADWRITE(WD179X, "wd179x", wd17xx_r, wd17xx_w)
436   AM_RANGE(0x7c, 0x7f) AM_DEVREADWRITE(Z80PIO, Z80PIO_TAG, z80pio_alt_r, z80pio_alt_w)
437   AM_RANGE(0xbc, 0xbf) AM_DEVREADWRITE(WD179X, WD1791_TAG, wd17xx_r, wd17xx_w)
416438   AM_RANGE(0xdf, 0xdf) AM_WRITE(slow_status_w)
417439   AM_RANGE(0xef, 0xef) AM_WRITE(slow_ctrl_w)
418440ADDRESS_MAP_END
r4243r4244
432454//   AM_RANGE(0x3f, 0x3f) AM_WRITE()
433455//   AM_RANGE(0x4f, 0x4f) AM_WRITE()
434456   AM_RANGE(0x5d, 0x5d) AM_READ(fast_ctrl_r)
435   AM_RANGE(0x68, 0x6b) AM_DEVREAD(WD1793, "wd1793", wd17xx_r)
436   AM_RANGE(0x78, 0x7b) AM_DEVWRITE(WD1793, "wd1793", wd17xx_w)
437   AM_RANGE(0x87, 0x87) AM_DEVREADWRITE(Z80DMA, CONKORT_Z80DMA_TAG, z80dma_r, z80dma_w)
457   AM_RANGE(0x68, 0x6b) AM_DEVREAD(WD1793, SAB1793_TAG, wd17xx_r)
458   AM_RANGE(0x78, 0x7b) AM_DEVWRITE(WD1793, SAB1793_TAG, wd17xx_w)
459   AM_RANGE(0x87, 0x87) AM_DEVREADWRITE(Z80DMA, Z80DMA_TAG, z80dma_r, z80dma_w)
438460ADDRESS_MAP_END
439461
440462/* Input Ports */
r4243r4244
572594
573595static const z80_daisy_chain slow_daisy_chain[] =
574596{
575   { Z80PIO, CONKORT_Z80PIO_TAG },
597   { Z80PIO, Z80PIO_TAG },
576598   { NULL }
577599};
578600
r4243r4244
684706
685707static const z80_daisy_chain fast_daisy_chain[] =
686708{
687   { Z80DMA, CONKORT_Z80DMA_TAG },
709   { Z80DMA, Z80DMA_TAG },
688710   { NULL }
689711};
690712
r4243r4244
709731   }
710732}
711733
712static const wd17xx_interface slow_wd17xx_interface = { slow_wd1791_callback, NULL };
734static const wd17xx_interface slow_wd17xx_interface =
735{
736   slow_wd1791_callback,
737   NULL
738};
713739
714740/* FD1793 */
715741
r4243r4244
732758   }
733759}
734760
735static const wd17xx_interface fast_wd17xx_interface = { fast_wd1793_callback };
761static const wd17xx_interface fast_wd17xx_interface =
762{
763   fast_wd1793_callback
764};
736765
737766/* Machine Driver */
738767
739768static MACHINE_DRIVER_START( luxor_55_10828 )
740   MDRV_CPU_ADD(CONKORT_Z80_TAG, Z80, XTAL_4MHz/2)
769   MDRV_CPU_ADD(Z80_TAG, Z80, XTAL_4MHz/2)
741770   MDRV_CPU_PROGRAM_MAP(slow_map, 0)
742771   MDRV_CPU_IO_MAP(slow_io_map, 0)
743772   MDRV_CPU_CONFIG(slow_daisy_chain)
744773
745   MDRV_Z80PIO_ADD(CONKORT_Z80PIO_TAG, conkort_pio_intf)
746   MDRV_WD179X_ADD("wd179x", slow_wd17xx_interface )
774   MDRV_Z80PIO_ADD(Z80PIO_TAG, conkort_pio_intf)
775   MDRV_WD179X_ADD(WD1791_TAG, slow_wd17xx_interface )
747776MACHINE_DRIVER_END
748777
749778static MACHINE_DRIVER_START( luxor_55_21046 )
750   MDRV_CPU_ADD(CONKORT_Z80_TAG, Z80, XTAL_16MHz/4)
779   MDRV_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4)
751780   MDRV_CPU_PROGRAM_MAP(fast_map, 0)
752781   MDRV_CPU_IO_MAP(fast_io_map, 0)
753782   MDRV_CPU_CONFIG(fast_daisy_chain)
754783
755   MDRV_Z80DMA_ADD(CONKORT_Z80DMA_TAG, XTAL_16MHz/4, dma_intf)
756
757   MDRV_WD1793_ADD("wd1793", fast_wd17xx_interface )
784   MDRV_Z80DMA_ADD(Z80DMA_TAG, XTAL_16MHz/4, dma_intf)
785   MDRV_WD1793_ADD(SAB1793_TAG, fast_wd17xx_interface )
758786MACHINE_DRIVER_END
759787
760788/* ROMs */
r4243r4244
804832   ROM_LOAD( "st225.bin",    0x0800, 0x0800, CRC(c9f68f81) SHA1(7ff8b2a19f71fe0279ab3e5a0a5fffcb6030360c) ) // Seagate ST225
805833ROM_END
806834
807/* Device Interface */
835/*-------------------------------------------------
836    DEVICE_START( luxor_55_10828 )
837-------------------------------------------------*/
808838
809839static DEVICE_START( luxor_55_10828 )
810840{
r4243r4244
815845   assert(device->tag != NULL);
816846
817847   /* find our CPU */
818   astring_printf(tempstring, "%s:%s", device->tag, CONKORT_Z80_TAG);
848   astring_printf(tempstring, "%s:%s", device->tag, Z80_TAG);
819849   conkort->cpu = cputag_get_cpu(device->machine, astring_c(tempstring));
820850
821851   /* find devices */
822   astring_printf(tempstring, "%s:%s", device->tag, CONKORT_Z80PIO_TAG);
852   astring_printf(tempstring, "%s:%s", device->tag, Z80PIO_TAG);
823853   conkort->z80pio = devtag_get_device(device->machine, Z80PIO, astring_c(tempstring));
854   astring_printf(tempstring, "%s:%s", device->tag, WD1791_TAG);
855   conkort->wd1791 = devtag_get_device(device->machine, Z80DMA, astring_c(tempstring));
824856
825857   /* register for state saving */
826858   state_save_register_device_item(device, 0, conkort->status);
r4243r4244
831863   astring_free(tempstring);
832864}
833865
866/*-------------------------------------------------
867    DEVICE_RESET( luxor_55_10828 )
868-------------------------------------------------*/
869
834870static DEVICE_RESET( luxor_55_10828 )
835871{
836872
837873}
838874
875/*-------------------------------------------------
876    DEVICE_SET_INFO( luxor_55_10828 )
877-------------------------------------------------*/
878
839879static DEVICE_SET_INFO( luxor_55_10828 )
840880{
841881   switch (state)
r4243r4244
844884   }
845885}
846886
887/*-------------------------------------------------
888    DEVICE_GET_INFO( luxor_55_10828 )
889-------------------------------------------------*/
890
847891DEVICE_GET_INFO( luxor_55_10828 )
848892{
849893   switch (state)
r4243r4244
865909      case DEVINFO_FCT_ABCBUS_CARD_SELECT:         info->f = (genf *)ABCBUS_CARD_SELECT_NAME(luxor_55_10828);   break;
866910
867911      /* --- the following bits of info are returned as NULL-terminated strings --- */
868      case DEVINFO_STR_NAME:                     strcpy(info->s, "Luxor 55 10828-01");                        break;
869      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Luxor ABC");                              break;
870      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                                 break;
871      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                                 break;
872      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");                   break;
912      case DEVINFO_STR_NAME:                     strcpy(info->s, "Luxor 55 10828-01");                  break;
913      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Luxor ABC");                        break;
914      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                              break;
915      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                           break;
916      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");             break;
873917   }
874918}
875919
920/*-------------------------------------------------
921    DEVICE_START( luxor_55_21046 )
922-------------------------------------------------*/
923
876924static DEVICE_START( luxor_55_21046 )
877925{
878926   fast_t *conkort = device->token;
r4243r4244
882930   assert(device->tag != NULL);
883931
884932   /* find our CPU */
885   astring_printf(tempstring, "%s:%s", device->tag, CONKORT_Z80_TAG);
933   astring_printf(tempstring, "%s:%s", device->tag, Z80_TAG);
886934   conkort->cpu = cputag_get_cpu(device->machine, astring_c(tempstring));
887935
888936   /* find devices */
889   astring_printf(tempstring, "%s:%s", device->tag, CONKORT_Z80DMA_TAG);
937   astring_printf(tempstring, "%s:%s", device->tag, Z80DMA_TAG);
890938   conkort->z80dma = devtag_get_device(device->machine, Z80DMA, astring_c(tempstring));
939   astring_printf(tempstring, "%s:%s", device->tag, SAB1793_TAG);
940   conkort->wd1793 = devtag_get_device(device->machine, Z80DMA, astring_c(tempstring));
891941
892942   /* register for state saving */
893943   state_save_register_device_item(device, 0, conkort->status);
r4243r4244
897947   astring_free(tempstring);
898948}
899949
950/*-------------------------------------------------
951    DEVICE_RESET( luxor_55_21046 )
952-------------------------------------------------*/
953
900954static DEVICE_RESET( luxor_55_21046 )
901955{
902956}
903957
958/*-------------------------------------------------
959    DEVICE_SET_INFO( luxor_55_21046 )
960-------------------------------------------------*/
961
904962static DEVICE_SET_INFO( luxor_55_21046 )
905963{
906964   switch (state)
r4243r4244
909967   }
910968}
911969
970/*-------------------------------------------------
971    DEVICE_GET_INFO( luxor_55_21046 )
972-------------------------------------------------*/
973
912974DEVICE_GET_INFO( luxor_55_21046 )
913975{
914976   switch (state)
r4243r4244
930992      case DEVINFO_FCT_ABCBUS_CARD_SELECT:         info->f = (genf *)ABCBUS_CARD_SELECT_NAME(luxor_55_21046);   break;
931993
932994      /* --- the following bits of info are returned as NULL-terminated strings --- */
933      case DEVINFO_STR_NAME:                     strcpy(info->s, "Luxor Conkort 55 21046-xx");                  break;
934      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Luxor ABC");                              break;
935      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                                 break;
936      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                                 break;
937      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");                   break;
995      case DEVINFO_STR_NAME:                     strcpy(info->s, "Luxor Conkort 55 21046-xx");            break;
996      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Luxor ABC");                        break;
997      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                              break;
998      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                           break;
999      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");             break;
9381000   }
9391001}
src/mess/machine/conkort.h
r4243r4244
33
44#include "driver.h"
55
6#define CONKORT_Z80_TAG      "5a"
7#define CONKORT_Z80PIO_TAG   "3a"
8#define CONKORT_Z80DMA_TAG   "z80dma"
6/***************************************************************************
7    MACROS / CONSTANTS
8***************************************************************************/
99
1010#define CONKORT_TAG   "conkort"
1111
1212#define LUXOR_55_10828 DEVICE_GET_INFO_NAME( luxor_55_10828 )
1313#define LUXOR_55_21046 DEVICE_GET_INFO_NAME( luxor_55_21046 )
1414
15#define MDRV_LUXOR_55_10828_ADD \
16   MDRV_DEVICE_ADD(CONKORT_TAG, LUXOR_55_10828, 0)
17
18#define MDRV_LUXOR_55_21046_ADD \
19   MDRV_DEVICE_ADD(CONKORT_TAG, LUXOR_55_21046, 0)
20
21/***************************************************************************
22    PROTOTYPES
23***************************************************************************/
24
1525/* device interface */
1626DEVICE_GET_INFO( luxor_55_10828 );
1727DEVICE_GET_INFO( luxor_55_21046 );
src/mess/machine/z80dart.c
r4243r4244
1111
1212   TODO:
1313
14   - save state support
1514   - break detection
1615   - wr0 reset tx interrupt pending
1716   - wait/ready
r4243r4244
2524#include "cpu/z80/z80daisy.h"
2625
2726/***************************************************************************
28    DEBUGGING
27    PARAMETERS
2928***************************************************************************/
3029
3130#define VERBOSE 0
3231
3332#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
3433
35/***************************************************************************
36    CONSTANTS
37***************************************************************************/
38
3934enum
4035{
4136   STATE_START = 0,
r4243r4244
125120typedef struct _dart_channel dart_channel;
126121struct _dart_channel
127122{
123   devcb_resolved_read_line   in_rxd_func;
124   devcb_resolved_write_line   out_txd_func;
125   devcb_resolved_write_line   out_dtr_func;
126   devcb_resolved_write_line   out_rts_func;
127   devcb_resolved_write_line   out_wrdy_func;
128
128129   /* register state */
129130   UINT8 rr[3];         /* read register */
130131   UINT8 wr[6];         /* write register */
r4243r4244
142143   int rx_first;         /* first character received */
143144   int rx_parity;         /* received data parity */
144145   int rx_break;         /* receive break condition */
145   int rx_rr0_latch;      /* read register 0 latched */
146   UINT8 rx_rr0_latch;      /* read register 0 latched */
146147
147148   int ri;               /* ring indicator latch */
148149   int cts;            /* clear to send latch */
r4243r4244
164165typedef struct _z80dart_t z80dart_t;
165166struct _z80dart_t
166167{
167   const z80dart_interface *intf;   /* interface */
168
168   devcb_resolved_write_line   out_int_func;
169   
169170   dart_channel channel[2];      /* channels */
170171
171   int clock;                  /* base clock */
172172   int int_state[8];            /* interrupt state */
173173
174174   /* timers */
r4243r4244
193193   assert(device != NULL);
194194   assert(device->token != NULL);
195195   assert(device->type == Z80DART);
196   
197196   return (z80dart_t *)device->token;
198197}
199198
200/***************************************************************************
201    CALLBACK INTERFACE MANAGEMENT
202***************************************************************************/
203
204static int z80dart_rxd_r(const device_config *device, int channel)
199INLINE const z80dart_interface *get_interface(const device_config *device)
205200{
206   z80dart_t *z80dart = get_safe_token(device);
207
208   int data = 1;
209
210   if (z80dart->intf->rxd_r)
211   {
212      data = z80dart->intf->rxd_r(device, channel);
213   }
214
215   return data;
201   assert(device != NULL);
202   assert((device->type == Z80DART));
203   return (const z80dart_interface *) device->static_config;
216204}
217205
218static void z80dart_txd_w(const device_config *device, int channel, int state)
219{
220   z80dart_t *z80dart = get_safe_token(device);
206/***************************************************************************
207    IMPLEMENTATION
208***************************************************************************/
221209
222   if (z80dart->intf->on_txd_changed)
223   {
224      z80dart->intf->on_txd_changed(device, channel, state);
225   }
226}
210#define RXD \
211   devcb_call_read_line(&ch->in_rxd_func)
227212
228static void z80dart_rts_w(const device_config *device, int channel, int state)
229{
230   z80dart_t *z80dart = get_safe_token(device);
213#define TXD(_state) \
214   devcb_call_write_line(&ch->out_txd_func, _state)
231215
232   if (z80dart->intf->on_rts_changed)
233   {
234      z80dart->intf->on_rts_changed(device, channel, state);
235   }
216#define RTS(_state) \
217   devcb_call_write_line(&ch->out_rts_func, _state)
236218
237   LOG(("Z80DART \"%s\" Channel %c : RTS %u\n", device->tag, 'A' + channel, state));
238}
219#define DTR(_state) \
220   devcb_call_write_line(&ch->out_dtr_func, _state)
239221
240static void z80dart_dtr_w(const device_config *device, int channel, int state)
241{
242   z80dart_t *z80dart = get_safe_token(device);
222/*-------------------------------------------------
223    check_interrupts - control interrupt line
224-------------------------------------------------*/
243225
244   if (z80dart->intf->on_dtr_changed)
245   {
246      z80dart->intf->on_dtr_changed(device, channel, state);
247   }
248
249   LOG(("Z80DART \"%s\" Channel %c : DTR %u\n", device->tag, 'A' + channel, state));
250}
251
252/***************************************************************************
253    INTERNAL STATE MANAGEMENT
254***************************************************************************/
255
256static void z80dart_check_interrupt(const device_config *device)
226static void check_interrupts(const device_config *device)
257227{
258228   z80dart_t *z80dart = get_safe_token(device);
259229   int state = (z80dart_irq_state(device) & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE;
260230
261   if (z80dart->intf->on_int_changed)
262   {
263      z80dart->intf->on_int_changed(device, state);
264   }
231   devcb_call_write_line(&z80dart->out_int_func, state);
265232}
266233
267static void z80dart_trigger_interrupt(const device_config *device, int channel, int level)
234/*-------------------------------------------------
235    take_interrupt - trigger interrupt
236-------------------------------------------------*/
237
238static void take_interrupt(const device_config *device, int channel, int level)
268239{
269240   z80dart_t *z80dart = get_safe_token(device);
270241   dart_channel *ch = &z80dart->channel[channel];
r4243r4244
287258   z80dart->channel[Z80DART_CH_A].rr[0] |= Z80DART_RR0_INTERRUPT_PENDING;
288259
289260   /* check for interrupt */
290   z80dart_check_interrupt(device);
261   check_interrupts(device);
291262}
292263
293static int z80dart_get_clock_mode(const device_config *device, int channel)
264/*-------------------------------------------------
265    get_clock_mode - get clock divisor
266-------------------------------------------------*/
267
268static int get_clock_mode(dart_channel *ch)
294269{
295   z80dart_t *z80dart = get_safe_token(device);
296   dart_channel *ch = &z80dart->channel[channel];
297
298270   int clocks = 1;
299271
300272   switch (ch->wr[4] & Z80DART_WR4_CLOCK_MODE_MASK)
301273   {
302   case Z80DART_WR4_CLOCK_MODE_X1:
303      clocks = 1;
304
305   case Z80DART_WR4_CLOCK_MODE_X16:
306      clocks = 16;
307
308   case Z80DART_WR4_CLOCK_MODE_X32:
309      clocks = 32;
310
311   case Z80DART_WR4_CLOCK_MODE_X64:
312      clocks = 64;
274   case Z80DART_WR4_CLOCK_MODE_X1:      clocks = 1;      break;
275   case Z80DART_WR4_CLOCK_MODE_X16:   clocks = 16;   break;
276   case Z80DART_WR4_CLOCK_MODE_X32:   clocks = 32;   break;
277   case Z80DART_WR4_CLOCK_MODE_X64:   clocks = 64;   break;
313278   }
314279
315280   return clocks;
316281}
317282
318static float z80dart_get_stop_bits(const device_config *device, int channel)
283/*-------------------------------------------------
284    get_stop_bits - get number of stop bits
285-------------------------------------------------*/
286
287static float get_stop_bits(dart_channel *ch)
319288{
320   z80dart_t *z80dart = get_safe_token(device);
321   dart_channel *ch = &z80dart->channel[channel];
322
323289   float bits = 1;
324290
325291   switch (ch->wr[4] & Z80DART_WR4_STOP_BITS_MASK)
326292   {
327   case Z80DART_WR4_STOP_BITS_1:
328      bits = 1;
329
330   case Z80DART_WR4_STOP_BITS_1_5:
331      bits = 1.5;
332
333   case Z80DART_WR4_STOP_BITS_2:
334      bits = 2;
293   case Z80DART_WR4_STOP_BITS_1:      bits = 1;      break;
294   case Z80DART_WR4_STOP_BITS_1_5:      bits = 1.5;      break;
295   case Z80DART_WR4_STOP_BITS_2:      bits = 2;      break;
335296   }
336297
337298   return bits;
338299}
339300
340static int z80dart_get_rx_word_length(const device_config *device, int channel)
301/*-------------------------------------------------
302    get_rx_word_length - get receive word length
303-------------------------------------------------*/
304
305static int get_rx_word_length(dart_channel *ch)
341306{
342   z80dart_t *z80dart = get_safe_token(device);
343   dart_channel *ch = &z80dart->channel[channel];
344
345307   int bits = 5;
346308
347309   switch (ch->wr[3] & Z80DART_WR3_RX_WORD_LENGTH_MASK)
348310   {
349   case Z80DART_WR3_RX_WORD_LENGTH_5:
350      bits = 5;
351
352   case Z80DART_WR3_RX_WORD_LENGTH_6:
353      bits = 6;
354
355   case Z80DART_WR3_RX_WORD_LENGTH_7:
356      bits = 7;
357
358   case Z80DART_WR3_RX_WORD_LENGTH_8:
359      bits = 8;
311   case Z80DART_WR3_RX_WORD_LENGTH_5:   bits = 5;      break;
312   case Z80DART_WR3_RX_WORD_LENGTH_6:   bits = 6;      break;
313   case Z80DART_WR3_RX_WORD_LENGTH_7:   bits = 7;      break;
314   case Z80DART_WR3_RX_WORD_LENGTH_8:   bits = 8;      break;
360315   }
361316
362317   return bits;
363318}
364319
365static int z80dart_get_tx_word_length(const device_config *device, int channel)
320/*-------------------------------------------------
321    get_rx_word_length - get transmit word length
322-------------------------------------------------*/
323
324static int get_tx_word_length(dart_channel *ch)
366325{
367   z80dart_t *z80dart = get_safe_token(device);
368   dart_channel *ch = &z80dart->channel[channel];
369
370326   int bits = 5;
371327
372328   switch (ch->wr[5] & Z80DART_WR5_TX_WORD_LENGTH_MASK)
373329   {
374   case Z80DART_WR5_TX_WORD_LENGTH_5:
375      bits = 5;
376
377   case Z80DART_WR5_TX_WORD_LENGTH_6:
378      bits = 6;
379
380   case Z80DART_WR5_TX_WORD_LENGTH_7:
381      bits = 7;
382
383   case Z80DART_WR5_TX_WORD_LENGTH_8:
384      bits = 8;
330   case Z80DART_WR5_TX_WORD_LENGTH_5:   bits = 5;   break;
331   case Z80DART_WR5_TX_WORD_LENGTH_6:   bits = 6;   break;
332   case Z80DART_WR5_TX_WORD_LENGTH_7:   bits = 7;   break;
333   case Z80DART_WR5_TX_WORD_LENGTH_8:   bits = 8;   break;
385334   }
386335
387336   return bits;
388337}
389338
390static void z80dart_reset_channel(const device_config *device, int channel)
339/*-------------------------------------------------
340    reset_channel - reset channel status
341-------------------------------------------------*/
342
343static void reset_channel(const device_config *device, int channel)
391344{
392345   z80dart_t *z80dart = get_safe_token(device);
393346   dart_channel *ch = &z80dart->channel[channel];
r4243r4244
401354   ch->tx_state = STATE_START;
402355
403356   /* reset external lines */
404   z80dart_rts_w(device, channel, 1);
405   z80dart_dtr_w(device, channel, 1);
357   RTS(1);
358   DTR(1);
406359
407360   if (channel == Z80DART_CH_A)
408361   {
r4243r4244
414367         z80dart->int_state[i] = 0;
415368      }
416369
417      z80dart_check_interrupt(device);
370      check_interrupts(device);
418371   }
419372}
420373
421/***************************************************************************
422    SERIAL RECEIVE
423***************************************************************************/
374/*-------------------------------------------------
375    detect_start_bit - detect start bit
376-------------------------------------------------*/
424377
425static int detect_start_bit(const device_config *device, int channel)
378static int detect_start_bit(dart_channel *ch)
426379{
427   z80dart_t *z80dart = get_safe_token(device);
428   dart_channel *ch = &z80dart->channel[channel];
429   
430   if (!(ch->wr[3] & Z80DART_WR3_RX_ENABLE))
431      return 0;
380   if (!(ch->wr[3] & Z80DART_WR3_RX_ENABLE)) return 0;
432381
433   return !z80dart_rxd_r(device, channel);
382   return !RXD;
434383}
435384
436static void shift_data_in(const device_config *device, int channel)
385/*-------------------------------------------------
386    shift_data_in - shift in serial data
387-------------------------------------------------*/
388
389static void shift_data_in(dart_channel *ch)
437390{
438   z80dart_t *z80dart = get_safe_token(device);
439   dart_channel *ch = &z80dart->channel[channel];
440
441391   if (ch->rx_bits < 8)
442392   {
443      int rxd = z80dart_rxd_r(device, channel);
393      int rxd = RXD;
444394
445395      ch->rx_shift >>= 1;
446396      ch->rx_shift = (rxd << 7) | (ch->rx_shift & 0x7f);
r4243r4244
449399   }
450400}
451401
452static int character_completed(const device_config *device, int channel)
402/*-------------------------------------------------
403    character_completed - check if complete
404   data word has been transferred
405-------------------------------------------------*/
406
407static int character_completed(dart_channel *ch)
453408{
454   z80dart_t *z80dart = get_safe_token(device);
455   dart_channel *ch = &z80dart->channel[channel];
456
457   return ch->rx_bits == z80dart_get_rx_word_length(device, channel);
409   return ch->rx_bits == get_rx_word_length(ch);
458410}
459411
412/*-------------------------------------------------
413    detect_parity_error - detect parity error
414-------------------------------------------------*/
415
460416static void detect_parity_error(const device_config *device, int channel)
461417{
462418   z80dart_t *z80dart = get_safe_token(device);
463419   dart_channel *ch = &z80dart->channel[channel];
464420   
465   int rxd = z80dart_rxd_r(device, channel);
466421   int parity = (ch->wr[1] & Z80DART_WR4_PARITY_EVEN) ? 1 : 0;
467422
468   if (rxd != (ch->rx_parity ^ parity))
423   if (RXD != (ch->rx_parity ^ parity))
469424   {
470425      /* parity error detected */
471426      ch->rx_error |= Z80DART_RR1_PARITY_ERROR;
r4243r4244
475430      case Z80DART_WR1_RX_INT_FIRST:
476431         if (!ch->rx_first)
477432         {
478            z80dart_trigger_interrupt(device, channel, INT_SPECIAL);
433            take_interrupt(device, channel, INT_SPECIAL);
479434         }
480435         break;
481436     
482437      case Z80DART_WR1_RX_INT_ALL_PARITY:
483         z80dart_trigger_interrupt(device, channel, INT_SPECIAL);
438         take_interrupt(device, channel, INT_SPECIAL);
484439         break;
485440     
486441      case Z80DART_WR1_RX_INT_ALL:
487         z80dart_trigger_interrupt(device, channel, INT_RECEIVE);
442         take_interrupt(device, channel, INT_RECEIVE);
488443         break;
489444      }
490445   }
491446}
492447
448/*-------------------------------------------------
449    detect_framing_error - detect framing error
450-------------------------------------------------*/
451
493452static void detect_framing_error(const device_config *device, int channel)
494453{
495454   z80dart_t *z80dart = get_safe_token(device);
496455   dart_channel *ch = &z80dart->channel[channel];
497456   
498   int rxd = z80dart_rxd_r(device, channel);
499
500   if (!rxd)
457   if (!RXD)
501458   {
502459      /* framing error detected */
503460      ch->rx_error |= Z80DART_RR1_FRAMING_ERROR;
r4243r4244
507464      case Z80DART_WR1_RX_INT_FIRST:
508465         if (!ch->rx_first)
509466         {
510            z80dart_trigger_interrupt(device, channel, INT_SPECIAL);
467            take_interrupt(device, channel, INT_SPECIAL);
511468         }
512469         break;
513470     
514471      case Z80DART_WR1_RX_INT_ALL_PARITY:
515472      case Z80DART_WR1_RX_INT_ALL:
516         z80dart_trigger_interrupt(device, channel, INT_SPECIAL);
473         take_interrupt(device, channel, INT_SPECIAL);
517474         break;
518475      }
519476   }
520477}
521478
479/*-------------------------------------------------
480    receive - receive serial data
481-------------------------------------------------*/
482
522483static void receive(const device_config *device, int channel)
523484{
524485   z80dart_t *z80dart = get_safe_token(device);
525486   dart_channel *ch = &z80dart->channel[channel];
526487   
527   float stop_bits = z80dart_get_stop_bits(device, channel);
488   float stop_bits = get_stop_bits(ch);
528489
529490   switch (ch->rx_state)
530491   {
531492   case STATE_START:
532493      /* check for start bit */
533      if (detect_start_bit(device, channel))
494      if (detect_start_bit(ch))
534495      {
535496         /* start bit detected */
536497         ch->rx_shift = 0;
r4243r4244
545506
546507   case STATE_DATA:
547508      /* shift bit into shift register */
548      shift_data_in(device, channel);
509      shift_data_in(ch);
549510     
550      if (character_completed(device, channel))
511      if (character_completed(ch))
551512      {
552513         /* all data bits received */
553514         if (ch->wr[4] & Z80DART_WR4_PARITY_ENABLE)
r4243r4244
568529
569530   case STATE_PARITY:
570531      /* shift bit into shift register */
571      shift_data_in(device, channel);
532      shift_data_in(ch);
572533
573534      /* check for parity error */
574535      detect_parity_error(device, channel);
r4243r4244
582543
583544   case STATE_STOP:
584545      /* shift bit into shift register */
585      shift_data_in(device, channel);
546      shift_data_in(ch);
586547
587548      /* check for framing error */
588549      detect_framing_error(device, channel);
r4243r4244
593554
594555   case STATE_STOP2:
595556      /* shift bit into shift register */
596      shift_data_in(device, channel);
557      shift_data_in(ch);
597558
598559      /* check for framing error */
599560      detect_framing_error(device, channel);
r4243r4244
607568   }
608569}
609570
610/***************************************************************************
611    SERIAL TRANSMIT
612***************************************************************************/
571/*-------------------------------------------------
572    transmit - transmit serial data
573-------------------------------------------------*/
613574
614#define TXD(state) z80dart_txd_w(device, channel, 1);
615
616575static void transmit(const device_config *device, int channel)
617576{
618577   z80dart_t *z80dart = get_safe_token(device);
619578   dart_channel *ch = &z80dart->channel[channel];
620579   
621   int word_length = z80dart_get_tx_word_length(device, channel);
622   float stop_bits = z80dart_get_stop_bits(device, channel);
580   int word_length = get_tx_word_length(ch);
581   float stop_bits = get_stop_bits(ch);
623582
624583   switch (ch->tx_state)
625584   {
r4243r4244
636595         ch->rr[0] |= Z80DART_RR0_TX_BUFFER_EMPTY;
637596
638597         if (ch->wr[1] & Z80DART_WR1_TX_INT_ENABLE)
639            z80dart_trigger_interrupt(device, channel, INT_TRANSMIT);
598            take_interrupt(device, channel, INT_TRANSMIT);
640599
641600         ch->tx_state = STATE_DATA;
642601      }
r4243r4244
702661
703662         /* when the RTS bit is reset, the _RTS output goes high after the transmitter empties */
704663         if (!ch->rts)
705            z80dart_rts_w(device, channel, 1);
664            RTS(1);
706665      }
707666
708667      ch->tx_state = STATE_START;
r4243r4244
710669   }
711670}
712671
713/***************************************************************************
714    CONTROL REGISTER READ/WRITE
715***************************************************************************/
672/*-------------------------------------------------
673    z80dart_c_r - read control register
674-------------------------------------------------*/
716675
717676READ8_DEVICE_HANDLER( z80dart_c_r )
718677{
r4243r4244
742701   return data;
743702}
744703
704/*-------------------------------------------------
705    z80dart_c_w - write control register
706-------------------------------------------------*/
707
745708WRITE8_DEVICE_HANDLER( z80dart_c_w )
746709{
747710   z80dart_t *z80dart = get_safe_token(device);
r4243r4244
782745      case Z80DART_WR0_CHANNEL_RESET:
783746         /* channel reset */
784747         LOG(("Z80DART \"%s\" Channel %c : Channel Reset\n", device->tag, 'A' + channel));
785         z80dart_reset_channel(device, channel);
748         reset_channel(device, channel);
786749         break;
787750
788751      case Z80DART_WR0_ENABLE_INT_NEXT_RX:
r4243r4244
835798         break;
836799      }
837800
838      z80dart_check_interrupt(device);
801      check_interrupts(device);
839802      break;
840803
841804   case 2:
842805      /* interrupt vector */
843      z80dart_check_interrupt(device);
806      check_interrupts(device);
844807      LOG(("Z80DART \"%s\" Channel %c : Interrupt Vector %02x\n", device->tag, 'A' + channel, data));
845808      break;
846809
847810   case 3:
848811      LOG(("Z80DART \"%s\" Channel %c : Receiver Enable %u\n", device->tag, 'A' + channel, (data & Z80DART_WR3_RX_ENABLE) ? 1 : 0));
849812      LOG(("Z80DART \"%s\" Channel %c : Auto Enables %u\n", device->tag, 'A' + channel, (data & Z80DART_WR3_AUTO_ENABLES) ? 1 : 0));
850      LOG(("Z80DART \"%s\" Channel %c : Receiver Bits/Character %u\n", device->tag, 'A' + channel, z80dart_get_rx_word_length(device, channel)));
813      LOG(("Z80DART \"%s\" Channel %c : Receiver Bits/Character %u\n", device->tag, 'A' + channel, get_rx_word_length(ch)));
851814      break;
852815
853816   case 4:
854817      LOG(("Z80DART \"%s\" Channel %c : Parity Enable %u\n", device->tag, 'A' + channel, (data & Z80DART_WR4_PARITY_ENABLE) ? 1 : 0));
855818      LOG(("Z80DART \"%s\" Channel %c : Parity %s\n", device->tag, 'A' + channel, (data & Z80DART_WR4_PARITY_EVEN) ? "Even" : "Odd"));
856      LOG(("Z80DART \"%s\" Channel %c : Stop Bits %f\n", device->tag, 'A' + channel, z80dart_get_stop_bits(device, channel)));
857      LOG(("Z80DART \"%s\" Channel %c : Clock Mode %uX\n", device->tag, 'A' + channel, z80dart_get_clock_mode(device, channel)));
819      LOG(("Z80DART \"%s\" Channel %c : Stop Bits %f\n", device->tag, 'A' + channel, get_stop_bits(ch)));
820      LOG(("Z80DART \"%s\" Channel %c : Clock Mode %uX\n", device->tag, 'A' + channel, get_clock_mode(ch)));
858821      break;
859822
860823   case 5:
861824      LOG(("Z80DART \"%s\" Channel %c : Transmitter Enable %u\n", device->tag, 'A' + channel, (data & Z80DART_WR5_TX_ENABLE) ? 1 : 0));
862      LOG(("Z80DART \"%s\" Channel %c : Transmitter Bits/Character %u\n", device->tag, 'A' + channel, z80dart_get_tx_word_length(device, channel)));
825      LOG(("Z80DART \"%s\" Channel %c : Transmitter Bits/Character %u\n", device->tag, 'A' + channel, get_tx_word_length(ch)));
863826      LOG(("Z80DART \"%s\" Channel %c : Send Break %u\n", device->tag, 'A' + channel, (data & Z80DART_WR5_SEND_BREAK) ? 1 : 0));
864827      LOG(("Z80DART \"%s\" Channel %c : Request to Send %u\n", device->tag, 'A' + channel, (data & Z80DART_WR5_RTS) ? 1 : 0));
865828      LOG(("Z80DART \"%s\" Channel %c : Data Terminal Ready %u\n", device->tag, 'A' + channel, (data & Z80DART_WR5_DTR) ? 1 : 0));
r4243r4244
867830      if (data & Z80DART_WR5_RTS)
868831      {
869832         /* when the RTS bit is set, the _RTS output goes low */
870         z80dart_rts_w(device, channel, 0);
833         RTS(0);
871834
872835         ch->rts = 1;
873836      }
r4243r4244
879842
880843      /* data terminal ready output follows the state programmed into the DTR bit*/
881844      ch->dtr = (data & Z80DART_WR5_DTR) ? 0 : 1;
882      z80dart_dtr_w(device, channel, ch->dtr);
845      DTR(ch->dtr);
883846      break;
884847   }
885848}
886849
887/***************************************************************************
888    DATA REGISTER READ/WRITE
889***************************************************************************/
850/*-------------------------------------------------
851    z80dart_d_r - read data register
852-------------------------------------------------*/
890853
891854READ8_DEVICE_HANDLER( z80dart_d_r )
892855{
r4243r4244
918881   return data;
919882}
920883
884/*-------------------------------------------------
885    z80dart_d_w - write data register
886-------------------------------------------------*/
887
921888WRITE8_DEVICE_HANDLER( z80dart_d_w )
922889{
923890   z80dart_t *z80dart = get_safe_token(device);
r4243r4244
932899   LOG(("Z80DART \"%s\" Channel %c : Data Register Write '%02x'\n", device->tag, 'A' + channel, data));
933900}
934901
935/***************************************************************************
936    CONTROL LINE READ/WRITE
937***************************************************************************/
902/*-------------------------------------------------
903    z80dart_receive_data - receive data word
904-------------------------------------------------*/
938905
939906void z80dart_receive_data(const device_config *device, int channel, UINT8 data)
940907{
r4243r4244
953920      case Z80DART_WR1_RX_INT_FIRST:
954921         if (!ch->rx_first)
955922         {
956            z80dart_trigger_interrupt(device, channel, INT_SPECIAL);
923            take_interrupt(device, channel, INT_SPECIAL);
957924         }
958925         break;
959926     
960927      case Z80DART_WR1_RX_INT_ALL_PARITY:
961928      case Z80DART_WR1_RX_INT_ALL:
962         z80dart_trigger_interrupt(device, channel, INT_SPECIAL);
929         take_interrupt(device, channel, INT_SPECIAL);
963930         break;
964931      }
965932   }
r4243r4244
980947   case Z80DART_WR1_RX_INT_FIRST:
981948      if (ch->rx_first)
982949      {
983         z80dart_trigger_interrupt(device, channel, INT_RECEIVE);
950         take_interrupt(device, channel, INT_RECEIVE);
984951
985952         ch->rx_first = 0;
986953      }
r4243r4244
988955
989956   case Z80DART_WR1_RX_INT_ALL_PARITY:
990957   case Z80DART_WR1_RX_INT_ALL:
991      z80dart_trigger_interrupt(device, channel, INT_RECEIVE);
958      take_interrupt(device, channel, INT_RECEIVE);
992959      break;
993960   }
994961}
995962
996void z80dart_cts_w(const device_config *device, int channel, int state)
963/*-------------------------------------------------
964    cts_w - clear to send handler
965-------------------------------------------------*/
966
967static void cts_w(const device_config *device, int channel, int state)
997968{
998969   z80dart_t *z80dart = get_safe_token(device);
999970   dart_channel *ch = &z80dart->channel[channel];
r4243r4244
1021992         if (ch->wr[1] & Z80DART_WR1_EXT_INT_ENABLE)
1022993         {
1023994            /* trigger interrupt */
1024            z80dart_trigger_interrupt(device, channel, INT_EXTERNAL);
995            take_interrupt(device, channel, INT_EXTERNAL);
1025996
1026997            /* latch read register 0 */
1027998            ch->rx_rr0_latch = 1;
r4243r4244
10301001   }
10311002}
10321003
1033void z80dart_dcd_w(const device_config *device, int channel, int state)
1004/*-------------------------------------------------
1005    z80dart_ctsa_w - clear to send (channel A)
1006-------------------------------------------------*/
1007
1008void z80dart_ctsa_w(const device_config *device, int state)
10341009{
1010   cts_w(device, Z80DART_CH_A, state);
1011}
1012
1013/*-------------------------------------------------
1014    z80dart_ctsb_w - clear to send (channel B)
1015-------------------------------------------------*/
1016
1017void z80dart_ctsb_w(const device_config *device, int state)
1018{
1019   cts_w(device, Z80DART_CH_B, state);
1020}
1021
1022/*-------------------------------------------------
1023    dcd_w - data carrier detected handler
1024-------------------------------------------------*/
1025
1026void dcd_w(const device_config *device, int channel, int state)
1027{
10351028   z80dart_t *z80dart = get_safe_token(device);
10361029   dart_channel *ch = &z80dart->channel[channel];
10371030
r4243r4244
10571050         if (ch->wr[1] & Z80DART_WR1_EXT_INT_ENABLE)
10581051         {
10591052            /* trigger interrupt */
1060            z80dart_trigger_interrupt(device, channel, INT_EXTERNAL);
1053            take_interrupt(device, channel, INT_EXTERNAL);
10611054
10621055            /* latch read register 0 */
10631056            ch->rx_rr0_latch = 1;
r4243r4244
10661059   }
10671060}
10681061
1069void z80dart_ri_w(const device_config *device, int channel, int state)
1062/*-------------------------------------------------
1063    z80dart_dcda_w - data carrier detected
1064   (channel A)
1065-------------------------------------------------*/
1066
1067void z80dart_dcda_w(const device_config *device, int state)
10701068{
1069   dcd_w(device, Z80DART_CH_A, state);
1070}
1071
1072/*-------------------------------------------------
1073    z80dart_dcdb_w - data carrier detected
1074   (channel B)
1075-------------------------------------------------*/
1076
1077void z80dart_dcdb_w(const device_config *device, int state)
1078{
1079   dcd_w(device, Z80DART_CH_B, state);
1080}
1081
1082/*-------------------------------------------------
1083    ri_w - ring indicator handler
1084-------------------------------------------------*/
1085
1086static void ri_w(const device_config *device, int channel, int state)
1087{
10711088   z80dart_t *z80dart = get_safe_token(device);
10721089   dart_channel *ch = &z80dart->channel[channel];
10731090
r4243r4244
10881105         if (ch->wr[1] & Z80DART_WR1_EXT_INT_ENABLE)
10891106         {
10901107            /* trigger interrupt */
1091            z80dart_trigger_interrupt(device, channel, INT_EXTERNAL);
1108            take_interrupt(device, channel, INT_EXTERNAL);
10921109
10931110            /* latch read register 0 */
10941111            ch->rx_rr0_latch = 1;
r4243r4244
10971114   }
10981115}
10991116
1100/***************************************************************************
1101    CLOCK MANAGEMENT
1102***************************************************************************/
1117/*-------------------------------------------------
1118    z80dart_ria_w - ring indicator (channel A)
1119-------------------------------------------------*/
11031120
1104void z80dart_rxca_w(const device_config *device)
1121void z80dart_ria_w(const device_config *device, int state)
11051122{
1123   ri_w(device, Z80DART_CH_A, state);
1124}
1125
1126/*-------------------------------------------------
1127    z80dart_rib_w - ring indicator (channel B)
1128-------------------------------------------------*/
1129
1130void z80dart_rib_w(const device_config *device, int state)
1131{
1132   ri_w(device, Z80DART_CH_B, state);
1133}
1134
1135/*-------------------------------------------------
1136    z80dart_rxca_w - receive clock (channel A)
1137-------------------------------------------------*/
1138
1139void z80dart_rxca_w(const device_config *device, int state)
1140{
11061141   z80dart_t *z80dart = get_safe_token(device);
11071142   dart_channel *ch = &z80dart->channel[Z80DART_CH_A];
11081143
1109   int clocks = z80dart_get_clock_mode(device, Z80DART_CH_A);
1144   int clocks = get_clock_mode(ch);
11101145
1146   if (!state) return;
1147
11111148   LOG(("Z80DART \"%s\" Channel A : Receiver Clock Pulse\n", device->tag));
11121149   
11131150   ch->rx_clock++;
r4243r4244
11211158   }
11221159}
11231160
1124void z80dart_txca_w(const device_config *device)
1161/*-------------------------------------------------
1162    z80dart_txca_w - transmit clock (channel A)
1163-------------------------------------------------*/
1164
1165void z80dart_txca_w(const device_config *device, int state)
11251166{
11261167   z80dart_t *z80dart = get_safe_token(device);
11271168   dart_channel *ch = &z80dart->channel[Z80DART_CH_A];
11281169
1129   int clocks = z80dart_get_clock_mode(device, Z80DART_CH_A);
1170   int clocks = get_clock_mode(ch);
11301171
1172   if (!state) return;
1173
11311174   LOG(("Z80DART \"%s\" Channel A : Transmitter Clock Pulse\n", device->tag));
11321175   
11331176   ch->tx_clock++;
r4243r4244
11411184   }
11421185}
11431186
1144void z80dart_rxtxcb_w(const device_config *device)
1187/*-------------------------------------------------
1188    z80dart_rxtxcb_w - receive/transmit clock
1189   (channel B)
1190-------------------------------------------------*/
1191
1192void z80dart_rxtxcb_w(const device_config *device, int state)
11451193{
11461194   z80dart_t *z80dart = get_safe_token(device);
11471195   dart_channel *ch = &z80dart->channel[Z80DART_CH_B];
11481196
1149   int clocks = z80dart_get_clock_mode(device, Z80DART_CH_B);
1197   int clocks = get_clock_mode(ch);
11501198
1199   if (!state) return;
1200
11511201   LOG(("Z80DART \"%s\" Channel A : Receiver/Transmitter Clock Pulse\n", device->tag));
11521202   
11531203   ch->rx_clock++;
r4243r4244
11641214   }
11651215}
11661216
1217/*-------------------------------------------------
1218    TIMER_CALLBACK( rxca_tick )
1219-------------------------------------------------*/
1220
11671221static TIMER_CALLBACK( rxca_tick )
11681222{
1169   z80dart_rxca_w(ptr);
1223   z80dart_rxca_w(ptr, 1);
11701224}
11711225
1226/*-------------------------------------------------
1227    TIMER_CALLBACK( txca_tick )
1228-------------------------------------------------*/
1229
11721230static TIMER_CALLBACK( txca_tick )
11731231{
1174   z80dart_txca_w(ptr);
1232   z80dart_txca_w(ptr, 1);
11751233}
11761234
1235/*-------------------------------------------------
1236    TIMER_CALLBACK( rxtxcb_tick )
1237-------------------------------------------------*/
1238
11771239static TIMER_CALLBACK( rxtxcb_tick )
11781240{
1179   z80dart_rxtxcb_w(ptr);
1241   z80dart_rxtxcb_w(ptr, 1);
11801242}
11811243
1182/***************************************************************************
1183    DAISY CHAIN INTERFACE
1184***************************************************************************/
1244/*-------------------------------------------------
1245    z80dart_irq_state - get interrupt status
1246-------------------------------------------------*/
11851247
11861248static int z80dart_irq_state(const device_config *device)
11871249{
r4243r4244
12101272   return state;
12111273}
12121274
1275/*-------------------------------------------------
1276    z80dart_irq_ack - interrupt acknowledge
1277-------------------------------------------------*/
1278
12131279static int z80dart_irq_ack(const device_config *device)
12141280{
12151281   z80dart_t *z80dart = get_safe_token( device );
r4243r4244
12261292         /* clear interrupt, switch to the IEO state, and update the IRQs */
12271293         z80dart->int_state[i] = Z80_DAISY_IEO;
12281294         z80dart->channel[Z80DART_CH_A].rr[0] &= ~Z80DART_RR0_INTERRUPT_PENDING;
1229         z80dart_check_interrupt(device);
1295         check_interrupts(device);
12301296
12311297         LOG(("Z80DART \"%s\" : Interrupt Acknowledge Vector %02x\n", device->tag, z80dart->channel[Z80DART_CH_B].rr[2]));
12321298
r4243r4244
12391305   return z80dart->channel[Z80DART_CH_B].rr[2];
12401306}
12411307
1308/*-------------------------------------------------
1309    z80dart_irq_reti - return from interrupt
1310-------------------------------------------------*/
1311
12421312static void z80dart_irq_reti(const device_config *device)
12431313{
12441314   z80dart_t *z80dart = get_safe_token( device );
r4243r4244
12541324      {
12551325         /* clear the IEO state and update the IRQs */
12561326         z80dart->int_state[i] &= ~Z80_DAISY_IEO;
1257         z80dart_check_interrupt(device);
1327         check_interrupts(device);
12581328         return;
12591329      }
12601330   }
r4243r4244
12621332   logerror("z80dart_irq_reti: failed to find an interrupt to clear IEO on!\n");
12631333}
12641334
1265/***************************************************************************
1266    READ/WRITE HANDLERS
1267***************************************************************************/
1335/*-------------------------------------------------
1336    z80dart_r - register read
1337-------------------------------------------------*/
12681338
12691339READ8_DEVICE_HANDLER( z80dart_r )
12701340{
12711341   return (offset & 2) ? z80dart_c_r(device, offset & 1) : z80dart_d_r(device, offset & 1);
12721342}
12731343
1344/*-------------------------------------------------
1345    z80dart_w - register write
1346-------------------------------------------------*/
1347
12741348WRITE8_DEVICE_HANDLER( z80dart_w )
12751349{
12761350   if (offset & 2)
r4243r4244
12791353      z80dart_d_w(device, offset & 1, data);
12801354}
12811355
1356/*-------------------------------------------------
1357    z80dart_alt_r - alternate register read
1358-------------------------------------------------*/
1359
12821360READ8_DEVICE_HANDLER( z80dart_alt_r )
12831361{
12841362   int channel = BIT(offset, 1);
r4243r4244
12861364   return (offset & 1) ? z80dart_c_r(device, channel) : z80dart_d_r(device, channel);
12871365}
12881366
1367/*-------------------------------------------------
1368    z80dart_alt_w - alternate register write
1369-------------------------------------------------*/
1370
12891371WRITE8_DEVICE_HANDLER( z80dart_alt_w )
12901372{
12911373   int channel = BIT(offset, 1);
r4243r4244
12961378      z80dart_d_w(device, channel, data);
12971379}
12981380
1299/***************************************************************************
1300    DEVICE INTERFACE
1301***************************************************************************/
1381/*-------------------------------------------------
1382    DEVICE_START( z80dart )
1383-------------------------------------------------*/
13021384
13031385static DEVICE_START( z80dart )
13041386{
1387   z80dart_t *z80dart = get_safe_token(device);
13051388   const z80dart_interface *intf = device->static_config;
1306   z80dart_t *z80dart = get_safe_token(device);
1307   const device_config *cpu = NULL;
1389   int channel;
13081390
1309   assert(intf != NULL);
1310   z80dart->intf = intf;
1391   /* resolve callbacks */
1392   devcb_resolve_read_line(&z80dart->channel[Z80DART_CH_A].in_rxd_func, &intf->in_rxda_func, device);
1393   devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_A].out_txd_func, &intf->out_txda_func, device);
1394   devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_A].out_dtr_func, &intf->out_dtra_func, device);
1395   devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_A].out_rts_func, &intf->out_rtsa_func, device);
1396   devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_A].out_wrdy_func, &intf->out_wrdya_func, device);
1397   devcb_resolve_read_line(&z80dart->channel[Z80DART_CH_B].in_rxd_func, &intf->in_rxdb_func, device);
1398   devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_B].out_txd_func, &intf->out_txdb_func, device);
1399   devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_B].out_dtr_func, &intf->out_dtrb_func, device);
1400   devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_B].out_rts_func, &intf->out_rtsb_func, device);
1401   devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_B].out_wrdy_func, &intf->out_wrdyb_func, device);
1402   devcb_resolve_write_line(&z80dart->out_int_func, &intf->out_int_func, device);
13111403
1312   /* get clock */
1404   if (intf->rx_clock_a)
1405   {
1406      /* allocate channel A receive timer */
1407      z80dart->rxca_timer = timer_alloc(device->machine, rxca_tick, (void *)device);
1408      timer_adjust_periodic(z80dart->rxca_timer, attotime_zero, 0, ATTOTIME_IN_HZ(intf->rx_clock_a));
1409   }
13131410
1314   if (intf->cpu != NULL)
1411   if (intf->tx_clock_a)
13151412   {
1316      cpu = cputag_get_cpu(device->machine, intf->cpu);
1413      /* allocate channel A transmit timer */
1414      z80dart->txca_timer = timer_alloc(device->machine, txca_tick, (void *)device);
1415      timer_adjust_periodic(z80dart->txca_timer, attotime_zero, 0, ATTOTIME_IN_HZ(intf->tx_clock_a));
13171416   }
13181417
1319   if (cpu != NULL)
1418   if (intf->rx_tx_clock_b)
13201419   {
1321      z80dart->clock = cpu_get_clock(cpu);
1420      /* allocate channel B receive/transmit timer */
1421      z80dart->rxtxcb_timer = timer_alloc(device->machine, rxtxcb_tick, (void *)device);
1422      timer_adjust_periodic(z80dart->rxtxcb_timer, attotime_zero, 0, ATTOTIME_IN_HZ(intf->rx_tx_clock_b));
13221423   }
1323   else
1424
1425   /* register for state saving */
1426   for (channel = Z80DART_CH_A; channel <= Z80DART_CH_B; channel++)
13241427   {
1325      assert(intf->clock > 0);
1326      z80dart->clock = intf->clock;
1428      state_save_register_device_item_array(device, channel, z80dart->channel[channel].rr);
1429      state_save_register_device_item_array(device, channel, z80dart->channel[channel].wr);
1430      state_save_register_device_item_array(device, channel, z80dart->channel[channel].rx_data_fifo);
1431      state_save_register_device_item_array(device, channel, z80dart->channel[channel].rx_error_fifo);
1432      state_save_register_device_item(device, channel, z80dart->channel[channel].rx_shift);
1433      state_save_register_device_item(device, channel, z80dart->channel[channel].rx_error);
1434      state_save_register_device_item(device, channel, z80dart->channel[channel].rx_fifo);
1435      state_save_register_device_item(device, channel, z80dart->channel[channel].rx_clock);
1436      state_save_register_device_item(device, channel, z80dart->channel[channel].rx_state);
1437      state_save_register_device_item(device, channel, z80dart->channel[channel].rx_bits);
1438      state_save_register_device_item(device, channel, z80dart->channel[channel].rx_first);
1439      state_save_register_device_item(device, channel, z80dart->channel[channel].rx_parity);
1440      state_save_register_device_item(device, channel, z80dart->channel[channel].rx_break);
1441      state_save_register_device_item(device, channel, z80dart->channel[channel].rx_rr0_latch);
1442      state_save_register_device_item(device, channel, z80dart->channel[channel].ri);
1443      state_save_register_device_item(device, channel, z80dart->channel[channel].cts);
1444      state_save_register_device_item(device, channel, z80dart->channel[channel].dcd);
1445      state_save_register_device_item(device, channel, z80dart->channel[channel].tx_data);
1446      state_save_register_device_item(device, channel, z80dart->channel[channel].tx_shift);
1447      state_save_register_device_item(device, channel, z80dart->channel[channel].tx_clock);
1448      state_save_register_device_item(device, channel, z80dart->channel[channel].tx_state);
1449      state_save_register_device_item(device, channel, z80dart->channel[channel].tx_bits);
1450      state_save_register_device_item(device, channel, z80dart->channel[channel].tx_parity);
1451      state_save_register_device_item(device, channel, z80dart->channel[channel].dtr);
1452      state_save_register_device_item(device, channel, z80dart->channel[channel].rts);
13271453   }
13281454
1329   /* allocate channel A receive timer */
1455   state_save_register_device_item_array(device, 0, z80dart->int_state);
1456}
13301457
1331   z80dart->rxca_timer = timer_alloc(device->machine, rxca_tick, (void *)device);
1458/*-------------------------------------------------
1459    DEVICE_RESET( z80dart )
1460-------------------------------------------------*/
13321461
1333   if (z80dart->intf->rx_clock_a)
1334      timer_adjust_periodic(z80dart->rxca_timer, attotime_zero, 0, ATTOTIME_IN_HZ(z80dart->intf->rx_clock_a));
1335
1336   /* allocate channel A transmit timer */
1337
1338   z80dart->txca_timer = timer_alloc(device->machine, txca_tick, (void *)device);
1339
1340   if (z80dart->intf->tx_clock_a)
1341      timer_adjust_periodic(z80dart->txca_timer, attotime_zero, 0, ATTOTIME_IN_HZ(z80dart->intf->tx_clock_a));
1342
1343   /* allocate channel B receive/transmit timer */
1344
1345   z80dart->rxtxcb_timer = timer_alloc(device->machine, rxtxcb_tick, (void *)device);
1346
1347   if (z80dart->intf->rx_tx_clock_b)
1348      timer_adjust_periodic(z80dart->rxtxcb_timer, attotime_zero, 0, ATTOTIME_IN_HZ(z80dart->intf->rx_tx_clock_b));
1349
1350   /* register for state saving */
1351   //state_save_register_item_array(machine, "z80dart", device->tag, 0, z80dart->);
1352}
1353
13541462static DEVICE_RESET( z80dart )
13551463{
13561464   int channel;
r4243r4244
13591467
13601468   for (channel = Z80DART_CH_A; channel <= Z80DART_CH_B; channel++)
13611469   {
1362      z80dart_reset_channel(device, channel);
1470      reset_channel(device, channel);
13631471   }
13641472
1365   z80dart_check_interrupt(device);
1473   check_interrupts(device);
13661474}
13671475
1476/*-------------------------------------------------
1477    DEVICE_SET_INFO( z80dart )
1478-------------------------------------------------*/
1479
13681480static DEVICE_SET_INFO( z80dart )
13691481{
13701482   switch (state)
r4243r4244
13731485   }
13741486}
13751487
1488/*-------------------------------------------------
1489    DEVICE_GET_INFO( z80dart )
1490-------------------------------------------------*/
1491
13761492DEVICE_GET_INFO( z80dart )
13771493{
13781494   switch (state)
r4243r4244
13921508      case DEVINFO_FCT_IRQ_RETI:                  info->f = (genf *)z80dart_irq_reti;            break;
13931509
13941510      /* --- the following bits of info are returned as NULL-terminated strings --- */
1395      case DEVINFO_STR_NAME:                     strcpy(info->s, "Zilog Z80 DART");                  break;
1396      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Z80");                        break;
1397      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                        break;
1398      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                        break;
1399      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");         break;
1511      case DEVINFO_STR_NAME:                     strcpy(info->s, "Zilog Z80 DART");            break;
1512      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Z80");                     break;
1513      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
1514      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                  break;
1515      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");      break;
14001516   }
14011517}
src/mess/machine/abcbus.c
r4243r4244
2525      (*tailptr)->next = NULL;
2626      (*tailptr)->device = devtag_get_device(machine, daisy->devtype, device_inherit_tag(tempstring, cputag, daisy->devname));
2727      if ((*tailptr)->device == NULL)
28      {
29         astring_free(tempstring);
2830         fatalerror("Unable to locate device '%s'", daisy->devname);
31      }
2932      (*tailptr)->card_select = (abcbus_card_select)device_get_info_fct((*tailptr)->device, DEVINFO_FCT_ABCBUS_CARD_SELECT);
3033      tailptr = &(*tailptr)->next;
3134   }
src/mess/machine/z80dart.h
r4243r4244
3333#ifndef __Z80DART_H_
3434#define __Z80DART_H_
3535
36#include "devcb.h"
37
3638/***************************************************************************
37    CALLBACK FUNCTION PROTOTYPES
39    MACROS / CONSTANTS
3840***************************************************************************/
3941
40typedef void (*z80dart_on_int_changed_func) (const device_config *device, int state);
41#define Z80DART_ON_INT_CHANGED(name) void name(const device_config *device, int state)
42#define Z80DART   DEVICE_GET_INFO_NAME(z80dart)
43/*
44#define Z8470   DEVICE_GET_INFO_NAME(z8470)
45#define LH0081   DEVICE_GET_INFO_NAME(lh0088)
46#define MK3881   DEVICE_GET_INFO_NAME(mk3888)
47*/
4248
43typedef int (*z80dart_rxd_read_func) (const device_config *device, int channel);
44#define Z80DART_RXD_READ(name) int name(const device_config *device, int channel)
49#define MDRV_Z80DART_ADD(_tag, _clock, _config) \
50   MDRV_DEVICE_ADD(_tag, Z80DART, _clock) \
51   MDRV_DEVICE_CONFIG(_config)
4552
46typedef void (*z80dart_on_txd_changed_func) (const device_config *device, int channel, int level);
47#define Z80DART_ON_TXD_CHANGED(name) void name(const device_config *device, int channel, int level)
53#define MDRV_Z80DART_REMOVE(_tag) \
54   MDRV_DEVICE_REMOVE(_tag, Z80DART)
4855
49typedef void (*z80dart_on_wrdy_changed_func) (const device_config *device, int channel, int level);
50#define Z80DART_ON_WRDY_CHANGED(name) void name(const device_config *device, int channel, int level)
56#define Z80DART_INTERFACE(_name) \
57   const z80dart_interface (_name) =
5158
52typedef void (*z80dart_on_rts_changed_func) (const device_config *device, int channel, int level);
53#define Z80DART_ON_RTS_CHANGED(name) void name(const device_config *device, int channel, int level)
54
55typedef void (*z80dart_on_dtr_changed_func) (const device_config *device, int channel, int level);
56#define Z80DART_ON_DTR_CHANGED(name) void name(const device_config *device, int channel, int level)
57
5859/***************************************************************************
5960    TYPE DEFINITIONS
6061***************************************************************************/
r4243r4244
6869typedef struct _z80dart_interface z80dart_interface;
6970struct _z80dart_interface
7071{
71   const char *cpu;      /* cpu tag */
72   int clock;            /* base clock */
73
7472   int rx_clock_a;         /* channel A receive clock */
7573   int tx_clock_a;         /* channel A transmit clock */
7674   int rx_tx_clock_b;      /* channel B receive/transmit clock */
7775
78   /* this gets called for every change of the INT pin (pin 5) */
79   z80dart_on_int_changed_func      on_int_changed;
76   devcb_read_line      in_rxda_func;
77   devcb_write_line   out_txda_func;
78   devcb_write_line   out_dtra_func;
79   devcb_write_line   out_rtsa_func;
80   devcb_write_line   out_wrdya_func;
8081
81   /* this gets called for every read of the RxDA/RxDB pins (pin 12/28) */
82   z80dart_rxd_read_func         rxd_r;
82   devcb_read_line      in_rxdb_func;
83   devcb_write_line   out_txdb_func;
84   devcb_write_line   out_dtrb_func;
85   devcb_write_line   out_rtsb_func;
86   devcb_write_line   out_wrdyb_func;
8387
84   /* this gets called for every change of the TxDA/TxDB pins (pin 15/26) */
85   z80dart_on_txd_changed_func      on_txd_changed;
86
87   /* this gets called for every change of the DTRA/DTRB pins (pin 16/25) */
88   z80dart_on_dtr_changed_func      on_dtr_changed;
89
90   /* this gets called for every change of the RTSA/RTSB pins (pin 17/24) */
91   z80dart_on_rts_changed_func      on_rts_changed;
92
93   /* this gets called for every change of the WRDYA/WRDYB pins (pin 10/30) */
94   z80dart_on_wrdy_changed_func   on_wrdy_changed;
88   devcb_write_line   out_int_func;
9589};
96#define Z80DART_INTERFACE(name) const z80dart_interface (name)=
9790
9891/***************************************************************************
99    DEVICE CONFIGURATION MACROS
92    PROTOTYPES
10093***************************************************************************/
10194
102#define MDRV_Z80DART_ADD(_tag, _intrf) \
103   MDRV_DEVICE_ADD(_tag, Z80DART, 0) \
104   MDRV_DEVICE_CONFIG(_intrf)
105
106#define MDRV_Z80DART_REMOVE(_tag) \
107   MDRV_DEVICE_REMOVE(_tag, Z80DART)
108
109/***************************************************************************
110    CONTROL REGISTER READ/WRITE
111***************************************************************************/
112
95/* control register access */
11396WRITE8_DEVICE_HANDLER( z80dart_c_w );
11497READ8_DEVICE_HANDLER( z80dart_c_r );
11598
116/***************************************************************************
117    DATA REGISTER READ/WRITE
118***************************************************************************/
119
99/* data register access */
120100WRITE8_DEVICE_HANDLER( z80dart_d_w );
121101READ8_DEVICE_HANDLER( z80dart_d_r );
122102
123/***************************************************************************
124    CLOCK MANAGEMENT
125***************************************************************************/
103void z80dart_rxca_w(const device_config *device, int state);
104void z80dart_txca_w(const device_config *device, int state);
105void z80dart_ria_w(const device_config *device, int state);
106void z80dart_dcda_w(const device_config *device, int state);
107void z80dart_ctsa_w(const device_config *device, int state);
126108
127void z80dart_rxca_w(const device_config *device);
128void z80dart_txca_w(const device_config *device);
129void z80dart_rxtxcb_w(const device_config *device);
109void z80dart_rxtxcb_w(const device_config *device, int state);
110void z80dart_rib_w(const device_config *device, int state);
111void z80dart_dcdb_w(const device_config *device, int state);
112void z80dart_ctsb_w(const device_config *device, int state);
130113
131/***************************************************************************
132    CONTROL LINE READ/WRITE
133***************************************************************************/
134
135114void z80dart_receive_data(const device_config *device, int channel, UINT8 data);
136115
137void z80dart_ri_w(const device_config *device, int channel, int level);
138void z80dart_dcd_w(const device_config *device, int channel, int level);
139void z80dart_cts_w(const device_config *device, int channel, int level);
140
141/***************************************************************************
142    READ/WRITE HANDLERS
143***************************************************************************/
144
145116/* A0 = B/A
146117   A1 = C/D */
147118READ8_DEVICE_HANDLER( z80dart_r );
r4243r4244
152123READ8_DEVICE_HANDLER( z80dart_alt_r );
153124WRITE8_DEVICE_HANDLER( z80dart_alt_w );
154125
155/***************************************************************************
156    DEVICE INTERFACE
157***************************************************************************/
158
159#define Z80DART DEVICE_GET_INFO_NAME(z80dart)
160126DEVICE_GET_INFO( z80dart );
161127
162#define Z8470 DEVICE_GET_INFO_NAME(z8470)
163DEVICE_GET_INFO( z8470 );
164
165#define LH0081 DEVICE_GET_INFO_NAME(lh0088)
166DEVICE_GET_INFO( lh0088 );
167
168#define MK3881 DEVICE_GET_INFO_NAME(mk3888)
169DEVICE_GET_INFO( mk3888 );
170
171128#endif
src/mess/machine/e0516.c
r4243r4244
11#include "driver.h"
22#include "e0516.h"
33
4enum {
4/***************************************************************************
5    TYPE DEFINITIONS
6***************************************************************************/
7
8enum
9{
510   E0516_REGISTER_SECOND = 0,
611   E0516_REGISTER_MINUTE,
712   E0516_REGISTER_HOUR,
r4243r4244
1520typedef struct _e0516_t e0516_t;
1621struct _e0516_t
1722{
18   const e0516_interface *intf;   /* interface */
19
2023   int cs;                     /* chip select */
2124   int data_latch;               /* data latch */
2225   int reg_latch;               /* register latch */
r4243r4244
3134   emu_timer *clock_timer;      /* clock timer */
3235};
3336
37/***************************************************************************
38    INLINE FUNCTIONS
39***************************************************************************/
40
3441INLINE e0516_t *get_safe_token(const device_config *device)
3542{
3643   assert(device != NULL);
3744   assert(device->token != NULL);
38
3945   return (e0516_t *)device->token;
4046}
4147
42/* Timer Callbacks */
48/***************************************************************************
49    IMPLEMENTATION
50***************************************************************************/
4351
44static TIMER_CALLBACK(clock_tick)
52/*-------------------------------------------------
53    TIMER_CALLBACK( clock_tick )
54-------------------------------------------------*/
55
56static TIMER_CALLBACK( clock_tick )
4557{
4658   const device_config *device = ptr;
4759   e0516_t *e0516 = get_safe_token(device);
r4243r4244
8597   }
8698}
8799
88/* Serial Data Input/Output */
100/*-------------------------------------------------
101    e0516_dio_r - data out
102-------------------------------------------------*/
89103
90104int e0516_dio_r(const device_config *device)
91105{
r4243r4244
94108   return e0516->dio;
95109}
96110
111/*-------------------------------------------------
112    e0516_dio_w - data in
113-------------------------------------------------*/
114
97115void e0516_dio_w(const device_config *device, int level)
98116{
99117   e0516_t *e0516 = get_safe_token(device);
r4243r4244
101119   e0516->dio = level;
102120}
103121
104/* Clock */
122/*-------------------------------------------------
123    e0516_clk_w - clock in
124-------------------------------------------------*/
105125
106126void e0516_clk_w(const device_config *device, int level)
107127{
r4243r4244
166186   }
167187}
168188
169/* Chip Select */
189/*-------------------------------------------------
190    e0516_clk_w - chip select
191-------------------------------------------------*/
170192
171193void e0516_cs_w(const device_config *device, int level)
172194{
r4243r4244
183205   }
184206}
185207
186/* Device Interface */
208/*-------------------------------------------------
209    DEVICE_START( e0516 )
210-------------------------------------------------*/
187211
188212static DEVICE_START( e0516 )
189213{
190214   e0516_t *e0516 = get_safe_token(device);
191215
192   /* validate arguments */
193   assert(device != NULL);
194   assert(device->tag != NULL);
195
196   e0516->intf = device->static_config;
197
198   assert(e0516->intf != NULL);
199   assert(e0516->intf->clock > 0);
200
201216   /* create the timers */
202217   e0516->clock_timer = timer_alloc(device->machine, clock_tick, (void *)device);
203   timer_adjust_periodic(e0516->clock_timer, attotime_zero, 0, ATTOTIME_IN_HZ(e0516->intf->clock / 32768));
218   timer_adjust_periodic(e0516->clock_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 32768));
204219
205220   /* register for state saving */
206   state_save_register_item(device->machine, "e0516", device->tag, 0, e0516->cs);
207   state_save_register_item(device->machine, "e0516", device->tag, 0, e0516->data_latch);
208   state_save_register_item(device->machine, "e0516", device->tag, 0, e0516->reg_latch);
209   state_save_register_item(device->machine, "e0516", device->tag, 0, e0516->read_write);
210   state_save_register_item(device->machine, "e0516", device->tag, 0, e0516->state);
211   state_save_register_item(device->machine, "e0516", device->tag, 0, e0516->bits);
212   state_save_register_item(device->machine, "e0516", device->tag, 0, e0516->dio);
213
214   state_save_register_item_array(device->machine, "e0516", device->tag, 0, e0516->reg);
221   state_save_register_device_item(device, 0, e0516->cs);
222   state_save_register_device_item(device, 0, e0516->data_latch);
223   state_save_register_device_item(device, 0, e0516->reg_latch);
224   state_save_register_device_item(device, 0, e0516->read_write);
225   state_save_register_device_item(device, 0, e0516->state);
226   state_save_register_device_item(device, 0, e0516->bits);
227   state_save_register_device_item(device, 0, e0516->dio);
228   state_save_register_device_item_array(device, 0, e0516->reg);
215229}
216230
231/*-------------------------------------------------
232    DEVICE_SET_INFO( e0516 )
233-------------------------------------------------*/
234
217235static DEVICE_SET_INFO( e0516 )
218236{
219237   switch (state)
r4243r4244
222240   }
223241}
224242
243/*-------------------------------------------------
244    DEVICE_GET_INFO( e0516 )
245-------------------------------------------------*/
246
225247DEVICE_GET_INFO( e0516 )
226248{
227249   switch (state)
src/mess/machine/e0516.h
r4243r4244
11#ifndef __E0516__
22#define __E0516__
33
4#define E0516   DEVICE_GET_INFO_NAME(e0516)
4/***************************************************************************
5    MACROS / CONSTANTS
6***************************************************************************/
57
6#define MDRV_E0516_ADD(_tag, _config)   \
7   MDRV_DEVICE_ADD(_tag, E0516, 0)      \
8   MDRV_DEVICE_CONFIG(_config)
8#define E0516 DEVICE_GET_INFO_NAME(e0516)
99
10/* interface */
11typedef struct _e0516_interface e0516_interface;
12struct _e0516_interface
13{
14   int clock;               /* the clock (pin 15) of the chip */
15   
16   int *dio_pin;            /* the DI/O (pin 13) of the chip */
17};
10#define MDRV_E0516_ADD(_tag, _clock) \
11   MDRV_DEVICE_ADD(_tag, E0516, _clock)
1812
13/***************************************************************************
14    PROTOTYPES
15***************************************************************************/
16
1917/* device interface */
2018DEVICE_GET_INFO( e0516 );
2119
src/mess/machine/mtx.c
r4243r4244
265265
266266Z80DART_INTERFACE( mtx_dart_intf )
267267{
268      "main",
269      MTX_SYSTEM_CLOCK,
270      0,
271      0,
272      0,
273      NULL,
274      NULL,
275      NULL,
276      NULL,
277      NULL,
278      NULL
279};
268   0,
269   0,
270   0,
280271
272   DEVCB_NULL,
273   DEVCB_NULL,
274   DEVCB_NULL,
275   DEVCB_NULL,
276   DEVCB_NULL,
281277
278   DEVCB_NULL,
279   DEVCB_NULL,
280   DEVCB_NULL,
281   DEVCB_NULL,
282   DEVCB_NULL,
282283
284   DEVCB_NULL,
285};
286
283287/*************************************
284288 *
285289 *  Bank switching
src/mess/machine/abc77.c
r4243r4244
33#include "cpu/mcs48/mcs48.h"
44#include "sound/discrete.h"
55
6/***************************************************************************
7    PARAMETERS
8***************************************************************************/
9
10#define I8035_TAG   "z16"
11
12/***************************************************************************
13    TYPE DEFINITIONS
14***************************************************************************/
15
616typedef struct _abc77_t abc77_t;
717struct _abc77_t
818{
9   const abc77_interface *intf;   /* interface */
19   devcb_resolved_write_line   out_txd_func;
20   devcb_resolved_write_line   out_clock_func;
21   devcb_resolved_write_line   out_keydown_func;
1022
1123   const device_config *cpu;      /* CPU of the 8035 */
1224
r4243r4244
1931   emu_timer *reset_timer;         /* reset timer */
2032};
2133
34/***************************************************************************
35    INLINE FUNCTIONS
36***************************************************************************/
37
2238INLINE abc77_t *get_safe_token(const device_config *device)
2339{
2440   assert(device != NULL);
2541   assert(device->token != NULL);
26
2742   return (abc77_t *)device->token;
2843}
2944
30/* Discrete Sound */
45INLINE const abc77_interface *get_interface(const device_config *device)
46{
47   assert(device != NULL);
48   assert((device->type == ABC77));
49   return (const abc77_interface *) device->static_config;
50}
3151
52/***************************************************************************
53    IMPLEMENTATION
54***************************************************************************/
55
56/*-------------------------------------------------
57    DISCRETE_SOUND( abc77 )
58-------------------------------------------------*/
59
3260static const discrete_555_desc abc77_ne556_a =
3361{
3462   DISC_555_OUT_SQW | DISC_555_OUT_DC,
r4243r4244
4270   DISCRETE_OUTPUT(NODE_02, 5000)
4371DISCRETE_SOUND_END
4472
45/* Read/Write Handlers */
73/*-------------------------------------------------
74    TIMER_DEVICE_CALLBACK( clock_tick )
75-------------------------------------------------*/
4676
47void abc77_rxd_w(const device_config *device, int level)
48{
49   abc77_t *abc77 = get_safe_token(device);
50
51   cpu_set_input_line(abc77->cpu, MCS48_INPUT_IRQ, level ? CLEAR_LINE : ASSERT_LINE);
52}
53
5477static TIMER_DEVICE_CALLBACK( clock_tick )
5578{
5679   const device_config *device = devtag_get_device(timer->machine, ABC77, ABC77_TAG);
5780   abc77_t *abc77 = get_safe_token(device);
5881
5982   abc77->clock = !abc77->clock;
83
84   devcb_call_write_line(&abc77->out_clock_func, abc77->clock);
6085}
6186
87/*-------------------------------------------------
88    TIMER_CALLBACK( reset_tick )
89-------------------------------------------------*/
90
6291static TIMER_CALLBACK( reset_tick )
6392{
6493   const device_config *device = ptr;
r4243r4244
6796   cpu_set_input_line(abc77->cpu, INPUT_LINE_RESET, CLEAR_LINE);
6897}
6998
70void abc77_reset_w(const device_config *device, int level)
71{
72   abc77_t *abc77 = get_safe_token(device);
99/*-------------------------------------------------
100    abc77_clock_r - read serial clock
101-------------------------------------------------*/
73102
74   if (abc77->reset && !level)
75   {
76      /* trigger reset */
77      int t = 1.1 * RES_K(100) * CAP_N(100) * 1000; // t = 1.1 * R1 * C1
78      int ea = BIT(input_port_read(device->machine, "ABC77_DSW"), 7);
79
80      cpu_set_input_line(abc77->cpu, INPUT_LINE_RESET, ASSERT_LINE);
81      timer_adjust_oneshot(abc77->reset_timer, ATTOTIME_IN_MSEC(t), 0);
82
83      cpu_set_input_line(abc77->cpu, MCS48_INPUT_EA, ea ? CLEAR_LINE : ASSERT_LINE);
84   }
85
86   abc77->reset = level;
87}
88
89103static READ8_HANDLER( abc77_clock_r )
90104{
91105   const device_config *device = devtag_get_device(space->machine, ABC77, ABC77_TAG);
r4243r4244
94108   return abc77->clock;
95109}
96110
111/*-------------------------------------------------
112    abc77_data_r - read keyboard matrix
113-------------------------------------------------*/
114
97115static READ8_HANDLER( abc77_data_r )
98116{
99117   const device_config *device = devtag_get_device(space->machine, ABC77, ABC77_TAG);
r4243r4244
104122   return input_port_read(device->machine, keynames[abc77->keylatch]);
105123}
106124
125/*-------------------------------------------------
126    abc77_data_w - keyboard control
127-------------------------------------------------*/
128
107129static WRITE8_HANDLER( abc77_data_w )
108130{
109131   const device_config *device = devtag_get_device(space->machine, ABC77, ABC77_TAG);
r4243r4244
120142   discrete_sound_w(space, NODE_01, BIT(data, 4));
121143
122144   /* transmit data */
123   abc77->intf->txd_w(device, BIT(data, 5));
145   devcb_call_write_line(&abc77->out_txd_func, BIT(data, 5));
124146
125147   /* key down */
126   abc77->intf->keydown_w(device, BIT(data, 6));
148   devcb_call_write_line(&abc77->out_keydown_func, BIT(data, 6));
127149
128150   /* hysteresis */
129151   abc77->hys = BIT(data, 7);
130152}
131153
132/* Memory Maps */
154/*-------------------------------------------------
155    ADDRESS_MAP( abc77_map )
156-------------------------------------------------*/
133157
134158static ADDRESS_MAP_START( abc77_map, ADDRESS_SPACE_PROGRAM, 8 )
135159   AM_RANGE(0x000, 0xfff) AM_ROM
136160ADDRESS_MAP_END
137161
162/*-------------------------------------------------
163    ADDRESS_MAP( abc77_io_map )
164-------------------------------------------------*/
165
138166static ADDRESS_MAP_START( abc77_io_map, ADDRESS_SPACE_IO, 8 )
139167   AM_RANGE(0x00, 0x3f) AM_RAM
140168   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(abc77_data_r)
r4243r4244
143171   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ_PORT("ABC77_DSW")
144172ADDRESS_MAP_END
145173
146/* Input Ports */
174/*-------------------------------------------------
175    INPUT_PORTS( abc77 )
176-------------------------------------------------*/
147177
148178INPUT_PORTS_START( abc77 )
149179   PORT_START("ABC77_X0")
r4243r4244
284314   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
285315INPUT_PORTS_END
286316
287/* Machine Driver */
317/*-------------------------------------------------
318    MACHINE_DRIVER( abc77 )
319-------------------------------------------------*/
288320
289321static MACHINE_DRIVER_START( abc77 )
290322   /* keyboard cpu */
r4243r4244
304336   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
305337MACHINE_DRIVER_END
306338
307/* ROMs */
339/*-------------------------------------------------
340    ROM( abc77 )
341-------------------------------------------------*/
308342
309343ROM_START( abc77 )
310344   ROM_REGION( 0x1000, I8035_TAG, 0 )
r4243r4244
313347   ROM_FILL( 0, 0x1000, 0 )
314348ROM_END
315349
316/* Device Interface */
350/*-------------------------------------------------
351    abc77_rxd_w - keyboard serial data in
352-------------------------------------------------*/
317353
354void abc77_rxd_w(const device_config *device, int level)
355{
356   abc77_t *abc77 = get_safe_token(device);
357
358   cpu_set_input_line(abc77->cpu, MCS48_INPUT_IRQ, level ? CLEAR_LINE : ASSERT_LINE);
359}
360
361/*-------------------------------------------------
362    abc77_reset_w - keyboard reset
363-------------------------------------------------*/
364
365void abc77_reset_w(const device_config *device, int level)
366{
367   abc77_t *abc77 = get_safe_token(device);
368
369   if (abc77->reset && !level)
370   {
371      int t = 1.1 * RES_K(100) * CAP_N(100) * 1000; // t = 1.1 * R1 * C1
372      int ea = BIT(input_port_read(device->machine, "ABC77_DSW"), 7);
373
374      /* trigger reset */
375      cpu_set_input_line(abc77->cpu, INPUT_LINE_RESET, ASSERT_LINE);
376      timer_adjust_oneshot(abc77->reset_timer, ATTOTIME_IN_MSEC(t), 0);
377
378      cpu_set_input_line(abc77->cpu, MCS48_INPUT_EA, ea ? CLEAR_LINE : ASSERT_LINE);
379   }
380
381   abc77->reset = level;
382}
383
384/*-------------------------------------------------
385    DEVICE_START( abc77 )
386-------------------------------------------------*/
387
318388static DEVICE_START( abc77 )
319389{
320390   abc77_t *abc77 = device->token;
391   const abc77_interface *intf = get_interface(device);
392
321393   astring *tempstring = astring_alloc();
322394
323   /* validate arguments */
395   /* resolve callbacks */
396   devcb_resolve_write_line(&abc77->out_txd_func, &intf->out_txd_func, device);
397   devcb_resolve_write_line(&abc77->out_clock_func, &intf->out_clock_func, device);
398   devcb_resolve_write_line(&abc77->out_keydown_func, &intf->out_keydown_func, device);
324399
325   assert(device->tag != NULL);
326
327   abc77->intf = device->static_config;
328   assert(abc77->intf != NULL);
329   assert(abc77->intf->txd_w != NULL);
330   assert(abc77->intf->keydown_w != NULL);
331
332400   /* find our CPU */
333
334401   astring_printf(tempstring, "%s:%s", device->tag, I8035_TAG);
335402   abc77->cpu = cputag_get_cpu(device->machine, astring_c(tempstring));
336403   astring_free(tempstring);
337404
338405   /* allocate reset timer */
339
340406   abc77->reset_timer = timer_alloc(device->machine, reset_tick, (FPTR *) device);
341407
342408   /* register for state saving */
343
344   state_save_register_item(device->machine, "abc77", device->tag, 0, abc77->keylatch);
345   state_save_register_item(device->machine, "abc77", device->tag, 0, abc77->clock);
346   state_save_register_item(device->machine, "abc77", device->tag, 0, abc77->hys);
347   state_save_register_item(device->machine, "abc77", device->tag, 0, abc77->reset);
409   state_save_register_device_item(device, 0, abc77->keylatch);
410   state_save_register_device_item(device, 0, abc77->clock);
411   state_save_register_device_item(device, 0, abc77->hys);
412   state_save_register_device_item(device, 0, abc77->reset);
348413}
349414
415/*-------------------------------------------------
416    DEVICE_SET_INFO( abc77 )
417-------------------------------------------------*/
418
350419static DEVICE_SET_INFO( abc77 )
351420{
352421   switch (state)
r4243r4244
355424   }
356425}
357426
427/*-------------------------------------------------
428    DEVICE_GET_INFO( abc77 )
429-------------------------------------------------*/
430
358431DEVICE_GET_INFO( abc77 )
359432{
360433   switch (state)
src/mess/machine/abc77.h
r4243r4244
1717#ifndef __ABC77__
1818#define __ABC77__
1919
20#include "driver.h"
20#include "devcb.h"
2121
22/***************************************************************************
23    MACROS / CONSTANTS
24***************************************************************************/
25
2226#define ABC77_TAG   "abc77"
23#define I8035_TAG   "z16"
2427
2528#define ABC77 DEVICE_GET_INFO_NAME( abc77 )
2629
27typedef void (*abc77_on_txd_changed_func) (const device_config *device, int level);
28#define ABC77_ON_TXD_CHANGED(name) void name(const device_config *device, int level)
30#define MDRV_ABC77_ADD(_config) \
31   MDRV_DEVICE_ADD(ABC77_TAG, ABC77, 0)\
32   MDRV_DEVICE_CONFIG(_config)
2933
30typedef void (*abc77_on_keydown_changed_func) (const device_config *device, int level);
31#define ABC77_ON_KEYDOWN_CHANGED(name) void name(const device_config *device, int level)
34#define ABC77_INTERFACE(_name) \
35   const abc77_interface (_name) =
3236
33typedef void (*abc77_on_clock_changed_func) (const device_config *device, int level);
34#define ABC77_ON_CLOCK_CHANGED(name) void name(const device_config *device, int level)
37/***************************************************************************
38    TYPE DEFINITIONS
39***************************************************************************/
3540
36/* interface */
3741typedef struct _abc77_interface abc77_interface;
3842struct _abc77_interface
3943{
4044   /* this gets called for every change of the TxD pin (pin 1) */
41   abc77_on_txd_changed_func      txd_w;
45   devcb_write_line   out_txd_func;
4246
4347   /* this gets called for every change of the CLOCK pin (pin 4) */
44   abc77_on_clock_changed_func      clock_w;
48   devcb_write_line   out_clock_func;
4549
4650   /* this gets called for every change of the _KEYDOWN pin (pin 5) */
47   abc77_on_keydown_changed_func   keydown_w;
51   devcb_write_line   out_keydown_func;
4852};
49#define ABC77_INTERFACE(name) const abc77_interface (name) =
5053
51/* inline configuration */
52#define MDRV_ABC77_ADD(config) \
53   MDRV_SPEAKER_STANDARD_MONO("mono")\
54   MDRV_DEVICE_ADD(ABC77_TAG, ABC77, 0)\
55   MDRV_DEVICE_CONFIG(config)
54/***************************************************************************
55    PROTOTYPES
56***************************************************************************/
5657
5758/* device interface */
5859DEVICE_GET_INFO( abc77 );
r4243r4244
6162INPUT_PORTS_EXTERN( abc77 );
6263
6364/* receive data */
64void abc77_rxd_w(const device_config *device, int level);
65void abc77_rxd_w(const device_config *device, int state);
6566
6667/* reset */
67void abc77_reset_w(const device_config *device, int level);
68void abc77_reset_w(const device_config *device, int state);
6869
6970#endif
src/mess/drivers/abc80x.c
r4243r4244
181181      {
182182         const device_config *z80dart = devtag_get_device(machine, Z80DART, Z80DART_TAG);
183183
184         z80dart_dcd_w(z80dart, Z80DART_CH_B, 0);
184         z80dart_dcdb_w(z80dart, 0);
185185         z80dart_receive_data(z80dart, Z80DART_CH_B, keycode);
186186
187187         keylatch = keycode;
r4243r4244
193193      {
194194         const device_config *z80dart = devtag_get_device(machine, Z80DART, Z80DART_TAG);
195195
196         z80dart_dcd_w(z80dart, Z80DART_CH_B, 1);
196         z80dart_dcdb_w(z80dart, 1);
197197         z80dart_receive_data(z80dart, Z80DART_CH_B, 0);
198198
199199         keylatch = 0;
r4243r4244
211211static void abc800_bankswitch(running_machine *machine)
212212{
213213   abc800_state *state = machine->driver_data;
214   const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM);
214215   
215216   if (state->fetch_charram)
216217   {
217218      /* HR video RAM selected */
218      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK1, SMH_BANK1);
219      memory_install_readwrite8_handler(program, 0x0000, 0x3fff, 0, 0, SMH_BANK1, SMH_BANK1);
219220   }
220221   else
221222   {
222223      /* BASIC ROM selected */
223      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK1, SMH_UNMAP);
224      memory_install_readwrite8_handler(program, 0x0000, 0x3fff, 0, 0, SMH_BANK1, SMH_UNMAP);
224225   }
225226
226227   memory_set_bank(machine, 1, state->fetch_charram);
r4243r4244
229230static void abc802_bankswitch(running_machine *machine)
230231{
231232   abc802_state *state = machine->driver_data;
233   const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM);
232234
233235   if (state->lrs)
234236   {
235237      /* ROM and video RAM selected */
236      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x77ff, 0, 0, SMH_BANK1, SMH_BANK1);
237      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7800, 0x7fff, 0, 0, abc802_charram_r, abc802_charram_w);
238      memory_install_readwrite8_handler(program, 0x0000, 0x77ff, 0, 0, SMH_BANK1, SMH_BANK1);
239      memory_install_readwrite8_handler(program, 0x7800, 0x7fff, 0, 0, abc802_charram_r, abc802_charram_w);
238240   }
239241   else
240242   {
241243      /* low RAM selected */
242      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1);
244      memory_install_readwrite8_handler(program, 0x0000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1);
243245   }
244246
245247   memory_set_bank(machine, 1, state->lrs);
r4243r4244
248250static void abc806_bankswitch(running_machine *machine)
249251{
250252   abc806_state *state = machine->driver_data;
253   const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM);
251254   UINT32 videoram_mask = mess_ram_size - (32 * 1024) - 1;
252255   FPTR bank;
253256
r4243r4244
267270         
268271         //logerror("%04x-%04x: Video RAM %04x (32K)\n", start_addr, end_addr, videoram_offset);
269272
270         memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank));
273         memory_install_readwrite8_handler(program, start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank));
271274         memory_configure_bank(machine, bank, 1, 1, state->videoram + videoram_offset, 0);
272275         memory_set_bank(machine, bank, 1);
273276      }
r4243r4244
281284         
282285         //logerror("%04x-%04x: Work RAM (32K)\n", start_addr, end_addr);
283286
284         memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank));
287         memory_install_readwrite8_handler(program, start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank));
285288         memory_set_bank(machine, bank, 0);
286289      }
287290   }
r4243r4244
301304            /* map to video RAM */
302305            //logerror("%04x-%04x: Video RAM %04x (4K)\n", start_addr, end_addr, videoram_offset);
303306
304            memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank));
307            memory_install_readwrite8_handler(program, start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank));
305308            memory_configure_bank(machine, bank, 1, 1, state->videoram + videoram_offset, 0);
306309            memory_set_bank(machine, bank, 1);
307310         }
r4243r4244
315318               /* ROM */
316319               //logerror("%04x-%04x: ROM (4K)\n", start_addr, end_addr);
317320
318               memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_UNMAP);
321               memory_install_readwrite8_handler(program, start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_UNMAP);
319322               memory_set_bank(machine, bank, 0);
320323               break;
321324
r4243r4244
323326               /* ROM/char RAM */
324327               //logerror("%04x-%04x: ROM (4K)\n", start_addr, end_addr);
325328
326               memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7000, 0x77ff, 0, 0, SMH_BANK(bank), SMH_UNMAP);
327               memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7800, 0x7fff, 0, 0, abc806_charram_r, abc806_charram_w);
329               memory_install_readwrite8_handler(program, 0x7000, 0x77ff, 0, 0, SMH_BANK(bank), SMH_UNMAP);
330               memory_install_readwrite8_handler(program, 0x7800, 0x7fff, 0, 0, abc806_charram_r, abc806_charram_w);
328331               memory_set_bank(machine, bank, 0);
329332               break;
330333
r4243r4244
332335               /* work RAM */
333336               //logerror("%04x-%04x: Work RAM (4K)\n", start_addr, end_addr);
334337
335               memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank));
338               memory_install_readwrite8_handler(program, start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank));
336339               memory_set_bank(machine, bank, 0);
337340               break;
338341            }
r4243r4244
358361
359362         if (start_addr == 0x7000)
360363         {
361            memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7000, 0x77ff, 0, 0, SMH_BANK(bank), SMH_BANK(bank));
362            memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7800, 0x7fff, 0, 0, abc806_charram_r, abc806_charram_w);
364            memory_install_readwrite8_handler(program, 0x7000, 0x77ff, 0, 0, SMH_BANK(bank), SMH_BANK(bank));
365            memory_install_readwrite8_handler(program, 0x7800, 0x7fff, 0, 0, abc806_charram_r, abc806_charram_w);
363366         }
364367         else
365368         {
366            memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank));
369            memory_install_readwrite8_handler(program, start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank));
367370         }
368371
369372         memory_configure_bank(machine, bank, 1, 1, state->videoram + videoram_offset, 0);
r4243r4244
710713
711714/* ABC 77 */
712715
713static ABC77_ON_TXD_CHANGED( abc800_abc77_txd_changed )
716static WRITE_LINE_DEVICE_HANDLER( abc800_abc77_txd_w )
714717{
715   abc800_state *state = device->machine->driver_data;
718   abc800_state *driver_state = device->machine->driver_data;
716719
717   state->abc77_txd = level;
720   driver_state->abc77_txd = state;
718721}
719722
720static ABC77_ON_CLOCK_CHANGED( abc77_clock_changed )
723static WRITE_LINE_DEVICE_HANDLER( abc77_clock_w )
721724{
722725   const device_config *z80dart = devtag_get_device(device->machine, Z80DART, Z80DART_TAG);
723726
724727   /* connected to DART channel B clock */
725   z80dart_rxtxcb_w(z80dart);
728   z80dart_rxtxcb_w(z80dart, state);
726729}
727730
728static ABC77_ON_KEYDOWN_CHANGED( abc77_keydown_changed )
731static WRITE_LINE_DEVICE_HANDLER( abc77_keydown_w )
729732{
730733   const device_config *z80dart = devtag_get_device(device->machine, Z80DART, Z80DART_TAG);
731734
732   /* connected to DART channel B DCD (pin ) */
733   z80dart_dcd_w(z80dart, 1, level);
735   /* connected to DART channel B DCD */
736   z80dart_dcdb_w(z80dart, state);
734737}
735738
736739static ABC77_INTERFACE( abc800_abc77_intf )
737740{
738   abc800_abc77_txd_changed,
739   abc77_clock_changed,
740   abc77_keydown_changed
741   DEVCB_LINE(abc800_abc77_txd_w),
742   DEVCB_LINE(abc77_clock_w),
743   DEVCB_LINE(abc77_keydown_w)
741744};
742745
743static ABC77_ON_TXD_CHANGED( abc802_abc77_txd_changed )
746static WRITE_LINE_DEVICE_HANDLER( abc802_abc77_txd_w )
744747{
745   abc802_state *state = device->machine->driver_data;
748   abc802_state *driver_state = device->machine->driver_data;
746749
747   state->abc77_txd = level;
750   driver_state->abc77_txd = state;
748751}
749752
750753static ABC77_INTERFACE( abc802_abc77_intf )
751754{
752   abc802_abc77_txd_changed,
753   abc77_clock_changed,
754   abc77_keydown_changed
755   DEVCB_LINE(abc802_abc77_txd_w),
756   DEVCB_LINE(abc77_clock_w),
757   DEVCB_LINE(abc77_keydown_w)
755758};
756759
757static ABC77_ON_TXD_CHANGED( abc806_abc77_txd_changed )
760static WRITE_LINE_DEVICE_HANDLER( abc806_abc77_txd_w )
758761{
759   abc806_state *state = device->machine->driver_data;
762   abc806_state *driver_state = device->machine->driver_data;
760763
761   state->abc77_txd = level;
764   driver_state->abc77_txd = state;
762765}
763766
764767static ABC77_INTERFACE( abc806_abc77_intf )
765768{
766   abc806_abc77_txd_changed,
767   abc77_clock_changed,
768   abc77_keydown_changed
769   DEVCB_LINE(abc806_abc77_txd_w),
770   DEVCB_LINE(abc77_clock_w),
771   DEVCB_LINE(abc77_keydown_w)
769772};
770773
771774/* Z80 CTC */
r4243r4244
836839   const device_config *z80dart = devtag_get_device(device->machine, Z80DART, Z80DART_TAG);
837840
838841   /* connected to DART channel A clock inputs */
839   z80dart_rxca_w(z80dart);
840   z80dart_txca_w(z80dart);
842   z80dart_rxca_w(z80dart, data);
843   z80dart_txca_w(z80dart, data);
841844}
842845
843846static const z80ctc_interface ctc_intf =
r4243r4244
895898
896899/* Z80 DART */
897900
898static Z80DART_ON_INT_CHANGED( dart_interrupt )
901static READ_LINE_DEVICE_HANDLER( abc800_dart_rxdb_r )
899902{
900   cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_IRQ0, state);
901}
902
903static Z80DART_RXD_READ( abc800_dart_rxd_r )
904{
905903   abc800_state *state = device->machine->driver_data;
906904
907   if (channel == Z80DART_CH_B)
908   {
909      /* receive bit from keyboard */
910      return state->abc77_txd;
911   }
912
913   return 1;
905   /* receive bit from keyboard */
906   return state->abc77_txd;
914907}
915908
916static Z80DART_ON_TXD_CHANGED( abc800_dart_txd_w )
917{
918   abc800_state *state = device->machine->driver_data;
919
920   if (channel == Z80DART_CH_B)
921   {
922      /* transmit bit to keyboard */
923      abc77_rxd_w(state->abc77, level);
924   }
925}
926
927909static Z80DART_INTERFACE( abc800_dart_intf )
928910{
929   Z80_TAG,            /* cpu */
930   ABC800_X01/2/2,         /* clock */
931   0,                  /* channel A receive clock */
932   0,                  /* channel A transmit clock */
933   0,                  /* channel B clock */
934   dart_interrupt,         /* interrupt handler */
935   abc800_dart_rxd_r,      /* receive handler */
936   abc800_dart_txd_w,      /* transmit handler */
937   NULL,               /* DTR changed handler */
938   NULL,               /* RTS changed handler */
939   NULL               /* W/RDY changed handler */
940};
911   0,
912   0,
913   0,
941914
942static Z80DART_RXD_READ( abc802_dart_rxd_r )
943{
944   abc802_state *state = device->machine->driver_data;
915   DEVCB_NULL,
916   DEVCB_NULL,
917   DEVCB_NULL,
918   DEVCB_NULL,
919   DEVCB_NULL,
945920
946   if (channel == Z80DART_CH_B)
947   {
948      /* receive bit from keyboard */
949      return state->abc77_txd;
950   }
921   DEVCB_LINE(abc800_dart_rxdb_r),
922   DEVCB_NULL, /* DEVCB_DEVICE_LINE(ABC77, ABC77_TAG, abc77_rxd_w), */
923   DEVCB_NULL,
924   DEVCB_NULL,
925   DEVCB_NULL,
951926
952   return 1;
953}
927   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0)
928};
954929
955static Z80DART_ON_TXD_CHANGED( abc802_dart_txd_w )
930static READ_LINE_DEVICE_HANDLER( abc802_dart_rxdb_r )
956931{
957932   abc802_state *state = device->machine->driver_data;
958933
959   if (channel == Z80DART_CH_B)
960   {
961      /* transmit bit to keyboard */
962      abc77_rxd_w(state->abc77, level);
963   }
934   /* receive bit from keyboard */
935   return state->abc77_txd;
964936}
965937
966static Z80DART_ON_DTR_CHANGED( abc802_dart_dtr_w )
938static WRITE_LINE_DEVICE_HANDLER( abc802_dart_dtrb_r )
967939{
968   abc802_state *state = device->machine->driver_data;
940   abc802_state *driver_state = device->machine->driver_data;
969941
970   if (channel == Z80DART_CH_B)
971   {
972      /* low RAM select */
973      state->lrs = level;
942   /* low RAM select */
943   driver_state->lrs = state;
974944
975      abc802_bankswitch(device->machine);
976   }
945   abc802_bankswitch(device->machine);
977946}
978947
979static Z80DART_ON_RTS_CHANGED( abc802_dart_rts_w )
948static WRITE_LINE_DEVICE_HANDLER( abc802_dart_rtsb_r )
980949{
981   abc802_state *state = device->machine->driver_data;
950   abc802_state *driver_state = device->machine->driver_data;
982951
983   if (channel == Z80DART_CH_B)
984   {
985      /* _MUX 80/40 */
986      state->mux80_40 = level;
987   }
952   /* _MUX 80/40 */
953   driver_state->mux80_40 = state;
988954}
989955
990956static Z80DART_INTERFACE( abc802_dart_intf )
991957{
992   Z80_TAG,            /* cpu */
993   ABC800_X01/2/2,         /* clock */
994   0,                  /* channel A receive clock */
995   0,                  /* channel A transmit clock */
996   0,                  /* channel B clock */
997   dart_interrupt,         /* interrupt handler */
998   abc802_dart_rxd_r,      /* receive handler */
999   abc802_dart_txd_w,      /* transmit handler */
1000   abc802_dart_dtr_w,      /* DTR changed handler */
1001   abc802_dart_rts_w,      /* RTS changed handler */
1002   NULL               /* W/RDY changed handler */
1003};
958   0,
959   0,
960   0,
1004961
1005static Z80DART_RXD_READ( abc806_dart_rxd_r )
1006{
1007   abc806_state *state = device->machine->driver_data;
962   DEVCB_NULL,
963   DEVCB_NULL,
964   DEVCB_NULL,
965   DEVCB_NULL,
966   DEVCB_NULL,
1008967
1009   if (channel == Z80DART_CH_B)
1010   {
1011      /* receive bit from keyboard */
1012      return state->abc77_txd;
1013   }
968   DEVCB_LINE(abc802_dart_rxdb_r),
969   DEVCB_NULL, /* DEVCB_DEVICE_LINE(ABC77, ABC77_TAG, abc77_rxd_w), */
970   DEVCB_LINE(abc802_dart_dtrb_r),
971   DEVCB_LINE(abc802_dart_rtsb_r),
972   DEVCB_NULL,
1014973
1015   return 1;
1016}
974   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0)
975};
1017976
1018static Z80DART_ON_TXD_CHANGED( abc806_dart_txd_w )
977static READ_LINE_DEVICE_HANDLER( abc806_dart_rxdb_r )
1019978{
1020979   abc806_state *state = device->machine->driver_data;
1021980
1022   if (channel == Z80DART_CH_B)
1023   {
1024      /* transmit bit to keyboard */
1025      abc77_rxd_w(state->abc77, level);
1026   }
981   /* receive bit from keyboard */
982   return state->abc77_txd;
1027983}
1028984
1029static Z80DART_ON_DTR_CHANGED( abc806_dart_dtr_w )
985static WRITE_LINE_DEVICE_HANDLER( abc806_dart_dtrb_w )
1030986{
1031   abc806_state *state = device->machine->driver_data;
987   abc806_state *driver_state = device->machine->driver_data;
1032988   
1033   if (channel == Z80DART_CH_B)
1034   {
1035      state->keydtr = level;
989   driver_state->keydtr = state;
1036990
1037      abc806_bankswitch(device->machine);
1038   }
991   abc806_bankswitch(device->machine);
1039992}
1040993
1041994static Z80DART_INTERFACE( abc806_dart_intf )
1042995{
1043   Z80_TAG,            /* cpu */
1044   ABC800_X01/2/2,         /* clock */
1045   0,                  /* channel A receive clock */
1046   0,                  /* channel A transmit clock */
1047   0,                  /* channel B clock */
1048   dart_interrupt,         /* interrupt handler */
1049   abc806_dart_rxd_r,      /* receive handler */
1050   abc806_dart_txd_w,      /* transmit handler */
1051   abc806_dart_dtr_w,      /* DTR changed handler */
1052   NULL,               /* RTS changed handler */
1053   NULL               /* W/RDY changed handler */
1054};
996   0,
997   0,
998   0,
1055999
1056/* E05-16 */
1000   DEVCB_NULL,
1001   DEVCB_NULL,
1002   DEVCB_NULL,
1003   DEVCB_NULL,
1004   DEVCB_NULL,
10571005
1058static const e0516_interface abc806_e0516_intf =
1059{
1060   ABC806_X02
1006   DEVCB_LINE(abc806_dart_rxdb_r),
1007   DEVCB_NULL, /* DEVCB_DEVICE_LINE(ABC77, ABC77_TAG, abc77_rxd_w), */
1008   DEVCB_LINE(abc806_dart_dtrb_w),
1009   DEVCB_NULL,
1010   DEVCB_NULL,
1011
1012   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0)
10611013};
10621014
10631015/* Z80 Daisy Chain */
r4243r4244
11581110   z80sio_set_cts(state->z80sio, 1, BIT(config, 1));
11591111
11601112   /* 40/80 char (S3) */
1161   z80dart_ri_w(state->z80dart, Z80DART_CH_A, BIT(config, 2)); // 0 = 40, 1 = 80
1113   z80dart_ria_w(state->z80dart, BIT(config, 2)); // 0 = 40, 1 = 80
11621114
11631115   /* 50/60 Hz */
1164   z80dart_cts_w(state->z80dart, Z80DART_CH_B, BIT(config, 3)); // 0 = 50Hz, 1 = 60Hz
1116   z80dart_ctsb_w(state->z80dart, BIT(config, 3)); // 0 = 50Hz, 1 = 60Hz
11651117}
11661118
11671119static MACHINE_START( abc806 )
r4243r4244
12291181   e0516_dio_w(state->e0516, 1);
12301182
12311183   /* 40/80 char */
1232   z80dart_ri_w(state->z80dart, Z80DART_CH_A, 1); // 0 = 40, 1 = 80
1184   z80dart_ria_w(state->z80dart, 1); // 0 = 40, 1 = 80
12331185
12341186   /* 50/60 Hz */
1235   z80dart_cts_w(state->z80dart, Z80DART_CH_B, 0); // 0 = 50Hz, 1 = 60Hz
1187   z80dart_ctsb_w(state->z80dart, 0); // 0 = 50Hz, 1 = 60Hz
12361188}
12371189
12381190/* Machine Drivers */
r4243r4244
12491201   MDRV_MACHINE_START(abc800)
12501202   MDRV_MACHINE_RESET(abc800)
12511203
1252   /* fake keyboard */
1253   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500))
1254
1255   /* ABC-77 keyboard */
1256//   MDRV_ABC77_ADD(abc800_abc77_intf)
1257
1258   /* Luxor Conkort 55-21046 */
1259//   MDRV_DEVICE_ADD(CONKORT_TAG, LUXOR_55_21046)
1260
12611204   /* video hardware */
12621205   MDRV_IMPORT_FROM(abc800m_video)
1263   
1264   /* Z80 CTC */
1265   MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf)
1266   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
12671206
1268   /* Z80 SIO/2 */
1269   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
1270
1271   /* Z80 DART */
1272   MDRV_Z80DART_ADD(Z80DART_TAG, abc800_dart_intf)
1273
1274   /* discrete sound */
1207   /* sound hardware */
12751208   MDRV_SPEAKER_STANDARD_MONO("mono")
12761209   MDRV_SOUND_ADD("discrete", DISCRETE, 0)
12771210   MDRV_SOUND_CONFIG_DISCRETE(abc800)
12781211   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1279
1280   /* printer */
1212   
1213   /* peripheral hardware */
1214   MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf)
1215   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
1216   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
1217   MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc800_dart_intf)
1218//   MDRV_ABC77_ADD(abc800_abc77_intf)
1219//   MDRV_LUXOR_55_21046_ADD
12811220   MDRV_PRINTER_ADD("printer")
1282
1283   /* cassette */
12841221   MDRV_CASSETTE_ADD( "cassette", default_cassette_config )
1222
1223   /* fake keyboard */
1224   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500))
12851225MACHINE_DRIVER_END
12861226
12871227static MACHINE_DRIVER_START( abc800c )
r4243r4244
12961236   MDRV_MACHINE_START(abc800)
12971237   MDRV_MACHINE_RESET(abc800)
12981238
1299   /* fake keyboard */
1300   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500))
1301
1302   /* ABC-77 keyboard */
1303//   MDRV_ABC77_ADD(abc800_abc77_intf)
1304
1305   /* Luxor Conkort 55-21046 */
1306//   MDRV_DEVICE_ADD(CONKORT_TAG, LUXOR_55_21046)
1307
13081239   /* video hardware */
13091240   MDRV_IMPORT_FROM(abc800c_video)
13101241
1311   /* Z80 CTC */
1312   MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf)
1313   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
1314
1315   /* Z80 SIO/2 */
1316   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
1317
1318   /* Z80 DART */
1319   MDRV_Z80DART_ADD(Z80DART_TAG, abc800_dart_intf)
1320
1321   /* discrete sound */
1242   /* sound hardware */
13221243   MDRV_SPEAKER_STANDARD_MONO("mono")
13231244   MDRV_SOUND_ADD("discrete", DISCRETE, 0)
13241245   MDRV_SOUND_CONFIG_DISCRETE(abc800)
13251246   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1326
1327   /* printer */
1247   
1248   /* peripheral hardware */
1249   MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf)
1250   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
1251   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
1252   MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc800_dart_intf)
1253//   MDRV_ABC77_ADD(abc800_abc77_intf)
1254//   MDRV_LUXOR_55_21046_ADD
13281255   MDRV_PRINTER_ADD("printer")
1329
1330   /* cassette */
13311256   MDRV_CASSETTE_ADD( "cassette", default_cassette_config )
1257
1258   /* fake keyboard */
1259   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500))
13321260MACHINE_DRIVER_END
13331261
13341262static MACHINE_DRIVER_START( abc802 )
r4243r4244
13431271   MDRV_MACHINE_START(abc802)
13441272   MDRV_MACHINE_RESET(abc802)
13451273
1346   /* fake keyboard */
1347   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500))
1348
1349   /* ABC-77 keyboard */
1350//   MDRV_ABC77_ADD(abc802_abc77_intf)
1351
1352   /* Luxor Conkort 55-21046 */
1353//   MDRV_DEVICE_ADD(CONKORT_TAG, LUXOR_55_21046)
1354
13551274   /* video hardware */
13561275   MDRV_IMPORT_FROM(abc802_video)
13571276
1358   /* Z80 CTC */
1359   MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf)
1360   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
1361
1362   /* Z80 SIO/2 */
1363   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
1364
1365   /* Z80 DART */
1366   MDRV_Z80DART_ADD(Z80DART_TAG, abc802_dart_intf)
1367
1368   /* discrete sound */
1277   /* sound hardware */
13691278   MDRV_SPEAKER_STANDARD_MONO("mono")
13701279   MDRV_SOUND_ADD("discrete", DISCRETE, 0)
13711280   MDRV_SOUND_CONFIG_DISCRETE(abc800)
13721281   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
13731282
1374   /* printer */
1283   /* peripheral hardware */
1284   MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf)
1285   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
1286   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
1287   MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc802_dart_intf)
1288//   MDRV_ABC77_ADD(abc802_abc77_intf)
1289//   MDRV_LUXOR_55_21046_ADD
13751290   MDRV_PRINTER_ADD("printer")
1376
1377   /* cassette */
13781291   MDRV_CASSETTE_ADD( "cassette", default_cassette_config )
1292
1293   /* fake keyboard */
1294   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500))
13791295MACHINE_DRIVER_END
13801296
13811297static MACHINE_DRIVER_START( abc806 )
r4243r4244
13901306   MDRV_MACHINE_START(abc806)
13911307   MDRV_MACHINE_RESET(abc806)
13921308   
1393   /* fake keyboard */
1394   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500))
1395
1396   /* ABC-77 keyboard */
1397   //MDRV_ABC77_ADD(abc806_abc77_intf)
1398
1399   /* Luxor Conkort 55-21046 */
1400//   MDRV_DEVICE_ADD(CONKORT_TAG, LUXOR_55_21046)
1401
14021309   /* video hardware */
14031310   MDRV_IMPORT_FROM(abc806_video)
14041311
1405   /* Z80 CTC */
1312   /* sound hardware */
1313   MDRV_SPEAKER_STANDARD_MONO("mono")
1314
1315   /* peripheral hardware */
1316   MDRV_E0516_ADD(E0516_TAG, ABC806_X02)
14061317   MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf)
14071318   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
1408
1409   /* Z80 SIO/2 */
14101319   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
1411
1412   /* Z80 DART */
1413   MDRV_Z80DART_ADD(Z80DART_TAG, abc806_dart_intf)
1414
1415   /* real time clock */
1416   MDRV_E0516_ADD(E0516_TAG, abc806_e0516_intf)
1417
1418   /* printer */
1320   MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc806_dart_intf)
1321//   MDRV_ABC77_ADD(abc806_abc77_intf)
1322//   MDRV_LUXOR_55_21046_ADD
14191323   MDRV_PRINTER_ADD("printer")
1420
1421   /* cassette */
14221324   MDRV_CASSETTE_ADD( "cassette", default_cassette_config )
1325
1326   /* fake keyboard */
1327   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500))
14231328MACHINE_DRIVER_END
14241329
14251330/* ROMs */
r4243r4244
17021607
17031608static DRIVER_INIT( abc800 )
17041609{
1705   memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), abc800_direct_update_handler);
1610   memory_set_direct_update_handler(cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM), abc800_direct_update_handler);
17061611}
17071612
17081613static DRIVER_INIT( abc802 )
17091614{
1710   memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), abc802_direct_update_handler);
1615   memory_set_direct_update_handler(cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM), abc802_direct_update_handler);
17111616}
17121617
17131618static DRIVER_INIT( abc806 )
17141619{
1715   memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), abc806_direct_update_handler);
1620   memory_set_direct_update_handler(cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM), abc806_direct_update_handler);
17161621}
17171622
17181623/* System Drivers */
src/mess/drivers/newbrain.c
r4243r4244
66#include "machine/6850acia.h"
77#include "machine/adc080x.h"
88#include "machine/z80ctc.h"
9#include "machine/z80dart.h"
109#include "machine/z80sio.h"
1110#include "includes/newbrain.h"
1211#include "includes/serial.h"
src/mess/drivers/mtx.c
r4243r4244
283283   MDRV_IMPORT_FROM(mtx512)
284284   MDRV_MACHINE_RESET(rs128)
285285
286   MDRV_Z80DART_ADD( "z80dart", mtx_dart_intf )
286   MDRV_Z80DART_ADD("z80dart", MTX_SYSTEM_CLOCK, mtx_dart_intf)
287287MACHINE_DRIVER_END
288288
289289
docs/messnew.txt
r4243r4244
7979
8080- Fixed image loading related memory leaks. [Curt Coder]
8181
82- Refactored the following devices to use devcb callbacks:
83  CDP1861, CDP1864, CDP1871, MC68901, ZX8301, ZX8302 [Curt Coder]
82- Refactored the following devices to use devcb callbacks: ABC77, CDP1861,
83  CDP1864, CDP1871, MC68901, Z80DART, ZX8301, ZX8302 [Curt Coder]
8484
8585
86
86870.129
8788
8889New System Drivers Supported (in no particular order):

Previous 15994 Revisions Next


© 1998-2018 The MESS Team