Previous 15994 Revisions Next

r8855 Sunday 22nd August, 2010 at 15:30:43 UTC by Curt Coder
Sync with MAME.
[src/emu/machine]z80dart.c z80dart.h

src/emu/machine/z80dart.c
r8854r8855
1717
1818    TODO:
1919
20   - synchronous mode (Z80-SIO/1,2)
2120    - break detection
2221    - wr0 reset tx interrupt pending
2322    - wait/ready
2423    - 1.5 stop bits
24   - synchronous mode (Z80-SIO/1,2)
25   - SDLC mode (Z80-SIO/1,2)
2526
2627*/
2728
r8854r8855
4849
4950enum
5051{
52   CHANNEL_A = 0,
53   CHANNEL_B
54};
55
56enum
57{
5158   STATE_START = 0,
5259   STATE_DATA,
5360   STATE_PARITY,
r8854r8855
6370   INT_SPECIAL
6471};
6572
66const int Z80DART_RR0_RX_CHAR_AVAILABLE      = 0x01;
67const int Z80DART_RR0_INTERRUPT_PENDING      = 0x02;
68const int Z80DART_RR0_TX_BUFFER_EMPTY      = 0x04;
69const int Z80DART_RR0_DCD               = 0x08;
70const int Z80DART_RR0_RI               = 0x10;
71const int Z80DART_RR0_CTS               = 0x20;
72const int Z80DART_RR0_BREAK               = 0x80; // not supported
73const int RR0_RX_CHAR_AVAILABLE      = 0x01;
74const int RR0_INTERRUPT_PENDING      = 0x02;
75const int RR0_TX_BUFFER_EMPTY      = 0x04;
76const int RR0_DCD               = 0x08;
77const int RR0_RI               = 0x10;
78const int RR0_SYNC_HUNT            = 0x10; // not supported
79const int RR0_CTS               = 0x20;
80const int RR0_TX_UNDERRUN         = 0x40; // not supported
81const int RR0_BREAK_ABORT         = 0x80; // not supported
7382
74const int Z80DART_RR1_ALL_SENT            = 0x01;
75const int Z80DART_RR1_PARITY_ERROR         = 0x10;
76const int Z80DART_RR1_RX_OVERRUN_ERROR      = 0x20;
77const int Z80DART_RR1_FRAMING_ERROR         = 0x40;
83const int RR1_ALL_SENT            = 0x01;
84const int RR1_RESIDUE_CODE_MASK      = 0x0e; // not supported
85const int RR1_PARITY_ERROR         = 0x10;
86const int RR1_RX_OVERRUN_ERROR      = 0x20;
87const int RR1_CRC_FRAMING_ERROR      = 0x40;
88const int RR1_END_OF_FRAME         = 0x80; // not supported
7889
79const int Z80DART_WR0_REGISTER_MASK         = 0x07;
80const int Z80DART_WR0_COMMAND_MASK         = 0x38;
81const int Z80DART_WR0_NULL_CODE            = 0x00;
82const int Z80DART_WR0_RESET_EXT_STATUS      = 0x10;
83const int Z80DART_WR0_CHANNEL_RESET         = 0x18;
84const int Z80DART_WR0_ENABLE_INT_NEXT_RX   = 0x20;
85const int Z80DART_WR0_RESET_TX_INT         = 0x28; // not supported
86const int Z80DART_WR0_ERROR_RESET         = 0x30;
87const int Z80DART_WR0_RETURN_FROM_INT      = 0x38; // not supported
90const int WR0_REGISTER_MASK         = 0x07;
91const int WR0_COMMAND_MASK         = 0x38;
92const int WR0_NULL               = 0x00;
93const int WR0_SEND_ABORT         = 0x08; // not supported
94const int WR0_RESET_EXT_STATUS      = 0x10;
95const int WR0_CHANNEL_RESET         = 0x18;
96const int WR0_ENABLE_INT_NEXT_RX   = 0x20;
97const int WR0_RESET_TX_INT         = 0x28; // not supported
98const int WR0_ERROR_RESET         = 0x30;
99const int WR0_RETURN_FROM_INT      = 0x38; // not supported
100const int WR0_CRC_RESET_CODE_MASK   = 0xc0; // not supported
101const int WR0_CRC_RESET_NULL      = 0x00; // not supported
102const int WR0_CRC_RESET_RX         = 0x40; // not supported
103const int WR0_CRC_RESET_TX         = 0x80; // not supported
104const int WR0_CRC_RESET_TX_UNDERRUN   = 0xc0; // not supported
88105
89const int Z80DART_WR1_EXT_INT_ENABLE      = 0x01;
90const int Z80DART_WR1_TX_INT_ENABLE         = 0x02;
91const int Z80DART_WR1_STATUS_VECTOR         = 0x04;
92const int Z80DART_WR1_RX_INT_ENABLE_MASK   = 0x18;
93const int Z80DART_WR1_RX_INT_DISABLE      = 0x00;
94const int Z80DART_WR1_RX_INT_FIRST         = 0x08;
95const int Z80DART_WR1_RX_INT_ALL_PARITY      = 0x10; // not supported
96const int Z80DART_WR1_RX_INT_ALL         = 0x18;
97const int Z80DART_WR1_WRDY_ON_RX_TX         = 0x20; // not supported
98const int Z80DART_WR1_WRDY_FUNCTION         = 0x40; // not supported
99const int Z80DART_WR1_WRDY_ENABLE         = 0x80; // not supported
106const int WR1_EXT_INT_ENABLE      = 0x01;
107const int WR1_TX_INT_ENABLE         = 0x02;
108const int WR1_STATUS_VECTOR         = 0x04;
109const int WR1_RX_INT_MODE_MASK      = 0x18;
110const int WR1_RX_INT_DISABLE      = 0x00;
111const int WR1_RX_INT_FIRST         = 0x08;
112const int WR1_RX_INT_ALL_PARITY      = 0x10; // not supported
113const int WR1_RX_INT_ALL         = 0x18;
114const int WR1_WRDY_ON_RX_TX         = 0x20; // not supported
115const int WR1_WRDY_FUNCTION         = 0x40; // not supported
116const int WR1_WRDY_ENABLE         = 0x80; // not supported
100117
101const int Z80DART_WR3_RX_ENABLE            = 0x01;
102const int Z80DART_WR3_AUTO_ENABLES         = 0x20;
103const int Z80DART_WR3_RX_WORD_LENGTH_MASK   = 0xc0;
104const int Z80DART_WR3_RX_WORD_LENGTH_5      = 0x00;
105const int Z80DART_WR3_RX_WORD_LENGTH_7      = 0x40;
106const int Z80DART_WR3_RX_WORD_LENGTH_6      = 0x80;
107const int Z80DART_WR3_RX_WORD_LENGTH_8      = 0xc0;
118const int WR3_RX_ENABLE            = 0x01;
119const int WR3_SYNC_CHAR_LOAD_INHIBIT= 0x02; // not supported
120const int WR3_ADDRESS_SEARCH_MODE   = 0x04; // not supported
121const int WR3_RX_CRC_ENABLE         = 0x08; // not supported
122const int WR3_ENTER_HUNT_PHASE      = 0x10; // not supported
123const int WR3_AUTO_ENABLES         = 0x20;
124const int WR3_RX_WORD_LENGTH_MASK   = 0xc0;
125const int WR3_RX_WORD_LENGTH_5      = 0x00;
126const int WR3_RX_WORD_LENGTH_7      = 0x40;
127const int WR3_RX_WORD_LENGTH_6      = 0x80;
128const int WR3_RX_WORD_LENGTH_8      = 0xc0;
108129
109const int Z80DART_WR4_PARITY_ENABLE         = 0x01; // not supported
110const int Z80DART_WR4_PARITY_EVEN         = 0x02; // not supported
111const int Z80DART_WR4_STOP_BITS_MASK      = 0x0c;
112const int Z80DART_WR4_STOP_BITS_1         = 0x04;
113const int Z80DART_WR4_STOP_BITS_1_5         = 0x08; // not supported
114const int Z80DART_WR4_STOP_BITS_2         = 0x0c;
115const int Z80DART_WR4_CLOCK_MODE_MASK      = 0xc0;
116const int Z80DART_WR4_CLOCK_MODE_X1         = 0x00;
117const int Z80DART_WR4_CLOCK_MODE_X16      = 0x40;
118const int Z80DART_WR4_CLOCK_MODE_X32      = 0x80;
119const int Z80DART_WR4_CLOCK_MODE_X64      = 0xc0;
130const int WR4_PARITY_ENABLE         = 0x01; // not supported
131const int WR4_PARITY_EVEN         = 0x02; // not supported
132const int WR4_STOP_BITS_MASK      = 0x0c;
133const int WR4_STOP_BITS_1         = 0x04;
134const int WR4_STOP_BITS_1_5         = 0x08; // not supported
135const int WR4_STOP_BITS_2         = 0x0c;
136const int WR4_SYNC_MODE_MASK      = 0x30; // not supported
137const int WR4_SYNC_MODE_8_BIT      = 0x00; // not supported
138const int WR4_SYNC_MODE_16_BIT      = 0x10; // not supported
139const int WR4_SYNC_MODE_SDLC      = 0x20; // not supported
140const int WR4_SYNC_MODE_EXT         = 0x30; // not supported
141const int WR4_CLOCK_RATE_MASK      = 0xc0;
142const int WR4_CLOCK_RATE_X1         = 0x00;
143const int WR4_CLOCK_RATE_X16      = 0x40;
144const int WR4_CLOCK_RATE_X32      = 0x80;
145const int WR4_CLOCK_RATE_X64      = 0xc0;
120146
121const int Z80DART_WR5_RTS               = 0x02;
122const int Z80DART_WR5_TX_ENABLE            = 0x08;
123const int Z80DART_WR5_SEND_BREAK         = 0x10;
124const int Z80DART_WR5_TX_WORD_LENGTH_MASK   = 0xc0;
125const int Z80DART_WR5_TX_WORD_LENGTH_5      = 0x00;
126const int Z80DART_WR5_TX_WORD_LENGTH_7      = 0x40;
127const int Z80DART_WR5_TX_WORD_LENGTH_6      = 0x80;
128const int Z80DART_WR5_TX_WORD_LENGTH_8      = 0xc0;
129const int Z80DART_WR5_DTR               = 0x80;
147const int WR5_TX_CRC_ENABLE         = 0x01; // not supported
148const int WR5_RTS               = 0x02;
149const int WR5_CRC16               = 0x04; // not supported
150const int WR5_TX_ENABLE            = 0x08;
151const int WR5_SEND_BREAK         = 0x10;
152const int WR5_TX_WORD_LENGTH_MASK   = 0xc0;
153const int WR5_TX_WORD_LENGTH_5      = 0x00;
154const int WR5_TX_WORD_LENGTH_7      = 0x40;
155const int WR5_TX_WORD_LENGTH_6      = 0x80;
156const int WR5_TX_WORD_LENGTH_8      = 0xc0;
157const int WR5_DTR               = 0x80;
130158
131159
132160
r8854r8855
246274   // resolve callbacks
247275   devcb_resolve_write_line(&m_out_int_func, &m_config.m_out_int_func, this);
248276
249   m_channel[Z80DART_CH_A].start(this, Z80DART_CH_A, m_config.m_in_rxda_func, m_config.m_out_txda_func, m_config.m_out_dtra_func, m_config.m_out_rtsa_func, m_config.m_out_wrdya_func, m_config.m_out_synca_func);
250   m_channel[Z80DART_CH_B].start(this, Z80DART_CH_B, m_config.m_in_rxdb_func, m_config.m_out_txdb_func, m_config.m_out_dtrb_func, m_config.m_out_rtsb_func, m_config.m_out_wrdyb_func, m_config.m_out_syncb_func);
277   m_channel[CHANNEL_A].start(this, CHANNEL_A, m_config.m_in_rxda_func, m_config.m_out_txda_func, m_config.m_out_dtra_func, m_config.m_out_rtsa_func, m_config.m_out_wrdya_func, m_config.m_out_synca_func);
278   m_channel[CHANNEL_B].start(this, CHANNEL_B, m_config.m_in_rxdb_func, m_config.m_out_txdb_func, m_config.m_out_dtrb_func, m_config.m_out_rtsb_func, m_config.m_out_wrdyb_func, m_config.m_out_syncb_func);
251279
252280   if (m_config.m_rx_clock_a != 0)
253281   {
254282      // allocate channel A receive timer
255      m_rxca_timer = timer_alloc(&m_machine, dart_channel::static_rxc_tick, (void *)&m_channel[Z80DART_CH_A]);
283      m_rxca_timer = timer_alloc(&m_machine, dart_channel::static_rxc_tick, (void *)&m_channel[CHANNEL_A]);
256284      timer_adjust_periodic(m_rxca_timer, attotime_zero, 0, ATTOTIME_IN_HZ(m_config.m_rx_clock_a));
257285   }
258286
259287   if (m_config.m_tx_clock_a != 0)
260288   {
261289      // allocate channel A transmit timer
262      m_txca_timer = timer_alloc(&m_machine, dart_channel::static_txc_tick, (void *)&m_channel[Z80DART_CH_A]);
290      m_txca_timer = timer_alloc(&m_machine, dart_channel::static_txc_tick, (void *)&m_channel[CHANNEL_A]);
263291      timer_adjust_periodic(m_txca_timer, attotime_zero, 0, ATTOTIME_IN_HZ(m_config.m_tx_clock_a));
264292   }
265293
266294   if (m_config.m_rx_clock_b != 0)
267295   {
268296      // allocate channel B receive timer
269      m_rxcb_timer = timer_alloc(&m_machine, dart_channel::static_rxc_tick, (void *)&m_channel[Z80DART_CH_B]);
297      m_rxcb_timer = timer_alloc(&m_machine, dart_channel::static_rxc_tick, (void *)&m_channel[CHANNEL_B]);
270298      timer_adjust_periodic(m_rxcb_timer, attotime_zero, 0, ATTOTIME_IN_HZ(m_config.m_rx_clock_b));
271299   }
272300
273301   if (m_config.m_tx_clock_b != 0)
274302   {
275303      // allocate channel B transmit timer
276      m_txcb_timer = timer_alloc(&m_machine, dart_channel::static_txc_tick, (void *)&m_channel[Z80DART_CH_B]);
304      m_txcb_timer = timer_alloc(&m_machine, dart_channel::static_txc_tick, (void *)&m_channel[CHANNEL_B]);
277305      timer_adjust_periodic(m_txcb_timer, attotime_zero, 0, ATTOTIME_IN_HZ(m_config.m_tx_clock_b));
278306   }
279307
r8854r8855
289317{
290318   LOG(("Z80DART \"%s\" Reset\n", tag()));
291319
292   for (int channel = Z80DART_CH_A; channel <= Z80DART_CH_B; channel++)
320   for (int channel = CHANNEL_A; channel <= CHANNEL_B; channel++)
293321   {
294322      m_channel[channel].reset();
295323   }
r8854r8855
352380      {
353381         // clear interrupt, switch to the IEO state, and update the IRQs
354382         m_int_state[i] = Z80_DAISY_IEO;
355         m_channel[Z80DART_CH_A].m_rr[0] &= ~Z80DART_RR0_INTERRUPT_PENDING;
383         m_channel[CHANNEL_A].m_rr[0] &= ~RR0_INTERRUPT_PENDING;
356384         check_interrupts();
357385
358         LOG(("Z80DART \"%s\" : Interrupt Acknowledge Vector %02x\n", tag(), m_channel[Z80DART_CH_B].m_rr[2]));
386         LOG(("Z80DART \"%s\" : Interrupt Acknowledge Vector %02x\n", tag(), m_channel[CHANNEL_B].m_rr[2]));
359387
360         return m_channel[Z80DART_CH_B].m_rr[2];
388         return m_channel[CHANNEL_B].m_rr[2];
361389      }
362390   }
363391
364392   logerror("z80dart_irq_ack: failed to find an interrupt to ack!\n");
365393
366   return m_channel[Z80DART_CH_B].m_rr[2];
394   return m_channel[CHANNEL_B].m_rr[2];
367395}
368396
369397
r8854r8855
417445void z80dart_device::take_interrupt(int priority)
418446{
419447   m_int_state[priority] |= Z80_DAISY_INT;
420   m_channel[Z80DART_CH_A].m_rr[0] |= Z80DART_RR0_INTERRUPT_PENDING;
448   m_channel[CHANNEL_A].m_rr[0] |= RR0_INTERRUPT_PENDING;
421449
422450   // check for interrupt
423451   check_interrupts();
r8854r8855
454482     m_tx_bits(0),
455483     m_tx_parity(0),
456484     m_dtr(0),
457     m_rts(0)
485     m_rts(0),
486     m_sync(0)
458487{
459488   memset(&m_in_rxd_func, 0, sizeof(m_in_rxd_func));
460489   memset(&m_out_txd_func, 0, sizeof(m_out_txd_func));
r8854r8855
509538   state_save_register_device_item(m_device, m_index, m_tx_parity);
510539   state_save_register_device_item(m_device, m_index, m_dtr);
511540   state_save_register_device_item(m_device, m_index, m_rts);
541   state_save_register_device_item(m_device, m_index, m_sync);
512542}
513543
514544
r8854r8855
523553
524554   LOG(("Z80DART \"%s\" Channel %c : Interrupt Request %u\n", m_device->tag(), 'A' + m_index, level));
525555
526   if ((m_index == Z80DART_CH_B) && (m_wr[1] & Z80DART_WR1_STATUS_VECTOR))
556   if ((m_index == CHANNEL_B) && (m_wr[1] & WR1_STATUS_VECTOR))
527557   {
528558      // status affects vector
529559      vector = (m_wr[2] & 0xf1) | (!m_index << 3) | (level << 1);
r8854r8855
545575{
546576   int clocks = 1;
547577
548   switch (m_wr[4] & Z80DART_WR4_CLOCK_MODE_MASK)
578   switch (m_wr[4] & WR4_CLOCK_RATE_MASK)
549579   {
550   case Z80DART_WR4_CLOCK_MODE_X1:      clocks = 1;      break;
551   case Z80DART_WR4_CLOCK_MODE_X16:   clocks = 16;   break;
552   case Z80DART_WR4_CLOCK_MODE_X32:   clocks = 32;   break;
553   case Z80DART_WR4_CLOCK_MODE_X64:   clocks = 64;   break;
580   case WR4_CLOCK_RATE_X1:      clocks = 1;      break;
581   case WR4_CLOCK_RATE_X16:   clocks = 16;   break;
582   case WR4_CLOCK_RATE_X32:   clocks = 32;   break;
583   case WR4_CLOCK_RATE_X64:   clocks = 64;   break;
554584   }
555585
556586   return clocks;
r8854r8855
565595{
566596   float bits = 1;
567597
568   switch (m_wr[4] & Z80DART_WR4_STOP_BITS_MASK)
598   switch (m_wr[4] & WR4_STOP_BITS_MASK)
569599   {
570   case Z80DART_WR4_STOP_BITS_1:      bits = 1;      break;
571   case Z80DART_WR4_STOP_BITS_1_5:      bits = 1.5;      break;
572   case Z80DART_WR4_STOP_BITS_2:      bits = 2;      break;
600   case WR4_STOP_BITS_1:      bits = 1;      break;
601   case WR4_STOP_BITS_1_5:      bits = 1.5;      break;
602   case WR4_STOP_BITS_2:      bits = 2;      break;
573603   }
574604
575605   return bits;
r8854r8855
584614{
585615   int bits = 5;
586616
587   switch (m_wr[3] & Z80DART_WR3_RX_WORD_LENGTH_MASK)
617   switch (m_wr[3] & WR3_RX_WORD_LENGTH_MASK)
588618   {
589   case Z80DART_WR3_RX_WORD_LENGTH_5:   bits = 5;      break;
590   case Z80DART_WR3_RX_WORD_LENGTH_6:   bits = 6;      break;
591   case Z80DART_WR3_RX_WORD_LENGTH_7:   bits = 7;      break;
592   case Z80DART_WR3_RX_WORD_LENGTH_8:   bits = 8;      break;
619   case WR3_RX_WORD_LENGTH_5:   bits = 5;      break;
620   case WR3_RX_WORD_LENGTH_6:   bits = 6;      break;
621   case WR3_RX_WORD_LENGTH_7:   bits = 7;      break;
622   case WR3_RX_WORD_LENGTH_8:   bits = 8;      break;
593623   }
594624
595625   return bits;
r8854r8855
604634{
605635   int bits = 5;
606636
607   switch (m_wr[5] & Z80DART_WR5_TX_WORD_LENGTH_MASK)
637   switch (m_wr[5] & WR5_TX_WORD_LENGTH_MASK)
608638   {
609   case Z80DART_WR5_TX_WORD_LENGTH_5:   bits = 5;   break;
610   case Z80DART_WR5_TX_WORD_LENGTH_6:   bits = 6;   break;
611   case Z80DART_WR5_TX_WORD_LENGTH_7:   bits = 7;   break;
612   case Z80DART_WR5_TX_WORD_LENGTH_8:   bits = 8;   break;
639   case WR5_TX_WORD_LENGTH_5:   bits = 5;   break;
640   case WR5_TX_WORD_LENGTH_6:   bits = 6;   break;
641   case WR5_TX_WORD_LENGTH_7:   bits = 7;   break;
642   case WR5_TX_WORD_LENGTH_8:   bits = 8;   break;
613643   }
614644
615645   return bits;
r8854r8855
623653void z80dart_device::dart_channel::reset()
624654{
625655   // disable receiver
626   m_wr[3] &= ~Z80DART_WR3_RX_ENABLE;
656   m_wr[3] &= ~WR3_RX_ENABLE;
627657   m_rx_state = STATE_START;
628658
629659   // disable transmitter
630   m_wr[5] &= ~Z80DART_WR5_TX_ENABLE;
660   m_wr[5] &= ~WR5_TX_ENABLE;
631661   m_tx_state = STATE_START;
632662
633663   // reset external lines
634664   RTS(1);
635665   DTR(1);
636666
637   if (m_index == Z80DART_CH_A)
667   if (m_index == CHANNEL_A)
638668   {
639669      // reset interrupt logic
640670      int i;
r8854r8855
655685
656686int z80dart_device::dart_channel::detect_start_bit()
657687{
658   if (!(m_wr[3] & Z80DART_WR3_RX_ENABLE)) return 0;
688   if (!(m_wr[3] & WR3_RX_ENABLE)) return 0;
659689
660690   return !RXD;
661691}
r8854r8855
696726
697727void z80dart_device::dart_channel::detect_parity_error()
698728{
699   int parity = (m_wr[1] & Z80DART_WR4_PARITY_EVEN) ? 1 : 0;
729   int parity = (m_wr[1] & WR4_PARITY_EVEN) ? 1 : 0;
700730
701731   if (RXD != (m_rx_parity ^ parity))
702732   {
703733      // parity error detected
704      m_rx_error |= Z80DART_RR1_PARITY_ERROR;
734      m_rx_error |= RR1_PARITY_ERROR;
705735
706      switch (m_wr[1] & Z80DART_WR1_RX_INT_ENABLE_MASK)
736      switch (m_wr[1] & WR1_RX_INT_MODE_MASK)
707737      {
708      case Z80DART_WR1_RX_INT_FIRST:
738      case WR1_RX_INT_FIRST:
709739         if (!m_rx_first)
710740         {
711741            take_interrupt(INT_SPECIAL);
712742         }
713743         break;
714744
715      case Z80DART_WR1_RX_INT_ALL_PARITY:
745      case WR1_RX_INT_ALL_PARITY:
716746         take_interrupt(INT_SPECIAL);
717747         break;
718748
719      case Z80DART_WR1_RX_INT_ALL:
749      case WR1_RX_INT_ALL:
720750         take_interrupt(INT_RECEIVE);
721751         break;
722752      }
r8854r8855
733763   if (!RXD)
734764   {
735765      // framing error detected
736      m_rx_error |= Z80DART_RR1_FRAMING_ERROR;
766      m_rx_error |= RR1_CRC_FRAMING_ERROR;
737767
738      switch (m_wr[1] & Z80DART_WR1_RX_INT_ENABLE_MASK)
768      switch (m_wr[1] & WR1_RX_INT_MODE_MASK)
739769      {
740      case Z80DART_WR1_RX_INT_FIRST:
770      case WR1_RX_INT_FIRST:
741771         if (!m_rx_first)
742772         {
743773            take_interrupt(INT_SPECIAL);
744774         }
745775         break;
746776
747      case Z80DART_WR1_RX_INT_ALL_PARITY:
748      case Z80DART_WR1_RX_INT_ALL:
777      case WR1_RX_INT_ALL_PARITY:
778      case WR1_RX_INT_ALL:
749779         take_interrupt(INT_SPECIAL);
750780         break;
751781      }
r8854r8855
785815      if (character_completed())
786816      {
787817         // all data bits received
788         if (m_wr[4] & Z80DART_WR4_PARITY_ENABLE)
818         if (m_wr[4] & WR4_PARITY_ENABLE)
789819         {
790820            // next bit is the parity bit
791821            m_rx_state = STATE_PARITY;
r8854r8855
855885   switch (m_tx_state)
856886   {
857887   case STATE_START:
858      if ((m_wr[5] & Z80DART_WR5_TX_ENABLE) && !(m_rr[0] & Z80DART_RR0_TX_BUFFER_EMPTY))
888      if ((m_wr[5] & WR5_TX_ENABLE) && !(m_rr[0] & RR0_TX_BUFFER_EMPTY))
859889      {
860890         // transmit start bit
861891         TXD(0);
r8854r8855
864894         m_tx_shift = m_tx_data;
865895
866896         // empty transmit buffer
867         m_rr[0] |= Z80DART_RR0_TX_BUFFER_EMPTY;
897         m_rr[0] |= RR0_TX_BUFFER_EMPTY;
868898
869         if (m_wr[1] & Z80DART_WR1_TX_INT_ENABLE)
899         if (m_wr[1] & WR1_TX_INT_ENABLE)
870900            take_interrupt(INT_TRANSMIT);
871901
872902         m_tx_state = STATE_DATA;
873903      }
874      else if (m_wr[5] & Z80DART_WR5_SEND_BREAK)
904      else if (m_wr[5] & WR5_SEND_BREAK)
875905      {
876906         // transmit break
877907         TXD(0);
r8854r8855
894924
895925      if (m_rx_bits == word_length)
896926      {
897         if (m_wr[4] & Z80DART_WR4_PARITY_ENABLE)
927         if (m_wr[4] & WR4_PARITY_ENABLE)
898928            m_tx_state = STATE_PARITY;
899929         else
900930         {
r8854r8855
926956      TXD(1);
927957
928958      // if transmit buffer is empty
929      if (m_rr[0] & Z80DART_RR0_TX_BUFFER_EMPTY)
959      if (m_rr[0] & RR0_TX_BUFFER_EMPTY)
930960      {
931961         // then all characters have been sent
932         m_rr[1] |= Z80DART_RR1_ALL_SENT;
962         m_rr[1] |= RR1_ALL_SENT;
933963
934964         // when the RTS bit is reset, the _RTS output goes high after the transmitter empties
935965         if (!m_rts)
r8854r8855
950980{
951981   UINT8 data = 0;
952982
953   int reg = m_wr[0] & Z80DART_WR0_REGISTER_MASK;
983   int reg = m_wr[0] & WR0_REGISTER_MASK;
954984
955985   switch (reg)
956986   {
r8854r8855
961991
962992   case 2:
963993      // channel B only
964      if (m_index == Z80DART_CH_B)
994      if (m_index == CHANNEL_B)
965995         data = m_rr[reg];
966996      break;
967997   }
r8854r8855
9781008
9791009void z80dart_device::dart_channel::control_write(UINT8 data)
9801010{
981   int reg = m_wr[0] & Z80DART_WR0_REGISTER_MASK;
1011   int reg = m_wr[0] & WR0_REGISTER_MASK;
9821012
9831013   LOG(("Z80DART \"%s\" Channel %c : Control Register Write '%02x'\n", m_device->tag(), 'A' + m_index, data));
9841014
r8854r8855
9881018   if (reg != 0)
9891019   {
9901020      // mask out register index
991      m_wr[0] &= ~Z80DART_WR0_REGISTER_MASK;
1021      m_wr[0] &= ~WR0_REGISTER_MASK;
9921022   }
9931023
9941024   switch (reg)
9951025   {
9961026   case 0:
997      switch (data & Z80DART_WR0_COMMAND_MASK)
1027      switch (data & WR0_COMMAND_MASK)
9981028      {
999      case Z80DART_WR0_RESET_EXT_STATUS:
1029      case WR0_NULL:
1030         LOG(("Z80DART \"%s\" Channel %c : Null\n", m_device->tag(), 'A' + m_index));
1031         break;
1032
1033      case WR0_SEND_ABORT:
1034         LOG(("Z80DART \"%s\" Channel %c : Send Abort\n", m_device->tag(), 'A' + m_index));
1035         logerror("Z80DART \"%s\" Channel %c : unsupported command: Send Abort\n", m_device->tag(), 'A' + m_index);
1036         break;
1037
1038      case WR0_RESET_EXT_STATUS:
10001039         // reset external/status interrupt
1001         m_rr[0] &= ~(Z80DART_RR0_DCD | Z80DART_RR0_RI | Z80DART_RR0_CTS | Z80DART_RR0_BREAK);
1040         m_rr[0] &= ~(RR0_DCD | RR0_RI | RR0_CTS | RR0_BREAK_ABORT);
10021041
1003         if (!m_dcd) m_rr[0] |= Z80DART_RR0_DCD;
1004         if (m_ri) m_rr[0] |= Z80DART_RR0_RI;
1005         if (m_cts) m_rr[0] |= Z80DART_RR0_CTS;
1042         if (!m_dcd) m_rr[0] |= RR0_DCD;
1043         if (m_ri) m_rr[0] |= RR0_RI;
1044         if (m_cts) m_rr[0] |= RR0_CTS;
10061045
10071046         m_rx_rr0_latch = 0;
10081047
10091048         LOG(("Z80DART \"%s\" Channel %c : Reset External/Status Interrupt\n", m_device->tag(), 'A' + m_index));
10101049         break;
10111050
1012      case Z80DART_WR0_CHANNEL_RESET:
1051      case WR0_CHANNEL_RESET:
10131052         // channel reset
10141053         LOG(("Z80DART \"%s\" Channel %c : Channel Reset\n", m_device->tag(), 'A' + m_index));
10151054         reset();
10161055         break;
10171056
1018      case Z80DART_WR0_ENABLE_INT_NEXT_RX:
1057      case WR0_ENABLE_INT_NEXT_RX:
10191058         // enable interrupt on next receive character
10201059         LOG(("Z80DART \"%s\" Channel %c : Enable Interrupt on Next Received Character\n", m_device->tag(), 'A' + m_index));
10211060         m_rx_first = 1;
10221061         break;
10231062
1024      case Z80DART_WR0_RESET_TX_INT:
1063      case WR0_RESET_TX_INT:
10251064         // reset transmitter interrupt pending
10261065         LOG(("Z80DART \"%s\" Channel %c : Reset Transmitter Interrupt Pending\n", m_device->tag(), 'A' + m_index));
1066         logerror("Z80DART \"%s\" Channel %c : unsupported command: Reset Transmitter Interrupt Pending\n", m_device->tag(), 'A' + m_index);
10271067         break;
10281068
1029      case Z80DART_WR0_ERROR_RESET:
1069      case WR0_ERROR_RESET:
10301070         // error reset
10311071         LOG(("Z80DART \"%s\" Channel %c : Error Reset\n", m_device->tag(), 'A' + m_index));
1032         m_rr[1] &= ~(Z80DART_RR1_FRAMING_ERROR | Z80DART_RR1_RX_OVERRUN_ERROR | Z80DART_RR1_PARITY_ERROR);
1072         m_rr[1] &= ~(RR1_CRC_FRAMING_ERROR | RR1_RX_OVERRUN_ERROR | RR1_PARITY_ERROR);
10331073         break;
10341074
1035      case Z80DART_WR0_RETURN_FROM_INT:
1075      case WR0_RETURN_FROM_INT:
10361076         // return from interrupt
10371077         LOG(("Z80DART \"%s\" Channel %c : Return from Interrupt\n", m_device->tag(), 'A' + m_index));
10381078         m_device->z80daisy_irq_reti();
r8854r8855
10411081      break;
10421082
10431083   case 1:
1044      LOG(("Z80DART \"%s\" Channel %c : External Interrupt Enable %u\n", m_device->tag(), 'A' + m_index, (data & Z80DART_WR1_EXT_INT_ENABLE) ? 1 : 0));
1045      LOG(("Z80DART \"%s\" Channel %c : Transmit Interrupt Enable %u\n", m_device->tag(), 'A' + m_index, (data & Z80DART_WR1_TX_INT_ENABLE) ? 1 : 0));
1046      LOG(("Z80DART \"%s\" Channel %c : Status Affects Vector %u\n", m_device->tag(), 'A' + m_index, (data & Z80DART_WR1_STATUS_VECTOR) ? 1 : 0));
1047      LOG(("Z80DART \"%s\" Channel %c : Wait/Ready Enable %u\n", m_device->tag(), 'A' + m_index, (data & Z80DART_WR1_WRDY_ENABLE) ? 1 : 0));
1084      LOG(("Z80DART \"%s\" Channel %c : External Interrupt Enable %u\n", m_device->tag(), 'A' + m_index, (data & WR1_EXT_INT_ENABLE) ? 1 : 0));
1085      LOG(("Z80DART \"%s\" Channel %c : Transmit Interrupt Enable %u\n", m_device->tag(), 'A' + m_index, (data & WR1_TX_INT_ENABLE) ? 1 : 0));
1086      LOG(("Z80DART \"%s\" Channel %c : Status Affects Vector %u\n", m_device->tag(), 'A' + m_index, (data & WR1_STATUS_VECTOR) ? 1 : 0));
1087      LOG(("Z80DART \"%s\" Channel %c : Wait/Ready Enable %u\n", m_device->tag(), 'A' + m_index, (data & WR1_WRDY_ENABLE) ? 1 : 0));
10481088
1049      switch (data & Z80DART_WR1_RX_INT_ENABLE_MASK)
1089      switch (data & WR1_RX_INT_MODE_MASK)
10501090      {
1051      case Z80DART_WR1_RX_INT_DISABLE:
1091      case WR1_RX_INT_DISABLE:
10521092         LOG(("Z80DART \"%s\" Channel %c : Receiver Interrupt Disabled\n", m_device->tag(), 'A' + m_index));
10531093         break;
10541094
1055      case Z80DART_WR1_RX_INT_FIRST:
1095      case WR1_RX_INT_FIRST:
10561096         LOG(("Z80DART \"%s\" Channel %c : Receiver Interrupt on First Character\n", m_device->tag(), 'A' + m_index));
10571097         break;
10581098
1059      case Z80DART_WR1_RX_INT_ALL_PARITY:
1099      case WR1_RX_INT_ALL_PARITY:
10601100         LOG(("Z80DART \"%s\" Channel %c : Receiver Interrupt on All Characters, Parity Affects Vector\n", m_device->tag(), 'A' + m_index));
10611101         break;
10621102
1063      case Z80DART_WR1_RX_INT_ALL:
1103      case WR1_RX_INT_ALL:
10641104         LOG(("Z80DART \"%s\" Channel %c : Receiver Interrupt on All Characters\n", m_device->tag(), 'A' + m_index));
10651105         break;
10661106      }
r8854r8855
10751115      break;
10761116
10771117   case 3:
1078      LOG(("Z80DART \"%s\" Channel %c : Receiver Enable %u\n", m_device->tag(), 'A' + m_index, (data & Z80DART_WR3_RX_ENABLE) ? 1 : 0));
1079      LOG(("Z80DART \"%s\" Channel %c : Auto Enables %u\n", m_device->tag(), 'A' + m_index, (data & Z80DART_WR3_AUTO_ENABLES) ? 1 : 0));
1118      LOG(("Z80DART \"%s\" Channel %c : Receiver Enable %u\n", m_device->tag(), 'A' + m_index, (data & WR3_RX_ENABLE) ? 1 : 0));
1119      LOG(("Z80DART \"%s\" Channel %c : Auto Enables %u\n", m_device->tag(), 'A' + m_index, (data & WR3_AUTO_ENABLES) ? 1 : 0));
10801120      LOG(("Z80DART \"%s\" Channel %c : Receiver Bits/Character %u\n", m_device->tag(), 'A' + m_index, get_rx_word_length()));
10811121      break;
10821122
10831123   case 4:
1084      LOG(("Z80DART \"%s\" Channel %c : Parity Enable %u\n", m_device->tag(), 'A' + m_index, (data & Z80DART_WR4_PARITY_ENABLE) ? 1 : 0));
1085      LOG(("Z80DART \"%s\" Channel %c : Parity %s\n", m_device->tag(), 'A' + m_index, (data & Z80DART_WR4_PARITY_EVEN) ? "Even" : "Odd"));
1124      LOG(("Z80DART \"%s\" Channel %c : Parity Enable %u\n", m_device->tag(), 'A' + m_index, (data & WR4_PARITY_ENABLE) ? 1 : 0));
1125      LOG(("Z80DART \"%s\" Channel %c : Parity %s\n", m_device->tag(), 'A' + m_index, (data & WR4_PARITY_EVEN) ? "Even" : "Odd"));
10861126      LOG(("Z80DART \"%s\" Channel %c : Stop Bits %f\n", m_device->tag(), 'A' + m_index, get_stop_bits()));
10871127      LOG(("Z80DART \"%s\" Channel %c : Clock Mode %uX\n", m_device->tag(), 'A' + m_index, get_clock_mode()));
10881128      break;
10891129
10901130   case 5:
1091      LOG(("Z80DART \"%s\" Channel %c : Transmitter Enable %u\n", m_device->tag(), 'A' + m_index, (data & Z80DART_WR5_TX_ENABLE) ? 1 : 0));
1131      LOG(("Z80DART \"%s\" Channel %c : Transmitter Enable %u\n", m_device->tag(), 'A' + m_index, (data & WR5_TX_ENABLE) ? 1 : 0));
10921132      LOG(("Z80DART \"%s\" Channel %c : Transmitter Bits/Character %u\n", m_device->tag(), 'A' + m_index, get_tx_word_length()));
1093      LOG(("Z80DART \"%s\" Channel %c : Send Break %u\n", m_device->tag(), 'A' + m_index, (data & Z80DART_WR5_SEND_BREAK) ? 1 : 0));
1094      LOG(("Z80DART \"%s\" Channel %c : Request to Send %u\n", m_device->tag(), 'A' + m_index, (data & Z80DART_WR5_RTS) ? 1 : 0));
1095      LOG(("Z80DART \"%s\" Channel %c : Data Terminal Ready %u\n", m_device->tag(), 'A' + m_index, (data & Z80DART_WR5_DTR) ? 1 : 0));
1133      LOG(("Z80DART \"%s\" Channel %c : Send Break %u\n", m_device->tag(), 'A' + m_index, (data & WR5_SEND_BREAK) ? 1 : 0));
1134      LOG(("Z80DART \"%s\" Channel %c : Request to Send %u\n", m_device->tag(), 'A' + m_index, (data & WR5_RTS) ? 1 : 0));
1135      LOG(("Z80DART \"%s\" Channel %c : Data Terminal Ready %u\n", m_device->tag(), 'A' + m_index, (data & WR5_DTR) ? 1 : 0));
10961136
1097      if (data & Z80DART_WR5_RTS)
1137      if (data & WR5_RTS)
10981138      {
10991139         // when the RTS bit is set, the _RTS output goes low
11001140         RTS(0);
r8854r8855
11081148      }
11091149
11101150      // data terminal ready output follows the state programmed into the DTR bit*/
1111      m_dtr = (data & Z80DART_WR5_DTR) ? 0 : 1;
1151      m_dtr = (data & WR5_DTR) ? 0 : 1;
11121152      DTR(m_dtr);
11131153      break;
1154
1155   case 6:
1156      LOG(("Z80DART \"%s\" Channel %c : Transmit Sync %02x\n", m_device->tag(), 'A' + m_index, data));
1157      m_sync = (m_sync & 0xff00) | data;
1158      break;
1159
1160   case 7:
1161      LOG(("Z80DART \"%s\" Channel %c : Receive Sync %02x\n", m_device->tag(), 'A' + m_index, data));
1162      m_sync = (data << 8) | (m_sync & 0xff);
1163      break;
11141164   }
11151165}
11161166
r8854r8855
11291179      data = m_rx_data_fifo[m_rx_fifo];
11301180
11311181      // load error status from the FIFO, retain overrun and parity errors
1132      m_rr[1] = (m_rr[1] & (Z80DART_RR1_RX_OVERRUN_ERROR | Z80DART_RR1_PARITY_ERROR)) | m_rx_error_fifo[m_rx_fifo];
1182      m_rr[1] = (m_rr[1] & (RR1_RX_OVERRUN_ERROR | RR1_PARITY_ERROR)) | m_rx_error_fifo[m_rx_fifo];
11331183
11341184      // decrease FIFO pointer
11351185      m_rx_fifo--;
r8854r8855
11371187      if (m_rx_fifo < 0)
11381188      {
11391189         // no more characters available in the FIFO
1140         m_rr[0] &= ~ Z80DART_RR0_RX_CHAR_AVAILABLE;
1190         m_rr[0] &= ~ RR0_RX_CHAR_AVAILABLE;
11411191      }
11421192   }
11431193
r8854r8855
11551205{
11561206   m_tx_data = data;
11571207
1158   m_rr[0] &= ~Z80DART_RR0_TX_BUFFER_EMPTY;
1159   m_rr[1] &= ~Z80DART_RR1_ALL_SENT;
1208   m_rr[0] &= ~RR0_TX_BUFFER_EMPTY;
1209   m_rr[1] &= ~RR1_ALL_SENT;
11601210
11611211   LOG(("Z80DART \"%s\" Channel %c : Data Register Write '%02x'\n", m_device->tag(), 'A' + m_index, data));
11621212}
r8854r8855
11731223   if (m_rx_fifo == 2)
11741224   {
11751225      // receive overrun error detected
1176      m_rx_error |= Z80DART_RR1_RX_OVERRUN_ERROR;
1226      m_rx_error |= RR1_RX_OVERRUN_ERROR;
11771227
1178      switch (m_wr[1] & Z80DART_WR1_RX_INT_ENABLE_MASK)
1228      switch (m_wr[1] & WR1_RX_INT_MODE_MASK)
11791229      {
1180      case Z80DART_WR1_RX_INT_FIRST:
1230      case WR1_RX_INT_FIRST:
11811231         if (!m_rx_first)
11821232         {
11831233            take_interrupt(INT_SPECIAL);
11841234         }
11851235         break;
11861236
1187      case Z80DART_WR1_RX_INT_ALL_PARITY:
1188      case Z80DART_WR1_RX_INT_ALL:
1237      case WR1_RX_INT_ALL_PARITY:
1238      case WR1_RX_INT_ALL:
11891239         take_interrupt(INT_SPECIAL);
11901240         break;
11911241      }
r8854r8855
11991249   m_rx_data_fifo[m_rx_fifo] = data;
12001250   m_rx_error_fifo[m_rx_fifo] = m_rx_error;
12011251
1202   m_rr[0] |= Z80DART_RR0_RX_CHAR_AVAILABLE;
1252   m_rr[0] |= RR0_RX_CHAR_AVAILABLE;
12031253
12041254   // receive interrupt
1205   switch (m_wr[1] & Z80DART_WR1_RX_INT_ENABLE_MASK)
1255   switch (m_wr[1] & WR1_RX_INT_MODE_MASK)
12061256   {
1207   case Z80DART_WR1_RX_INT_FIRST:
1257   case WR1_RX_INT_FIRST:
12081258      if (m_rx_first)
12091259      {
12101260         take_interrupt(INT_RECEIVE);
r8854r8855
12131263      }
12141264      break;
12151265
1216   case Z80DART_WR1_RX_INT_ALL_PARITY:
1217   case Z80DART_WR1_RX_INT_ALL:
1266   case WR1_RX_INT_ALL_PARITY:
1267   case WR1_RX_INT_ALL:
12181268      take_interrupt(INT_RECEIVE);
12191269      break;
12201270   }
r8854r8855
12331283   {
12341284      // enable transmitter if in auto enables mode
12351285      if (!state)
1236         if (m_wr[3] & Z80DART_WR3_AUTO_ENABLES)
1237            m_wr[5] |= Z80DART_WR5_TX_ENABLE;
1286         if (m_wr[3] & WR3_AUTO_ENABLES)
1287            m_wr[5] |= WR5_TX_ENABLE;
12381288
12391289      // set clear to send
12401290      m_cts = state;
r8854r8855
12421292      if (!m_rx_rr0_latch)
12431293      {
12441294         if (!m_cts)
1245            m_rr[0] |= Z80DART_RR0_CTS;
1295            m_rr[0] |= RR0_CTS;
12461296         else
1247            m_rr[0] &= ~Z80DART_RR0_CTS;
1297            m_rr[0] &= ~RR0_CTS;
12481298
12491299         // trigger interrupt
1250         if (m_wr[1] & Z80DART_WR1_EXT_INT_ENABLE)
1300         if (m_wr[1] & WR1_EXT_INT_ENABLE)
12511301         {
12521302            // trigger interrupt
12531303            take_interrupt(INT_EXTERNAL);
r8854r8855
12721322   {
12731323      // enable receiver if in auto enables mode
12741324      if (!state)
1275         if (m_wr[3] & Z80DART_WR3_AUTO_ENABLES)
1276            m_wr[3] |= Z80DART_WR3_RX_ENABLE;
1325         if (m_wr[3] & WR3_AUTO_ENABLES)
1326            m_wr[3] |= WR3_RX_ENABLE;
12771327
12781328      // set data carrier detect
12791329      m_dcd = state;
r8854r8855
12811331      if (!m_rx_rr0_latch)
12821332      {
12831333         if (m_dcd)
1284            m_rr[0] |= Z80DART_RR0_DCD;
1334            m_rr[0] |= RR0_DCD;
12851335         else
1286            m_rr[0] &= ~Z80DART_RR0_DCD;
1336            m_rr[0] &= ~RR0_DCD;
12871337
1288         if (m_wr[1] & Z80DART_WR1_EXT_INT_ENABLE)
1338         if (m_wr[1] & WR1_EXT_INT_ENABLE)
12891339         {
12901340            // trigger interrupt
12911341            take_interrupt(INT_EXTERNAL);
r8854r8855
13141364      if (!m_rx_rr0_latch)
13151365      {
13161366         if (m_ri)
1317            m_rr[0] |= Z80DART_RR0_RI;
1367            m_rr[0] |= RR0_RI;
13181368         else
1319            m_rr[0] &= ~Z80DART_RR0_RI;
1369            m_rr[0] &= ~RR0_RI;
13201370
1321         if (m_wr[1] & Z80DART_WR1_EXT_INT_ENABLE)
1371         if (m_wr[1] & WR1_EXT_INT_ENABLE)
13221372         {
13231373            // trigger interrupt
13241374            take_interrupt(INT_EXTERNAL);
r8854r8855
13941444WRITE8_DEVICE_HANDLER( z80dart_c_w ) { downcast<z80dart_device *>(device)->control_write(offset & 1, data); }
13951445WRITE8_DEVICE_HANDLER( z80dart_d_w ) { downcast<z80dart_device *>(device)->data_write(offset & 1, data); }
13961446
1397WRITE_LINE_DEVICE_HANDLER( z80dart_ctsa_w ) { downcast<z80dart_device *>(device)->cts_w(Z80DART_CH_A, state); }
1398WRITE_LINE_DEVICE_HANDLER( z80dart_ctsb_w ) { downcast<z80dart_device *>(device)->cts_w(Z80DART_CH_B, state); }
1399WRITE_LINE_DEVICE_HANDLER( z80dart_dcda_w ) { downcast<z80dart_device *>(device)->dcd_w(Z80DART_CH_A, state); }
1400WRITE_LINE_DEVICE_HANDLER( z80dart_dcdb_w ) { downcast<z80dart_device *>(device)->dcd_w(Z80DART_CH_B, state); }
1401WRITE_LINE_DEVICE_HANDLER( z80dart_ria_w ) { downcast<z80dart_device *>(device)->ri_w(Z80DART_CH_A, state); }
1402WRITE_LINE_DEVICE_HANDLER( z80dart_rib_w ) { downcast<z80dart_device *>(device)->ri_w(Z80DART_CH_B, state); }
1403WRITE_LINE_DEVICE_HANDLER( z80dart_synca_w ) { downcast<z80dart_device *>(device)->sync_w(Z80DART_CH_A, state); }
1404WRITE_LINE_DEVICE_HANDLER( z80dart_syncb_w ) { downcast<z80dart_device *>(device)->sync_w(Z80DART_CH_B, state); }
1447WRITE_LINE_DEVICE_HANDLER( z80dart_ctsa_w ) { downcast<z80dart_device *>(device)->cts_w(CHANNEL_A, state); }
1448WRITE_LINE_DEVICE_HANDLER( z80dart_ctsb_w ) { downcast<z80dart_device *>(device)->cts_w(CHANNEL_B, state); }
1449WRITE_LINE_DEVICE_HANDLER( z80dart_dcda_w ) { downcast<z80dart_device *>(device)->dcd_w(CHANNEL_A, state); }
1450WRITE_LINE_DEVICE_HANDLER( z80dart_dcdb_w ) { downcast<z80dart_device *>(device)->dcd_w(CHANNEL_B, state); }
1451WRITE_LINE_DEVICE_HANDLER( z80dart_ria_w ) { downcast<z80dart_device *>(device)->ri_w(CHANNEL_A, state); }
1452WRITE_LINE_DEVICE_HANDLER( z80dart_rib_w ) { downcast<z80dart_device *>(device)->ri_w(CHANNEL_B, state); }
1453WRITE_LINE_DEVICE_HANDLER( z80dart_synca_w ) { downcast<z80dart_device *>(device)->sync_w(CHANNEL_A, state); }
1454WRITE_LINE_DEVICE_HANDLER( z80dart_syncb_w ) { downcast<z80dart_device *>(device)->sync_w(CHANNEL_B, state); }
14051455
1406WRITE_LINE_DEVICE_HANDLER( z80dart_rxca_w ) { downcast<z80dart_device *>(device)->rx_w(Z80DART_CH_A, state); }
1407WRITE_LINE_DEVICE_HANDLER( z80dart_txca_w ) { downcast<z80dart_device *>(device)->tx_w(Z80DART_CH_A, state); }
1408WRITE_LINE_DEVICE_HANDLER( z80dart_rxcb_w ) { downcast<z80dart_device *>(device)->rx_w(Z80DART_CH_B, state); }
1409WRITE_LINE_DEVICE_HANDLER( z80dart_txcb_w ) { downcast<z80dart_device *>(device)->tx_w(Z80DART_CH_B, state); }
1410WRITE_LINE_DEVICE_HANDLER( z80dart_rxtxcb_w ) { downcast<z80dart_device *>(device)->rx_w(Z80DART_CH_B, state); downcast<z80dart_device *>(device)->tx_w(Z80DART_CH_B, state); }
1456WRITE_LINE_DEVICE_HANDLER( z80dart_rxca_w ) { downcast<z80dart_device *>(device)->rx_w(CHANNEL_A, state); }
1457WRITE_LINE_DEVICE_HANDLER( z80dart_txca_w ) { downcast<z80dart_device *>(device)->tx_w(CHANNEL_A, state); }
1458WRITE_LINE_DEVICE_HANDLER( z80dart_rxcb_w ) { downcast<z80dart_device *>(device)->rx_w(CHANNEL_B, state); }
1459WRITE_LINE_DEVICE_HANDLER( z80dart_txcb_w ) { downcast<z80dart_device *>(device)->tx_w(CHANNEL_B, state); }
1460WRITE_LINE_DEVICE_HANDLER( z80dart_rxtxcb_w ) { downcast<z80dart_device *>(device)->rx_w(CHANNEL_B, state); downcast<z80dart_device *>(device)->tx_w(CHANNEL_B, state); }
14111461
14121462READ8_DEVICE_HANDLER( z80dart_cd_ba_r )
14131463{
r8854r8855
14431493const device_type Z80SIO0 = z80dart_device_config::static_alloc_device_config; // FIXME
14441494const device_type Z80SIO1 = z80dart_device_config::static_alloc_device_config; // FIXME
14451495const device_type Z80SIO2 = z80dart_device_config::static_alloc_device_config; // FIXME
1496const device_type Z80SIO3 = z80dart_device_config::static_alloc_device_config; // FIXME
1497const device_type Z80SIO4 = z80dart_device_config::static_alloc_device_config; // FIXME
src/emu/machine/z80dart.h
r8854r8855
1616                   IEO   7 |             | 34  B/_A
1717                   _M1   8 |             | 33  C/_D
1818                   Vdd   9 |             | 32  _RD
19               _W/RDYA  10 |  Z80-DART   | 31  GND
20                  _RIA  11 |  Z80-SIO/0  | 30  _W/RDYB
19               _W/RDYA  10 |   Z80-DART  | 31  GND
20                  _RIA  11 |             | 30  _W/RDYB
2121                  RxDA  12 |             | 29  _RIB
2222                 _RxCA  13 |             | 28  RxDB
2323                 _TxCA  14 |             | 27  _RxTxCB
r8854r8855
3838                   IEO   7 |             | 34  B/_A
3939                   _M1   8 |             | 33  C/_D
4040                   Vdd   9 |             | 32  _RD
41               _W/RDYA  10 |  Z80-SIO/0  | 31  GND
42                _SYNCA  11 |             | 30  _W/RDYB
43                  RxDA  12 |             | 29  _SYNCB
44                 _RxCA  13 |             | 28  RxDB
45                 _TxCA  14 |             | 27  _RxTxCB
46                  TxDA  15 |             | 26  TxDB
47                 _DTRA  16 |             | 25  _DTRB
48                 _RTSA  17 |             | 24  _RTSB
49                 _CTSA  18 |             | 23  _CTSB
50                 _DCDA  19 |             | 22  _DCDB
51                   CLK  20 |_____________| 21  _RESET
52
53                            _____   _____
54                    D1   1 |*    \_/     | 40  D0
55                    D3   2 |             | 39  D2
56                    D5   3 |             | 38  D4
57                    D7   4 |             | 37  D6
58                  _INT   5 |             | 36  _IORQ
59                   IEI   6 |             | 35  _CE
60                   IEO   7 |             | 34  B/_A
61                   _M1   8 |             | 33  C/_D
62                   Vdd   9 |             | 32  _RD
4163               _W/RDYA  10 |  Z80-SIO/1  | 31  GND
4264                _SYNCA  11 |             | 30  _W/RDYB
4365                  RxDA  12 |             | 29  _SYNCB
r8854r8855
82104
83105
84106//**************************************************************************
85//  CONSTANTS
86//**************************************************************************
87
88enum
89{
90   Z80DART_CH_A = 0,
91   Z80DART_CH_B
92};
93
94
95
96//**************************************************************************
97107//  DEVICE CONFIGURATION MACROS
98108//**************************************************************************
99109
r8854r8855
113123   MDRV_DEVICE_ADD(_tag, Z80SIO2, _clock) \
114124   MDRV_DEVICE_CONFIG(_config)
115125
126#define MDRV_Z80SIO3_ADD(_tag, _clock, _config) \
127   MDRV_DEVICE_ADD(_tag, Z80SIO3, _clock) \
128   MDRV_DEVICE_CONFIG(_config)
129
130#define MDRV_Z80SIO4_ADD(_tag, _clock, _config) \
131   MDRV_DEVICE_ADD(_tag, Z80SIO4, _clock) \
132   MDRV_DEVICE_CONFIG(_config)
133
116134#define MDRV_Z80DART_REMOVE(_tag) \
117135   MDRV_DEVICE_REMOVE(_tag)
118136
r8854r8855
309327
310328      int m_dtr;               // data terminal ready
311329      int m_rts;               // request to send
330
331      // synchronous state
332      UINT16 m_sync;            // sync character
312333   };
313334
314335   // internal state
r8854r8855
330351extern const device_type Z80SIO0;
331352extern const device_type Z80SIO1;
332353extern const device_type Z80SIO2;
333/*
334#define Z8470   DEVICE_GET_INFO_NAME(z8470)
335#define LH0081  DEVICE_GET_INFO_NAME(lh0088)
336#define MK3881  DEVICE_GET_INFO_NAME(mk3888)
337*/
354extern const device_type Z80SIO3;
355extern const device_type Z80SIO4;
338356
339357
340358

Previous 15994 Revisions Next


© 1998-2018 The MESS Team