Previous 15994 Revisions Next

r9972 Sunday 9th January, 2011 at 14:01:09 UTC by Curt Coder
[ST] Modernized driver, converted MC68901 to C++ device.
[src/mess]mess.mak
[src/mess/drivers]atarist.c x68k.c
[src/mess/includes]atarist.h
[src/mess/machine]68901mfp.c 68901mfp.h mc68901.c* mc68901.h*
[src/mess/video]atarist.c atarist.h

src/mess/machine/mc68901.c
r0r9972
1/**********************************************************************
2
3    Motorola MC68901 Multi Function Peripheral emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10/*
11
12    TODO:
13
14    - daisy chaining
15    - disable GPIO3/4 interrupts when timer A/B in pulse mode
16    - spurious interrupt
17
18        If you look at the MFP datasheet it is obvious that it can generate the conditions for a spurious interrupt.
19        However the fact that they indeed happen in the ST is quite interesting.
20
21        The MFP will generate a spurious interrupt if interrupts are disabled (by changing the IERA/IERB registers)
22        at the ???precise point???. The precise point would be after the system (but not necessarily the CPU, see below)
23        triggered an MFP interrupt, and before the CPU drives the interrupt acknowledge cycle.
24
25        If the MFP was connected directly to the CPU, spurious interrupts probably couldn???t happen. However in the
26        ST, GLUE seats in the middle and handles all the interrupt timing. It is possible that GLUE introduces a
27        delay between detecting a change in the MFP interrupt request signal and actually propagating the change to
28        the CPU IPL signals (it is even possible that GLUE make some kind of latching). This would create a window
29        long enough for the ???precise point??? described above.
30
31        "yes, the spurious interrupt occurs when i mask a timer. i did not notice an occurance of the SPI when changing data and control registers.
32        if i kill interrupts with the status reg before masking the timer interrupt, then the SPI occurs as soon as the status register is set to re-enable interrupts."
33
34    - divide serial clock by 16
35    - synchronous mode
36    - 1.5/2 stop bits
37    - interrupt on receiver break end
38    - interrupt on character boundaries during break transmission
39    - loopback mode
40
41*/
42
43#include "emu.h"
44#include "mc68901.h"
45#include "cpu/m68000/m68000.h"
46#include "machine/devhelpr.h"
47
48
49
50//**************************************************************************
51//   MACROS / CONSTANTS
52//**************************************************************************
53
54#define LOG 0
55
56
57enum
58{
59   REGISTER_GPIP = 0,
60   REGISTER_AER,
61   REGISTER_DDR,
62   REGISTER_IERA,
63   REGISTER_IERB,
64   REGISTER_IPRA,
65   REGISTER_IPRB,
66   REGISTER_ISRA,
67   REGISTER_ISRB,
68   REGISTER_IMRA,
69   REGISTER_IMRB,
70   REGISTER_VR,
71   REGISTER_TACR,
72   REGISTER_TBCR,
73   REGISTER_TCDCR,
74   REGISTER_TADR,
75   REGISTER_TBDR,
76   REGISTER_TCDR,
77   REGISTER_TDDR,
78   REGISTER_SCR,
79   REGISTER_UCR,
80   REGISTER_RSR,
81   REGISTER_TSR,
82   REGISTER_UDR
83};
84
85
86enum
87{
88   INT_GPI0 = 0,
89   INT_GPI1,
90   INT_GPI2,
91   INT_GPI3,
92   INT_TIMER_D,
93   INT_TIMER_C,
94   INT_GPI4,
95   INT_GPI5,
96   INT_TIMER_B,
97   INT_XMIT_ERROR,
98   INT_XMIT_BUFFER_EMPTY,
99   INT_RCV_ERROR,
100   INT_RCV_BUFFER_FULL,
101   INT_TIMER_A,
102   INT_GPI6,
103   INT_GPI7
104};
105
106
107enum
108{
109   GPIP_0 = 0,
110   GPIP_1,
111   GPIP_2,
112   GPIP_3,
113   GPIP_4,
114   GPIP_5,
115   GPIP_6,
116   GPIP_7
117};
118
119
120enum
121{
122   TIMER_A = 0,
123   TIMER_B,
124   TIMER_C,
125   TIMER_D,
126   MAX_TIMERS
127};
128
129
130enum
131{
132   SERIAL_START = 0,
133   SERIAL_DATA,
134   SERIAL_PARITY,
135   SERIAL_STOP
136};
137
138
139enum
140{
141   XMIT_OFF = 0,
142   XMIT_STARTING,
143   XMIT_ON,
144   XMIT_BREAK,
145   XMIT_STOPPING
146};
147
148
149#define AER_GPIP_0            0x01
150#define AER_GPIP_1            0x02
151#define AER_GPIP_2            0x04
152#define AER_GPIP_3            0x08
153#define AER_GPIP_4            0x10
154#define AER_GPIP_5            0x20
155#define AER_GPIP_6            0x40
156#define AER_GPIP_7            0x80
157
158
159#define VR_S               0x08
160
161
162#define IR_GPIP_0            0x0001
163#define IR_GPIP_1            0x0002
164#define IR_GPIP_2            0x0004
165#define IR_GPIP_3            0x0008
166#define IR_TIMER_D            0x0010
167#define IR_TIMER_C            0x0020
168#define IR_GPIP_4            0x0040
169#define IR_GPIP_5            0x0080
170#define IR_TIMER_B            0x0100
171#define IR_XMIT_ERROR         0x0200
172#define IR_XMIT_BUFFER_EMPTY   0x0400
173#define IR_RCV_ERROR         0x0800
174#define IR_RCV_BUFFER_FULL      0x1000
175#define IR_TIMER_A            0x2000
176#define IR_GPIP_6            0x4000
177#define IR_GPIP_7            0x8000
178
179
180#define TCR_TIMER_STOPPED      0x00
181#define TCR_TIMER_DELAY_4      0x01
182#define TCR_TIMER_DELAY_10      0x02
183#define TCR_TIMER_DELAY_16      0x03
184#define TCR_TIMER_DELAY_50      0x04
185#define TCR_TIMER_DELAY_64      0x05
186#define TCR_TIMER_DELAY_100      0x06
187#define TCR_TIMER_DELAY_200      0x07
188#define TCR_TIMER_EVENT         0x08
189#define TCR_TIMER_PULSE_4      0x09
190#define TCR_TIMER_PULSE_10      0x0a
191#define TCR_TIMER_PULSE_16      0x0b
192#define TCR_TIMER_PULSE_50      0x0c
193#define TCR_TIMER_PULSE_64      0x0d
194#define TCR_TIMER_PULSE_100      0x0e
195#define TCR_TIMER_PULSE_200      0x0f
196#define TCR_TIMER_RESET         0x10
197
198
199#define UCR_PARITY_ENABLED      0x04
200#define UCR_PARITY_EVEN         0x02
201#define UCR_PARITY_ODD         0x00
202#define UCR_WORD_LENGTH_8      0x00
203#define UCR_WORD_LENGTH_7      0x20
204#define UCR_WORD_LENGTH_6      0x40
205#define UCR_WORD_LENGTH_5      0x60
206#define UCR_START_STOP_0_0      0x00
207#define UCR_START_STOP_1_1      0x08
208#define UCR_START_STOP_1_15      0x10
209#define UCR_START_STOP_1_2      0x18
210#define UCR_CLOCK_DIVIDE_16      0x80
211#define UCR_CLOCK_DIVIDE_1      0x00
212
213
214#define RSR_RCV_ENABLE         0x01
215#define RSR_SYNC_STRIP_ENABLE   0x02
216#define RSR_MATCH            0x04
217#define RSR_CHAR_IN_PROGRESS   0x04
218#define RSR_FOUND_SEARCH      0x08
219#define RSR_BREAK            0x08
220#define RSR_FRAME_ERROR         0x10
221#define RSR_PARITY_ERROR      0x20
222#define RSR_OVERRUN_ERROR      0x40
223#define RSR_BUFFER_FULL         0x80
224
225#define TSR_XMIT_ENABLE         0x01
226#define TSR_OUTPUT_HI_Z         0x00
227#define TSR_OUTPUT_LOW         0x02
228#define TSR_OUTPUT_HIGH         0x04
229#define TSR_OUTPUT_LOOP         0x06
230#define TSR_OUTPUT_MASK         0x06
231#define TSR_BREAK            0x08
232#define TSR_END_OF_XMIT         0x10
233#define TSR_AUTO_TURNAROUND      0x20
234#define TSR_UNDERRUN_ERROR      0x40
235#define TSR_BUFFER_EMPTY      0x80
236
237
238static const int INT_MASK_GPIO[] =
239{
240   IR_GPIP_0, IR_GPIP_1, IR_GPIP_2, IR_GPIP_3,
241   IR_GPIP_4, IR_GPIP_5, IR_GPIP_6, IR_GPIP_7
242};
243
244
245static const int INT_MASK_TIMER[] =
246{
247   IR_TIMER_A, IR_TIMER_B, IR_TIMER_C, IR_TIMER_D
248};
249
250
251static const int GPIO_TIMER[] =
252{
253   GPIP_4, GPIP_3
254};
255
256
257static const int PRESCALER[] = { 0, 4, 10, 16, 50, 64, 100, 200 };
258
259
260#define TXD(_data) devcb_call_write_line(&m_out_so_func, _data);
261
262
263//**************************************************************************
264//  GLOBAL VARIABLES
265//**************************************************************************
266
267// devices
268const device_type MC68901 = mc68901_device_config::static_alloc_device_config;
269
270
271
272//**************************************************************************
273//  DEVICE CONFIGURATION
274//**************************************************************************
275
276GENERIC_DEVICE_CONFIG_SETUP(mc68901, "Motorola MC68901")
277
278
279//-------------------------------------------------
280//  device_config_complete - perform any
281//  operations now that the configuration is
282//  complete
283//-------------------------------------------------
284
285void mc68901_device_config::device_config_complete()
286{
287   // inherit a copy of the static data
288   const mc68901_interface *intf = reinterpret_cast<const mc68901_interface *>(static_config());
289   if (intf != NULL)
290      *static_cast<mc68901_interface *>(this) = *intf;
291
292   // or initialize to defaults if none provided
293   else
294   {
295//      memset(&in_pa_func, 0, sizeof(in_pa_func));
296   }
297}
298
299
300
301//**************************************************************************
302//  INLINE HELPERS
303//**************************************************************************
304
305inline void mc68901_device::check_interrupts()
306{
307   if (m_ipr & m_imr)
308   {
309      devcb_call_write_line(&m_out_irq_func, ASSERT_LINE);
310   }
311   else
312   {
313      devcb_call_write_line(&m_out_irq_func, CLEAR_LINE);
314   }
315}
316
317inline void mc68901_device::take_interrupt(UINT16 mask)
318{
319   m_ipr |= mask;
320
321   check_interrupts();
322}
323
324inline void mc68901_device::rx_buffer_full()
325{
326   if (m_ier & IR_RCV_BUFFER_FULL)
327   {
328      take_interrupt(IR_RCV_BUFFER_FULL);
329   }
330}
331
332inline void mc68901_device::rx_error()
333{
334   if (m_ier & IR_RCV_ERROR)
335   {
336      take_interrupt(IR_RCV_ERROR);
337   }
338   else
339   {
340      rx_buffer_full();
341   }
342}
343
344inline void mc68901_device::tx_buffer_empty()
345{
346   if (m_ier & IR_XMIT_BUFFER_EMPTY)
347   {
348      take_interrupt(IR_XMIT_BUFFER_EMPTY);
349   }
350}
351
352inline void mc68901_device::tx_error()
353{
354   if (m_ier & IR_XMIT_ERROR)
355   {
356      take_interrupt(IR_XMIT_ERROR);
357   }
358   else
359   {
360      tx_buffer_empty();
361   }
362}
363
364inline int mc68901_device::get_parity_bit(UINT8 b)
365{
366   b ^= b >> 4;
367   b ^= b >> 2;
368   b ^= b >> 1;
369   return b & 1;
370}
371
372inline void mc68901_device::serial_receive()
373{
374   int rxd;
375
376   if (!(m_rsr & RSR_RCV_ENABLE)) return;
377
378   rxd = devcb_call_read_line(&m_in_si_func);
379
380   switch (m_rx_state)
381   {
382   case SERIAL_START:
383      if (!rxd)
384      {
385         m_rsr |= RSR_CHAR_IN_PROGRESS;
386         m_rx_bits = 0;
387         m_rx_buffer = 0;
388         m_rx_state = SERIAL_DATA;
389         m_next_rsr = RSR_BREAK;
390      }
391      break;
392
393   case SERIAL_DATA:
394      if ((m_next_rsr & RSR_BREAK) && (rxd == 1) && m_rsr_read)
395      {
396         m_next_rsr &= ~RSR_BREAK;
397      }
398
399      m_rx_buffer >>= 1;
400      m_rx_buffer |= (rxd << 7);
401      m_rx_bits++;
402
403      if (m_rx_bits == m_rxtx_word)
404      {
405         if (m_rxtx_word < 8)
406         {
407            m_rx_buffer >>= (8 - m_rxtx_word);
408         }
409
410         m_rsr &= ~RSR_CHAR_IN_PROGRESS;
411
412         if (m_ucr & UCR_PARITY_ENABLED)
413         {
414            m_rx_state = SERIAL_PARITY;
415         }
416         else
417         {
418            m_rx_state = SERIAL_STOP;
419         }
420      }
421      break;
422
423   case SERIAL_PARITY:
424      m_rx_parity = rxd;
425
426      if (m_rx_parity != (get_parity_bit(m_rx_buffer) ^ ((m_ucr & UCR_PARITY_EVEN) >> 1)))
427      {
428         m_next_rsr |= RSR_PARITY_ERROR;
429      }
430
431      m_rx_state = SERIAL_STOP;
432      break;
433
434   case SERIAL_STOP:
435      if (rxd == 1)
436      {
437         if (!((m_rsr & RSR_SYNC_STRIP_ENABLE) && (m_rx_buffer == m_scr)))
438         {
439            if (!(m_rsr & RSR_OVERRUN_ERROR))
440            {
441               if (m_rsr & RSR_BUFFER_FULL)
442               {
443                  // incoming word received but last word in receive buffer has not been read
444                  m_next_rsr |= RSR_OVERRUN_ERROR;
445               }
446               else
447               {
448                  // incoming word received and receive buffer is empty
449                  m_rsr |= RSR_BUFFER_FULL;
450                  m_udr = m_rx_buffer;
451                  rx_buffer_full();
452               }
453            }
454         }
455      }
456      else
457      {
458         if (m_rx_buffer)
459         {
460            // non-zero data word not followed by a stop bit
461            m_next_rsr |= RSR_FRAME_ERROR;
462         }
463      }
464
465      m_rx_state = SERIAL_START;
466      break;
467   }
468}
469
470
471inline void mc68901_device::tx_disabled()
472{
473   switch (m_tsr & TSR_OUTPUT_MASK)
474   {
475   case TSR_OUTPUT_HI_Z:
476      /* indeterminate state */
477   case TSR_OUTPUT_LOW:
478      TXD(0);
479      break;
480
481   case TSR_OUTPUT_HIGH:
482   case TSR_OUTPUT_LOOP:
483      TXD(1);
484      break;
485   }
486}
487
488
489inline void mc68901_device::tx_starting()
490{
491   if (m_tsr & TSR_XMIT_ENABLE)
492   {
493      /* enable transmitter */
494      TXD(1);
495      m_xmit_state = XMIT_ON;
496   }
497   else
498   {
499      /* disable transmitter */
500      m_tsr |= TSR_END_OF_XMIT;
501      m_xmit_state = XMIT_OFF;
502   }
503}
504
505
506inline void mc68901_device::tx_break()
507{
508   if (m_tsr & TSR_XMIT_ENABLE)
509   {
510      if (m_tsr & TSR_BREAK)
511      {
512         /* transmit break */
513         TXD(1);
514      }
515      else
516      {
517         /* enable transmitter */
518         m_xmit_state = XMIT_ON;
519      }
520   }
521   else
522   {
523      /* disable transmitter */
524      m_tsr |= TSR_END_OF_XMIT;
525      m_xmit_state = XMIT_OFF;
526   }
527}
528
529
530inline void mc68901_device::tx_enabled()
531{
532   switch (m_tx_state)
533   {
534   case SERIAL_START:
535      if (m_tsr & TSR_UNDERRUN_ERROR)
536      {
537         /* buffer underrun condition */
538         if (m_tsr & TSR_XMIT_ENABLE)
539         {
540            /* transmit break */
541            TXD(1);
542         }
543         else
544         {
545            /* transmitter disabled */
546            tx_disabled();
547         }
548      }
549      else
550      {
551         if (m_tsr & TSR_BUFFER_EMPTY)
552         {
553            /* transmit buffer is empty, signal underrun error */
554            m_tsr |= TSR_UNDERRUN_ERROR;
555
556            if (m_tsr & TSR_XMIT_ENABLE)
557            {
558               /* transmit break */
559               TXD(1);
560            }
561            else
562            {
563               /* transmitter disabled */
564               tx_disabled();
565            }
566         }
567         else
568         {
569            /* transmit start bit */
570            TXD(0);
571
572            /* load transmit buffer */
573            m_tx_buffer = m_udr;
574            m_tx_bits = 0;
575
576            /* signal transmit buffer empty */
577            m_tsr |= TSR_BUFFER_EMPTY;
578            tx_buffer_empty();
579
580            /* calculate parity */
581            m_tx_parity = get_parity_bit(m_tx_buffer);
582
583            /* next bit is data */
584            m_tx_state = SERIAL_DATA;
585         }
586      }
587      break;
588
589   case SERIAL_DATA:
590      /* transmit data bit */
591      TXD(m_tx_buffer & 0x01);
592
593      /* shift transmit buffer */
594      m_tx_buffer >>= 1;
595      m_tx_bits++;
596
597      if (m_tx_bits == m_rxtx_word)
598      {
599         /* all data bits transferred */
600         if (m_ucr & UCR_PARITY_ENABLED)
601         {
602            /* next bit is parity */
603            m_tx_state = SERIAL_PARITY;
604         }
605         else
606         {
607            /* next bit is stop */
608            m_tx_state = SERIAL_STOP;
609         }
610      }
611      break;
612
613   case SERIAL_PARITY:
614      if (m_rxtx_word < 8)
615      {
616         /* transmit user-defined parity bit from buffer */
617         TXD(m_tx_buffer & 0x01);
618      }
619      else
620      {
621         /* transmit calculated parity bit */
622         TXD(m_tx_parity ^ ((m_ucr & UCR_PARITY_EVEN) >> 1));
623      }
624
625      /* next bit is stop */
626      m_tx_state = SERIAL_STOP;
627      break;
628
629   case SERIAL_STOP:
630      /* transmit stop bit */
631      TXD(1);
632
633      if (m_tsr & TSR_XMIT_ENABLE)
634      {
635         /* next bit is start */
636         m_tx_state = SERIAL_START;
637      }
638      else
639      {
640         if (m_tsr & TSR_AUTO_TURNAROUND)
641         {
642            /* enable transmitter */
643            m_tsr |= TSR_XMIT_ENABLE;
644
645            /* next bit is start */
646            m_tx_state = SERIAL_START;
647         }
648         else
649         {
650            /* disable transmitter */
651            m_xmit_state = XMIT_OFF;
652            m_tsr |= TSR_END_OF_XMIT;
653
654            /* signal transmit error */
655            tx_error();
656         }
657      }
658      break;
659   }
660}
661
662inline void mc68901_device::serial_transmit()
663{
664   switch (m_xmit_state)
665   {
666   case XMIT_OFF:      tx_disabled();   break;
667   case XMIT_STARTING:   tx_starting();   break;
668   case XMIT_BREAK:   tx_break();      break;
669   case XMIT_ON:      tx_enabled();   break;
670   }
671}
672
673
674inline void mc68901_device::timer_count(int index)
675{
676   if (m_tmc[index] == 0x01)
677   {
678      /* toggle timer output signal */
679      m_to[index] = !m_to[index];
680
681      switch (index)
682      {
683      case TIMER_A:   devcb_call_write_line(&m_out_tao_func, m_to[index]);   break;
684      case TIMER_B:   devcb_call_write_line(&m_out_tbo_func, m_to[index]);   break;
685      case TIMER_C:   devcb_call_write_line(&m_out_tco_func, m_to[index]);   break;
686      case TIMER_D:   devcb_call_write_line(&m_out_tdo_func, m_to[index]);   break;
687      }
688
689      if (m_ier & INT_MASK_TIMER[index])
690      {
691         /* signal timer elapsed interrupt */
692         take_interrupt(INT_MASK_TIMER[index]);
693      }
694
695      /* load main counter */
696      m_tmc[index] = m_tdr[index];
697   }
698   else
699   {
700      /* count down */
701      m_tmc[index]--;
702   }
703}
704
705
706inline void mc68901_device::timer_input(int index, int value)
707{
708   int bit = GPIO_TIMER[index];
709   int aer = BIT(m_aer, bit);
710   int cr = index ? m_tbcr : m_tacr;
711
712   switch (cr & 0x0f)
713   {
714   case TCR_TIMER_EVENT:
715      if (((m_ti[index] ^ aer) == 1) && ((value ^ aer) == 0))
716      {
717         timer_count(index);
718      }
719
720      m_ti[index] = value;
721      break;
722
723   case TCR_TIMER_PULSE_4:
724   case TCR_TIMER_PULSE_10:
725   case TCR_TIMER_PULSE_16:
726   case TCR_TIMER_PULSE_50:
727   case TCR_TIMER_PULSE_64:
728   case TCR_TIMER_PULSE_100:
729   case TCR_TIMER_PULSE_200:
730      timer_enable(m_timer[index], (value == aer));
731
732      if (((m_ti[index] ^ aer) == 0) && ((value ^ aer) == 1))
733      {
734         if (m_ier & INT_MASK_GPIO[bit])
735         {
736            take_interrupt(INT_MASK_GPIO[bit]);
737         }
738      }
739
740      m_ti[index] = value;
741      break;
742   }
743}
744
745
746inline void mc68901_device::gpio_input(int bit, int state)
747{
748   if (BIT(m_gpip, bit) && !state) // if transition from 1 to 0 is detected...
749   {
750      if (LOG) logerror("MC68901 '%s' Edge Transition Detected on GPIO%u\n", tag(), bit);
751
752      if (m_ier & INT_MASK_GPIO[bit]) // AND interrupt enabled bit is set...
753      {
754         if (LOG) logerror("MC68901 '%s' Interrupt Pending for GPIO%u\n", tag(), bit);
755
756         take_interrupt(INT_MASK_GPIO[bit]); // set interrupt pending bit
757      }
758   }
759
760   m_gpip &= ((1 << bit) ^ 0xff);
761   m_gpip |= (state << bit);
762}
763
764
765
766//**************************************************************************
767//  LIVE DEVICE
768//**************************************************************************
769
770//-------------------------------------------------
771//  mc68901_device - constructor
772//-------------------------------------------------
773
774mc68901_device::mc68901_device(running_machine &_machine, const mc68901_device_config &config)
775    : device_t(_machine, config),
776     m_gpip(0),
777     m_tsr(TSR_BUFFER_EMPTY),
778      m_config(config)
779{
780}
781
782
783//-------------------------------------------------
784//  device_start - device-specific startup
785//-------------------------------------------------
786
787void mc68901_device::device_start()
788{
789   /* resolve callbacks */
790   devcb_resolve_read8(&m_in_gpio_func, &m_config.in_gpio_func, this);
791   devcb_resolve_write8(&m_out_gpio_func, &m_config.out_gpio_func, this);
792   devcb_resolve_read_line(&m_in_si_func, &m_config.in_si_func, this);
793   devcb_resolve_write_line(&m_out_so_func, &m_config.out_so_func, this);
794   devcb_resolve_write_line(&m_out_tao_func, &m_config.out_tao_func, this);
795   devcb_resolve_write_line(&m_out_tbo_func, &m_config.out_tbo_func, this);
796   devcb_resolve_write_line(&m_out_tco_func, &m_config.out_tco_func, this);
797   devcb_resolve_write_line(&m_out_tdo_func, &m_config.out_tdo_func, this);
798   devcb_resolve_write_line(&m_out_irq_func, &m_config.out_irq_func, this);
799
800   /* set initial values */
801   m_timer_clock = m_config.timer_clock;
802
803   /* create the timers */
804   m_timer[TIMER_A] = device_timer_alloc(*this, TIMER_A);
805   m_timer[TIMER_B] = device_timer_alloc(*this, TIMER_B);
806   m_timer[TIMER_C] = device_timer_alloc(*this, TIMER_C);
807   m_timer[TIMER_D] = device_timer_alloc(*this, TIMER_D);
808
809   if (m_config.rx_clock > 0)
810   {
811      m_rx_timer = device_timer_alloc(*this, TIMER_RX);
812      timer_adjust_periodic(m_rx_timer, attotime_zero, 0, ATTOTIME_IN_HZ(m_config.rx_clock));
813   }
814
815   if (m_config.tx_clock > 0)
816   {
817      m_tx_timer = device_timer_alloc(*this, TIMER_TX);
818      timer_adjust_periodic(m_tx_timer, attotime_zero, 0, ATTOTIME_IN_HZ(m_config.tx_clock));
819   }
820
821   /* register for state saving */
822   state_save_register_device_item(this, 0, m_gpip);
823   state_save_register_device_item(this, 0, m_aer);
824   state_save_register_device_item(this, 0, m_ddr);
825   state_save_register_device_item(this, 0, m_ier);
826   state_save_register_device_item(this, 0, m_ipr);
827   state_save_register_device_item(this, 0, m_isr);
828   state_save_register_device_item(this, 0, m_imr);
829   state_save_register_device_item(this, 0, m_vr);
830   state_save_register_device_item(this, 0, m_tacr);
831   state_save_register_device_item(this, 0, m_tbcr);
832   state_save_register_device_item(this, 0, m_tcdcr);
833   state_save_register_device_item_array(this, 0, m_tdr);
834   state_save_register_device_item_array(this, 0, m_tmc);
835   state_save_register_device_item_array(this, 0, m_to);
836   state_save_register_device_item_array(this, 0, m_ti);
837   state_save_register_device_item(this, 0, m_scr);
838   state_save_register_device_item(this, 0, m_ucr);
839   state_save_register_device_item(this, 0, m_rsr);
840   state_save_register_device_item(this, 0, m_tsr);
841   state_save_register_device_item(this, 0, m_udr);
842   state_save_register_device_item(this, 0, m_rx_bits);
843   state_save_register_device_item(this, 0, m_tx_bits);
844   state_save_register_device_item(this, 0, m_rx_parity);
845   state_save_register_device_item(this, 0, m_tx_parity);
846   state_save_register_device_item(this, 0, m_rx_state);
847   state_save_register_device_item(this, 0, m_tx_state);
848   state_save_register_device_item(this, 0, m_rx_buffer);
849   state_save_register_device_item(this, 0, m_tx_buffer);
850   state_save_register_device_item(this, 0, m_xmit_state);
851   state_save_register_device_item(this, 0, m_rxtx_word);
852   state_save_register_device_item(this, 0, m_rxtx_start);
853   state_save_register_device_item(this, 0, m_rxtx_stop);
854   state_save_register_device_item(this, 0, m_rsr_read);
855   state_save_register_device_item(this, 0, m_next_rsr);
856}
857
858
859//-------------------------------------------------
860//  device_reset - device-specific reset
861//-------------------------------------------------
862
863void mc68901_device::device_reset()
864{
865   register_w(REGISTER_GPIP, 0);
866   register_w(REGISTER_AER, 0);
867   register_w(REGISTER_DDR, 0);
868   register_w(REGISTER_IERA, 0);
869   register_w(REGISTER_IERB, 0);
870   register_w(REGISTER_IPRA, 0);
871   register_w(REGISTER_IPRB, 0);
872   register_w(REGISTER_ISRA, 0);
873   register_w(REGISTER_ISRB, 0);
874   register_w(REGISTER_IMRA, 0);
875   register_w(REGISTER_IMRB, 0);
876   register_w(REGISTER_VR, 0);
877   register_w(REGISTER_TACR, 0);
878   register_w(REGISTER_TBCR, 0);
879   register_w(REGISTER_TCDCR, 0);
880   register_w(REGISTER_SCR, 0);
881   register_w(REGISTER_UCR, 0);
882   register_w(REGISTER_RSR, 0);
883}
884
885
886//-------------------------------------------------
887//  device_timer - handler timer events
888//-------------------------------------------------
889
890void mc68901_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
891{
892   switch (id)
893   {
894   case TIMER_RX:
895      serial_receive();
896      break;
897
898   case TIMER_TX:
899      serial_transmit();
900      break;
901
902   default:
903      timer_count(id);
904      break;
905   }
906}
907
908
909
910READ8_MEMBER( mc68901_device::read )
911{
912   switch (offset)
913   {
914   case REGISTER_GPIP: 
915      m_gpip = devcb_call_read8(&m_in_gpio_func, 0);
916      return m_gpip;
917
918   case REGISTER_AER:   return m_aer;
919   case REGISTER_DDR:   return m_ddr;
920
921   case REGISTER_IERA:  return m_ier >> 8;
922   case REGISTER_IERB:  return m_ier & 0xff;
923   case REGISTER_IPRA:  return m_ipr >> 8;
924   case REGISTER_IPRB:  return m_ipr & 0xff;
925   case REGISTER_ISRA:  return m_isr >> 8;
926   case REGISTER_ISRB:  return m_isr & 0xff;
927   case REGISTER_IMRA:  return m_imr >> 8;
928   case REGISTER_IMRB:  return m_imr & 0xff;
929   case REGISTER_VR:    return m_vr;
930
931   case REGISTER_TACR:  return m_tacr;
932   case REGISTER_TBCR:  return m_tbcr;
933   case REGISTER_TCDCR: return m_tcdcr;
934   case REGISTER_TADR:  return m_tmc[TIMER_A];
935   case REGISTER_TBDR:  return m_tmc[TIMER_B];
936   case REGISTER_TCDR:  return m_tmc[TIMER_C];
937   case REGISTER_TDDR:  return m_tmc[TIMER_D];
938
939   case REGISTER_SCR:   return m_scr;
940   case REGISTER_UCR:   return m_ucr;
941   case REGISTER_RSR:
942      m_rsr_read = 1;
943      return m_rsr;
944
945   case REGISTER_TSR:
946      {
947         /* clear UE bit (in reality, this won't be cleared until one full clock cycle of the transmitter has passed since the bit was set) */
948         UINT8 tsr = m_tsr;
949         m_tsr &= 0xbf;
950
951         return tsr;
952      }
953
954   case REGISTER_UDR:
955      /* load RSR with latched value */
956      m_rsr = (m_next_rsr & 0x7c) | (m_rsr & 0x03);
957      m_next_rsr = 0;
958
959      if (m_rsr & 0x78)
960      {
961         /* signal receiver error interrupt */
962         rx_error();
963      }
964
965      return m_udr;
966
967   default:                 return 0;
968   }
969}
970
971
972#define DIVISOR PRESCALER[data & 0x07]
973
974void mc68901_device::register_w(offs_t offset, UINT8 data)
975{
976   switch (offset)
977   {
978   case REGISTER_GPIP:
979      if (LOG) logerror("MC68901 '%s' General Purpose I/O : %x\n", tag(), data);
980      m_gpip = data & m_ddr;
981
982      devcb_call_write8(&m_out_gpio_func, 0, m_gpip);
983      break;
984
985   case REGISTER_AER:
986      if (LOG) logerror("MC68901 '%s' Active Edge Register : %x\n", tag(), data);
987      m_aer = data;
988      break;
989
990   case REGISTER_DDR:
991      if (LOG) logerror("MC68901 '%s' Data Direction Register : %x\n", tag(), data);
992      m_ddr = data;
993      break;
994
995   case REGISTER_IERA:
996      if (LOG) logerror("MC68901 '%s' Interrupt Enable Register A : %x\n", tag(), data);
997      m_ier = (data << 8) | (m_ier & 0xff);
998      m_ipr &= m_ier;
999      check_interrupts();
1000      break;
1001
1002   case REGISTER_IERB:
1003      if (LOG) logerror("MC68901 '%s' Interrupt Enable Register B : %x\n", tag(), data);
1004      m_ier = (m_ier & 0xff00) | data;
1005      m_ipr &= m_ier;
1006      check_interrupts();
1007      break;
1008
1009   case REGISTER_IPRA:
1010      if (LOG) logerror("MC68901 '%s' Interrupt Pending Register A : %x\n", tag(), data);
1011      m_ipr &= (data << 8) | (m_ipr & 0xff);
1012      check_interrupts();
1013      break;
1014
1015   case REGISTER_IPRB:
1016      if (LOG) logerror("MC68901 '%s' Interrupt Pending Register B : %x\n", tag(), data);
1017      m_ipr &= (m_ipr & 0xff00) | data;
1018      check_interrupts();
1019      break;
1020
1021   case REGISTER_ISRA:
1022      if (LOG) logerror("MC68901 '%s' Interrupt In-Service Register A : %x\n", tag(), data);
1023      m_isr &= (data << 8) | (m_isr & 0xff);
1024      break;
1025
1026   case REGISTER_ISRB:
1027      if (LOG) logerror("MC68901 '%s' Interrupt In-Service Register B : %x\n", tag(), data);
1028      m_isr &= (m_isr & 0xff00) | data;
1029      break;
1030
1031   case REGISTER_IMRA:
1032      if (LOG) logerror("MC68901 '%s' Interrupt Mask Register A : %x\n", tag(), data);
1033      m_imr = (data << 8) | (m_imr & 0xff);
1034      m_isr &= m_imr;
1035      check_interrupts();
1036      break;
1037
1038   case REGISTER_IMRB:
1039      if (LOG) logerror("MC68901 '%s' Interrupt Mask Register B : %x\n", tag(), data);
1040      m_imr = (m_imr & 0xff00) | data;
1041      m_isr &= m_imr;
1042      check_interrupts();
1043      break;
1044
1045   case REGISTER_VR:
1046      if (LOG) logerror("MC68901 '%s' Interrupt Vector : %x\n", tag(), data & 0xf0);
1047
1048      m_vr = data & 0xf8;
1049
1050      if (m_vr & VR_S)
1051      {
1052         if (LOG) logerror("MC68901 '%s' Software End-Of-Interrupt Mode\n", tag());
1053      }
1054      else
1055      {
1056         if (LOG) logerror("MC68901 '%s' Automatic End-Of-Interrupt Mode\n", tag());
1057
1058         m_isr = 0;
1059      }
1060      break;
1061
1062   case REGISTER_TACR:
1063      m_tacr = data & 0x1f;
1064
1065      switch (m_tacr & 0x0f)
1066      {
1067      case TCR_TIMER_STOPPED:
1068         if (LOG) logerror("MC68901 '%s' Timer A Stopped\n", tag());
1069         timer_enable(m_timer[TIMER_A], 0);
1070         break;
1071
1072      case TCR_TIMER_DELAY_4:
1073      case TCR_TIMER_DELAY_10:
1074      case TCR_TIMER_DELAY_16:
1075      case TCR_TIMER_DELAY_50:
1076      case TCR_TIMER_DELAY_64:
1077      case TCR_TIMER_DELAY_100:
1078      case TCR_TIMER_DELAY_200:
1079         {
1080         int divisor = PRESCALER[m_tacr & 0x07];
1081         if (LOG) logerror("MC68901 '%s' Timer A Delay Mode : %u Prescale\n", tag(), divisor);
1082         timer_adjust_periodic(m_timer[TIMER_A], ATTOTIME_IN_HZ(m_timer_clock / divisor), 0, ATTOTIME_IN_HZ(m_timer_clock / divisor));
1083         }
1084         break;
1085
1086      case TCR_TIMER_EVENT:
1087         if (LOG) logerror("MC68901 '%s' Timer A Event Count Mode\n", tag());
1088         timer_enable(m_timer[TIMER_A], 0);
1089         break;
1090
1091      case TCR_TIMER_PULSE_4:
1092      case TCR_TIMER_PULSE_10:
1093      case TCR_TIMER_PULSE_16:
1094      case TCR_TIMER_PULSE_50:
1095      case TCR_TIMER_PULSE_64:
1096      case TCR_TIMER_PULSE_100:
1097      case TCR_TIMER_PULSE_200:
1098         {
1099         int divisor = PRESCALER[m_tacr & 0x07];
1100         if (LOG) logerror("MC68901 '%s' Timer A Pulse Width Mode : %u Prescale\n", tag(), divisor);
1101         timer_adjust_periodic(m_timer[TIMER_A], attotime_never, 0, ATTOTIME_IN_HZ(m_timer_clock / divisor));
1102         timer_enable(m_timer[TIMER_A], 0);
1103         }
1104         break;
1105      }
1106
1107      if (m_tacr & TCR_TIMER_RESET)
1108      {
1109         if (LOG) logerror("MC68901 '%s' Timer A Reset\n", tag());
1110
1111         m_to[TIMER_A] = 0;
1112
1113         devcb_call_write_line(&m_out_tao_func, m_to[TIMER_A]);
1114      }
1115      break;
1116
1117   case REGISTER_TBCR:
1118      m_tbcr = data & 0x1f;
1119
1120      switch (m_tbcr & 0x0f)
1121      {
1122      case TCR_TIMER_STOPPED:
1123         if (LOG) logerror("MC68901 '%s' Timer B Stopped\n", tag());
1124         timer_enable(m_timer[TIMER_B], 0);
1125         break;
1126
1127      case TCR_TIMER_DELAY_4:
1128      case TCR_TIMER_DELAY_10:
1129      case TCR_TIMER_DELAY_16:
1130      case TCR_TIMER_DELAY_50:
1131      case TCR_TIMER_DELAY_64:
1132      case TCR_TIMER_DELAY_100:
1133      case TCR_TIMER_DELAY_200:
1134         {
1135         int divisor = PRESCALER[m_tbcr & 0x07];
1136         if (LOG) logerror("MC68901 '%s' Timer B Delay Mode : %u Prescale\n", tag(), divisor);
1137         timer_adjust_periodic(m_timer[TIMER_B], ATTOTIME_IN_HZ(m_timer_clock / divisor), 0, ATTOTIME_IN_HZ(m_timer_clock / divisor));
1138         }
1139         break;
1140
1141      case TCR_TIMER_EVENT:
1142         if (LOG) logerror("MC68901 '%s' Timer B Event Count Mode\n", tag());
1143         timer_enable(m_timer[TIMER_B], 0);
1144         break;
1145
1146      case TCR_TIMER_PULSE_4:
1147      case TCR_TIMER_PULSE_10:
1148      case TCR_TIMER_PULSE_16:
1149      case TCR_TIMER_PULSE_50:
1150      case TCR_TIMER_PULSE_64:
1151      case TCR_TIMER_PULSE_100:
1152      case TCR_TIMER_PULSE_200:
1153         {
1154         int divisor = PRESCALER[m_tbcr & 0x07];
1155         if (LOG) logerror("MC68901 '%s' Timer B Pulse Width Mode : %u Prescale\n", tag(), DIVISOR);
1156         timer_adjust_periodic(m_timer[TIMER_B], attotime_never, 0, ATTOTIME_IN_HZ(m_timer_clock / divisor));
1157         timer_enable(m_timer[TIMER_B], 0);
1158         }
1159         break;
1160      }
1161
1162      if (m_tacr & TCR_TIMER_RESET)
1163      {
1164         if (LOG) logerror("MC68901 '%s' Timer B Reset\n", tag());
1165
1166         m_to[TIMER_B] = 0;
1167
1168         devcb_call_write_line(&m_out_tbo_func, m_to[TIMER_B]);
1169      }
1170      break;
1171
1172   case REGISTER_TCDCR:
1173      m_tcdcr = data & 0x6f;
1174
1175      switch (m_tcdcr & 0x07)
1176      {
1177      case TCR_TIMER_STOPPED:
1178         if (LOG) logerror("MC68901 '%s' Timer D Stopped\n", tag());
1179         timer_enable(m_timer[TIMER_D], 0);
1180         break;
1181
1182      case TCR_TIMER_DELAY_4:
1183      case TCR_TIMER_DELAY_10:
1184      case TCR_TIMER_DELAY_16:
1185      case TCR_TIMER_DELAY_50:
1186      case TCR_TIMER_DELAY_64:
1187      case TCR_TIMER_DELAY_100:
1188      case TCR_TIMER_DELAY_200:
1189         {
1190         int divisor = PRESCALER[m_tcdcr & 0x07];
1191         if (LOG) logerror("MC68901 '%s' Timer D Delay Mode : %u Prescale\n", tag(), divisor);
1192         timer_adjust_periodic(m_timer[TIMER_D], ATTOTIME_IN_HZ(m_timer_clock / divisor), 0, ATTOTIME_IN_HZ(m_timer_clock / divisor));
1193         }
1194         break;
1195      }
1196
1197      switch ((m_tcdcr >> 4) & 0x07)
1198      {
1199      case TCR_TIMER_STOPPED:
1200         if (LOG) logerror("MC68901 '%s' Timer C Stopped\n", tag());
1201         timer_enable(m_timer[TIMER_C], 0);
1202         break;
1203
1204      case TCR_TIMER_DELAY_4:
1205      case TCR_TIMER_DELAY_10:
1206      case TCR_TIMER_DELAY_16:
1207      case TCR_TIMER_DELAY_50:
1208      case TCR_TIMER_DELAY_64:
1209      case TCR_TIMER_DELAY_100:
1210      case TCR_TIMER_DELAY_200:
1211         {
1212         int divisor = PRESCALER[(m_tcdcr >> 4) & 0x07];
1213         if (LOG) logerror("MC68901 '%s' Timer C Delay Mode : %u Prescale\n", tag(), divisor);
1214         timer_adjust_periodic(m_timer[TIMER_C], ATTOTIME_IN_HZ(m_timer_clock / divisor), 0, ATTOTIME_IN_HZ(m_timer_clock / divisor));
1215         }
1216         break;
1217      }
1218      break;
1219
1220   case REGISTER_TADR:
1221      if (LOG) logerror("MC68901 '%s' Timer A Data Register : %x\n", tag(), data);
1222
1223      m_tdr[TIMER_A] = data;
1224
1225      if (!timer_enabled(m_timer[TIMER_A]))
1226      {
1227         m_tmc[TIMER_A] = data;
1228      }
1229      break;
1230
1231   case REGISTER_TBDR:
1232      if (LOG) logerror("MC68901 '%s' Timer B Data Register : %x\n", tag(), data);
1233
1234      m_tdr[TIMER_B] = data;
1235
1236      if (!timer_enabled(m_timer[TIMER_B]))
1237      {
1238         m_tmc[TIMER_B] = data;
1239      }
1240      break;
1241
1242   case REGISTER_TCDR:
1243      if (LOG) logerror("MC68901 '%s' Timer C Data Register : %x\n", tag(), data);
1244
1245      m_tdr[TIMER_C] = data;
1246
1247      if (!timer_enabled(m_timer[TIMER_C]))
1248      {
1249         m_tmc[TIMER_C] = data;
1250      }
1251      break;
1252
1253   case REGISTER_TDDR:
1254      if (LOG) logerror("MC68901 '%s' Timer D Data Register : %x\n", tag(), data);
1255
1256      m_tdr[TIMER_D] = data;
1257
1258      if (!timer_enabled(m_timer[TIMER_D]))
1259      {
1260         m_tmc[TIMER_D] = data;
1261      }
1262      break;
1263
1264   case REGISTER_SCR:
1265      if (LOG) logerror("MC68901 '%s' Sync Character : %x\n", tag(), data);
1266
1267      m_scr = data;
1268      break;
1269
1270   case REGISTER_UCR:
1271      if (data & UCR_PARITY_ENABLED)
1272      {
1273         if (data & UCR_PARITY_EVEN)
1274         {
1275            if (LOG) logerror("MC68901 '%s' Parity : Even\n", tag());
1276         }
1277         else
1278         {
1279            if (LOG) logerror("MC68901 '%s' Parity : Odd\n", tag());
1280         }
1281      }
1282      else
1283      {
1284         if (LOG) logerror("MC68901 '%s' Parity : Disabled\n", tag());
1285      }
1286
1287      switch (data & 0x60)
1288      {
1289      case UCR_WORD_LENGTH_8: m_rxtx_word = 8; break;
1290      case UCR_WORD_LENGTH_7: m_rxtx_word = 7; break;
1291      case UCR_WORD_LENGTH_6: m_rxtx_word = 6; break;
1292      case UCR_WORD_LENGTH_5: m_rxtx_word = 5; break;
1293      }
1294
1295      if (LOG) logerror("MC68901 '%s' Word Length : %u bits\n", tag(), m_rxtx_word);
1296
1297      switch (data & 0x18)
1298      {
1299      case UCR_START_STOP_0_0:
1300         m_rxtx_start = 0;
1301         m_rxtx_stop = 0;
1302         if (LOG) logerror("MC68901 '%s' Start Bits : 0, Stop Bits : 0, Format : synchronous\n", tag());
1303         break;
1304      case UCR_START_STOP_1_1:
1305         m_rxtx_start = 1;
1306         m_rxtx_stop = 1;
1307         if (LOG) logerror("MC68901 '%s' Start Bits : 1, Stop Bits : 1, Format : asynchronous\n", tag());
1308         break;
1309      case UCR_START_STOP_1_15:
1310         m_rxtx_start = 1;
1311         m_rxtx_stop = 1;
1312         if (LOG) logerror("MC68901 '%s' Start Bits : 1, Stop Bits : 1??, Format : asynchronous\n", tag());
1313         break;
1314      case UCR_START_STOP_1_2:
1315         m_rxtx_start = 1;
1316         m_rxtx_stop = 2;
1317         if (LOG) logerror("MC68901 '%s' Start Bits : 1, Stop Bits : 2, Format : asynchronous\n", tag());
1318         break;
1319      }
1320
1321      if (data & UCR_CLOCK_DIVIDE_16)
1322      {
1323         if (LOG) logerror("MC68901 '%s' Rx/Tx Clock Divisor : 16\n", tag());
1324      }
1325      else
1326      {
1327         if (LOG) logerror("MC68901 '%s' Rx/Tx Clock Divisor : 1\n", tag());
1328      }
1329
1330      m_ucr = data;
1331      break;
1332
1333   case REGISTER_RSR:
1334      if ((data & RSR_RCV_ENABLE) == 0)
1335      {
1336         if (LOG) logerror("MC68901 '%s' Receiver Disabled\n", tag());
1337         m_rsr = 0;
1338      }
1339      else
1340      {
1341         if (LOG) logerror("MC68901 '%s' Receiver Enabled\n", tag());
1342
1343         if (data & RSR_SYNC_STRIP_ENABLE)
1344         {
1345            if (LOG) logerror("MC68901 '%s' Sync Strip Enabled\n", tag());
1346         }
1347         else
1348         {
1349            if (LOG) logerror("MC68901 '%s' Sync Strip Disabled\n", tag());
1350         }
1351
1352         if (data & RSR_FOUND_SEARCH)
1353            if (LOG) logerror("MC68901 '%s' Receiver Search Mode Enabled\n", tag());
1354
1355         m_rsr = data & 0x0b;
1356      }
1357      break;
1358
1359   case REGISTER_TSR:
1360      if ((data & TSR_XMIT_ENABLE) == 0)
1361      {
1362         if (LOG) logerror("MC68901 '%s' Transmitter Disabled\n", tag());
1363
1364         m_tsr = data & 0x27;
1365      }
1366      else
1367      {
1368         if (LOG) logerror("MC68901 '%s' Transmitter Enabled\n", tag());
1369
1370         switch (data & 0x06)
1371         {
1372         case TSR_OUTPUT_HI_Z:
1373            if (LOG) logerror("MC68901 '%s' Transmitter Disabled Output State : Hi-Z\n", tag());
1374            break;
1375         case TSR_OUTPUT_LOW:
1376            if (LOG) logerror("MC68901 '%s' Transmitter Disabled Output State : 0\n", tag());
1377            break;
1378         case TSR_OUTPUT_HIGH:
1379            if (LOG) logerror("MC68901 '%s' Transmitter Disabled Output State : 1\n", tag());
1380            break;
1381         case TSR_OUTPUT_LOOP:
1382            if (LOG) logerror("MC68901 '%s' Transmitter Disabled Output State : Loop\n", tag());
1383            break;
1384         }
1385
1386         if (data & TSR_BREAK)
1387         {
1388            if (LOG) logerror("MC68901 '%s' Transmitter Break Enabled\n", tag());
1389         }
1390         else
1391         {
1392            if (LOG) logerror("MC68901 '%s' Transmitter Break Disabled\n", tag());
1393         }
1394
1395         if (data & TSR_AUTO_TURNAROUND)
1396         {
1397            if (LOG) logerror("MC68901 '%s' Transmitter Auto Turnaround Enabled\n", tag());
1398         }
1399         else
1400         {
1401            if (LOG) logerror("MC68901 '%s' Transmitter Auto Turnaround Disabled\n", tag());
1402         }
1403
1404         m_tsr = data & 0x2f;
1405         m_tsr |= TSR_BUFFER_EMPTY;  // x68000 expects the buffer to be empty, so this will do for now
1406      }
1407      break;
1408
1409   case REGISTER_UDR:
1410      if (LOG) logerror("MC68901 '%s' UDR %x\n", tag(), data);
1411      m_udr = data;
1412      //m_tsr &= ~TSR_BUFFER_EMPTY;
1413      break;
1414   }
1415}
1416
1417WRITE8_MEMBER( mc68901_device::write )
1418{
1419   register_w(offset, data);
1420}
1421
1422
1423int mc68901_device::get_vector()
1424{
1425   int ch;
1426
1427   for (ch = 15; ch >= 0; ch--)
1428   {
1429      if (BIT(m_imr, ch) && BIT(m_ipr, ch))
1430      {
1431         if (m_vr & VR_S)
1432         {
1433            /* set interrupt-in-service bit */
1434            m_isr |= (1 << ch);
1435         }
1436
1437         /* clear interrupt pending bit */
1438         m_ipr &= ~(1 << ch);
1439
1440         check_interrupts();
1441
1442         return (m_vr & 0xf0) | ch;
1443      }
1444   }
1445
1446   return M68K_INT_ACK_SPURIOUS;
1447}
1448
1449WRITE_LINE_MEMBER( mc68901_device::i0_w ) {   gpio_input(0, state); }
1450WRITE_LINE_MEMBER( mc68901_device::i1_w ) {   gpio_input(1, state); }
1451WRITE_LINE_MEMBER( mc68901_device::i2_w ) {   gpio_input(2, state); }
1452WRITE_LINE_MEMBER( mc68901_device::i3_w ) {   gpio_input(3, state); }
1453WRITE_LINE_MEMBER( mc68901_device::i4_w ) {   gpio_input(4, state); }
1454WRITE_LINE_MEMBER( mc68901_device::i5_w ) {   gpio_input(5, state); }
1455WRITE_LINE_MEMBER( mc68901_device::i6_w ) {   gpio_input(6, state); }
1456WRITE_LINE_MEMBER( mc68901_device::i7_w ) {   gpio_input(7, state); }
1457
1458
1459WRITE_LINE_MEMBER( mc68901_device::tai_w )
1460{
1461   timer_input(TIMER_A, state);
1462}
1463
1464
1465WRITE_LINE_MEMBER( mc68901_device::tbi_w )
1466{
1467   timer_input(TIMER_B, state);
1468}
1469
1470
1471WRITE_LINE_MEMBER( mc68901_device::rc_w )
1472{
1473   if (state)
1474   {
1475      serial_receive();
1476   }
1477}
1478
1479
1480WRITE_LINE_MEMBER( mc68901_device::tc_w )
1481{
1482   if (state)
1483   {
1484      serial_transmit();
1485   }
1486}
src/mess/machine/mc68901.h
r0r9972
1/**********************************************************************
2
3    Motorola MC68901 Multi Function Peripheral emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9                            _____   _____
10                  R/_W   1 |*    \_/     | 48  _CS
11                   RS1   2 |             | 47  _DS
12                   RS2   3 |             | 46  _DTACK
13                   RS3   4 |             | 45  _IACK
14                   RS4   5 |             | 44  D7
15                   RS5   6 |             | 43  D6
16                    TC   7 |             | 42  D5
17                    SO   8 |             | 41  D4
18                    SI   9 |             | 40  D3
19                    RC  10 |             | 39  D2
20                   Vcc  11 |             | 38  D1
21                    NC  12 |   MC68901   | 37  D0
22                   TAO  13 |   MK68901   | 36  GND
23                   TBO  14 |             | 35  CLK
24                   TCO  15 |             | 34  _IEI
25                   TDO  16 |             | 33  _IEO
26                 XTAL1  17 |             | 32  _IRQ
27                 XTAL2  18 |             | 31  _RR
28                   TAI  19 |             | 30  _TR
29                   TBI  20 |             | 29  I7
30                _RESET  21 |             | 28  I6
31                    I0  22 |             | 27  I5
32                    I1  23 |             | 26  I4
33                    I2  24 |_____________| 25  I3
34
35**********************************************************************/
36
37#pragma once
38
39#ifndef __MC68901__
40#define __MC68901__
41
42#include "emu.h"
43
44
45
46//**************************************************************************
47//   MACROS / CONSTANTS
48//**************************************************************************
49
50
51
52
53//**************************************************************************
54//  INTERFACE CONFIGURATION MACROS
55//**************************************************************************
56
57#define MCFG_MC68901_ADD(_tag, _clock, _config) \
58   MCFG_DEVICE_ADD((_tag), MC68901, _clock)   \
59   MCFG_DEVICE_CONFIG(_config)
60
61#define MC68901_INTERFACE(name) \
62   const mc68901_interface (name) =
63
64
65
66//**************************************************************************
67//   TYPE DEFINITIONS
68//**************************************************************************
69
70// ======================> mc68901_interface
71
72struct mc68901_interface
73{
74   int   timer_clock;      /* timer clock */
75   int   rx_clock;         /* serial receive clock */
76   int   tx_clock;         /* serial transmit clock */
77
78   devcb_write_line      out_irq_func;
79
80   devcb_read8            in_gpio_func;
81   devcb_write8         out_gpio_func;
82
83   devcb_write_line      out_tao_func;
84   devcb_write_line      out_tbo_func;
85   devcb_write_line      out_tco_func;
86   devcb_write_line      out_tdo_func;
87
88   devcb_read_line         in_si_func;
89   devcb_write_line      out_so_func;
90   devcb_write_line      out_rr_func;
91   devcb_write_line      out_tr_func;
92};
93
94
95
96// ======================> mc68901_device_config
97
98class mc68901_device_config :   public device_config,
99                                public mc68901_interface
100{
101    friend class mc68901_device;
102
103    // construction/destruction
104    mc68901_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
105
106public:
107    // allocators
108    static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
109    virtual device_t *alloc_device(running_machine &machine) const;
110
111protected:
112   // device_config overrides
113   virtual void device_config_complete();
114};
115
116
117
118// ======================> mc68901_device
119
120class mc68901_device :   public device_t
121{
122    friend class mc68901_device_config;
123
124    // construction/destruction
125    mc68901_device(running_machine &_machine, const mc68901_device_config &_config);
126
127public:
128    DECLARE_READ8_MEMBER( read );
129    DECLARE_WRITE8_MEMBER( write );
130
131   int get_vector();
132
133   DECLARE_WRITE_LINE_MEMBER( i0_w );
134   DECLARE_WRITE_LINE_MEMBER( i1_w );
135   DECLARE_WRITE_LINE_MEMBER( i2_w );
136   DECLARE_WRITE_LINE_MEMBER( i3_w );
137   DECLARE_WRITE_LINE_MEMBER( i4_w );
138   DECLARE_WRITE_LINE_MEMBER( i5_w );
139   DECLARE_WRITE_LINE_MEMBER( i6_w );
140   DECLARE_WRITE_LINE_MEMBER( i7_w );
141
142   DECLARE_WRITE_LINE_MEMBER( tai_w );
143   DECLARE_WRITE_LINE_MEMBER( tbi_w );
144
145   DECLARE_WRITE_LINE_MEMBER( rc_w );
146   DECLARE_WRITE_LINE_MEMBER( tc_w );
147
148protected:
149    // device-level overrides
150    virtual void device_start();
151    virtual void device_reset();
152   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
153
154   void check_interrupts();
155   void take_interrupt(UINT16 mask);
156   void rx_buffer_full();
157   void rx_error();
158   void tx_buffer_empty();
159   void tx_error();
160   int get_parity_bit(UINT8 b);
161   void serial_receive();
162   void tx_disabled();
163   void tx_starting();
164   void tx_break();
165   void tx_enabled();
166   void serial_transmit();
167   void timer_count(int index);
168   void timer_input(int index, int value);
169   void gpio_input(int bit, int state);
170   void register_w(offs_t offset, UINT8 data);
171
172private:
173   static const device_timer_id TIMER_A = 0;
174   static const device_timer_id TIMER_B = 1;
175   static const device_timer_id TIMER_C = 2;
176   static const device_timer_id TIMER_D = 3;
177   static const device_timer_id TIMER_RX = 4;
178   static const device_timer_id TIMER_TX = 5;
179
180   devcb_resolved_read8      m_in_gpio_func;
181   devcb_resolved_write8      m_out_gpio_func;
182   devcb_resolved_read_line   m_in_si_func;
183   devcb_resolved_write_line   m_out_so_func;
184   devcb_resolved_write_line   m_out_tao_func;
185   devcb_resolved_write_line   m_out_tbo_func;
186   devcb_resolved_write_line   m_out_tco_func;
187   devcb_resolved_write_line   m_out_tdo_func;
188   devcb_resolved_write_line   m_out_irq_func;
189
190   int m_device_type;                  /* device type */
191   int m_timer_clock;                  /* timer clock */
192
193   /* registers */
194   UINT8 m_gpip;                     /* general purpose I/O register */
195   UINT8 m_aer;                     /* active edge register */
196   UINT8 m_ddr;                     /* data direction register */
197
198   UINT16 m_ier;                     /* interrupt enable register */
199   UINT16 m_ipr;                     /* interrupt pending register */
200   UINT16 m_isr;                     /* interrupt in-service register */
201   UINT16 m_imr;                     /* interrupt mask register */
202   UINT8 m_vr;                        /* vector register */
203
204   UINT8 m_tacr;                     /* timer A control register */
205   UINT8 m_tbcr;                     /* timer B control register */
206   UINT8 m_tcdcr;                     /* timers C and D control register */
207   UINT8 m_tdr[4];      /* timer data registers */
208
209   UINT8 m_scr;                     /* synchronous character register */
210   UINT8 m_ucr;                     /* USART control register */
211   UINT8 m_tsr;                     /* transmitter status register */
212   UINT8 m_rsr;                     /* receiver status register */
213   UINT8 m_udr;                     /* USART data register */
214
215   /* counter timer state */
216   UINT8 m_tmc[4];      /* timer main counters */
217   int m_ti[4];         /* timer in latch */
218   int m_to[4];         /* timer out latch */
219
220   /* interrupt state */
221   int m_irqlevel;                     /* interrupt level latch */
222
223   /* serial state */
224   UINT8 m_next_rsr;                  /* receiver status register latch */
225   int m_rsr_read;                     /* receiver status register read flag */
226   int m_rxtx_word;                  /* word length */
227   int m_rxtx_start;                  /* start bits */
228   int m_rxtx_stop;                  /* stop bits */
229
230   /* receive state */
231   UINT8 m_rx_buffer;                  /* receive buffer */
232   int   m_rx_bits;                     /* receive bit count */
233   int   m_rx_parity;                  /* receive parity bit */
234   int   m_rx_state;                     /* receive state */
235
236   /* transmit state */
237   UINT8 m_tx_buffer;                  /* transmit buffer */
238   int m_tx_bits;                     /* transmit bit count */
239   int m_tx_parity;                  /* transmit parity bit */
240   int m_tx_state;                     /* transmit state */
241   int m_xmit_state;                  /* transmitter state */
242
243   // timers
244   emu_timer *m_timer[4]; /* counter timers */
245   emu_timer *m_rx_timer;               /* receive timer */
246   emu_timer *m_tx_timer;               /* transmit timer */
247   
248   const mc68901_device_config &m_config;
249};
250
251
252// device type definition
253extern const device_type MC68901;
254
255
256
257#endif
src/mess/machine/68901mfp.c
r9971r9972
329329INLINE const mc68901_interface *get_interface(device_t *device)
330330{
331331   assert(device != NULL);
332   assert(device->type() == MC68901);
332   assert(device->type() == MK68901);
333333   return (const mc68901_interface *) device->baseconfig().static_config();
334334}
335335
r9971r9972
16871687   }
16881688}
16891689
1690DEFINE_LEGACY_DEVICE(MC68901, mc68901);
1690//DEFINE_LEGACY_DEVICE(MC68901, mc68901);
16911691DEFINE_LEGACY_DEVICE(MK68901, mk68901);
src/mess/machine/68901mfp.h
r9971r9972
4444    MACROS / CONSTANTS
4545***************************************************************************/
4646
47DECLARE_LEGACY_DEVICE(MC68901, mc68901);
47//DECLARE_LEGACY_DEVICE(MC68901, mc68901);
4848DECLARE_LEGACY_DEVICE(MK68901, mk68901);
4949
5050#define MCFG_MC68901_ADD(_tag, _clock, _config) \
src/mess/video/atarist.c
r9971r9972
66    - STe pixelofs
77    - blitter hog
88    - high resolution
9
9   
1010*/
1111
1212#include "emu.h"
1313#include "cpu/m68000/m68000.h"
14#include "machine/68901mfp.h"
14#include "machine/mc68901.h"
15#include "machine/ram.h"
1516#include "video/atarist.h"
1617#include "includes/atarist.h"
1718
18INLINE pen_t atarist_shift_mode_0(running_machine *machine)
19
20
21//**************************************************************************
22//   CONSTANTS / MACROS
23//**************************************************************************
24
25#define LOG 0
26
27static const int BLITTER_NOPS[16][4] =
1928{
20   atarist_state *state = machine->driver_data<atarist_state>();
29   { 1, 1, 1, 1 },
30   { 2, 2, 3, 3 },
31   { 2, 2, 3, 3 },
32   { 1, 1, 2, 2 },
33   { 2, 2, 3, 3 },
34   { 2, 2, 2, 2 },
35   { 2, 2, 3, 3 },
36   { 2, 2, 3, 3 },
37   { 2, 2, 3, 3 },
38   { 2, 2, 3, 3 },
39   { 2, 2, 2, 2 },
40   { 2, 2, 3, 3 },
41   { 1, 1, 2, 2 },
42   { 2, 2, 3, 3 },
43   { 2, 2, 3, 3 },
44   { 1, 1, 1, 1 }
45};
2146
22   int color = (BIT(state->shifter_rr[3], 15) << 3) | (BIT(state->shifter_rr[2], 15) << 2) | (BIT(state->shifter_rr[1], 15) << 1) | BIT(state->shifter_rr[0], 15);
2347
24   state->shifter_rr[0] <<= 1;
25   state->shifter_rr[1] <<= 1;
26   state->shifter_rr[2] <<= 1;
27   state->shifter_rr[3] <<= 1;
2848
49//**************************************************************************
50//   SHIFTER
51//**************************************************************************
52
53//-------------------------------------------------
54//  shift_mode_0 -
55//-------------------------------------------------
56
57inline pen_t st_state::shift_mode_0()
58{
59   int color = (BIT(m_shifter_rr[3], 15) << 3) | (BIT(m_shifter_rr[2], 15) << 2) | (BIT(m_shifter_rr[1], 15) << 1) | BIT(m_shifter_rr[0], 15);
60
61   m_shifter_rr[0] <<= 1;
62   m_shifter_rr[1] <<= 1;
63   m_shifter_rr[2] <<= 1;
64   m_shifter_rr[3] <<= 1;
65
2966   return machine->pens[color];
3067}
3168
32INLINE pen_t atarist_shift_mode_1(running_machine *machine)
69
70//-------------------------------------------------
71//  shift_mode_1 -
72//-------------------------------------------------
73
74inline pen_t st_state::shift_mode_1()
3375{
34   atarist_state *state = machine->driver_data<atarist_state>();
76   int color = (BIT(m_shifter_rr[1], 15) << 1) | BIT(m_shifter_rr[0], 15);
3577
36   int color = (BIT(state->shifter_rr[1], 15) << 1) | BIT(state->shifter_rr[0], 15);
78   m_shifter_rr[0] <<= 1;
79   m_shifter_rr[1] <<= 1;
80   m_shifter_shift++;
3781
38   state->shifter_rr[0] <<= 1;
39   state->shifter_rr[1] <<= 1;
40   state->shifter_shift++;
41
42   if (state->shifter_shift == 16)
82   if (m_shifter_shift == 16)
4383   {
44      state->shifter_rr[0] = state->shifter_rr[2];
45      state->shifter_rr[1] = state->shifter_rr[3];
46      state->shifter_rr[2] = state->shifter_rr[3] = 0;
47      state->shifter_shift = 0;
84      m_shifter_rr[0] = m_shifter_rr[2];
85      m_shifter_rr[1] = m_shifter_rr[3];
86      m_shifter_rr[2] = m_shifter_rr[3] = 0;
87      m_shifter_shift = 0;
4888   }
4989
5090   return machine->pens[color];
5191}
5292
53INLINE pen_t atarist_shift_mode_2(running_machine *machine)
93
94//-------------------------------------------------
95//  shift_mode_2 -
96//-------------------------------------------------
97
98inline pen_t st_state::shift_mode_2()
5499{
55   atarist_state *state = machine->driver_data<atarist_state>();
100   int color = BIT(m_shifter_rr[0], 15);
56101
57   int color = BIT(state->shifter_rr[0], 15);
102   m_shifter_rr[0] <<= 1;
103   m_shifter_shift++;
58104
59   state->shifter_rr[0] <<= 1;
60   state->shifter_shift++;
61
62   switch (state->shifter_shift)
105   switch (m_shifter_shift)
63106   {
64107   case 16:
65      state->shifter_rr[0] = state->shifter_rr[1];
66      state->shifter_rr[1] = state->shifter_rr[2];
67      state->shifter_rr[2] = state->shifter_rr[3];
68      state->shifter_rr[3] = 0;
108      m_shifter_rr[0] = m_shifter_rr[1];
109      m_shifter_rr[1] = m_shifter_rr[2];
110      m_shifter_rr[2] = m_shifter_rr[3];
111      m_shifter_rr[3] = 0;
69112      break;
70113
71114   case 32:
72      state->shifter_rr[0] = state->shifter_rr[1];
73      state->shifter_rr[1] = state->shifter_rr[2];
74      state->shifter_rr[2] = 0;
115      m_shifter_rr[0] = m_shifter_rr[1];
116      m_shifter_rr[1] = m_shifter_rr[2];
117      m_shifter_rr[2] = 0;
75118      break;
76119
77120   case 48:
78      state->shifter_rr[0] = state->shifter_rr[1];
79      state->shifter_rr[1] = 0;
80      state->shifter_shift = 0;
121      m_shifter_rr[0] = m_shifter_rr[1];
122      m_shifter_rr[1] = 0;
123      m_shifter_shift = 0;
81124      break;
82125   }
83126
84127   return machine->pens[color];
85128}
86129
87static TIMER_CALLBACK( atarist_shifter_tick )
130
131//-------------------------------------------------
132//  shifter_tick -
133//-------------------------------------------------
134
135void st_state::shifter_tick()
88136{
89   atarist_state *state = machine->driver_data<atarist_state>();
90
91137   int y = machine->primary_screen->vpos();
92138   int x = machine->primary_screen->hpos();
93139
94140   pen_t pen;
95141
96   switch (state->shifter_mode)
142   switch (m_shifter_mode)
97143   {
98144   case 0:
99      pen = atarist_shift_mode_0(machine);
145      pen = shift_mode_0();
100146      break;
101147
102148   case 1:
103      pen = atarist_shift_mode_1(machine);
149      pen = shift_mode_1();
104150      break;
105151
106152   case 2:
107      pen = atarist_shift_mode_2(machine);
153      pen = shift_mode_2();
108154      break;
109
155     
110156   default:
111157      pen = get_black_pen(machine);
112158      break;
r9971r9972
115161   *BITMAP_ADDR32(machine->generic.tmpbitmap, y, x) = pen;
116162}
117163
118INLINE void atarist_shifter_load(running_machine *machine)
164
165//-------------------------------------------------
166//  TIMER_CALLBACK( atarist_shifter_tick )
167//-------------------------------------------------
168
169static TIMER_CALLBACK( atarist_shifter_tick )
119170{
120   atarist_state *state = machine->driver_data<atarist_state>();
171   st_state *state = machine->driver_data<st_state>();
121172
122   address_space *program = cputag_get_address_space(machine, M68000_TAG, ADDRESS_SPACE_PROGRAM);
123   UINT16 data = program->read_word(state->shifter_ofs);
173   state->shifter_tick();
174}
124175
125   state->shifter_ir[state->shifter_bitplane] = data;
126   state->shifter_bitplane++;
127   state->shifter_ofs += 2;
128176
129   if (state->shifter_bitplane == 4)
177//-------------------------------------------------
178//  shifter_load -
179//-------------------------------------------------
180
181inline void st_state::shifter_load()
182{
183   address_space *program = cpu_get_address_space(m_maincpu, ADDRESS_SPACE_PROGRAM);
184   UINT16 data = program->read_word(m_shifter_ofs);
185
186   m_shifter_ir[m_shifter_bitplane] = data;
187   m_shifter_bitplane++;
188   m_shifter_ofs += 2;
189
190   if (m_shifter_bitplane == 4)
130191   {
131      state->shifter_bitplane = 0;
192      m_shifter_bitplane = 0;
132193
133      state->shifter_rr[0] = state->shifter_ir[0];
134      state->shifter_rr[1] = state->shifter_ir[1];
135      state->shifter_rr[2] = state->shifter_ir[2];
136      state->shifter_rr[3] = state->shifter_ir[3];
194      m_shifter_rr[0] = m_shifter_ir[0];
195      m_shifter_rr[1] = m_shifter_ir[1];
196      m_shifter_rr[2] = m_shifter_ir[2];
197      m_shifter_rr[3] = m_shifter_ir[3];
137198   }
138199}
139200
140static TIMER_CALLBACK( atarist_glue_tick )
201
202//-------------------------------------------------
203//  glue_tick -
204//-------------------------------------------------
205
206void st_state::glue_tick()
141207{
142   atarist_state *state = machine->driver_data<atarist_state>();
143
144208   int y = machine->primary_screen->vpos();
145209   int x = machine->primary_screen->hpos();
146210
147   int v = (y >= state->shifter_y_start) && (y < state->shifter_y_end);
148   int h = (x >= state->shifter_x_start) && (x < state->shifter_x_end);
211   int v = (y >= m_shifter_y_start) && (y < m_shifter_y_end);
212   int h = (x >= m_shifter_x_start) && (x < m_shifter_x_end);
149213
150214   int de = h && v;
151215
152   if (de != state->shifter_de)
216   if (de != m_shifter_de)
153217   {
154      mc68901_tbi_w(state->mc68901, de);
155      state->shifter_de = de;
218      m_mfp->tbi_w(de);
219      m_shifter_de = de;
156220   }
157221
158222   if (de)
159223   {
160      atarist_shifter_load(machine);
224      shifter_load();
161225   }
162226
163   if ((y == state->shifter_vblank_start) && (x == 0))
227   if ((y == m_shifter_vblank_start) && (x == 0))
164228   {
165      cputag_set_input_line(machine, M68000_TAG, M68K_IRQ_4, HOLD_LINE);
166      state->shifter_ofs = state->shifter_base;
229      cpu_set_input_line(m_maincpu, M68K_IRQ_4, HOLD_LINE);
230      m_shifter_ofs = m_shifter_base;
167231   }
168232
169   if (x == state->shifter_hblank_start)
233   if (x == m_shifter_hblank_start)
170234   {
171      cputag_set_input_line(machine, M68000_TAG, M68K_IRQ_2, HOLD_LINE);
172      state->shifter_ofs += (state->shifter_lineofs * 2); // STe
235      cpu_set_input_line(m_maincpu, M68K_IRQ_2, HOLD_LINE);
236//      m_shifter_ofs += (m_shifter_lineofs * 2); // STe
173237   }
174238}
175239
176static void atarist_set_screen_parameters(running_machine *machine)
240
241//-------------------------------------------------
242//  TIMER_CALLBACK( atarist_glue_tick )
243//-------------------------------------------------
244
245static TIMER_CALLBACK( atarist_glue_tick )
177246{
178   atarist_state *state = machine->driver_data<atarist_state>();
247   st_state *state = machine->driver_data<st_state>();
179248
180   if (state->shifter_sync & 0x02)
249   state->glue_tick();
250}
251
252
253//-------------------------------------------------
254//  set_screen_parameters -
255//-------------------------------------------------
256
257void st_state::set_screen_parameters()
258{
259   if (m_shifter_sync & 0x02)
181260   {
182      state->shifter_x_start = ATARIST_HBDEND_PAL;
183      state->shifter_x_end = ATARIST_HBDSTART_PAL;
184      state->shifter_y_start = ATARIST_VBDEND_PAL;
185      state->shifter_y_end = ATARIST_VBDSTART_PAL;
186      state->shifter_hblank_start = ATARIST_HBSTART_PAL;
187      state->shifter_vblank_start = ATARIST_VBSTART_PAL;
261      m_shifter_x_start = ATARIST_HBDEND_PAL;
262      m_shifter_x_end = ATARIST_HBDSTART_PAL;
263      m_shifter_y_start = ATARIST_VBDEND_PAL;
264      m_shifter_y_end = ATARIST_VBDSTART_PAL;
265      m_shifter_hblank_start = ATARIST_HBSTART_PAL;
266      m_shifter_vblank_start = ATARIST_VBSTART_PAL;
188267   }
189268   else
190269   {
191      state->shifter_x_start = ATARIST_HBDEND_NTSC;
192      state->shifter_x_end = ATARIST_HBDSTART_NTSC;
193      state->shifter_y_start = ATARIST_VBDEND_NTSC;
194      state->shifter_y_end = ATARIST_VBDSTART_NTSC;
195      state->shifter_hblank_start = ATARIST_HBSTART_NTSC;
196      state->shifter_vblank_start = ATARIST_VBSTART_NTSC;
270      m_shifter_x_start = ATARIST_HBDEND_NTSC;
271      m_shifter_x_end = ATARIST_HBDSTART_NTSC;
272      m_shifter_y_start = ATARIST_VBDEND_NTSC;
273      m_shifter_y_end = ATARIST_VBDSTART_NTSC;
274      m_shifter_hblank_start = ATARIST_HBSTART_NTSC;
275      m_shifter_vblank_start = ATARIST_VBSTART_NTSC;
197276   }
198277}
199278
200/* Atari ST Shifter */
201279
202READ16_HANDLER( atarist_shifter_base_r )
280//-------------------------------------------------
281//  shifter_base_r -
282//-------------------------------------------------
283
284READ8_MEMBER( st_state::shifter_base_r )
203285{
204   atarist_state *state = space->machine->driver_data<atarist_state>();
286   UINT8 data = 0;
205287
206288   switch (offset)
207289   {
208290   case 0x00:
209      return (state->shifter_base >> 16) & 0x3f;
291      data = (m_shifter_base >> 16) & 0x3f;
292      break;
293
210294   case 0x01:
211      return (state->shifter_base >> 8) & 0xff;
295      data = (m_shifter_base >> 8) & 0xff;
296      break;
212297   }
213298
214   return 0;
299   return data;
215300}
216301
217WRITE16_HANDLER( atarist_shifter_base_w )
302
303//-------------------------------------------------
304//  shifter_base_w -
305//-------------------------------------------------
306
307WRITE8_MEMBER( st_state::shifter_base_w )
218308{
219   atarist_state *state = space->machine->driver_data<atarist_state>();
220
221309   switch (offset)
222310   {
223311   case 0x00:
224      state->shifter_base = (state->shifter_base & 0x00ff00) | (data & 0x3f) << 16;
225      logerror("SHIFTER Video Base Address %06x\n", state->shifter_base);
312      m_shifter_base = (m_shifter_base & 0x00ff00) | (data & 0x3f) << 16;
313      logerror("SHIFTER Video Base Address %06x\n", m_shifter_base);
226314      break;
315
227316   case 0x01:
228      state->shifter_base = (state->shifter_base & 0x3f0000) | (data & 0xff) << 8;
229      logerror("SHIFTER Video Base Address %06x\n", state->shifter_base);
317      m_shifter_base = (m_shifter_base & 0x3f0000) | (data << 8);
318      logerror("SHIFTER Video Base Address %06x\n", m_shifter_base);
230319      break;
231320   }
232321}
233322
234READ16_HANDLER( atarist_shifter_counter_r )
323
324//-------------------------------------------------
325//  shifter_counter_r -
326//-------------------------------------------------
327
328READ8_MEMBER( st_state::shifter_counter_r )
235329{
236   atarist_state *state = space->machine->driver_data<atarist_state>();
330   UINT8 data = 0;
237331
238332   switch (offset)
239333   {
240334   case 0x00:
241      return (state->shifter_ofs >> 16) & 0x3f;
335      data = (m_shifter_ofs >> 16) & 0x3f;
336      break;
337
242338   case 0x01:
243      return (state->shifter_ofs >> 8) & 0xff;
339      data = (m_shifter_ofs >> 8) & 0xff;
340      break;
341
244342   case 0x02:
245      return state->shifter_ofs & 0xff;
343      data = m_shifter_ofs & 0xff;
344      break;
246345   }
247346
248   return 0;
347   return data;
249348}
250349
251READ8_HANDLER( atarist_shifter_sync_r )
350
351//-------------------------------------------------
352//  shifter_sync_r -
353//-------------------------------------------------
354
355READ8_MEMBER( st_state::shifter_sync_r )
252356{
253   atarist_state *state = space->machine->driver_data<atarist_state>();
254
255   return state->shifter_sync;
357   return m_shifter_sync;
256358}
257359
258WRITE8_HANDLER( atarist_shifter_sync_w )
360
361//-------------------------------------------------
362//  shifter_sync_w -
363//-------------------------------------------------
364
365WRITE8_MEMBER( st_state::shifter_sync_w )
259366{
260   atarist_state *state = space->machine->driver_data<atarist_state>();
261
262   state->shifter_sync = data;
263   logerror("SHIFTER Sync %x\n", state->shifter_sync);
264   atarist_set_screen_parameters(space->machine);
367   m_shifter_sync = data;
368   logerror("SHIFTER Sync %x\n", m_shifter_sync);
369   set_screen_parameters();
265370}
266371
267READ8_HANDLER( atarist_shifter_mode_r )
372
373//-------------------------------------------------
374//  shifter_mode_r -
375//-------------------------------------------------
376
377READ8_MEMBER( st_state::shifter_mode_r )
268378{
269   atarist_state *state = space->machine->driver_data<atarist_state>();
270
271   return state->shifter_mode;
379   return m_shifter_mode;
272380}
273381
274WRITE8_HANDLER( atarist_shifter_mode_w )
382
383//-------------------------------------------------
384//  shifter_mode_w -
385//-------------------------------------------------
386
387WRITE8_MEMBER( st_state::shifter_mode_w )
275388{
276   atarist_state *state = space->machine->driver_data<atarist_state>();
277
278   state->shifter_mode = data;
279   logerror("SHIFTER Mode %x\n", state->shifter_mode);
389   m_shifter_mode = data;
390   logerror("SHIFTER Mode %x\n", m_shifter_mode);
280391}
281392
282READ16_HANDLER( atarist_shifter_palette_r )
393
394//-------------------------------------------------
395//  shifter_palette_r -
396//-------------------------------------------------
397
398READ16_MEMBER( st_state::shifter_palette_r )
283399{
284   atarist_state *state = space->machine->driver_data<atarist_state>();
285
286   return state->shifter_palette[offset];
400   return m_shifter_palette[offset];
287401}
288402
289WRITE16_HANDLER( atarist_shifter_palette_w )
403
404//-------------------------------------------------
405//  shifter_palette_w -
406//-------------------------------------------------
407
408WRITE16_MEMBER( st_state::shifter_palette_w )
290409{
291   atarist_state *state = space->machine->driver_data<atarist_state>();
292
293   state->shifter_palette[offset] = data;
410   m_shifter_palette[offset] = data;
294411   logerror("SHIFTER Palette[%x] = %x\n", offset, data);
295412
296   palette_set_color_rgb(space->machine, offset, pal3bit(data >> 8), pal3bit(data >> 4), pal3bit(data));
413   palette_set_color_rgb(machine, offset, pal3bit(data >> 8), pal3bit(data >> 4), pal3bit(data));
297414}
298415
299/* Atari STe Shifter */
300416
301READ16_HANDLER( atariste_shifter_base_low_r )
417
418//**************************************************************************
419//   STE SHIFTER
420//**************************************************************************
421
422//-------------------------------------------------
423//  shifter_base_low_r -
424//-------------------------------------------------
425
426READ16_MEMBER( ste_state::shifter_base_low_r )
302427{
303   atarist_state *state = space->machine->driver_data<atarist_state>();
304
305   return state->shifter_base & 0xfe;
428   return m_shifter_base & 0xfe;
306429}
307430
308WRITE16_HANDLER( atariste_shifter_base_low_w )
431
432//-------------------------------------------------
433//  shifter_base_low_w -
434//-------------------------------------------------
435
436WRITE16_MEMBER( ste_state::shifter_base_low_w )
309437{
310   atarist_state *state = space->machine->driver_data<atarist_state>();
311
312   state->shifter_base = (state->shifter_base & 0x3fff00) | (data & 0xfe);
313   logerror("SHIFTER Video Base Address %06x\n", state->shifter_base);
438   m_shifter_base = (m_shifter_base & 0x3fff00) | (data & 0xfe);
439   logerror("SHIFTER Video Base Address %06x\n", m_shifter_base);
314440}
315441
316READ16_HANDLER( atariste_shifter_counter_r )
442
443//-------------------------------------------------
444//  shifter_counter_r -
445//-------------------------------------------------
446
447READ16_MEMBER( ste_state::shifter_counter_r )
317448{
318   atarist_state *state = space->machine->driver_data<atarist_state>();
449   UINT16 data = 0;
319450
320451   switch (offset)
321452   {
322453   case 0x00:
323      return (state->shifter_ofs >> 16) & 0x3f;
454      data = (m_shifter_ofs >> 16) & 0x3f;
455      break;
456
324457   case 0x01:
325      return (state->shifter_ofs >> 8) & 0xff;
458      data = (m_shifter_ofs >> 8) & 0xff;
459      break;
460
326461   case 0x02:
327      return state->shifter_ofs & 0xfe;
462      data = m_shifter_ofs & 0xfe;
463      break;
328464   }
329465
330   return 0;
466   return data;
331467}
332468
333WRITE16_HANDLER( atariste_shifter_counter_w )
469
470//-------------------------------------------------
471//  shifter_counter_w -
472//-------------------------------------------------
473
474WRITE16_MEMBER( ste_state::shifter_counter_w )
334475{
335   atarist_state *state = space->machine->driver_data<atarist_state>();
336
337476   switch (offset)
338477   {
339478   case 0x00:
340      state->shifter_ofs = (state->shifter_ofs & 0x00fffe) | (data & 0x3f) << 16;
341      logerror("SHIFTER Video Address Counter %06x\n", state->shifter_ofs);
479      m_shifter_ofs = (m_shifter_ofs & 0x00fffe) | (data & 0x3f) << 16;
480      logerror("SHIFTER Video Address Counter %06x\n", m_shifter_ofs);
342481      break;
482
343483   case 0x01:
344      state->shifter_ofs = (state->shifter_ofs & 0x3f00fe) | (data & 0xff) << 8;
345      logerror("SHIFTER Video Address Counter %06x\n", state->shifter_ofs);
484      m_shifter_ofs = (m_shifter_ofs & 0x3f00fe) | (data & 0xff) << 8;
485      logerror("SHIFTER Video Address Counter %06x\n", m_shifter_ofs);
346486      break;
487
347488   case 0x02:
348      state->shifter_ofs = (state->shifter_ofs & 0x3fff00) | (data & 0xfe);
349      logerror("SHIFTER Video Address Counter %06x\n", state->shifter_ofs);
489      m_shifter_ofs = (m_shifter_ofs & 0x3fff00) | (data & 0xfe);
490      logerror("SHIFTER Video Address Counter %06x\n", m_shifter_ofs);
350491      break;
351492   }
352493}
353494
354WRITE16_HANDLER( atariste_shifter_palette_w )
495
496//-------------------------------------------------
497//  shifter_palette_w -
498//-------------------------------------------------
499
500WRITE16_MEMBER( ste_state::shifter_palette_w )
355501{
356   atarist_state *state = space->machine->driver_data<atarist_state>();
357
358502   int r = ((data >> 7) & 0x0e) | BIT(data, 11);
359503   int g = ((data >> 3) & 0x0e) | BIT(data, 7);
360504   int b = ((data << 1) & 0x0e) | BIT(data, 3);
361505
362   state->shifter_palette[offset] = data;
506   m_shifter_palette[offset] = data;
363507   logerror("SHIFTER palette %x = %x\n", offset, data);
364508
365   palette_set_color_rgb(space->machine, offset, r, g, b);
509   palette_set_color_rgb(machine, offset, r, g, b);
366510}
367511
368READ16_HANDLER( atariste_shifter_lineofs_r )
369{
370   atarist_state *state = space->machine->driver_data<atarist_state>();
371512
372   return state->shifter_lineofs;
373}
513//-------------------------------------------------
514//  shifter_lineofs_r -
515//-------------------------------------------------
374516
375WRITE16_HANDLER( atariste_shifter_lineofs_w )
517READ16_MEMBER( ste_state::shifter_lineofs_r )
376518{
377   atarist_state *state = space->machine->driver_data<atarist_state>();
378
379   state->shifter_lineofs = data & 0xff;
380   logerror("SHIFTER Line Offset %x\n", state->shifter_lineofs);
519   return m_shifter_lineofs;
381520}
382521
383READ16_HANDLER( atariste_shifter_pixelofs_r )
522
523//-------------------------------------------------
524//  shifter_lineofs_w -
525//-------------------------------------------------
526
527WRITE16_MEMBER( ste_state::shifter_lineofs_w )
384528{
385   atarist_state *state = space->machine->driver_data<atarist_state>();
386
387   return state->shifter_pixelofs;
529   m_shifter_lineofs = data & 0xff;
530   logerror("SHIFTER Line Offset %x\n", m_shifter_lineofs);
388531}
389532
390WRITE16_HANDLER( atariste_shifter_pixelofs_w )
533
534//-------------------------------------------------
535//  shifter_pixelofs_r -
536//-------------------------------------------------
537
538READ16_MEMBER( ste_state::shifter_pixelofs_r )
391539{
392   atarist_state *state = space->machine->driver_data<atarist_state>();
393
394   state->shifter_pixelofs = data & 0x0f;
395   logerror("SHIFTER Pixel Offset %x\n", state->shifter_pixelofs);
540   return m_shifter_pixelofs;
396541}
397542
398/* Atari ST Blitter */
399543
400static const int BLITTER_NOPS[16][4] =
544//-------------------------------------------------
545//  shifter_pixelofs_w -
546//-------------------------------------------------
547
548WRITE16_MEMBER( ste_state::shifter_pixelofs_w )
401549{
402   { 1, 1, 1, 1 },
403   { 2, 2, 3, 3 },
404   { 2, 2, 3, 3 },
405   { 1, 1, 2, 2 },
406   { 2, 2, 3, 3 },
407   { 2, 2, 2, 2 },
408   { 2, 2, 3, 3 },
409   { 2, 2, 3, 3 },
410   { 2, 2, 3, 3 },
411   { 2, 2, 3, 3 },
412   { 2, 2, 2, 2 },
413   { 2, 2, 3, 3 },
414   { 1, 1, 2, 2 },
415   { 2, 2, 3, 3 },
416   { 2, 2, 3, 3 },
417   { 1, 1, 1, 1 }
418};
550   m_shifter_pixelofs = data & 0x0f;
551   logerror("SHIFTER Pixel Offset %x\n", m_shifter_pixelofs);
552}
419553
420static void atarist_blitter_source(running_machine *machine)
554
555
556//**************************************************************************
557//   BLITTER
558//**************************************************************************
559
560//-------------------------------------------------
561//  blitter_source -
562//-------------------------------------------------
563
564void st_state::blitter_source()
421565{
422   atarist_state *state = machine->driver_data<atarist_state>();
566   address_space *program = cpu_get_address_space(m_maincpu, ADDRESS_SPACE_PROGRAM);
567   UINT16 data = program->read_word(m_blitter_src);
423568
424   address_space *program = cputag_get_address_space(machine, M68000_TAG, ADDRESS_SPACE_PROGRAM);
425   UINT16 data = program->read_word(state->blitter_src);
426
427   if (state->blitter_src_inc_x < 0)
569   if (m_blitter_src_inc_x < 0)
428570   {
429      state->blitter_srcbuf = (data << 16) | (state->blitter_srcbuf >> 16);
571      m_blitter_srcbuf = (data << 16) | (m_blitter_srcbuf >> 16);
430572   }
431573   else
432574   {
433      state->blitter_srcbuf = (state->blitter_srcbuf << 16) | data;
575      m_blitter_srcbuf = (m_blitter_srcbuf << 16) | data;
434576   }
435577}
436578
437static UINT16 atarist_blitter_hop(running_machine *machine)
579
580//-------------------------------------------------
581//  blitter_hop -
582//-------------------------------------------------
583
584UINT16 st_state::blitter_hop()
438585{
439   atarist_state *state = machine->driver_data<atarist_state>();
586   UINT16 source = m_blitter_srcbuf >> (m_blitter_skew & 0x0f);
587   UINT16 halftone = m_blitter_halftone[m_blitter_ctrl & 0x0f];
440588
441   UINT16 source = state->blitter_srcbuf >> (state->blitter_skew & 0x0f);
442   UINT16 halftone = state->blitter_halftone[state->blitter_ctrl & 0x0f];
443
444   if (state->blitter_ctrl & ATARIST_BLITTER_CTRL_SMUDGE)
589   if (m_blitter_ctrl & ATARIST_BLITTER_CTRL_SMUDGE)
445590   {
446      halftone = state->blitter_halftone[source & 0x0f];
591      halftone = m_blitter_halftone[source & 0x0f];
447592   }
448593
449   switch (state->blitter_hop)
594   switch (m_blitter_hop)
450595   {
451596   case 0:
452597      return 0xffff;
r9971r9972
461606   return 0;
462607}
463608
464static void atarist_blitter_op(running_machine *machine, UINT16 s, UINT32 dstaddr, UINT16 mask)
609
610//-------------------------------------------------
611//  blitter_op -
612//-------------------------------------------------
613
614void st_state::blitter_op(UINT16 s, UINT32 dstaddr, UINT16 mask)
465615{
466   atarist_state *state = machine->driver_data<atarist_state>();
467   address_space *program = cputag_get_address_space(machine, M68000_TAG, ADDRESS_SPACE_PROGRAM);
616   address_space *program = cpu_get_address_space(m_maincpu, ADDRESS_SPACE_PROGRAM);
468617
469618   UINT16 d = program->read_word(dstaddr);
470619   UINT16 result = 0;
471620
472   if (state->blitter_op & 0x08) result = (~s & ~d);
473   if (state->blitter_op & 0x04) result |= (~s & d);
474   if (state->blitter_op & 0x02) result |= (s & ~d);
475   if (state->blitter_op & 0x01) result |= (s & d);
621   if (m_blitter_op & 0x08) result = (~s & ~d);
622   if (m_blitter_op & 0x04) result |= (~s & d);
623   if (m_blitter_op & 0x02) result |= (s & ~d);
624   if (m_blitter_op & 0x01) result |= (s & d);
476625
477626   program->write_word(dstaddr, result);
478627}
479628
480static TIMER_CALLBACK( atarist_blitter_tick )
629
630//-------------------------------------------------
631//  blitter_tick -
632//-------------------------------------------------
633
634void st_state::blitter_tick()
481635{
482   atarist_state *state = machine->driver_data<atarist_state>();
483
484636   do
485637   {
486      if (state->blitter_skew & ATARIST_BLITTER_SKEW_FXSR)
638      if (m_blitter_skew & ATARIST_BLITTER_SKEW_FXSR)
487639      {
488         atarist_blitter_source(machine);
489         state->blitter_src += state->blitter_src_inc_x;
640         blitter_source();
641         m_blitter_src += m_blitter_src_inc_x;
490642      }
491643
492      atarist_blitter_source(machine);
493      atarist_blitter_op(machine, atarist_blitter_hop(machine), state->blitter_dst, state->blitter_endmask1);
494      state->blitter_xcount--;
644      blitter_source();
645      blitter_op(blitter_hop(), m_blitter_dst, m_blitter_endmask1);
646      m_blitter_xcount--;
495647
496      while (state->blitter_xcount > 0)
648      while (m_blitter_xcount > 0)
497649      {
498         state->blitter_src += state->blitter_src_inc_x;
499         state->blitter_dst += state->blitter_dst_inc_x;
650         m_blitter_src += m_blitter_src_inc_x;
651         m_blitter_dst += m_blitter_dst_inc_x;
500652
501         if (state->blitter_xcount == 1)
653         if (m_blitter_xcount == 1)
502654         {
503            if (!(state->blitter_skew & ATARIST_BLITTER_SKEW_NFSR))
655            if (!(m_blitter_skew & ATARIST_BLITTER_SKEW_NFSR))
504656            {
505               atarist_blitter_source(machine);
657               blitter_source();
506658            }
507659
508            atarist_blitter_op(machine, atarist_blitter_hop(machine), state->blitter_dst, state->blitter_endmask3);
660            blitter_op(blitter_hop(), m_blitter_dst, m_blitter_endmask3);
509661         }
510662         else
511663         {
512            atarist_blitter_source(machine);
513            atarist_blitter_op(machine, atarist_blitter_hop(machine), state->blitter_dst, state->blitter_endmask2);
664            blitter_source();
665            blitter_op(blitter_hop(), m_blitter_dst, m_blitter_endmask2);
514666         }
515667
516         state->blitter_xcount--;
668         m_blitter_xcount--;
517669      }
518670
519      state->blitter_src += state->blitter_src_inc_y;
520      state->blitter_dst += state->blitter_dst_inc_y;
671      m_blitter_src += m_blitter_src_inc_y;
672      m_blitter_dst += m_blitter_dst_inc_y;
521673
522      if (state->blitter_dst_inc_y < 0)
674      if (m_blitter_dst_inc_y < 0)
523675      {
524         state->blitter_ctrl = (state->blitter_ctrl & 0xf0) | (((state->blitter_ctrl & 0x0f) - 1) & 0x0f);
676         m_blitter_ctrl = (m_blitter_ctrl & 0xf0) | (((m_blitter_ctrl & 0x0f) - 1) & 0x0f);
525677      }
526678      else
527679      {
528         state->blitter_ctrl = (state->blitter_ctrl & 0xf0) | (((state->blitter_ctrl & 0x0f) + 1) & 0x0f);
680         m_blitter_ctrl = (m_blitter_ctrl & 0xf0) | (((m_blitter_ctrl & 0x0f) + 1) & 0x0f);
529681      }
530682
531      state->blitter_xcount = state->blitter_xcountl;
532      state->blitter_ycount--;
683      m_blitter_xcount = m_blitter_xcountl;
684      m_blitter_ycount--;
533685   }
534   while (state->blitter_ycount > 0);
686   while (m_blitter_ycount > 0);
535687
536   state->blitter_ctrl &= 0x7f;
688   m_blitter_ctrl &= 0x7f;
689
690   m_blitter_done = 0;
691   m_mfp->i3_w(m_blitter_done);
537692}
538693
539READ16_HANDLER( atarist_blitter_halftone_r )
694
695//-------------------------------------------------
696//  TIMER_CALLBACK( atarist_blitter_tick )
697//-------------------------------------------------
698
699static TIMER_CALLBACK( atarist_blitter_tick )
540700{
541   atarist_state *state = space->machine->driver_data<atarist_state>();
701   st_state *state = machine->driver_data<st_state>();
702   
703   state->blitter_tick();
704}
542705
543   return state->blitter_halftone[offset];
706
707//-------------------------------------------------
708//  blitter_halftone_r -
709//-------------------------------------------------
710
711READ16_MEMBER( st_state::blitter_halftone_r )
712{
713   return m_blitter_halftone[offset];
544714}
545715
546READ16_HANDLER( atarist_blitter_src_inc_x_r )
716
717//-------------------------------------------------
718//  blitter_src_inc_x_r -
719//-------------------------------------------------
720
721READ16_MEMBER( st_state::blitter_src_inc_x_r )
547722{
548   atarist_state *state = space->machine->driver_data<atarist_state>();
549
550   return state->blitter_src_inc_x;
723   return m_blitter_src_inc_x;
551724}
552725
553READ16_HANDLER( atarist_blitter_src_inc_y_r )
726
727//-------------------------------------------------
728//  blitter_src_inc_y_r -
729//-------------------------------------------------
730
731READ16_MEMBER( st_state::blitter_src_inc_y_r )
554732{
555   atarist_state *state = space->machine->driver_data<atarist_state>();
556
557   return state->blitter_src_inc_y;
733   return m_blitter_src_inc_y;
558734}
559735
560READ16_HANDLER( atarist_blitter_src_r )
736
737//-------------------------------------------------
738//  blitter_src_r -
739//-------------------------------------------------
740
741READ16_MEMBER( st_state::blitter_src_r )
561742{
562   atarist_state *state = space->machine->driver_data<atarist_state>();
563
564743   switch (offset)
565744   {
566745   case 0:
567      return (state->blitter_src >> 16) & 0xff;
746      return (m_blitter_src >> 16) & 0xff;
568747   case 1:
569      return state->blitter_src & 0xfffe;
748      return m_blitter_src & 0xfffe;
570749   }
571750
572751   return 0;
573752}
574753
575READ16_HANDLER( atarist_blitter_end_mask_r )
754
755//-------------------------------------------------
756//  blitter_end_mask_r -
757//-------------------------------------------------
758
759READ16_MEMBER( st_state::blitter_end_mask_r )
576760{
577   atarist_state *state = space->machine->driver_data<atarist_state>();
578
579761   switch (offset)
580762   {
581763   case 0:
582      return state->blitter_endmask1;
764      return m_blitter_endmask1;
583765   case 1:
584      return state->blitter_endmask2;
766      return m_blitter_endmask2;
585767   case 2:
586      return state->blitter_endmask3;
768      return m_blitter_endmask3;
587769   }
588770
589771   return 0;
590772}
591773
592READ16_HANDLER( atarist_blitter_dst_inc_x_r )
774
775//-------------------------------------------------
776//  blitter_dst_inc_x_r -
777//-------------------------------------------------
778
779READ16_MEMBER( st_state::blitter_dst_inc_x_r )
593780{
594   atarist_state *state = space->machine->driver_data<atarist_state>();
595
596   return state->blitter_dst_inc_x;
781   return m_blitter_dst_inc_x;
597782}
598783
599READ16_HANDLER( atarist_blitter_dst_inc_y_r )
784
785//-------------------------------------------------
786//  blitter_dst_inc_y_r -
787//-------------------------------------------------
788
789READ16_MEMBER( st_state::blitter_dst_inc_y_r )
600790{
601   atarist_state *state = space->machine->driver_data<atarist_state>();
602
603   return state->blitter_dst_inc_y;
791   return m_blitter_dst_inc_y;
604792}
605793
606READ16_HANDLER( atarist_blitter_dst_r )
794
795//-------------------------------------------------
796//  blitter_dst_r -
797//-------------------------------------------------
798
799READ16_MEMBER( st_state::blitter_dst_r )
607800{
608   atarist_state *state = space->machine->driver_data<atarist_state>();
609
610801   switch (offset)
611802   {
612803   case 0:
613      return (state->blitter_dst >> 16) & 0xff;
804      return (m_blitter_dst >> 16) & 0xff;
614805   case 1:
615      return state->blitter_dst & 0xfffe;
806      return m_blitter_dst & 0xfffe;
616807   }
617808
618809   return 0;
619810}
620811
621READ16_HANDLER( atarist_blitter_count_x_r )
812
813//-------------------------------------------------
814//  blitter_count_x_r -
815//-------------------------------------------------
816
817READ16_MEMBER( st_state::blitter_count_x_r )
622818{
623   atarist_state *state = space->machine->driver_data<atarist_state>();
624
625   return state->blitter_xcount;
819   return m_blitter_xcount;
626820}
627821
628READ16_HANDLER( atarist_blitter_count_y_r )
822
823//-------------------------------------------------
824//  blitter_count_y_r -
825//-------------------------------------------------
826
827READ16_MEMBER( st_state::blitter_count_y_r )
629828{
630   atarist_state *state = space->machine->driver_data<atarist_state>();
631
632   return state->blitter_ycount;
829   return m_blitter_ycount;
633830}
634831
635READ16_HANDLER( atarist_blitter_op_r )
832
833//-------------------------------------------------
834//  blitter_op_r -
835//-------------------------------------------------
836
837READ16_MEMBER( st_state::blitter_op_r )
636838{
637   atarist_state *state = space->machine->driver_data<atarist_state>();
638
639839   if (ACCESSING_BITS_0_7)
640840   {
641      return state->blitter_hop;
841      return m_blitter_hop;
642842   }
643843   else
644844   {
645      return state->blitter_op;
845      return m_blitter_op;
646846   }
647847}
648848
649READ16_HANDLER( atarist_blitter_ctrl_r )
849
850//-------------------------------------------------
851//  blitter_ctrl_r -
852//-------------------------------------------------
853
854READ16_MEMBER( st_state::blitter_ctrl_r )
650855{
651   atarist_state *state = space->machine->driver_data<atarist_state>();
652
653856   if (ACCESSING_BITS_0_7)
654857   {
655      return state->blitter_ctrl;
858      return m_blitter_ctrl;
656859   }
657860   else
658861   {
659      return state->blitter_skew;
862      return m_blitter_skew;
660863   }
661864}
662865
663WRITE16_HANDLER( atarist_blitter_halftone_w )
866
867//-------------------------------------------------
868//  blitter_halftone_w -
869//-------------------------------------------------
870
871WRITE16_MEMBER( st_state::blitter_halftone_w )
664872{
665   atarist_state *state = space->machine->driver_data<atarist_state>();
666
667   state->blitter_halftone[offset] = data;
873   m_blitter_halftone[offset] = data;
668874}
669875
670WRITE16_HANDLER( atarist_blitter_src_inc_x_w )
876
877//-------------------------------------------------
878//  blitter_src_inc_x_w -
879//-------------------------------------------------
880
881WRITE16_MEMBER( st_state::blitter_src_inc_x_w )
671882{
672   atarist_state *state = space->machine->driver_data<atarist_state>();
673
674   state->blitter_src_inc_x = data & 0xfffe;
883   m_blitter_src_inc_x = data & 0xfffe;
675884}
676885
677WRITE16_HANDLER( atarist_blitter_src_inc_y_w )
886
887//-------------------------------------------------
888//  blitter_src_inc_y_w -
889//-------------------------------------------------
890
891WRITE16_MEMBER( st_state::blitter_src_inc_y_w )
678892{
679   atarist_state *state = space->machine->driver_data<atarist_state>();
680
681   state->blitter_src_inc_y = data & 0xfffe;
893   m_blitter_src_inc_y = data & 0xfffe;
682894}
683895
684WRITE16_HANDLER( atarist_blitter_src_w )
896
897//-------------------------------------------------
898//  blitter_src_w -
899//-------------------------------------------------
900
901WRITE16_MEMBER( st_state::blitter_src_w )
685902{
686   atarist_state *state = space->machine->driver_data<atarist_state>();
687
688903   switch (offset)
689904   {
690905   case 0:
691      state->blitter_src = (data & 0xff) | (state->blitter_src & 0xfffe);
906      m_blitter_src = (data & 0xff) | (m_blitter_src & 0xfffe);
692907   case 1:
693      state->blitter_src = (state->blitter_src & 0xff0000) | (data & 0xfffe);
908      m_blitter_src = (m_blitter_src & 0xff0000) | (data & 0xfffe);
694909   }
695910}
696911
697WRITE16_HANDLER( atarist_blitter_end_mask_w )
912
913//-------------------------------------------------
914//  blitter_end_mask_w -
915//-------------------------------------------------
916
917WRITE16_MEMBER( st_state::blitter_end_mask_w )
698918{
699   atarist_state *state = space->machine->driver_data<atarist_state>();
700
701919   switch (offset)
702920   {
703921   case 0:
704      state->blitter_endmask1 = data;
922      m_blitter_endmask1 = data;
705923   case 1:
706      state->blitter_endmask2 = data;
924      m_blitter_endmask2 = data;
707925   case 2:
708      state->blitter_endmask3 = data;
926      m_blitter_endmask3 = data;
709927   }
710928}
711929
712WRITE16_HANDLER( atarist_blitter_dst_inc_x_w )
930
931//-------------------------------------------------
932//  blitter_dst_inc_x_w -
933//-------------------------------------------------
934
935WRITE16_MEMBER( st_state::blitter_dst_inc_x_w )
713936{
714   atarist_state *state = space->machine->driver_data<atarist_state>();
715
716   state->blitter_dst_inc_x = data & 0xfffe;
937   m_blitter_dst_inc_x = data & 0xfffe;
717938}
718939
719WRITE16_HANDLER( atarist_blitter_dst_inc_y_w )
940
941//-------------------------------------------------
942//  blitter_dst_inc_y_w -
943//-------------------------------------------------
944
945WRITE16_MEMBER( st_state::blitter_dst_inc_y_w )
720946{
721   atarist_state *state = space->machine->driver_data<atarist_state>();
722
723   state->blitter_dst_inc_y = data & 0xfffe;
947   m_blitter_dst_inc_y = data & 0xfffe;
724948}
725949
726WRITE16_HANDLER( atarist_blitter_dst_w )
950
951//-------------------------------------------------
952//  blitter_dst_w -
953//-------------------------------------------------
954
955WRITE16_MEMBER( st_state::blitter_dst_w )
727956{
728   atarist_state *state = space->machine->driver_data<atarist_state>();
729
730957   switch (offset)
731958   {
732959   case 0:
733      state->blitter_dst = (data & 0xff) | (state->blitter_dst & 0xfffe);
960      m_blitter_dst = (data & 0xff) | (m_blitter_dst & 0xfffe);
734961   case 1:
735      state->blitter_dst = (state->blitter_dst & 0xff0000) | (data & 0xfffe);
962      m_blitter_dst = (m_blitter_dst & 0xff0000) | (data & 0xfffe);
736963   }
737964}
738965
739WRITE16_HANDLER( atarist_blitter_count_x_w )
966
967//-------------------------------------------------
968//  blitter_count_x_w -
969//-------------------------------------------------
970
971WRITE16_MEMBER( st_state::blitter_count_x_w )
740972{
741   atarist_state *state = space->machine->driver_data<atarist_state>();
742
743   state->blitter_xcount = data;
973   m_blitter_xcount = data;
744974}
745975
746WRITE16_HANDLER( atarist_blitter_count_y_w )
976
977//-------------------------------------------------
978//  blitter_count_y_w -
979//-------------------------------------------------
980
981WRITE16_MEMBER( st_state::blitter_count_y_w )
747982{
748   atarist_state *state = space->machine->driver_data<atarist_state>();
749
750   state->blitter_ycount = data;
983   m_blitter_ycount = data;
751984}
752985
753WRITE16_HANDLER( atarist_blitter_op_w )
986
987//-------------------------------------------------
988//  blitter_op_w -
989//-------------------------------------------------
990
991WRITE16_MEMBER( st_state::blitter_op_w )
754992{
755   atarist_state *state = space->machine->driver_data<atarist_state>();
756
757993   if (ACCESSING_BITS_0_7)
758994   {
759      state->blitter_hop = (data >> 8) & 0x03;
995      m_blitter_hop = (data >> 8) & 0x03;
760996   }
761997   else
762998   {
763      state->blitter_op = data & 0x0f;
999      m_blitter_op = data & 0x0f;
7641000   }
7651001}
7661002
767WRITE16_HANDLER( atarist_blitter_ctrl_w )
1003
1004//-------------------------------------------------
1005//  blitter_ctrl_w -
1006//-------------------------------------------------
1007
1008WRITE16_MEMBER( st_state::blitter_ctrl_w )
7681009{
769   atarist_state *state = space->machine->driver_data<atarist_state>();
770
7711010   if (ACCESSING_BITS_0_7)
7721011   {
773      state->blitter_ctrl = (data >> 8) & 0xef;
1012      m_blitter_ctrl = (data >> 8) & 0xef;
7741013
775      if (!(state->blitter_ctrl & ATARIST_BLITTER_CTRL_BUSY))
1014      if (!(m_blitter_ctrl & ATARIST_BLITTER_CTRL_BUSY))
7761015      {
7771016         if ((data >> 8) & ATARIST_BLITTER_CTRL_BUSY)
7781017         {
779            int nops = BLITTER_NOPS[state->blitter_op][state->blitter_hop]; // each NOP takes 4 cycles
780            timer_set(space->machine, ATTOTIME_IN_HZ((Y2/4)/(4*nops)), NULL, 0, atarist_blitter_tick);
1018            m_blitter_done = 1;
1019            m_mfp->i3_w(m_blitter_done);
1020
1021            int nops = BLITTER_NOPS[m_blitter_op][m_blitter_hop]; // each NOP takes 4 cycles
1022            timer_set(machine, ATTOTIME_IN_HZ((Y2/4)/(4*nops)), NULL, 0, atarist_blitter_tick);
7811023         }
7821024      }
7831025   }
7841026   else
7851027   {
786      state->blitter_skew = data & 0xcf;
1028      m_blitter_skew = data & 0xcf;
7871029   }
7881030}
7891031
790/* Video */
7911032
792VIDEO_START( atarist )
1033
1034//**************************************************************************
1035//   VIDEO
1036//**************************************************************************
1037
1038//-------------------------------------------------
1039//  VIDEO_START( st )
1040//-------------------------------------------------
1041
1042void st_state::video_start()
7931043{
794   atarist_state *state = machine->driver_data<atarist_state>();
1044   m_shifter_timer = timer_alloc(machine, atarist_shifter_tick, NULL);
1045   m_glue_timer = timer_alloc(machine, atarist_glue_tick, NULL);
7951046
796   state->shifter_timer = timer_alloc(machine, atarist_shifter_tick, NULL);
797   state->glue_timer = timer_alloc(machine, atarist_glue_tick, NULL);
1047   timer_adjust_periodic(m_shifter_timer, machine->primary_screen->time_until_pos(0,0), 0, ATTOTIME_IN_HZ(Y2/4)); // 125 ns
1048   timer_adjust_periodic(m_glue_timer, machine->primary_screen->time_until_pos(0,0), 0, ATTOTIME_IN_HZ(Y2/16)); // 500 ns
7981049
799   timer_adjust_periodic(state->shifter_timer, machine->primary_screen->time_until_pos(0,0), 0, ATTOTIME_IN_HZ(Y2/4)); // 125 ns
800   timer_adjust_periodic(state->glue_timer, machine->primary_screen->time_until_pos(0,0), 0, ATTOTIME_IN_HZ(Y2/16)); // 500 ns
801
8021050   /* register for state saving */
803   state_save_register_global(machine, state->shifter_base);
804   state_save_register_global(machine, state->shifter_ofs);
805   state_save_register_global(machine, state->shifter_sync);
806   state_save_register_global(machine, state->shifter_mode);
807   state_save_register_global_array(machine, state->shifter_palette);
808   state_save_register_global(machine, state->shifter_lineofs);
809   state_save_register_global(machine, state->shifter_pixelofs);
810   state_save_register_global_array(machine, state->shifter_rr);
811   state_save_register_global_array(machine, state->shifter_ir);
812   state_save_register_global(machine, state->shifter_bitplane);
813   state_save_register_global(machine, state->shifter_shift);
814   state_save_register_global(machine, state->shifter_h);
815   state_save_register_global(machine, state->shifter_v);
816   state_save_register_global(machine, state->shifter_de);
1051   state_save_register_global(machine, m_shifter_base);
1052   state_save_register_global(machine, m_shifter_ofs);
1053   state_save_register_global(machine, m_shifter_sync);
1054   state_save_register_global(machine, m_shifter_mode);
1055   state_save_register_global_array(machine, m_shifter_palette);
1056   state_save_register_global_array(machine, m_shifter_rr);
1057   state_save_register_global_array(machine, m_shifter_ir);
1058   state_save_register_global(machine, m_shifter_bitplane);
1059   state_save_register_global(machine, m_shifter_shift);
1060   state_save_register_global(machine, m_shifter_h);
1061   state_save_register_global(machine, m_shifter_v);
1062   state_save_register_global(machine, m_shifter_de);
8171063
818   state_save_register_global_array(machine, state->blitter_halftone);
819   state_save_register_global(machine, state->blitter_src_inc_x);
820   state_save_register_global(machine, state->blitter_src_inc_y);
821   state_save_register_global(machine, state->blitter_dst_inc_x);
822   state_save_register_global(machine, state->blitter_dst_inc_y);
823   state_save_register_global(machine, state->blitter_src);
824   state_save_register_global(machine, state->blitter_dst);
825   state_save_register_global(machine, state->blitter_endmask1);
826   state_save_register_global(machine, state->blitter_endmask2);
827   state_save_register_global(machine, state->blitter_endmask3);
828   state_save_register_global(machine, state->blitter_xcount);
829   state_save_register_global(machine, state->blitter_ycount);
830   state_save_register_global(machine, state->blitter_xcountl);
831   state_save_register_global(machine, state->blitter_hop);
832   state_save_register_global(machine, state->blitter_op);
833   state_save_register_global(machine, state->blitter_ctrl);
834   state_save_register_global(machine, state->blitter_skew);
1064   state_save_register_global_array(machine, m_blitter_halftone);
1065   state_save_register_global(machine, m_blitter_src_inc_x);
1066   state_save_register_global(machine, m_blitter_src_inc_y);
1067   state_save_register_global(machine, m_blitter_dst_inc_x);
1068   state_save_register_global(machine, m_blitter_dst_inc_y);
1069   state_save_register_global(machine, m_blitter_src);
1070   state_save_register_global(machine, m_blitter_dst);
1071   state_save_register_global(machine, m_blitter_endmask1);
1072   state_save_register_global(machine, m_blitter_endmask2);
1073   state_save_register_global(machine, m_blitter_endmask3);
1074   state_save_register_global(machine, m_blitter_xcount);
1075   state_save_register_global(machine, m_blitter_ycount);
1076   state_save_register_global(machine, m_blitter_xcountl);
1077   state_save_register_global(machine, m_blitter_hop);
1078   state_save_register_global(machine, m_blitter_op);
1079   state_save_register_global(machine, m_blitter_ctrl);
1080   state_save_register_global(machine, m_blitter_skew);
8351081
836   atarist_set_screen_parameters(machine);
1082   set_screen_parameters();
8371083
8381084   VIDEO_START_CALL(generic_bitmapped);
8391085}
1086
1087
1088//-------------------------------------------------
1089//  VIDEO_START( ste )
1090//-------------------------------------------------
1091
1092void ste_state::video_start()
1093{
1094   st_state::video_start();
1095
1096   // register for state saving
1097   state_save_register_global(machine, m_shifter_lineofs);
1098   state_save_register_global(machine, m_shifter_pixelofs);
1099}
src/mess/video/atarist.h
r9971r9972
3535#define ATARIST_BLITTER_CTRL_HOG   0x40
3636#define ATARIST_BLITTER_CTRL_BUSY   0x80
3737
38/* Atari ST Shifter */
39
40READ16_HANDLER( atarist_shifter_base_r );
41READ16_HANDLER( atarist_shifter_counter_r );
42READ8_HANDLER( atarist_shifter_sync_r );
43READ16_HANDLER( atarist_shifter_palette_r );
44READ8_HANDLER( atarist_shifter_mode_r );
45
46WRITE16_HANDLER( atarist_shifter_base_w );
47WRITE8_HANDLER( atarist_shifter_sync_w );
48WRITE16_HANDLER( atarist_shifter_palette_w );
49WRITE8_HANDLER( atarist_shifter_mode_w );
50
51/* Atari STe Shifter */
52
53READ16_HANDLER( atariste_shifter_base_low_r );
54READ16_HANDLER( atariste_shifter_counter_r );
55READ16_HANDLER( atariste_shifter_lineofs_r );
56READ16_HANDLER( atariste_shifter_pixelofs_r );
57
58WRITE16_HANDLER( atariste_shifter_base_low_w );
59WRITE16_HANDLER( atariste_shifter_counter_w );
60WRITE16_HANDLER( atariste_shifter_lineofs_w );
61WRITE16_HANDLER( atariste_shifter_pixelofs_w );
62WRITE16_HANDLER( atariste_shifter_palette_w );
63
64/* Atari ST Blitter */
65
66READ16_HANDLER( atarist_blitter_halftone_r );
67READ16_HANDLER( atarist_blitter_src_inc_x_r );
68READ16_HANDLER( atarist_blitter_src_inc_y_r );
69READ16_HANDLER( atarist_blitter_src_r );
70READ16_HANDLER( atarist_blitter_end_mask_r );
71READ16_HANDLER( atarist_blitter_dst_inc_x_r );
72READ16_HANDLER( atarist_blitter_dst_inc_y_r );
73READ16_HANDLER( atarist_blitter_dst_r );
74READ16_HANDLER( atarist_blitter_count_x_r );
75READ16_HANDLER( atarist_blitter_count_y_r );
76READ16_HANDLER( atarist_blitter_op_r );
77READ16_HANDLER( atarist_blitter_ctrl_r );
78
79WRITE16_HANDLER( atarist_blitter_halftone_w );
80WRITE16_HANDLER( atarist_blitter_src_inc_x_w );
81WRITE16_HANDLER( atarist_blitter_src_inc_y_w );
82WRITE16_HANDLER( atarist_blitter_src_w );
83WRITE16_HANDLER( atarist_blitter_end_mask_w );
84WRITE16_HANDLER( atarist_blitter_dst_inc_x_w );
85WRITE16_HANDLER( atarist_blitter_dst_inc_y_w );
86WRITE16_HANDLER( atarist_blitter_dst_w );
87WRITE16_HANDLER( atarist_blitter_count_x_w );
88WRITE16_HANDLER( atarist_blitter_count_y_w );
89WRITE16_HANDLER( atarist_blitter_op_w );
90WRITE16_HANDLER( atarist_blitter_ctrl_w );
91
92/* Video */
93
94VIDEO_START( atarist );
95
9638#endif
src/mess/includes/atarist.h
r9971r9972
44#define __ATARI_ST__
55
66#define M68000_TAG      "m68000"
7#define HD6301_TAG      "hd6301"
7#define HD6301V1_TAG   "hd6301"
88#define YM2149_TAG      "ym2149"
99#define MC6850_0_TAG   "mc6850_0"
1010#define MC6850_1_TAG   "mc6850_1"
11#define Z8530_TAG      "z8530"
1112#define COP888_TAG      "u703"
1213#define RP5C15_TAG      "rp5c15"
1314#define YM3439_TAG      "ym3439"
r9971r9972
5051   IKBD_MOUSE_PHASE_NEGATIVE
5152};
5253
53class atarist_state : public driver_device
54class st_state : public driver_device
5455{
5556public:
56   atarist_state(running_machine &machine, const driver_device_config_base &config)
57      : driver_device(machine, config) { }
57   st_state(running_machine &machine, const driver_device_config_base &config)
58      : driver_device(machine, config),
59        m_maincpu(*this, M68000_TAG),
60        m_fdc(*this, WD1772_TAG),
61        m_mfp(*this, MC68901_TAG),
62        m_centronics(*this, CENTRONICS_TAG),
63        m_rs232(*this, RS232_TAG),
64        m_ram(*this, RAM_TAG)
65   { }
5866
67   required_device<cpu_device> m_maincpu;
68   required_device<device_t> m_fdc;
69   required_device<mc68901_device> m_mfp;
70   required_device<device_t> m_centronics;
71   required_device<device_t> m_rs232;
72   required_device<device_t> m_ram;
73   
74   void machine_start();
75
76   void video_start();
77
78   // video
79   DECLARE_READ8_MEMBER( shifter_base_r );
80   DECLARE_READ8_MEMBER( shifter_counter_r );
81   DECLARE_READ8_MEMBER( shifter_sync_r );
82   DECLARE_READ16_MEMBER( shifter_palette_r );
83   DECLARE_READ8_MEMBER( shifter_mode_r );
84
85   DECLARE_WRITE8_MEMBER( shifter_base_w );
86   DECLARE_WRITE8_MEMBER( shifter_sync_w );
87   DECLARE_WRITE16_MEMBER( shifter_palette_w );
88   DECLARE_WRITE8_MEMBER( shifter_mode_w );
89   
90   DECLARE_READ16_MEMBER( blitter_halftone_r );
91   DECLARE_READ16_MEMBER( blitter_src_inc_x_r );
92   DECLARE_READ16_MEMBER( blitter_src_inc_y_r );
93   DECLARE_READ16_MEMBER( blitter_src_r );
94   DECLARE_READ16_MEMBER( blitter_end_mask_r );
95   DECLARE_READ16_MEMBER( blitter_dst_inc_x_r );
96   DECLARE_READ16_MEMBER( blitter_dst_inc_y_r );
97   DECLARE_READ16_MEMBER( blitter_dst_r );
98   DECLARE_READ16_MEMBER( blitter_count_x_r );
99   DECLARE_READ16_MEMBER( blitter_count_y_r );
100   DECLARE_READ16_MEMBER( blitter_op_r );
101   DECLARE_READ16_MEMBER( blitter_ctrl_r );
102
103   DECLARE_WRITE16_MEMBER( blitter_halftone_w );
104   DECLARE_WRITE16_MEMBER( blitter_src_inc_x_w );
105   DECLARE_WRITE16_MEMBER( blitter_src_inc_y_w );
106   DECLARE_WRITE16_MEMBER( blitter_src_w );
107   DECLARE_WRITE16_MEMBER( blitter_end_mask_w );
108   DECLARE_WRITE16_MEMBER( blitter_dst_inc_x_w );
109   DECLARE_WRITE16_MEMBER( blitter_dst_inc_y_w );
110   DECLARE_WRITE16_MEMBER( blitter_dst_w );
111   DECLARE_WRITE16_MEMBER( blitter_count_x_w );
112   DECLARE_WRITE16_MEMBER( blitter_count_y_w );
113   DECLARE_WRITE16_MEMBER( blitter_op_w );
114   DECLARE_WRITE16_MEMBER( blitter_ctrl_w );
115
116   inline pen_t shift_mode_0();
117   inline pen_t shift_mode_1();
118   inline pen_t shift_mode_2();
119   void shifter_tick();
120   inline void shifter_load();
121   void glue_tick();
122   void set_screen_parameters();
123   void blitter_source();
124   UINT16 blitter_hop();
125   void blitter_op(UINT16 s, UINT32 dstaddr, UINT16 mask);
126   void blitter_tick();
127
128   // driver
129   DECLARE_READ16_MEMBER( fdc_data_r );
130   DECLARE_WRITE16_MEMBER( fdc_data_w );
131   DECLARE_READ16_MEMBER( dma_status_r );
132   DECLARE_WRITE16_MEMBER( dma_mode_w );
133   DECLARE_READ8_MEMBER( dma_counter_r );
134   DECLARE_WRITE8_MEMBER( dma_base_w );
135   DECLARE_READ8_MEMBER( mmu_r );
136   DECLARE_WRITE8_MEMBER( mmu_w );
137   DECLARE_READ8_MEMBER( ikbd_port1_r );
138   DECLARE_READ8_MEMBER( ikbd_port2_r );
139   DECLARE_WRITE8_MEMBER( ikbd_port2_w );
140   DECLARE_WRITE8_MEMBER( ikbd_port3_w );
141   DECLARE_READ8_MEMBER( ikbd_port4_r );
142   DECLARE_WRITE8_MEMBER( ikbd_port4_w );
143
144   DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w );
145   DECLARE_WRITE_LINE_MEMBER( fdc_drq_w );
146
147   DECLARE_WRITE8_MEMBER( psg_pa_w );
148
149   DECLARE_READ_LINE_MEMBER( ikbd_rx_r );
150   DECLARE_WRITE_LINE_MEMBER( ikbd_tx_w );
151   DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
152
153   DECLARE_READ8_MEMBER( mfp_gpio_r );
154   DECLARE_WRITE_LINE_MEMBER( mfp_tdo_w );
155   DECLARE_WRITE_LINE_MEMBER( mfp_so_w );
156   
157   void toggle_dma_fifo();
158   void flush_dma_fifo();
159   void fill_dma_fifo();
160   void fdc_dma_transfer();
161
162   void configure_memory();
163   void state_save();
164
59165   /* memory state */
60   UINT8 mmu;
61   UINT16 megaste_cache;
166   UINT8 m_mmu;
167   UINT16 m_megaste_cache;
62168
63169   /* keyboard state */
64   UINT8 ikbd_keylatch;
65   UINT8 ikbd_mouse_x;
66   UINT8 ikbd_mouse_y;
67   UINT8 ikbd_mouse_px;
68   UINT8 ikbd_mouse_py;
69   UINT8 ikbd_mouse_pc;
70   int ikbd_rx;
71   int ikbd_tx;
72   int midi_rx;
73   int midi_tx;
74   int acia_irq;
170   UINT8 m_ikbd_keylatch;
171   UINT8 m_ikbd_mouse_x;
172   UINT8 m_ikbd_mouse_y;
173   UINT8 m_ikbd_mouse_px;
174   UINT8 m_ikbd_mouse_py;
175   UINT8 m_ikbd_mouse_pc;
176   int m_ikbd_rx;
177   int m_ikbd_tx;
178   int m_midi_rx;
179   int m_midi_tx;
180   int m_acia_irq;
75181
76182   /* floppy state */
77   UINT32 fdc_dmabase;
78   UINT16 fdc_status;
79   UINT16 fdc_mode;
80   UINT8 fdc_sectors;
81   UINT16 fdc_fifo[2][8];
82   int fdc_fifo_sel;
83   int fdc_fifo_index;
84   int fdc_fifo_msb;
85   int fdc_fifo_empty[2];
86   int fdc_dmabytes;
87   int fdc_irq;
183   UINT32 m_dma_base;
184   UINT16 m_dma_error;
185   UINT16 m_fdc_mode;
186   UINT8 m_fdc_sectors;
187   UINT16 m_fdc_fifo[2][8];
188   int m_fdc_fifo_sel;
189   int m_fdc_fifo_index;
190   int m_fdc_fifo_msb;
191   int m_fdc_fifo_empty[2];
192   int m_fdc_dmabytes;
88193
89194   /* shifter state */
90   UINT32 shifter_base;
91   UINT32 shifter_ofs;
92   UINT8 shifter_sync;
93   UINT8 shifter_mode;
94   UINT16 shifter_palette[16];
95   UINT8 shifter_lineofs;  // STe
96   UINT8 shifter_pixelofs; // STe
97   UINT16 shifter_rr[4];
98   UINT16 shifter_ir[4];
99   int shifter_bitplane;
100   int shifter_shift;
101   int shifter_h;
102   int shifter_v;
103   int shifter_de;
104   int shifter_x_start;
105   int shifter_x_end;
106   int shifter_y_start;
107   int shifter_y_end;
108   int shifter_hblank_start;
109   int shifter_vblank_start;
195   UINT32 m_shifter_base;
196   UINT32 m_shifter_ofs;
197   UINT8 m_shifter_sync;
198   UINT8 m_shifter_mode;
199   UINT16 m_shifter_palette[16];
200   UINT16 m_shifter_rr[4];
201   UINT16 m_shifter_ir[4];
202   int m_shifter_bitplane;
203   int m_shifter_shift;
204   int m_shifter_h;
205   int m_shifter_v;
206   int m_shifter_de;
207   int m_shifter_x_start;
208   int m_shifter_x_end;
209   int m_shifter_y_start;
210   int m_shifter_y_end;
211   int m_shifter_hblank_start;
212   int m_shifter_vblank_start;
110213
111214   /* blitter state */
112   UINT16 blitter_halftone[16];
113   INT16 blitter_src_inc_x;
114   INT16 blitter_src_inc_y;
115   INT16 blitter_dst_inc_x;
116   INT16 blitter_dst_inc_y;
117   UINT32 blitter_src;
118   UINT32 blitter_dst;
119   UINT16 blitter_endmask1;
120   UINT16 blitter_endmask2;
121   UINT16 blitter_endmask3;
122   UINT16 blitter_xcount;
123   UINT16 blitter_ycount;
124   UINT16 blitter_xcountl;
125   UINT8 blitter_hop;
126   UINT8 blitter_op;
127   UINT8 blitter_ctrl;
128   UINT8 blitter_skew;
129   UINT32 blitter_srcbuf;
215   int m_blitter_done;
216   UINT16 m_blitter_halftone[16];
217   INT16 m_blitter_src_inc_x;
218   INT16 m_blitter_src_inc_y;
219   INT16 m_blitter_dst_inc_x;
220   INT16 m_blitter_dst_inc_y;
221   UINT32 m_blitter_src;
222   UINT32 m_blitter_dst;
223   UINT16 m_blitter_endmask1;
224   UINT16 m_blitter_endmask2;
225   UINT16 m_blitter_endmask3;
226   UINT16 m_blitter_xcount;
227   UINT16 m_blitter_ycount;
228   UINT16 m_blitter_xcountl;
229   UINT8 m_blitter_hop;
230   UINT8 m_blitter_op;
231   UINT8 m_blitter_ctrl;
232   UINT8 m_blitter_skew;
233   UINT32 m_blitter_srcbuf;
234   
235   /* timers */
236   emu_timer *m_glue_timer;
237   emu_timer *m_shifter_timer;
238};
130239
240class megast_state : public st_state
241{
242public:
243   megast_state(running_machine &machine, const driver_device_config_base &config)
244      : st_state(machine, config)
245   { }
246
247   void machine_start();
248};
249
250class ste_state : public st_state
251{
252public:
253   ste_state(running_machine &machine, const driver_device_config_base &config)
254      : st_state(machine, config),
255        m_lmc1992(*this, LMC1992_TAG)
256   { }
257
258   required_device<device_t> m_lmc1992;
259
260   void machine_start();
261
262   void video_start();
263
264   READ16_MEMBER( shifter_base_low_r );
265   WRITE16_MEMBER( shifter_base_low_w );
266   READ16_MEMBER( shifter_counter_r );
267   WRITE16_MEMBER( shifter_counter_w );
268   WRITE16_MEMBER( shifter_palette_w );
269   READ16_MEMBER( shifter_lineofs_r );
270   WRITE16_MEMBER( shifter_lineofs_w );
271   READ16_MEMBER( shifter_pixelofs_r );
272   WRITE16_MEMBER( shifter_pixelofs_w );
273
274   DECLARE_READ16_MEMBER( sound_dma_control_r );
275   DECLARE_READ16_MEMBER( sound_dma_base_r );
276   DECLARE_READ16_MEMBER( sound_dma_counter_r );
277   DECLARE_READ16_MEMBER( sound_dma_end_r );
278   DECLARE_READ16_MEMBER( sound_mode_r );
279   DECLARE_WRITE16_MEMBER( sound_dma_control_w );
280   DECLARE_WRITE16_MEMBER( sound_dma_base_w );
281   DECLARE_WRITE16_MEMBER( sound_dma_end_w );
282   DECLARE_WRITE16_MEMBER( sound_mode_w );
283   DECLARE_READ16_MEMBER( microwire_data_r );
284   DECLARE_WRITE16_MEMBER( microwire_data_w );
285   DECLARE_READ16_MEMBER( microwire_mask_r );
286   DECLARE_WRITE16_MEMBER( microwire_mask_w );
287
288   DECLARE_READ8_MEMBER( mfp_gpio_r );
289
290   void dmasound_set_state(int level);
291   void dmasound_tick();
292   void microwire_shift();
293   void microwire_tick();
294   void state_save();
295
296   // shifter state
297   UINT8 m_shifter_lineofs;
298   UINT8 m_shifter_pixelofs;
299
131300   /* microwire state */
132   UINT16 mw_data;
133   UINT16 mw_mask;
134   int mw_shift;
301   UINT16 m_mw_data;
302   UINT16 m_mw_mask;
303   int m_mw_shift;
135304
136305   /* DMA sound state */
137   UINT32 dmasnd_base;
138   UINT32 dmasnd_end;
139   UINT32 dmasnd_cntr;
140   UINT32 dmasnd_baselatch;
141   UINT32 dmasnd_endlatch;
142   UINT16 dmasnd_ctrl;
143   UINT16 dmasnd_mode;
144   UINT8 dmasnd_fifo[8];
145   UINT8 dmasnd_samples;
146   int dmasnd_active;
306   UINT32 m_dmasnd_base;
307   UINT32 m_dmasnd_end;
308   UINT32 m_dmasnd_cntr;
309   UINT32 m_dmasnd_baselatch;
310   UINT32 m_dmasnd_endlatch;
311   UINT16 m_dmasnd_ctrl;
312   UINT16 m_dmasnd_mode;
313   UINT8 m_dmasnd_fifo[8];
314   UINT8 m_dmasnd_samples;
315   int m_dmasnd_active;
147316
148   /* devices */
149   device_t *mc68901;
150   device_t *lmc1992;
151   device_t *wd1772;
152   device_t *centronics;
153   device_t *rs232;
317   // timers
318   emu_timer *m_microwire_timer;
319   emu_timer *m_dmasound_timer;
320};
154321
155   /* timers */
156   emu_timer *glue_timer;
157   emu_timer *shifter_timer;
158   emu_timer *microwire_timer;
159   emu_timer *dmasound_timer;
322class megaste_state : public ste_state
323{
324public:
325   megaste_state(running_machine &machine, const driver_device_config_base &config)
326      : ste_state(machine, config)
327   { }
328
329   void machine_start();
330
331   DECLARE_READ16_MEMBER( cache_r );
332   DECLARE_WRITE16_MEMBER( cache_w );
160333};
161334
335class stbook_state : public ste_state
336{
337public:
338   stbook_state(running_machine &machine, const driver_device_config_base &config)
339      : ste_state(machine, config)
340   { }
341
342   void machine_start();
343
344   DECLARE_READ16_MEMBER( config_r );
345   DECLARE_WRITE16_MEMBER( lcd_control_w );
346
347   DECLARE_WRITE8_MEMBER( psg_pa_w );
348   DECLARE_READ8_MEMBER( mfp_gpio_r );
349};
350
162351#endif
src/mess/mess.mak
r9971r9972
526526   $(MESS_MACHINE)/mc6846.o   \
527527   $(MESS_MACHINE)/mc6852.o   \
528528   $(MESS_MACHINE)/mc6854.o   \
529   $(MESS_MACHINE)/mc68901.o   \
529530   $(MESS_MACHINE)/mm58274c.o   \
530531   $(MESS_MACHINE)/mm74c922.o   \
531532   $(MESS_MACHINE)/mpc105.o   \
src/mess/drivers/atarist.c
r9971r9972
1#define ADDRESS_MAP_MODERN
2
13#include "emu.h"
2#include "includes/atarist.h"
34#include "cpu/m68000/m68000.h"
45#include "cpu/m6800/m6800.h"
56#include "audio/lmc1992.h"
r9971r9972
89#include "imagedev/flopdrv.h"
910#include "machine/ram.h"
1011#include "machine/6850acia.h"
11#include "machine/68901mfp.h"
1212#include "machine/8530scc.h"
1313#include "machine/ctronics.h"
14#include "machine/mc68901.h"
1415#include "machine/rescap.h"
1516#include "machine/rp5c15.h"
1617#include "machine/rs232.h"
1718#include "machine/wd17xx.h"
1819#include "sound/ay8910.h"
1920#include "video/atarist.h"
21#include "includes/atarist.h"
2022
2123/*
2224
2325    TODO:
2426
25    - fix floppy interface
26    - fix mouse
27    - memory shadow for boot memory check
28    - floppy write
29    - floppy DMA transfer timer
2730    - MSA disk image support
31    - mouse
2832    - UK keyboard layout for the special keys
2933    - accurate screen timing
30    - floppy DMA transfer timer
31    - memory shadow for boot memory check
3234    - STe DMA sound and LMC1992 Microwire mixer
3335    - Mega ST/STe MC68881 FPU
3436    - MIDI interface
r9971r9972
3739
3840*/
3941
42
43
44//**************************************************************************
45//   CONSTANTS / MACROS
46//**************************************************************************
47
4048#define LOG 0
4149
42/* Floppy Disk Controller */
50static const int IKBD_MOUSE_XYA[3][4] = { { 0, 0, 0, 0 }, { 1, 1, 0, 0 }, { 0, 1, 1, 0 } };
51static const int IKBD_MOUSE_XYB[3][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 1, 1, 0, 0 } };
4352
44static void toggle_dma_fifo(running_machine *machine)
53static const int DMASOUND_RATE[] = { Y2/640/8, Y2/640/4, Y2/640/2, Y2/640 };
54
55
56//**************************************************************************
57//   FLOPPY
58//**************************************************************************
59
60//-------------------------------------------------
61//  toggle_dma_fifo -
62//-------------------------------------------------
63
64void st_state::toggle_dma_fifo()
4565{
46   atarist_state *state = machine->driver_data<atarist_state>();
47
4866   if (LOG) logerror("Toggling DMA FIFO\n");
4967
50   state->fdc_fifo_sel = !state->fdc_fifo_sel;
51   state->fdc_fifo_index = 0;
68   m_fdc_fifo_sel = !m_fdc_fifo_sel;
69   m_fdc_fifo_index = 0;
5270}
5371
54static void flush_dma_fifo(running_machine *machine)
72
73//-------------------------------------------------
74//  flush_dma_fifo -
75//-------------------------------------------------
76
77void st_state::flush_dma_fifo()
5578{
56   address_space *program = cputag_get_address_space(machine, M68000_TAG, ADDRESS_SPACE_PROGRAM);
57   atarist_state *state = machine->driver_data<atarist_state>();
79   address_space *program = cpu_get_address_space(m_maincpu, ADDRESS_SPACE_PROGRAM);
80   
81   if (m_fdc_fifo_empty[m_fdc_fifo_sel]) return;
5882
59   if (state->fdc_fifo_empty[state->fdc_fifo_sel]) return;
60
6183   for (int i = 0; i < 8; i++)
6284   {
63      UINT16 data = state->fdc_fifo[state->fdc_fifo_sel][i];
85      UINT16 data = m_fdc_fifo[m_fdc_fifo_sel][i];
6486     
65      if (LOG) logerror("Flushing DMA FIFO %u data %04x to address %06x\n", state->fdc_fifo_sel, data, state->fdc_dmabase);
87      if (LOG) logerror("Flushing DMA FIFO %u data %04x to address %06x\n", m_fdc_fifo_sel, data, m_dma_base);
6688
67      program->write_word(state->fdc_dmabase, data);
68      state->fdc_dmabase += 2;
89      program->write_word(m_dma_base, data);
90      m_dma_base += 2;
6991   }
7092
71   state->fdc_fifo_empty[state->fdc_fifo_sel] = 1;
93   m_fdc_fifo_empty[m_fdc_fifo_sel] = 1;
7294}
7395
74static void fill_dma_fifo(running_machine *machine)
96
97//-------------------------------------------------
98//  fill_dma_fifo -
99//-------------------------------------------------
100
101void st_state::fill_dma_fifo()
75102{
76   address_space *program = cputag_get_address_space(machine, M68000_TAG, ADDRESS_SPACE_PROGRAM);
77   atarist_state *state = machine->driver_data<atarist_state>();
103   address_space *program = cpu_get_address_space(m_maincpu, ADDRESS_SPACE_PROGRAM);
78104
79105   for (int i = 0; i < 8; i++)
80106   {
81      UINT16 data = program->read_word(state->fdc_dmabase);
107      UINT16 data = program->read_word(m_dma_base);
82108
83      if (LOG) logerror("Filling DMA FIFO %u with data %04x from memory address %06x\n", state->fdc_fifo_sel, data, state->fdc_dmabase);
109      if (LOG) logerror("Filling DMA FIFO %u with data %04x from memory address %06x\n", m_fdc_fifo_sel, data, m_dma_base);
84110
85      state->fdc_fifo[state->fdc_fifo_sel][i] = data;
86      state->fdc_dmabase += 2;
111      m_fdc_fifo[m_fdc_fifo_sel][i] = data;
112      m_dma_base += 2;
87113   }
88114
89   state->fdc_fifo_empty[state->fdc_fifo_sel] = 0;
115   m_fdc_fifo_empty[m_fdc_fifo_sel] = 0;
90116}
91117
92static void atarist_fdc_dma_transfer(running_machine *machine)
118
119//-------------------------------------------------
120//  fdc_dma_transfer -
121//-------------------------------------------------
122
123void st_state::fdc_dma_transfer()
93124{
94   atarist_state *state = machine->driver_data<atarist_state>();
125   if (!m_fdc_dmabytes) return;
95126
96   if (!state->fdc_dmabytes) return;
97
98   if (state->fdc_mode & DMA_MODE_READ_WRITE)
127   if (m_fdc_mode & DMA_MODE_READ_WRITE)
99128   {
100      UINT16 data = state->fdc_fifo[state->fdc_fifo_sel][state->fdc_fifo_index];
129      UINT16 data = m_fdc_fifo[m_fdc_fifo_sel][m_fdc_fifo_index];
101130
102      if (state->fdc_fifo_msb)
131      if (m_fdc_fifo_msb)
103132      {
104133         // write LSB to disk
105         wd17xx_data_w(state->wd1772, 0, data & 0xff);
134         wd17xx_data_w(m_fdc, 0, data & 0xff);
106135         
107136         if (LOG) logerror("DMA Write to FDC %02x\n", data & 0xff);
108137
109         state->fdc_fifo_index++;
138         m_fdc_fifo_index++;
110139      }
111140      else
112141      {
113142         // write MSB to disk
114         wd17xx_data_w(state->wd1772, 0, data >> 8);
143         wd17xx_data_w(m_fdc, 0, data >> 8);
115144
116145         if (LOG) logerror("DMA Write to FDC %02x\n", data >> 8);
117146      }
118147
119148      // toggle MSB/LSB
120      state->fdc_fifo_msb = !state->fdc_fifo_msb;
149      m_fdc_fifo_msb = !m_fdc_fifo_msb;
121150
122      if (state->fdc_fifo_index == 8)
151      if (m_fdc_fifo_index == 8)
123152      {
124         state->fdc_fifo_index--;
125         state->fdc_fifo_empty[state->fdc_fifo_sel] = 1;
153         m_fdc_fifo_index--;
154         m_fdc_fifo_empty[m_fdc_fifo_sel] = 1;
126155
127         toggle_dma_fifo(machine);
156         toggle_dma_fifo();
128157
129         if (state->fdc_fifo_empty[state->fdc_fifo_sel])
158         if (m_fdc_fifo_empty[m_fdc_fifo_sel])
130159         {
131            fill_dma_fifo(machine);
160            fill_dma_fifo();
132161         }
133162      }
134163   }
135164   else
136165   {
137166      // read from controller to FIFO
138      UINT8 data = wd17xx_data_r(state->wd1772, 0);
167      UINT8 data = wd17xx_data_r(m_fdc, 0);
139168
140      state->fdc_fifo_empty[state->fdc_fifo_sel] = 0;
169      m_fdc_fifo_empty[m_fdc_fifo_sel] = 0;
141170         
142171      if (LOG) logerror("DMA Read from FDC %02x\n", data);
143172
144      if (state->fdc_fifo_msb)
173      if (m_fdc_fifo_msb)
145174      {
146175         // write MSB to FIFO
147         state->fdc_fifo[state->fdc_fifo_sel][state->fdc_fifo_index] |= data;
148         state->fdc_fifo_index++;
176         m_fdc_fifo[m_fdc_fifo_sel][m_fdc_fifo_index] |= data;
177         m_fdc_fifo_index++;
149178      }
150179      else
151180      {
152181         // write LSB to FIFO
153         state->fdc_fifo[state->fdc_fifo_sel][state->fdc_fifo_index] = data << 8;
182         m_fdc_fifo[m_fdc_fifo_sel][m_fdc_fifo_index] = data << 8;
154183      }
155184
156185      // toggle MSB/LSB
157      state->fdc_fifo_msb = !state->fdc_fifo_msb;
186      m_fdc_fifo_msb = !m_fdc_fifo_msb;
158187
159      if (state->fdc_fifo_index == 8)
188      if (m_fdc_fifo_index == 8)
160189      {
161         flush_dma_fifo(machine);
162         toggle_dma_fifo(machine);
190         flush_dma_fifo();
191         toggle_dma_fifo();
163192      }
164193   }
165194
166   state->fdc_dmabytes--;
195   m_fdc_dmabytes--;
167196
168   if (state->fdc_dmabytes == 0)
197   if (m_fdc_dmabytes == 0)
169198   {
170      state->fdc_sectors--;
199      m_fdc_sectors--;
171200
172      if (state->fdc_sectors)
201      if (m_fdc_sectors)
173202      {
174         state->fdc_dmabytes = DMA_SECTOR_SIZE;
203         m_fdc_dmabytes = DMA_SECTOR_SIZE;
175204      }
176205   }
177206}
178207
179static WRITE_LINE_DEVICE_HANDLER( atarist_fdc_intrq_w )
180{
181   atarist_state *driver_state = device->machine->driver_data<atarist_state>();
182   
183   driver_state->fdc_irq = !state;
184}
185208
186static WRITE_LINE_DEVICE_HANDLER( atarist_fdc_drq_w )
187{
188   atarist_state *driver_state = device->machine->driver_data<atarist_state>();
209//-------------------------------------------------
210//  fdc_data_r -
211//-------------------------------------------------
189212
190   if (state && (!(driver_state->fdc_mode & DMA_MODE_ENABLED)) && (driver_state->fdc_mode & DMA_MODE_FDC_HDC_ACK))
191   {
192      atarist_fdc_dma_transfer(device->machine);
193   }
194}
195
196static const wd17xx_interface fdc_intf =
213READ16_MEMBER( st_state::fdc_data_r )
197214{
198   DEVCB_LINE_GND,
199   DEVCB_LINE(atarist_fdc_intrq_w),
200   DEVCB_LINE(atarist_fdc_drq_w),
201   { FLOPPY_0, FLOPPY_1, NULL, NULL }
202};
203
204static const wd17xx_interface stbook_fdc_intf =
205{
206   DEVCB_NULL,
207   DEVCB_LINE(atarist_fdc_intrq_w),
208   DEVCB_LINE(atarist_fdc_drq_w),
209   { FLOPPY_0, FLOPPY_1, NULL, NULL }
210};
211
212static READ16_HANDLER( atarist_fdc_data_r )
213{
214   atarist_state *state = space->machine->driver_data<atarist_state>();
215
216215   UINT8 data = 0;
217216
218   if (state->fdc_mode & DMA_MODE_SECTOR_COUNT)
217   if (m_fdc_mode & DMA_MODE_SECTOR_COUNT)
219218   {
220219      if (LOG) logerror("Indeterminate DMA Sector Count Read!\n");
221220
222221      // sector count register is write only, reading it returns unpredictable values
223      data = space->machine->rand() & 0xff;
222      data = machine->rand() & 0xff;
224223   }
225224   else
226225   {
227      if (!(state->fdc_mode & DMA_MODE_FDC_HDC_CS))
226      if (!(m_fdc_mode & DMA_MODE_FDC_HDC_CS))
228227      {
229228         // floppy controller
230         int offset = (state->fdc_mode & DMA_MODE_ADDRESS_MASK) >> 1;
229         int offset = (m_fdc_mode & DMA_MODE_ADDRESS_MASK) >> 1;
231230
232         data = wd17xx_r(state->wd1772, offset);
231         data = wd17xx_r(m_fdc, offset);
233232
234233         if (LOG) logerror("FDC Register %u Read %02x\n", offset, data);
235234      }
r9971r9972
238237   return data;
239238}
240239
241static WRITE16_HANDLER( atarist_fdc_data_w )
240
241//-------------------------------------------------
242//  fdc_data_w -
243//-------------------------------------------------
244
245WRITE16_MEMBER( st_state::fdc_data_w )
242246{
243   atarist_state *state = space->machine->driver_data<atarist_state>();
244
245   if (state->fdc_mode & DMA_MODE_SECTOR_COUNT)
247   if (m_fdc_mode & DMA_MODE_SECTOR_COUNT)
246248   {
247249      if (LOG) logerror("DMA Sector Count %u\n", data);
248250
249251      // sector count register
250      state->fdc_sectors = data;
252      m_fdc_sectors = data;
251253   
252      if (state->fdc_sectors)
254      if (m_fdc_sectors)
253255      {
254         state->fdc_dmabytes = DMA_SECTOR_SIZE;
256         m_fdc_dmabytes = DMA_SECTOR_SIZE;
255257      }
256258
257      if (state->fdc_mode & DMA_MODE_READ_WRITE)
259      if (m_fdc_mode & DMA_MODE_READ_WRITE)
258260      {
259261         // fill both FIFOs with data
260         fill_dma_fifo(space->machine);
261         toggle_dma_fifo(space->machine);
262         fill_dma_fifo(space->machine);
263         toggle_dma_fifo(space->machine);
262         fill_dma_fifo();
263         toggle_dma_fifo();
264         fill_dma_fifo();
265         toggle_dma_fifo();
264266      }
265267   }
266268   else
267269   {
268      if (!(state->fdc_mode & DMA_MODE_FDC_HDC_CS))
270      if (!(m_fdc_mode & DMA_MODE_FDC_HDC_CS))
269271      {
270272         // floppy controller
271         int offset = (state->fdc_mode & DMA_MODE_ADDRESS_MASK) >> 1;
273         int offset = (m_fdc_mode & DMA_MODE_ADDRESS_MASK) >> 1;
272274
273275         if (LOG) logerror("FDC Register %u Write %02x\n", offset, data);
274276
275         wd17xx_w(state->wd1772, offset, data);
277         wd17xx_w(m_fdc, offset, data);
276278      }
277279   }
278280}
279281
280static READ16_HANDLER( atarist_fdc_dma_status_r )
282
283//-------------------------------------------------
284//  dma_status_r -
285//-------------------------------------------------
286
287READ16_MEMBER( st_state::dma_status_r )
281288{
282   atarist_state *state = space->machine->driver_data<atarist_state>();
283
284289   UINT16 data = 0;
285290
286291   // DMA error
287   data |= 1;
292   data |= m_dma_error;
288293
289294   // sector count null
290   data |= !(state->fdc_sectors == 0) << 1;
295   data |= !(m_fdc_sectors == 0) << 1;
291296
292297   // DRQ state
293   data |= wd17xx_drq_r(state->wd1772) << 2;
298   data |= wd17xx_drq_r(m_fdc) << 2;
294299
295300   return data;
296301}
297302
298static WRITE16_HANDLER( atarist_fdc_dma_mode_w )
303
304//-------------------------------------------------
305//  dma_mode_w -
306//-------------------------------------------------
307
308WRITE16_MEMBER( st_state::dma_mode_w )
299309{
300   atarist_state *state = space->machine->driver_data<atarist_state>();
301
302310   if (LOG) logerror("DMA Mode %04x\n", data);
303311
304   if ((data & DMA_MODE_READ_WRITE) != (state->fdc_mode & DMA_MODE_READ_WRITE))
312   if ((data & DMA_MODE_READ_WRITE) != (m_fdc_mode & DMA_MODE_READ_WRITE))
305313   {
306314      if (LOG) logerror("DMA reset\n");
307315
308      flush_dma_fifo(space->machine);
316      flush_dma_fifo();
309317
310      state->fdc_status = 0;
311      state->fdc_sectors = 0;
312      state->fdc_fifo_sel = 0;
313      state->fdc_fifo_msb = 0;
318      m_dma_error = 1;
319      m_fdc_sectors = 0;
320      m_fdc_fifo_sel = 0;
321      m_fdc_fifo_msb = 0;
314322   }
315323
316   state->fdc_mode = data;
324   m_fdc_mode = data;
317325}
318326
319static READ8_HANDLER( atarist_fdc_dma_base_r )
327
328//-------------------------------------------------
329//  dma_counter_r -
330//-------------------------------------------------
331
332READ8_MEMBER( st_state::dma_counter_r )
320333{
321   atarist_state *state = space->machine->driver_data<atarist_state>();
322
323334   UINT8 data = 0;
324335
325336   switch (offset)
326337   {
327338   case 0:
328      data = (state->fdc_dmabase >> 16) & 0xff;
339      data = (m_dma_base >> 16) & 0xff;
329340
330341   case 1:
331      data = (state->fdc_dmabase >> 8) & 0xff;
342      data = (m_dma_base >> 8) & 0xff;
332343
333344   case 2:
334      data = state->fdc_dmabase & 0xff;
345      data = m_dma_base & 0xff;
335346   }
336347
337348   return data;
338349}
339350
340static WRITE8_HANDLER( atarist_fdc_dma_base_w )
351
352//-------------------------------------------------
353//  dma_base_w -
354//-------------------------------------------------
355
356WRITE8_MEMBER( st_state::dma_base_w )
341357{
342   atarist_state *state = space->machine->driver_data<atarist_state>();
343
344358   switch (offset)
345359   {
346360   case 0:
347      state->fdc_dmabase = (state->fdc_dmabase & 0x00ffff) | (data << 16);
348      if (LOG) logerror("DMA Address High %02x (%06x)\n", data & 0xff, state->fdc_dmabase);
361      m_dma_base = (m_dma_base & 0x00ffff) | (data << 16);
362      if (LOG) logerror("DMA Address High %02x (%06x)\n", data & 0xff, m_dma_base);
349363      break;
350364
351365   case 1:
352      state->fdc_dmabase = (state->fdc_dmabase & 0x0000ff) | (data << 8);
353      if (LOG) logerror("DMA Address Mid %02x (%06x)\n", data & 0xff, state->fdc_dmabase);
366      m_dma_base = (m_dma_base & 0x0000ff) | (data << 8);
367      if (LOG) logerror("DMA Address Mid %02x (%06x)\n", data & 0xff, m_dma_base);
354368      break;
355369
356370   case 2:
357      state->fdc_dmabase = data & 0xff;
358      if (LOG) logerror("DMA Address Low %02x (%06x)\n", data & 0xff, state->fdc_dmabase);
371      m_dma_base = data & 0xff;
372      if (LOG) logerror("DMA Address Low %02x (%06x)\n", data & 0xff, m_dma_base);
359373      break;
360374   }
361375}
362376
363/* MMU */
364377
365static READ16_HANDLER( atarist_mmu_r )
378
379//**************************************************************************
380//   MMU
381//**************************************************************************
382
383//-------------------------------------------------
384//  mmu_r -
385//-------------------------------------------------
386
387READ8_MEMBER( st_state::mmu_r )
366388{
367   atarist_state *state = space->machine->driver_data<atarist_state>();
368
369   return state->mmu;
389   return m_mmu;
370390}
371391
372static WRITE16_HANDLER( atarist_mmu_w )
392
393//-------------------------------------------------
394//  mmu_w -
395//-------------------------------------------------
396
397WRITE8_MEMBER( st_state::mmu_w )
373398{
374   atarist_state *state = space->machine->driver_data<atarist_state>();
375
376   state->mmu = data & 0xff;
399   m_mmu = data;
377400}
378401
379/* IKBD */
380402
381static const int IKBD_MOUSE_XYA[3][4] = { { 0, 0, 0, 0 }, { 1, 1, 0, 0 }, { 0, 1, 1, 0 } };
382static const int IKBD_MOUSE_XYB[3][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 1, 1, 0, 0 } };
383403
384static READ8_HANDLER( ikbd_port1_r )
404//**************************************************************************
405//   IKBD
406//**************************************************************************
407
408//-------------------------------------------------
409//  ikbd_port1_r -
410//-------------------------------------------------
411
412READ8_MEMBER( st_state::ikbd_port1_r )
385413{
386414   /*
387415
r9971r9972
398426
399427    */
400428
401   atarist_state *state = space->machine->driver_data<atarist_state>();
402
403   return state->ikbd_keylatch;
429   return m_ikbd_keylatch;
404430}
405431
406static READ8_HANDLER( ikbd_port2_r )
432
433//-------------------------------------------------
434//  ikbd_port2_r -
435//-------------------------------------------------
436
437READ8_MEMBER( st_state::ikbd_port2_r )
407438{
408439   /*
409440
r9971r9972
417448
418449    */
419450
420   atarist_state *state = space->machine->driver_data<atarist_state>();
421
422   return (state->ikbd_tx << 3) | (input_port_read_safe(space->machine, "IKBD_JOY1", 0xff) & 0x06);
451   return (m_ikbd_tx << 3) | (input_port_read_safe(machine, "IKBD_JOY1", 0xff) & 0x06);
423452}
424453
425static WRITE8_HANDLER( ikbd_port2_w )
454
455//-------------------------------------------------
456//  ikbd_port2_w -
457//-------------------------------------------------
458
459WRITE8_MEMBER( st_state::ikbd_port2_w )
426460{
427461   /*
428462
r9971r9972
436470
437471    */
438472
439   atarist_state *state = space->machine->driver_data<atarist_state>();
440
441   state->ikbd_rx = (data & 0x10) >> 4;
473   m_ikbd_rx = BIT(data, 4);
442474}
443475
444static WRITE8_HANDLER( ikbd_port3_w )
476
477//-------------------------------------------------
478//  ikbd_port3_w -
479//-------------------------------------------------
480
481WRITE8_MEMBER( st_state::ikbd_port3_w )
445482{
446483   /*
447484
r9971r9972
458495
459496    */
460497
461   atarist_state *state = space->machine->driver_data<atarist_state>();
498   set_led_status(machine, 1, data & 0x01);
462499
463   set_led_status(space->machine, 1, data & 0x01);
464
465   if (~data & 0x02) state->ikbd_keylatch = input_port_read(space->machine, "P31");
466   if (~data & 0x04) state->ikbd_keylatch = input_port_read(space->machine, "P32");
467   if (~data & 0x08) state->ikbd_keylatch = input_port_read(space->machine, "P33");
468   if (~data & 0x10) state->ikbd_keylatch = input_port_read(space->machine, "P34");
469   if (~data & 0x20) state->ikbd_keylatch = input_port_read(space->machine, "P35");
470   if (~data & 0x40) state->ikbd_keylatch = input_port_read(space->machine, "P36");
471   if (~data & 0x80) state->ikbd_keylatch = input_port_read(space->machine, "P37");
500   if (~data & 0x02) m_ikbd_keylatch = input_port_read(machine, "P31");
501   if (~data & 0x04) m_ikbd_keylatch = input_port_read(machine, "P32");
502   if (~data & 0x08) m_ikbd_keylatch = input_port_read(machine, "P33");
503   if (~data & 0x10) m_ikbd_keylatch = input_port_read(machine, "P34");
504   if (~data & 0x20) m_ikbd_keylatch = input_port_read(machine, "P35");
505   if (~data & 0x40) m_ikbd_keylatch = input_port_read(machine, "P36");
506   if (~data & 0x80) m_ikbd_keylatch = input_port_read(machine, "P37");
472507}
473508
474static READ8_HANDLER( ikbd_port4_r )
509
510//-------------------------------------------------
511//  ikbd_port4_r -
512//-------------------------------------------------
513
514READ8_MEMBER( st_state::ikbd_port4_r )
475515{
476516   /*
477517
r9971r9972
488528
489529    */
490530
491   atarist_state *state = space->machine->driver_data<atarist_state>();
492
493   if (input_port_read(space->machine, "config") & 0x01)
531   if (input_port_read(machine, "config") & 0x01)
494532   {
495533      /*
496534
r9971r9972
501539
502540        */
503541
504      UINT8 data = input_port_read_safe(space->machine, "IKBD_JOY0", 0xff) & 0xf0;
505      UINT8 x = input_port_read_safe(space->machine, "IKBD_MOUSEX", 0x00);
506      UINT8 y = input_port_read_safe(space->machine, "IKBD_MOUSEY", 0x00);
542      UINT8 data = input_port_read_safe(machine, "IKBD_JOY0", 0xff) & 0xf0;
543      UINT8 x = input_port_read_safe(machine, "IKBD_MOUSEX", 0x00);
544      UINT8 y = input_port_read_safe(machine, "IKBD_MOUSEY", 0x00);
507545
508      if (x == state->ikbd_mouse_x)
546      if (x == m_ikbd_mouse_x)
509547      {
510         state->ikbd_mouse_px = IKBD_MOUSE_PHASE_STATIC;
548         m_ikbd_mouse_px = IKBD_MOUSE_PHASE_STATIC;
511549      }
512      else if (x > state->ikbd_mouse_x)
550      else if (x > m_ikbd_mouse_x)
513551      {
514         state->ikbd_mouse_px = IKBD_MOUSE_PHASE_POSITIVE;
552         m_ikbd_mouse_px = IKBD_MOUSE_PHASE_POSITIVE;
515553      }
516      else if (x < state->ikbd_mouse_x)
554      else if (x < m_ikbd_mouse_x)
517555      {
518         state->ikbd_mouse_px = IKBD_MOUSE_PHASE_NEGATIVE;
556         m_ikbd_mouse_px = IKBD_MOUSE_PHASE_NEGATIVE;
519557      }
520558
521      if (y == state->ikbd_mouse_y)
559      if (y == m_ikbd_mouse_y)
522560      {
523         state->ikbd_mouse_py = IKBD_MOUSE_PHASE_STATIC;
561         m_ikbd_mouse_py = IKBD_MOUSE_PHASE_STATIC;
524562      }
525      else if (y > state->ikbd_mouse_y)
563      else if (y > m_ikbd_mouse_y)
526564      {
527         state->ikbd_mouse_py = IKBD_MOUSE_PHASE_POSITIVE;
565         m_ikbd_mouse_py = IKBD_MOUSE_PHASE_POSITIVE;
528566      }
529      else if (y < state->ikbd_mouse_y)
567      else if (y < m_ikbd_mouse_y)
530568      {
531         state->ikbd_mouse_py = IKBD_MOUSE_PHASE_NEGATIVE;
569         m_ikbd_mouse_py = IKBD_MOUSE_PHASE_NEGATIVE;
532570      }
533571
534      data |= IKBD_MOUSE_XYB[state->ikbd_mouse_px][state->ikbd_mouse_pc];       // XB
535      data |= IKBD_MOUSE_XYA[state->ikbd_mouse_px][state->ikbd_mouse_pc] << 1; // XA
536      data |= IKBD_MOUSE_XYA[state->ikbd_mouse_py][state->ikbd_mouse_pc] << 2; // YA
537      data |= IKBD_MOUSE_XYB[state->ikbd_mouse_py][state->ikbd_mouse_pc] << 3; // YB
572      data |= IKBD_MOUSE_XYB[m_ikbd_mouse_px][m_ikbd_mouse_pc];       // XB
573      data |= IKBD_MOUSE_XYA[m_ikbd_mouse_px][m_ikbd_mouse_pc] << 1; // XA
574      data |= IKBD_MOUSE_XYA[m_ikbd_mouse_py][m_ikbd_mouse_pc] << 2; // YA
575      data |= IKBD_MOUSE_XYB[m_ikbd_mouse_py][m_ikbd_mouse_pc] << 3; // YB
538576
539      state->ikbd_mouse_pc++;
577      m_ikbd_mouse_pc++;
540578
541      if (state->ikbd_mouse_pc == 4)
579      if (m_ikbd_mouse_pc == 4)
542580      {
543         state->ikbd_mouse_pc = 0;
581         m_ikbd_mouse_pc = 0;
544582      }
545583
546      state->ikbd_mouse_x = x;
547      state->ikbd_mouse_y = y;
584      m_ikbd_mouse_x = x;
585      m_ikbd_mouse_y = y;
548586
549587      return data;
550588   }
551589   else
552590   {
553      return input_port_read_safe(space->machine, "IKBD_JOY0", 0xff);
591      return input_port_read_safe(machine, "IKBD_JOY0", 0xff);
554592   }
555593}
556594
557static WRITE8_HANDLER( ikbd_port4_w )
595
596//-------------------------------------------------
597//  ikbd_port4_w -
598//-------------------------------------------------
599
600WRITE8_MEMBER( st_state::ikbd_port4_w )
558601{
559602   /*
560603
r9971r9972
571614
572615    */
573616
574   atarist_state *state = space->machine->driver_data<atarist_state>();
575
576   if (~data & 0x01) state->ikbd_keylatch = input_port_read(space->machine, "P40");
577   if (~data & 0x02) state->ikbd_keylatch = input_port_read(space->machine, "P41");
578   if (~data & 0x04) state->ikbd_keylatch = input_port_read(space->machine, "P42");
579   if (~data & 0x08) state->ikbd_keylatch = input_port_read(space->machine, "P43");
580   if (~data & 0x10) state->ikbd_keylatch = input_port_read(space->machine, "P44");
581   if (~data & 0x20) state->ikbd_keylatch = input_port_read(space->machine, "P45");
582   if (~data & 0x40) state->ikbd_keylatch = input_port_read(space->machine, "P46");
583   if (~data & 0x80) state->ikbd_keylatch = input_port_read(space->machine, "P47");
617   if (~data & 0x01) m_ikbd_keylatch = input_port_read(machine, "P40");
618   if (~data & 0x02) m_ikbd_keylatch = input_port_read(machine, "P41");
619   if (~data & 0x04) m_ikbd_keylatch = input_port_read(machine, "P42");
620   if (~data & 0x08) m_ikbd_keylatch = input_port_read(machine, "P43");
621   if (~data & 0x10) m_ikbd_keylatch = input_port_read(machine, "P44");
622   if (~data & 0x20) m_ikbd_keylatch = input_port_read(machine, "P45");
623   if (~data & 0x40) m_ikbd_keylatch = input_port_read(machine, "P46");
624   if (~data & 0x80) m_ikbd_keylatch = input_port_read(machine, "P47");
584625}
585626
586/* DMA Sound */
587627
588static const int DMASOUND_RATE[] = { Y2/640/8, Y2/640/4, Y2/640/2, Y2/640 };
589628
590static void atariste_dmasound_set_state(running_machine *machine, int level)
629//**************************************************************************
630//   DMA SOUND
631//**************************************************************************
632
633//-------------------------------------------------
634//  dmasound_set_state -
635//-------------------------------------------------
636
637void ste_state::dmasound_set_state(int level)
591638{
592   atarist_state *state = machine->driver_data<atarist_state>();
639   m_dmasnd_active = level;
640   m_mfp->tai_w(level);
593641
594   state->dmasnd_active = level;
595   mc68901_tai_w(state->mc68901, level);
596
597642   if (level == 0)
598643   {
599      state->dmasnd_baselatch = state->dmasnd_base;
600      state->dmasnd_endlatch = state->dmasnd_end;
644      m_dmasnd_baselatch = m_dmasnd_base;
645      m_dmasnd_endlatch = m_dmasnd_end;
601646   }
602647   else
603648   {
604      state->dmasnd_cntr = state->dmasnd_baselatch;
649      m_dmasnd_cntr = m_dmasnd_baselatch;
605650   }
606651}
607652
608static TIMER_CALLBACK( atariste_dmasound_tick )
653
654//-------------------------------------------------
655//  dmasound_tick -
656//-------------------------------------------------
657
658void ste_state::dmasound_tick()
609659{
610   atarist_state *state = machine->driver_data<atarist_state>();
611
612   if (state->dmasnd_samples == 0)
660   if (m_dmasnd_samples == 0)
613661   {
614      int i;
615662      UINT8 *RAM = ram_get_ptr(machine->device(RAM_TAG));
616663
617      for (i = 0; i < 8; i++)
664      for (int i = 0; i < 8; i++)
618665      {
619         state->dmasnd_fifo[i] = RAM[state->dmasnd_cntr];
620         state->dmasnd_cntr++;
621         state->dmasnd_samples++;
666         m_dmasnd_fifo[i] = RAM[m_dmasnd_cntr];
667         m_dmasnd_cntr++;
668         m_dmasnd_samples++;
622669
623         if (state->dmasnd_cntr == state->dmasnd_endlatch)
670         if (m_dmasnd_cntr == m_dmasnd_endlatch)
624671         {
625            atariste_dmasound_set_state(machine, 0);
672            dmasound_set_state(0);
626673            break;
627674         }
628675      }
629676   }
630677
631   if (state->dmasnd_ctrl & 0x80)
678   if (m_dmasnd_ctrl & 0x80)
632679   {
633//      if (LOG) logerror("DMA sound left  %i\n", state->dmasnd_fifo[7 - state->dmasnd_samples]);
634      state->dmasnd_samples--;
680      if (LOG) logerror("DMA sound left  %i\n", m_dmasnd_fifo[7 - m_dmasnd_samples]);
681      m_dmasnd_samples--;
635682
636//      if (LOG) logerror("DMA sound right %i\n", state->dmasnd_fifo[7 - state->dmasnd_samples]);
637      state->dmasnd_samples--;
683      if (LOG) logerror("DMA sound right %i\n", m_dmasnd_fifo[7 - m_dmasnd_samples]);
684      m_dmasnd_samples--;
638685   }
639686   else
640687   {
641//      if (LOG) logerror("DMA sound mono %i\n", state->dmasnd_fifo[7 - state->dmasnd_samples]);
642      state->dmasnd_samples--;
688      if (LOG) logerror("DMA sound mono %i\n", m_dmasnd_fifo[7 - m_dmasnd_samples]);
689      m_dmasnd_samples--;
643690   }
644691
645   if ((state->dmasnd_samples == 0) && (state->dmasnd_active == 0))
692   if ((m_dmasnd_samples == 0) && (m_dmasnd_active == 0))
646693   {
647      if ((state->dmasnd_ctrl & 0x03) == 0x03)
694      if ((m_dmasnd_ctrl & 0x03) == 0x03)
648695      {
649         atariste_dmasound_set_state(machine, 1);
696         dmasound_set_state(1);
650697      }
651698      else
652699      {
653         timer_enable(state->dmasound_timer, 0);
700         timer_enable(m_dmasound_timer, 0);
654701      }
655702   }
656703}
657704
658static READ16_HANDLER( atariste_sound_dma_control_r )
705
706//-------------------------------------------------
707//  TIMER_CALLBACK( atariste_dmasound_tick )
708//-------------------------------------------------
709
710static TIMER_CALLBACK( atariste_dmasound_tick )
659711{
660   atarist_state *state = space->machine->driver_data<atarist_state>();
712   ste_state *state = machine->driver_data<ste_state>();
713   
714   state->dmasound_tick();
715}
661716
662   return state->dmasnd_ctrl;
717
718//-------------------------------------------------
719//  sound_dma_control_r -
720//-------------------------------------------------
721
722READ16_MEMBER( ste_state::sound_dma_control_r )
723{
724   return m_dmasnd_ctrl;
663725}
664726
665static READ16_HANDLER( atariste_sound_dma_base_r )
727
728//-------------------------------------------------
729//  sound_dma_base_r -
730//-------------------------------------------------
731
732READ16_MEMBER( ste_state::sound_dma_base_r )
666733{
667   atarist_state *state = space->machine->driver_data<atarist_state>();
668
669734   switch (offset)
670735   {
671736   case 0x00:
672      return (state->dmasnd_base >> 16) & 0x3f;
737      return (m_dmasnd_base >> 16) & 0x3f;
673738   case 0x01:
674      return (state->dmasnd_base >> 8) & 0xff;
739      return (m_dmasnd_base >> 8) & 0xff;
675740   case 0x02:
676      return state->dmasnd_base & 0xff;
741      return m_dmasnd_base & 0xff;
677742   }
678743
679744   return 0;
680745}
681746
682static READ16_HANDLER( atariste_sound_dma_counter_r )
747
748//-------------------------------------------------
749//  sound_dma_counter_r -
750//-------------------------------------------------
751
752READ16_MEMBER( ste_state::sound_dma_counter_r )
683753{
684   atarist_state *state = space->machine->driver_data<atarist_state>();
685
686754   switch (offset)
687755   {
688756   case 0x00:
689      return (state->dmasnd_cntr >> 16) & 0x3f;
757      return (m_dmasnd_cntr >> 16) & 0x3f;
690758   case 0x01:
691      return (state->dmasnd_cntr >> 8) & 0xff;
759      return (m_dmasnd_cntr >> 8) & 0xff;
692760   case 0x02:
693      return state->dmasnd_cntr & 0xff;
761      return m_dmasnd_cntr & 0xff;
694762   }
695763
696764   return 0;
697765}
698766
699static READ16_HANDLER( atariste_sound_dma_end_r )
767
768//-------------------------------------------------
769//  sound_dma_end_r -
770//-------------------------------------------------
771
772READ16_MEMBER( ste_state::sound_dma_end_r )
700773{
701   atarist_state *state = space->machine->driver_data<atarist_state>();
702
703774   switch (offset)
704775   {
705776   case 0x00:
706      return (state->dmasnd_end >> 16) & 0x3f;
777      return (m_dmasnd_end >> 16) & 0x3f;
707778   case 0x01:
708      return (state->dmasnd_end >> 8) & 0xff;
779      return (m_dmasnd_end >> 8) & 0xff;
709780   case 0x02:
710      return state->dmasnd_end & 0xff;
781      return m_dmasnd_end & 0xff;
711782   }
712783
713784   return 0;
714785}
715786
716static READ16_HANDLER( atariste_sound_mode_r )
787
788//-------------------------------------------------
789//  sound_mode_r -
790//-------------------------------------------------
791
792READ16_MEMBER( ste_state::sound_mode_r )
717793{
718   atarist_state *state = space->machine->driver_data<atarist_state>();
719
720   return state->dmasnd_mode;
794   return m_dmasnd_mode;
721795}
722796
723static WRITE16_HANDLER( atariste_sound_dma_control_w )
797
798//-------------------------------------------------
799//  sound_dma_control_w -
800//-------------------------------------------------
801
802WRITE16_MEMBER( ste_state::sound_dma_control_w )
724803{
725   atarist_state *state = space->machine->driver_data<atarist_state>();
804   m_dmasnd_ctrl = data & 0x03;
726805
727   state->dmasnd_ctrl = data & 0x03;
728
729   if (state->dmasnd_ctrl & 0x01)
806   if (m_dmasnd_ctrl & 0x01)
730807   {
731      if (!state->dmasnd_active)
808      if (!m_dmasnd_active)
732809      {
733         atariste_dmasound_set_state(space->machine, 1);
734         timer_adjust_periodic(state->dmasound_timer, attotime_zero, 0, ATTOTIME_IN_HZ(DMASOUND_RATE[state->dmasnd_mode & 0x03]));
810         dmasound_set_state(1);
811         timer_adjust_periodic(m_dmasound_timer, attotime_zero, 0, ATTOTIME_IN_HZ(DMASOUND_RATE[m_dmasnd_mode & 0x03]));
735812      }
736813   }
737814   else
738815   {
739      atariste_dmasound_set_state(space->machine, 0);
740      timer_enable(state->dmasound_timer, 0);
816      dmasound_set_state(0);
817      timer_enable(m_dmasound_timer, 0);
741818   }
742819}
743820
744static WRITE16_HANDLER( atariste_sound_dma_base_w )
821
822//-------------------------------------------------
823//  sound_dma_base_w -
824//-------------------------------------------------
825
826WRITE16_MEMBER( ste_state::sound_dma_base_w )
745827{
746   atarist_state *state = space->machine->driver_data<atarist_state>();
747
748828   switch (offset)
749829   {
750830   case 0x00:
751      state->dmasnd_base = (data << 16) & 0x3f0000;
831      m_dmasnd_base = (data << 16) & 0x3f0000;
752832      break;
753833   case 0x01:
754      state->dmasnd_base = (state->dmasnd_base & 0x3f00fe) | (data & 0xff) << 8;
834      m_dmasnd_base = (m_dmasnd_base & 0x3f00fe) | (data & 0xff) << 8;
755835      break;
756836   case 0x02:
757      state->dmasnd_base = (state->dmasnd_base & 0x3fff00) | (data & 0xfe);
837      m_dmasnd_base = (m_dmasnd_base & 0x3fff00) | (data & 0xfe);
758838      break;
759839   }
760840
761   if (!state->dmasnd_active)
841   if (!m_dmasnd_active)
762842   {
763      state->dmasnd_baselatch = state->dmasnd_base;
843      m_dmasnd_baselatch = m_dmasnd_base;
764844   }
765845}
766846
767static WRITE16_HANDLER( atariste_sound_dma_end_w )
847
848//-------------------------------------------------
849//  sound_dma_end_w -
850//-------------------------------------------------
851
852WRITE16_MEMBER( ste_state::sound_dma_end_w )
768853{
769   atarist_state *state = space->machine->driver_data<atarist_state>();
770
771854   switch (offset)
772855   {
773856   case 0x00:
774      state->dmasnd_end = (data << 16) & 0x3f0000;
857      m_dmasnd_end = (data << 16) & 0x3f0000;
775858      break;
776859   case 0x01:
777      state->dmasnd_end = (state->dmasnd_end & 0x3f00fe) | (data & 0xff) << 8;
860      m_dmasnd_end = (m_dmasnd_end & 0x3f00fe) | (data & 0xff) << 8;
778861      break;
779862   case 0x02:
780      state->dmasnd_end = (state->dmasnd_end & 0x3fff00) | (data & 0xfe);
863      m_dmasnd_end = (m_dmasnd_end & 0x3fff00) | (data & 0xfe);
781864      break;
782865   }
783866
784   if (!state->dmasnd_active)
867   if (!m_dmasnd_active)
785868   {
786      state->dmasnd_endlatch = state->dmasnd_end;
869      m_dmasnd_endlatch = m_dmasnd_end;
787870   }
788871}
789872
790static WRITE16_HANDLER( atariste_sound_mode_w )
873
874//-------------------------------------------------
875//  sound_mode_w -
876//-------------------------------------------------
877
878WRITE16_MEMBER( ste_state::sound_mode_w )
791879{
792   atarist_state *state = space->machine->driver_data<atarist_state>();
793
794   state->dmasnd_mode = data & 0x8f;
880   m_dmasnd_mode = data & 0x8f;
795881}
796882
797/* Microwire */
798883
799static void atariste_microwire_shift(running_machine *machine)
884
885//**************************************************************************
886//   MICROWIRE
887//**************************************************************************
888
889//-------------------------------------------------
890//  microwire_shift -
891//-------------------------------------------------
892
893void ste_state::microwire_shift()
800894{
801   atarist_state *state = machine->driver_data<atarist_state>();
802
803   if (BIT(state->mw_mask, 15))
895   if (BIT(m_mw_mask, 15))
804896   {
805      lmc1992_data_w(state->lmc1992, BIT(state->mw_data, 15));
806      lmc1992_clock_w(state->lmc1992, 1);
807      lmc1992_clock_w(state->lmc1992, 0);
897      lmc1992_data_w(m_lmc1992, BIT(m_mw_data, 15));
898      lmc1992_clock_w(m_lmc1992, 1);
899      lmc1992_clock_w(m_lmc1992, 0);
808900   }
809901
810902   // rotate mask and data left
811
812   state->mw_mask = (state->mw_mask << 1) | BIT(state->mw_mask, 15);
813   state->mw_data = (state->mw_data << 1) | BIT(state->mw_data, 15);
814   state->mw_shift++;
903   m_mw_mask = (m_mw_mask << 1) | BIT(m_mw_mask, 15);
904   m_mw_data = (m_mw_data << 1) | BIT(m_mw_data, 15);
905   m_mw_shift++;
815906}
816907
817static TIMER_CALLBACK( atariste_microwire_tick )
908
909//-------------------------------------------------
910//  microwire_tick -
911//-------------------------------------------------
912
913void ste_state::microwire_tick()
818914{
819   atarist_state *state = machine->driver_data<atarist_state>();
820
821   switch (state->mw_shift)
915   switch (m_mw_shift)
822916   {
823917   case 0:
824      lmc1992_enable_w(state->lmc1992, 0);
825      atariste_microwire_shift(machine);
918      lmc1992_enable_w(m_lmc1992, 0);
919      microwire_shift();
826920      break;
827921
828922   default:
829      atariste_microwire_shift(machine);
923      microwire_shift();
830924      break;
831925
832926   case 15:
833      atariste_microwire_shift(machine);
834      lmc1992_enable_w(state->lmc1992, 1);
835      state->mw_shift = 0;
836      timer_enable(state->microwire_timer, 0);
927      microwire_shift();
928      lmc1992_enable_w(m_lmc1992, 1);
929      m_mw_shift = 0;
930      timer_enable(m_microwire_timer, 0);
837931      break;
838932   }
839933}
840934
841static READ16_HANDLER( atariste_microwire_data_r )
935
936//-------------------------------------------------
937//  TIMER_CALLBACK( atariste_microwire_tick )
938//-------------------------------------------------
939
940static TIMER_CALLBACK( atariste_microwire_tick )
842941{
843   atarist_state *state = space->machine->driver_data<atarist_state>();
942   ste_state *state = machine->driver_data<ste_state>();
844943
845   return state->mw_data;
944   state->microwire_tick();
846945}
847946
848static WRITE16_HANDLER( atariste_microwire_data_w )
947
948//-------------------------------------------------
949//  microwire_data_r -
950//-------------------------------------------------
951
952READ16_MEMBER( ste_state::microwire_data_r )
849953{
850   atarist_state *state = space->machine->driver_data<atarist_state>();
954   return m_mw_data;
955}
851956
852   if (!timer_enabled(state->microwire_timer))
957
958//-------------------------------------------------
959//  microwire_data_w -
960//-------------------------------------------------
961
962WRITE16_MEMBER( ste_state::microwire_data_w )
963{
964   if (!timer_enabled(m_microwire_timer))
853965   {
854      state->mw_data = data;
855      timer_adjust_periodic(state->microwire_timer, attotime_zero, 0, ATTOTIME_IN_USEC(2));
966      m_mw_data = data;
967      timer_adjust_periodic(m_microwire_timer, attotime_zero, 0, ATTOTIME_IN_USEC(2));
856968   }
857969}
858970
859static READ16_HANDLER( atariste_microwire_mask_r )
971
972//-------------------------------------------------
973//  microwire_mask_r -
974//-------------------------------------------------
975
976READ16_MEMBER( ste_state::microwire_mask_r )
860977{
861   atarist_state *state = space->machine->driver_data<atarist_state>();
862
863   return state->mw_mask;
978   return m_mw_mask;
864979}
865980
866static WRITE16_HANDLER( atariste_microwire_mask_w )
981
982//-------------------------------------------------
983//  microwire_mask_w -
984//-------------------------------------------------
985
986WRITE16_MEMBER( ste_state::microwire_mask_w )
867987{
868   atarist_state *state = space->machine->driver_data<atarist_state>();
869
870   if (!timer_enabled(state->microwire_timer))
988   if (!timer_enabled(m_microwire_timer))
871989   {
872      state->mw_mask = data;
990      m_mw_mask = data;
873991   }
874992}
875993
876/* Mega STe Cache */
877994
878static READ16_HANDLER( megaste_cache_r )
995
996//**************************************************************************
997//   CACHE
998//**************************************************************************
999
1000//-------------------------------------------------
1001//  cache_r -
1002//-------------------------------------------------
1003
1004READ16_MEMBER( megaste_state::cache_r )
8791005{
880   atarist_state *state = space->machine->driver_data<atarist_state>();
881
882   return state->megaste_cache;
1006   return m_megaste_cache;
8831007}
8841008
885static WRITE16_HANDLER( megaste_cache_w )
1009
1010//-------------------------------------------------
1011//  cache_w -
1012//-------------------------------------------------
1013
1014WRITE16_MEMBER( megaste_state::cache_w )
8861015{
887   atarist_state *state = space->machine->driver_data<atarist_state>();
1016   m_megaste_cache = data;
8881017
889   state->megaste_cache = data;
890
891   cputag_set_clock(space->machine, M68000_TAG, BIT(data, 0) ? Y2/2 : Y2/4);
1018   m_maincpu->set_unscaled_clock(BIT(data, 0) ? Y2/2 : Y2/4);
8921019}
8931020
894/* ST Book */
8951021
896static READ16_HANDLER( stbook_config_r )
1022
1023//**************************************************************************
1024//   STBOOK
1025//**************************************************************************
1026
1027//-------------------------------------------------
1028//  config_r -
1029//-------------------------------------------------
1030
1031READ16_MEMBER( stbook_state::config_r )
8971032{
8981033   /*
8991034
r9971r9972
9181053
9191054    */
9201055
921   return (input_port_read(space->machine, "SW400") << 8) | 0xff;
1056   return (input_port_read(machine, "SW400") << 8) | 0xff;
9221057}
9231058
924static WRITE16_HANDLER( stbook_lcd_control_w )
1059
1060//-------------------------------------------------
1061//  lcd_control_w -
1062//-------------------------------------------------
1063
1064WRITE16_MEMBER( stbook_state::lcd_control_w )
9251065{
9261066   /*
9271067
r9971r9972
9391079    */
9401080}
9411081
942/* Memory Maps */
9431082
944static ADDRESS_MAP_START( ikbd_map, ADDRESS_SPACE_PROGRAM, 8 )
945   AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_internal_registers_r, hd63701_internal_registers_w)
1083
1084//**************************************************************************
1085//   ADDRESS MAPS
1086//**************************************************************************
1087
1088//-------------------------------------------------
1089//  ADDRESS_MAP( ikbd_map )
1090//-------------------------------------------------
1091
1092static ADDRESS_MAP_START( ikbd_map, ADDRESS_SPACE_PROGRAM, 8, st_state )
1093   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(hd63701_internal_registers_r, hd63701_internal_registers_w)
9461094   AM_RANGE(0x0080, 0x00ff) AM_RAM
947   AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(HD6301_TAG, 0)
1095   AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(HD6301V1_TAG, 0)
9481096ADDRESS_MAP_END
9491097
950static ADDRESS_MAP_START( ikbd_io_map, ADDRESS_SPACE_IO, 8 )
1098
1099//-------------------------------------------------
1100//  ADDRESS_MAP( ikbd_io_map )
1101//-------------------------------------------------
1102
1103static ADDRESS_MAP_START( ikbd_io_map, ADDRESS_SPACE_IO, 8, st_state )
9511104   AM_RANGE(HD63701_PORT1, HD63701_PORT1) AM_READ(ikbd_port1_r)
9521105   AM_RANGE(HD63701_PORT2, HD63701_PORT2) AM_READWRITE(ikbd_port2_r, ikbd_port2_w)
9531106   AM_RANGE(HD63701_PORT3, HD63701_PORT3) AM_WRITE(ikbd_port3_w)
9541107   AM_RANGE(HD63701_PORT4, HD63701_PORT4) AM_READWRITE(ikbd_port4_r, ikbd_port4_w)
9551108ADDRESS_MAP_END
9561109
957static ADDRESS_MAP_START( st_map, ADDRESS_SPACE_PROGRAM, 16 )
958   AM_RANGE(0x000000, 0x000007) AM_RAM
959   AM_RANGE(0x000008, 0x1fffff) AM_RAM
1110
1111//-------------------------------------------------
1112//  ADDRESS_MAP( st_map )
1113//-------------------------------------------------
1114
1115static ADDRESS_MAP_START( st_map, ADDRESS_SPACE_PROGRAM, 16, st_state )
1116   AM_RANGE(0x000000, 0x1fffff) AM_RAM
9601117   AM_RANGE(0x200000, 0x3fffff) AM_RAM
9611118//   AM_RANGE(0xfa0000, 0xfbffff) AM_ROM // cartridge
9621119   AM_RANGE(0xfc0000, 0xfeffff) AM_ROM AM_REGION(M68000_TAG, 0)
963   AM_RANGE(0xff8000, 0xff8001) AM_READWRITE(atarist_mmu_r, atarist_mmu_w)
964   AM_RANGE(0xff8200, 0xff8203) AM_READWRITE(atarist_shifter_base_r, atarist_shifter_base_w)
965   AM_RANGE(0xff8204, 0xff8209) AM_READ(atarist_shifter_counter_r)
966   AM_RANGE(0xff820a, 0xff820b) AM_READWRITE8(atarist_shifter_sync_r, atarist_shifter_sync_w, 0xff00)
967   AM_RANGE(0xff8240, 0xff825f) AM_READWRITE(atarist_shifter_palette_r, atarist_shifter_palette_w)
968   AM_RANGE(0xff8260, 0xff8261) AM_READWRITE8(atarist_shifter_mode_r, atarist_shifter_mode_w, 0xff00)
969   AM_RANGE(0xff8604, 0xff8605) AM_READWRITE(atarist_fdc_data_r, atarist_fdc_data_w)
970   AM_RANGE(0xff8606, 0xff8607) AM_READWRITE(atarist_fdc_dma_status_r, atarist_fdc_dma_mode_w)
971   AM_RANGE(0xff8608, 0xff860d) AM_READWRITE8(atarist_fdc_dma_base_r, atarist_fdc_dma_base_w, 0x00ff)
972   AM_RANGE(0xff8800, 0xff8801) AM_DEVREADWRITE8(YM2149_TAG, ay8910_r, ay8910_data_w, 0xff00)
973   AM_RANGE(0xff8802, 0xff8803) AM_DEVWRITE8(YM2149_TAG, ay8910_data_w, 0xff00)
974   AM_RANGE(0xfffa00, 0xfffa2f) AM_DEVREADWRITE8(MC68901_TAG, mc68901_register_r, mc68901_register_w, 0xff)
975   AM_RANGE(0xfffc00, 0xfffc01) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_stat_r, acia6850_ctrl_w, 0xff00)
976   AM_RANGE(0xfffc02, 0xfffc03) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_data_r, acia6850_data_w, 0xff00)
977   AM_RANGE(0xfffc04, 0xfffc05) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_stat_r, acia6850_ctrl_w, 0xff00)
978   AM_RANGE(0xfffc06, 0xfffc07) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_data_r, acia6850_data_w, 0xff00)
1120   AM_RANGE(0xff8000, 0xff8001) AM_READWRITE8(mmu_r, mmu_w, 0x00ff)
1121   AM_RANGE(0xff8200, 0xff8203) AM_READWRITE8(shifter_base_r, shifter_base_w, 0x00ff)
1122   AM_RANGE(0xff8204, 0xff8209) AM_READ8(shifter_counter_r, 0x00ff)
1123   AM_RANGE(0xff820a, 0xff820b) AM_READWRITE8(shifter_sync_r, shifter_sync_w, 0xff00)
1124   AM_RANGE(0xff8240, 0xff825f) AM_READWRITE(shifter_palette_r, shifter_palette_w)
1125   AM_RANGE(0xff8260, 0xff8261) AM_READWRITE8(shifter_mode_r, shifter_mode_w, 0xff00)
1126   AM_RANGE(0xff8604, 0xff8605) AM_READWRITE(fdc_data_r, fdc_data_w)
1127   AM_RANGE(0xff8606, 0xff8607) AM_READWRITE(dma_status_r, dma_mode_w)
1128   AM_RANGE(0xff8608, 0xff860d) AM_READWRITE8(dma_counter_r, dma_base_w, 0x00ff)
1129   AM_RANGE(0xff8800, 0xff8801) AM_DEVREADWRITE8_LEGACY(YM2149_TAG, ay8910_r, ay8910_data_w, 0xff00)
1130   AM_RANGE(0xff8802, 0xff8803) AM_DEVWRITE8_LEGACY(YM2149_TAG, ay8910_data_w, 0xff00)
1131   AM_RANGE(0xfffa00, 0xfffa3f) AM_DEVREADWRITE8(MC68901_TAG, mc68901_device, read, write, 0x00ff)
1132   AM_RANGE(0xfffc00, 0xfffc01) AM_DEVREADWRITE8_LEGACY(MC6850_0_TAG, acia6850_stat_r, acia6850_ctrl_w, 0xff00)
1133   AM_RANGE(0xfffc02, 0xfffc03) AM_DEVREADWRITE8_LEGACY(MC6850_0_TAG, acia6850_data_r, acia6850_data_w, 0xff00)
1134   AM_RANGE(0xfffc04, 0xfffc05) AM_DEVREADWRITE8_LEGACY(MC6850_1_TAG, acia6850_stat_r, acia6850_ctrl_w, 0xff00)
1135   AM_RANGE(0xfffc06, 0xfffc07) AM_DEVREADWRITE8_LEGACY(MC6850_1_TAG, acia6850_data_r, acia6850_data_w, 0xff00)
9791136ADDRESS_MAP_END
9801137
981static ADDRESS_MAP_START( megast_map, ADDRESS_SPACE_PROGRAM, 16 )
982   AM_RANGE(0x000000, 0x000007) AM_ROM AM_REGION(M68000_TAG, 0)
983   AM_RANGE(0x000008, 0x1fffff) AM_RAM
984   AM_RANGE(0x200000, 0x3fffff) AM_RAM
985//   AM_RANGE(0xfa0000, 0xfbffff) AM_ROM // cartridge
986   AM_RANGE(0xfc0000, 0xfeffff) AM_ROM AM_REGION(M68000_TAG, 0)
987   AM_RANGE(0xff7f30, 0xff7f31) AM_READWRITE(atarist_blitter_dst_inc_y_r, atarist_blitter_dst_inc_y_w) // for TOS 1.02
988   AM_RANGE(0xff8000, 0xff8007) AM_READWRITE(atarist_mmu_r, atarist_mmu_w)
989   AM_RANGE(0xff8200, 0xff8203) AM_READWRITE(atarist_shifter_base_r, atarist_shifter_base_w)
990   AM_RANGE(0xff8204, 0xff8209) AM_READ(atarist_shifter_counter_r)
991   AM_RANGE(0xff820a, 0xff820b) AM_READWRITE8(atarist_shifter_sync_r, atarist_shifter_sync_w, 0xff00)
992   AM_RANGE(0xff8240, 0xff825f) AM_READWRITE(atarist_shifter_palette_r, atarist_shifter_palette_w)
993   AM_RANGE(0xff8260, 0xff8261) AM_READWRITE8(atarist_shifter_mode_r, atarist_shifter_mode_w, 0xff00)
994   AM_RANGE(0xff8604, 0xff8605) AM_READWRITE(atarist_fdc_data_r, atarist_fdc_data_w)
995   AM_RANGE(0xff8606, 0xff8607) AM_READWRITE(atarist_fdc_dma_status_r, atarist_fdc_dma_mode_w)
996   AM_RANGE(0xff8608, 0xff860d) AM_READWRITE8(atarist_fdc_dma_base_r, atarist_fdc_dma_base_w, 0x00ff)
997   AM_RANGE(0xff8800, 0xff8801) AM_DEVREADWRITE8(YM2149_TAG, ay8910_r, ay8910_data_w, 0xff00)
998   AM_RANGE(0xff8802, 0xff8803) AM_DEVWRITE8(YM2149_TAG, ay8910_data_w, 0xff00)
999   AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(atarist_blitter_halftone_r, atarist_blitter_halftone_w)
1000   AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(atarist_blitter_src_inc_x_r, atarist_blitter_src_inc_x_w)
1001   AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(atarist_blitter_src_inc_y_r, atarist_blitter_src_inc_y_w)
1002   AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(atarist_blitter_src_r, atarist_blitter_src_w)
1003   AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(atarist_blitter_end_mask_r, atarist_blitter_end_mask_w)
1004   AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(atarist_blitter_dst_inc_x_r, atarist_blitter_dst_inc_x_w)
1005   AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(atarist_blitter_dst_inc_y_r, atarist_blitter_dst_inc_y_w)
1006   AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(atarist_blitter_dst_r, atarist_blitter_dst_w)
1007   AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(atarist_blitter_count_x_r, atarist_blitter_count_x_w)
1008   AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(atarist_blitter_count_y_r, atarist_blitter_count_y_w)
1009   AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(atarist_blitter_op_r, atarist_blitter_op_w)
1010   AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(atarist_blitter_ctrl_r, atarist_blitter_ctrl_w)
1011   AM_RANGE(0xfffa00, 0xfffa3f) AM_DEVREADWRITE8(MC68901_TAG, mc68901_register_r, mc68901_register_w, 0xff)
1012//  AM_RANGE(0xfffa40, 0xfffa57) AM_READWRITE(megast_fpu_r, megast_fpu_w)
1013   AM_RANGE(0xfffc00, 0xfffc01) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_stat_r, acia6850_ctrl_w, 0xff00)
1014   AM_RANGE(0xfffc02, 0xfffc03) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_data_r, acia6850_data_w, 0xff00)
1015   AM_RANGE(0xfffc04, 0xfffc05) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_stat_r, acia6850_ctrl_w, 0xff00)
1016   AM_RANGE(0xfffc06, 0xfffc07) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_data_r, acia6850_data_w, 0xff00)
1017   AM_RANGE(0xfffc20, 0xfffc3f) AM_DEVREADWRITE(RP5C15_TAG, rp5c15_r, rp5c15_w)
1138
1139//-------------------------------------------------
1140//  ADDRESS_MAP( megast_map )
1141//-------------------------------------------------
1142
1143static ADDRESS_MAP_START( megast_map, ADDRESS_SPACE_PROGRAM, 16, megast_state )
1144   AM_IMPORT_FROM(st_map)
1145/*   AM_RANGE(0xff7f30, 0xff7f31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w) // for TOS 1.02
1146   AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(blitter_halftone_r, blitter_halftone_w)
1147   AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(blitter_src_inc_x_r, blitter_src_inc_x_w)
1148   AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(blitter_src_inc_y_r, blitter_src_inc_y_w)
1149   AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(blitter_src_r, blitter_src_w)
1150   AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(blitter_end_mask_r, blitter_end_mask_w)
1151   AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(blitter_dst_inc_x_r, blitter_dst_inc_x_w)
1152   AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w)
1153   AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(blitter_dst_r, blitter_dst_w)
1154   AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(blitter_count_x_r, blitter_count_x_w)
1155   AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(blitter_count_y_r, blitter_count_y_w)
1156   AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(blitter_op_r, blitter_op_w)
1157   AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(blitter_ctrl_r, blitter_ctrl_w)
1158   AM_RANGE(0xfffa40, 0xfffa57) AM_READWRITE(fpu_r, fpu_w)
1159   AM_RANGE(0xfffc20, 0xfffc3f) AM_DEVREADWRITE_LEGACY(RP5C15_TAG, rp5c15_r, rp5c15_w)*/
10181160ADDRESS_MAP_END
10191161
1020static ADDRESS_MAP_START( ste_map, ADDRESS_SPACE_PROGRAM, 16 )
1021   AM_RANGE(0x000000, 0x000007) AM_ROM AM_REGION(M68000_TAG, 0)
1022   AM_RANGE(0x000008, 0x1fffff) AM_RAM
1023   AM_RANGE(0x200000, 0x3fffff) AM_RAM
1024   AM_RANGE(0xe00000, 0xe3ffff) AM_ROM AM_REGION(M68000_TAG, 0)
1025//   AM_RANGE(0xfa0000, 0xfbffff) AM_ROM // cartridge
1026//   AM_RANGE(0xfc0000, 0xfeffff) AM_ROM
1027   AM_RANGE(0xff8000, 0xff8001) AM_READWRITE(atarist_mmu_r, atarist_mmu_w)
1028   AM_RANGE(0xff8200, 0xff8203) AM_READWRITE(atarist_shifter_base_r, atarist_shifter_base_w)
1029   AM_RANGE(0xff8204, 0xff8209) AM_READWRITE(atariste_shifter_counter_r, atariste_shifter_counter_w)
1030   AM_RANGE(0xff820a, 0xff820b) AM_READWRITE8(atarist_shifter_sync_r, atarist_shifter_sync_w, 0xff00)
1031   AM_RANGE(0xff820c, 0xff820d) AM_READWRITE(atariste_shifter_base_low_r, atariste_shifter_base_low_w)
1032   AM_RANGE(0xff820e, 0xff820f) AM_READWRITE(atariste_shifter_lineofs_r, atariste_shifter_lineofs_w)
1033   AM_RANGE(0xff8240, 0xff825f) AM_READWRITE(atarist_shifter_palette_r, atariste_shifter_palette_w)
1034   AM_RANGE(0xff8260, 0xff8261) AM_READWRITE8(atarist_shifter_mode_r, atarist_shifter_mode_w, 0xff00)
1035   AM_RANGE(0xff8264, 0xff8265) AM_READWRITE(atariste_shifter_pixelofs_r, atariste_shifter_pixelofs_w)
1036   AM_RANGE(0xff8604, 0xff8605) AM_READWRITE(atarist_fdc_data_r, atarist_fdc_data_w)
1037   AM_RANGE(0xff8606, 0xff8607) AM_READWRITE(atarist_fdc_dma_status_r, atarist_fdc_dma_mode_w)
1038   AM_RANGE(0xff8608, 0xff860d) AM_READWRITE8(atarist_fdc_dma_base_r, atarist_fdc_dma_base_w, 0x00ff)
1039   AM_RANGE(0xff8800, 0xff8801) AM_DEVREADWRITE8(YM2149_TAG, ay8910_r, ay8910_data_w, 0xff00)
1040   AM_RANGE(0xff8802, 0xff8803) AM_DEVWRITE8(YM2149_TAG, ay8910_data_w, 0xff00)
1041   AM_RANGE(0xff8900, 0xff8901) AM_READWRITE(atariste_sound_dma_control_r, atariste_sound_dma_control_w)
1042   AM_RANGE(0xff8902, 0xff8907) AM_READWRITE(atariste_sound_dma_base_r, atariste_sound_dma_base_w)
1043   AM_RANGE(0xff8908, 0xff890d) AM_READ(atariste_sound_dma_counter_r)
1044   AM_RANGE(0xff890e, 0xff8913) AM_READWRITE(atariste_sound_dma_end_r, atariste_sound_dma_end_w)
1045   AM_RANGE(0xff8920, 0xff8921) AM_READWRITE(atariste_sound_mode_r, atariste_sound_mode_w)
1046   AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(atariste_microwire_data_r, atariste_microwire_data_w)
1047   AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(atariste_microwire_mask_r, atariste_microwire_mask_w)
1048   AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(atarist_blitter_halftone_r, atarist_blitter_halftone_w)
1049   AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(atarist_blitter_src_inc_x_r, atarist_blitter_src_inc_x_w)
1050   AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(atarist_blitter_src_inc_y_r, atarist_blitter_src_inc_y_w)
1051   AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(atarist_blitter_src_r, atarist_blitter_src_w)
1052   AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(atarist_blitter_end_mask_r, atarist_blitter_end_mask_w)
1053   AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(atarist_blitter_dst_inc_x_r, atarist_blitter_dst_inc_x_w)
1054   AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(atarist_blitter_dst_inc_y_r, atarist_blitter_dst_inc_y_w)
1055   AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(atarist_blitter_dst_r, atarist_blitter_dst_w)
1056   AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(atarist_blitter_count_x_r, atarist_blitter_count_x_w)
1057   AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(atarist_blitter_count_y_r, atarist_blitter_count_y_w)
1058   AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(atarist_blitter_op_r, atarist_blitter_op_w)
1059   AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(atarist_blitter_ctrl_r, atarist_blitter_ctrl_w)
1162
1163//-------------------------------------------------
1164//  ADDRESS_MAP( ste_map )
1165//-------------------------------------------------
1166
1167static ADDRESS_MAP_START( ste_map, ADDRESS_SPACE_PROGRAM, 16, ste_state )
1168   AM_IMPORT_FROM(st_map)
1169/*   AM_RANGE(0xe00000, 0xe3ffff) AM_ROM AM_REGION(M68000_TAG, 0)
1170   AM_RANGE(0xff8204, 0xff8209) AM_READWRITE(shifter_counter_r, shifter_counter_w)
1171   AM_RANGE(0xff820c, 0xff820d) AM_READWRITE(shifter_base_low_r, shifter_base_low_w)
1172   AM_RANGE(0xff820e, 0xff820f) AM_READWRITE(shifter_lineofs_r, shifter_lineofs_w)
1173   AM_RANGE(0xff8264, 0xff8265) AM_READWRITE(shifter_pixelofs_r, shifter_pixelofs_w)
1174   AM_RANGE(0xff8900, 0xff8901) AM_READWRITE(sound_dma_control_r, sound_dma_control_w)
1175   AM_RANGE(0xff8902, 0xff8907) AM_READWRITE(sound_dma_base_r, sound_dma_base_w)
1176   AM_RANGE(0xff8908, 0xff890d) AM_READ(sound_dma_counter_r)
1177   AM_RANGE(0xff890e, 0xff8913) AM_READWRITE(sound_dma_end_r, sound_dma_end_w)
1178   AM_RANGE(0xff8920, 0xff8921) AM_READWRITE(sound_mode_r, sound_mode_w)
1179   AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(microwire_data_r, microwire_data_w)
1180   AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(microwire_mask_r, microwire_mask_w)
1181   AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(blitter_halftone_r, blitter_halftone_w)
1182   AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(blitter_src_inc_x_r, blitter_src_inc_x_w)
1183   AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(blitter_src_inc_y_r, blitter_src_inc_y_w)
1184   AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(blitter_src_r, blitter_src_w)
1185   AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(blitter_end_mask_r, blitter_end_mask_w)
1186   AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(blitter_dst_inc_x_r, blitter_dst_inc_x_w)
1187   AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w)
1188   AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(blitter_dst_r, blitter_dst_w)
1189   AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(blitter_count_x_r, blitter_count_x_w)
1190   AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(blitter_count_y_r, blitter_count_y_w)
1191   AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(blitter_op_r, blitter_op_w)
1192   AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(blitter_ctrl_r, blitter_ctrl_w)
10601193   AM_RANGE(0xff9200, 0xff9201) AM_READ_PORT("JOY0")
10611194   AM_RANGE(0xff9202, 0xff9203) AM_READ_PORT("JOY1")
10621195   AM_RANGE(0xff9210, 0xff9211) AM_READ_PORT("PADDLE0X")
r9971r9972
10641197   AM_RANGE(0xff9214, 0xff9215) AM_READ_PORT("PADDLE1X")
10651198   AM_RANGE(0xff9216, 0xff9217) AM_READ_PORT("PADDLE1Y")
10661199   AM_RANGE(0xff9220, 0xff9221) AM_READ_PORT("GUNX")
1067   AM_RANGE(0xff9222, 0xff9223) AM_READ_PORT("GUNY")
1068   AM_RANGE(0xfffa00, 0xfffa2f) AM_DEVREADWRITE8(MC68901_TAG, mc68901_register_r, mc68901_register_w, 0xff)
1069   AM_RANGE(0xfffc00, 0xfffc01) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_stat_r, acia6850_ctrl_w, 0xff00)
1070   AM_RANGE(0xfffc02, 0xfffc03) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_data_r, acia6850_data_w, 0xff00)
1071   AM_RANGE(0xfffc04, 0xfffc05) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_stat_r, acia6850_ctrl_w, 0xff00)
1072   AM_RANGE(0xfffc06, 0xfffc07) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_data_r, acia6850_data_w, 0xff00)
1200   AM_RANGE(0xff9222, 0xff9223) AM_READ_PORT("GUNY")*/
10731201ADDRESS_MAP_END
10741202
1075static ADDRESS_MAP_START( megaste_map, ADDRESS_SPACE_PROGRAM, 16 )
1076   AM_RANGE(0x000000, 0x000007) AM_ROM AM_REGION(M68000_TAG, 0)
1077   AM_RANGE(0x000008, 0x1fffff) AM_RAM
1078   AM_RANGE(0x200000, 0x3fffff) AM_RAM
1079   AM_RANGE(0xe00000, 0xe3ffff) AM_ROM AM_REGION(M68000_TAG, 0)
1080//   AM_RANGE(0xfa0000, 0xfbffff) AM_ROM // cartridge
1081//   AM_RANGE(0xfc0000, 0xfeffff) AM_ROM
1082   AM_RANGE(0xff8000, 0xff8007) AM_READWRITE(atarist_mmu_r, atarist_mmu_w)
1083   AM_RANGE(0xff8200, 0xff8203) AM_READWRITE(atarist_shifter_base_r, atarist_shifter_base_w)
1084   AM_RANGE(0xff8204, 0xff8209) AM_READWRITE(atariste_shifter_counter_r, atariste_shifter_counter_w)
1085   AM_RANGE(0xff820a, 0xff820b) AM_READWRITE8(atarist_shifter_sync_r, atarist_shifter_sync_w, 0xff00)
1086   AM_RANGE(0xff820c, 0xff820d) AM_READWRITE(atariste_shifter_base_low_r, atariste_shifter_base_low_w)
1087   AM_RANGE(0xff820e, 0xff820f) AM_READWRITE(atariste_shifter_lineofs_r, atariste_shifter_lineofs_w)
1088   AM_RANGE(0xff8240, 0xff825f) AM_READWRITE(atarist_shifter_palette_r, atariste_shifter_palette_w)
1089   AM_RANGE(0xff8260, 0xff8261) AM_READWRITE8(atarist_shifter_mode_r, atarist_shifter_mode_w, 0xff00)
1090   AM_RANGE(0xff8264, 0xff8265) AM_READWRITE(atariste_shifter_pixelofs_r, atariste_shifter_pixelofs_w)
1091   AM_RANGE(0xff8604, 0xff8605) AM_READWRITE(atarist_fdc_data_r, atarist_fdc_data_w)
1092   AM_RANGE(0xff8606, 0xff8607) AM_READWRITE(atarist_fdc_dma_status_r, atarist_fdc_dma_mode_w)
1093   AM_RANGE(0xff8608, 0xff860d) AM_READWRITE8(atarist_fdc_dma_base_r, atarist_fdc_dma_base_w, 0x00ff)
1094   AM_RANGE(0xff8800, 0xff8801) AM_DEVREADWRITE8(YM2149_TAG, ay8910_r, ay8910_data_w, 0xff00)
1095   AM_RANGE(0xff8802, 0xff8803) AM_DEVWRITE8(YM2149_TAG, ay8910_data_w, 0xff00)
1096   AM_RANGE(0xff8900, 0xff8901) AM_READWRITE(atariste_sound_dma_control_r, atariste_sound_dma_control_w)
1097   AM_RANGE(0xff8902, 0xff8907) AM_READWRITE(atariste_sound_dma_base_r, atariste_sound_dma_base_w)
1098   AM_RANGE(0xff8908, 0xff890d) AM_READ(atariste_sound_dma_counter_r)
1099   AM_RANGE(0xff890e, 0xff8913) AM_READWRITE(atariste_sound_dma_end_r, atariste_sound_dma_end_w)
1100   AM_RANGE(0xff8920, 0xff8921) AM_READWRITE(atariste_sound_mode_r, atariste_sound_mode_w)
1101   AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(atariste_microwire_data_r, atariste_microwire_data_w)
1102   AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(atariste_microwire_mask_r, atariste_microwire_mask_w)
1103   AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(atarist_blitter_halftone_r, atarist_blitter_halftone_w)
1104   AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(atarist_blitter_src_inc_x_r, atarist_blitter_src_inc_x_w)
1105   AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(atarist_blitter_src_inc_y_r, atarist_blitter_src_inc_y_w)
1106   AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(atarist_blitter_src_r, atarist_blitter_src_w)
1107   AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(atarist_blitter_end_mask_r, atarist_blitter_end_mask_w)
1108   AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(atarist_blitter_dst_inc_x_r, atarist_blitter_dst_inc_x_w)
1109   AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(atarist_blitter_dst_inc_y_r, atarist_blitter_dst_inc_y_w)
1110   AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(atarist_blitter_dst_r, atarist_blitter_dst_w)
1111   AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(atarist_blitter_count_x_r, atarist_blitter_count_x_w)
1112   AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(atarist_blitter_count_y_r, atarist_blitter_count_y_w)
1113   AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(atarist_blitter_op_r, atarist_blitter_op_w)
1114   AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(atarist_blitter_ctrl_r, atarist_blitter_ctrl_w)
1203
1204//-------------------------------------------------
1205//  ADDRESS_MAP( megaste_map )
1206//-------------------------------------------------
1207
1208static ADDRESS_MAP_START( megaste_map, ADDRESS_SPACE_PROGRAM, 16, megaste_state )
1209   AM_IMPORT_FROM(st_map)
1210/*   AM_RANGE(0xff8204, 0xff8209) AM_READWRITE(shifter_counter_r, shifter_counter_w)
1211   AM_RANGE(0xff820c, 0xff820d) AM_READWRITE(shifter_base_low_r, shifter_base_low_w)
1212   AM_RANGE(0xff820e, 0xff820f) AM_READWRITE(shifter_lineofs_r, shifter_lineofs_w)
1213   AM_RANGE(0xff8264, 0xff8265) AM_READWRITE(shifter_pixelofs_r, shifter_pixelofs_w)
1214   AM_RANGE(0xff8900, 0xff8901) AM_READWRITE(sound_dma_control_r, sound_dma_control_w)
1215   AM_RANGE(0xff8902, 0xff8907) AM_READWRITE(sound_dma_base_r, sound_dma_base_w)
1216   AM_RANGE(0xff8908, 0xff890d) AM_READ(sound_dma_counter_r)
1217   AM_RANGE(0xff890e, 0xff8913) AM_READWRITE(sound_dma_end_r, sound_dma_end_w)
1218   AM_RANGE(0xff8920, 0xff8921) AM_READWRITE(sound_mode_r, sound_mode_w)
1219   AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(microwire_data_r, microwire_data_w)
1220   AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(microwire_mask_r, microwire_mask_w)
1221   AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(blitter_halftone_r, blitter_halftone_w)
1222   AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(blitter_src_inc_x_r, blitter_src_inc_x_w)
1223   AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(blitter_src_inc_y_r, blitter_src_inc_y_w)
1224   AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(blitter_src_r, blitter_src_w)
1225   AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(blitter_end_mask_r, blitter_end_mask_w)
1226   AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(blitter_dst_inc_x_r, blitter_dst_inc_x_w)
1227   AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w)
1228   AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(blitter_dst_r, blitter_dst_w)
1229   AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(blitter_count_x_r, blitter_count_x_w)
1230   AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(blitter_count_y_r, blitter_count_y_w)
1231   AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(blitter_op_r, blitter_op_w)
1232   AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(blitter_ctrl_r, blitter_ctrl_w)
11151233   AM_RANGE(0xff8e20, 0xff8e21) AM_READWRITE(megaste_cache_r, megaste_cache_w)
1116   AM_RANGE(0xfffa00, 0xfffa3f) AM_DEVREADWRITE8(MC68901_TAG, mc68901_register_r, mc68901_register_w, 0xff)
11171234//  AM_RANGE(0xfffa40, 0xfffa5f) AM_READWRITE(megast_fpu_r, megast_fpu_w)
1118   AM_RANGE(0xff8c80, 0xff8c87) AM_DEVREADWRITE8("scc", scc8530_r, scc8530_w, 0xff00)
1119   AM_RANGE(0xfffc00, 0xfffc01) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_stat_r, acia6850_ctrl_w, 0xff00)
1120   AM_RANGE(0xfffc02, 0xfffc03) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_data_r, acia6850_data_w, 0xff00)
1121   AM_RANGE(0xfffc04, 0xfffc05) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_stat_r, acia6850_ctrl_w, 0xff00)
1122   AM_RANGE(0xfffc06, 0xfffc07) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_data_r, acia6850_data_w, 0xff00)
1123   AM_RANGE(0xfffc20, 0xfffc3f) AM_DEVREADWRITE(RP5C15_TAG, rp5c15_r, rp5c15_w)
1235   AM_RANGE(0xff8c80, 0xff8c87) AM_DEVREADWRITE8_LEGACY(Z8530_TAG, scc8530_r, scc8530_w, 0xff00)
1236   AM_RANGE(0xfffc20, 0xfffc3f) AM_DEVREADWRITE_LEGACY(RP5C15_TAG, rp5c15_r, rp5c15_w)*/
11241237ADDRESS_MAP_END
11251238
1126static ADDRESS_MAP_START( stbook_map, ADDRESS_SPACE_PROGRAM, 16 )
1127   AM_RANGE(0x000000, 0x000007) AM_ROM AM_REGION(M68000_TAG, 0)
1128   AM_RANGE(0x000008, 0x1fffff) AM_RAM
1239
1240//-------------------------------------------------
1241//  ADDRESS_MAP( stbook_map )
1242//-------------------------------------------------
1243
1244static ADDRESS_MAP_START( stbook_map, ADDRESS_SPACE_PROGRAM, 16, stbook_state )
1245   AM_RANGE(0x000000, 0x1fffff) AM_RAM
11291246   AM_RANGE(0x200000, 0x3fffff) AM_RAM
11301247//   AM_RANGE(0xd40000, 0xd7ffff) AM_ROM
11311248   AM_RANGE(0xe00000, 0xe3ffff) AM_ROM AM_REGION(M68000_TAG, 0)
11321249//   AM_RANGE(0xe80000, 0xebffff) AM_ROM
1133//  AM_RANGE(0xf00000, 0xf1ffff) AM_READWRITE(stbook_ide_r, stbook_ide_w)
11341250//   AM_RANGE(0xfa0000, 0xfbffff) AM_ROM // cartridge
1135//   AM_RANGE(0xfc0000, 0xfeffff) AM_ROM
1136/*  AM_RANGE(0xff8000, 0xff8001) AM_READWRITE(stbook_mmu_r, stbook_mmu_w)
1251   AM_RANGE(0xfc0000, 0xfeffff) AM_ROM AM_REGION(M68000_TAG, 0)
1252/*   AM_RANGE(0xf00000, 0xf1ffff) AM_READWRITE(stbook_ide_r, stbook_ide_w)
1253   AM_RANGE(0xff8000, 0xff8001) AM_READWRITE(stbook_mmu_r, stbook_mmu_w)
11371254    AM_RANGE(0xff8200, 0xff8203) AM_READWRITE(stbook_shifter_base_r, stbook_shifter_base_w)
11381255    AM_RANGE(0xff8204, 0xff8209) AM_READWRITE(stbook_shifter_counter_r, stbook_shifter_counter_w)
11391256    AM_RANGE(0xff820a, 0xff820b) AM_READWRITE8(stbook_shifter_sync_r, stbook_shifter_sync_w, 0xff00)
r9971r9972
11411258    AM_RANGE(0xff820e, 0xff820f) AM_READWRITE(stbook_shifter_lineofs_r, stbook_shifter_lineofs_w)
11421259    AM_RANGE(0xff8240, 0xff8241) AM_READWRITE(stbook_shifter_palette_r, stbook_shifter_palette_w)
11431260    AM_RANGE(0xff8260, 0xff8261) AM_READWRITE8(stbook_shifter_mode_r, stbook_shifter_mode_w, 0xff00)
1144    AM_RANGE(0xff8264, 0xff8265) AM_READWRITE(stbook_shifter_pixelofs_r, stbook_shifter_pixelofs_w)*/
1145   AM_RANGE(0xff827e, 0xff827f) AM_WRITE(stbook_lcd_control_w)
1146   AM_RANGE(0xff8604, 0xff8605) AM_READWRITE(atarist_fdc_data_r, atarist_fdc_data_w)
1147   AM_RANGE(0xff8606, 0xff8607) AM_READWRITE(atarist_fdc_dma_status_r, atarist_fdc_dma_mode_w)
1148   AM_RANGE(0xff8608, 0xff860d) AM_READWRITE8(atarist_fdc_dma_base_r, atarist_fdc_dma_base_w, 0x00ff)
1261    AM_RANGE(0xff8264, 0xff8265) AM_READWRITE(stbook_shifter_pixelofs_r, stbook_shifter_pixelofs_w)
1262   AM_RANGE(0xff827e, 0xff827f) AM_WRITE(lcd_control_w)
11491263   AM_RANGE(0xff8800, 0xff8801) AM_DEVREADWRITE8(YM3439_TAG, ay8910_r, ay8910_data_w, 0xff00)
11501264   AM_RANGE(0xff8802, 0xff8803) AM_DEVWRITE8(YM3439_TAG, ay8910_data_w, 0xff00)
1151   AM_RANGE(0xff8900, 0xff8901) AM_READWRITE(atariste_sound_dma_control_r, atariste_sound_dma_control_w)
1152   AM_RANGE(0xff8902, 0xff8907) AM_READWRITE(atariste_sound_dma_base_r, atariste_sound_dma_base_w)
1153   AM_RANGE(0xff8908, 0xff890d) AM_READ(atariste_sound_dma_counter_r)
1154   AM_RANGE(0xff890e, 0xff8913) AM_READWRITE(atariste_sound_dma_end_r, atariste_sound_dma_end_w)
1155   AM_RANGE(0xff8920, 0xff8921) AM_READWRITE(atariste_sound_mode_r, atariste_sound_mode_w)
1156   AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(atariste_microwire_data_r, atariste_microwire_data_w)
1157   AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(atariste_microwire_mask_r, atariste_microwire_mask_w)
1158   AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(atarist_blitter_halftone_r, atarist_blitter_halftone_w)
1159   AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(atarist_blitter_src_inc_x_r, atarist_blitter_src_inc_x_w)
1160   AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(atarist_blitter_src_inc_y_r, atarist_blitter_src_inc_y_w)
1161   AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(atarist_blitter_src_r, atarist_blitter_src_w)
1162   AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(atarist_blitter_end_mask_r, atarist_blitter_end_mask_w)
1163   AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(atarist_blitter_dst_inc_x_r, atarist_blitter_dst_inc_x_w)
1164   AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(atarist_blitter_dst_inc_y_r, atarist_blitter_dst_inc_y_w)
1165   AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(atarist_blitter_dst_r, atarist_blitter_dst_w)
1166   AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(atarist_blitter_count_x_r, atarist_blitter_count_x_w)
1167   AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(atarist_blitter_count_y_r, atarist_blitter_count_y_w)
1168   AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(atarist_blitter_op_r, atarist_blitter_op_w)
1169   AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(atarist_blitter_ctrl_r, atarist_blitter_ctrl_w)
1170   AM_RANGE(0xff9200, 0xff9201) AM_READ(stbook_config_r)
1171/*  AM_RANGE(0xff9202, 0xff9203) AM_READWRITE(stbook_lcd_contrast_r, stbook_lcd_contrast_w)
1172    AM_RANGE(0xff9210, 0xff9211) AM_READWRITE(stbook_power_r, stbook_power_w)
1173    AM_RANGE(0xff9214, 0xff9215) AM_READWRITE(stbook_reference_r, stbook_reference_w)*/
1174   AM_RANGE(0xfffa00, 0xfffa2f) AM_DEVREADWRITE8(MC68901_TAG, mc68901_register_r, mc68901_register_w, 0xff)
1175   AM_RANGE(0xfffc00, 0xfffc01) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_stat_r, acia6850_ctrl_w, 0xff00)
1176   AM_RANGE(0xfffc02, 0xfffc03) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_data_r, acia6850_data_w, 0xff00)
1177   AM_RANGE(0xfffc04, 0xfffc05) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_stat_r, acia6850_ctrl_w, 0xff00)
1178   AM_RANGE(0xfffc06, 0xfffc07) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_data_r, acia6850_data_w, 0xff00)
1265   AM_RANGE(0xff8900, 0xff8901) AM_READWRITE(sound_dma_control_r, sound_dma_control_w)
1266   AM_RANGE(0xff8902, 0xff8907) AM_READWRITE(sound_dma_base_r, sound_dma_base_w)
1267   AM_RANGE(0xff8908, 0xff890d) AM_READ(sound_dma_counter_r)
1268   AM_RANGE(0xff890e, 0xff8913) AM_READWRITE(sound_dma_end_r, sound_dma_end_w)
1269   AM_RANGE(0xff8920, 0xff8921) AM_READWRITE(sound_mode_r, sound_mode_w)
1270   AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(microwire_data_r, microwire_data_w)
1271   AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(microwire_mask_r, microwire_mask_w)
1272   AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(blitter_halftone_r, blitter_halftone_w)
1273   AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(blitter_src_inc_x_r, blitter_src_inc_x_w)
1274   AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(blitter_src_inc_y_r, blitter_src_inc_y_w)
1275   AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(blitter_src_r, blitter_src_w)
1276   AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(blitter_end_mask_r, blitter_end_mask_w)
1277   AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(blitter_dst_inc_x_r, blitter_dst_inc_x_w)
1278   AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w)
1279   AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(blitter_dst_r, blitter_dst_w)
1280   AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(blitter_count_x_r, blitter_count_x_w)
1281   AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(blitter_count_y_r, blitter_count_y_w)
1282   AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(blitter_op_r, blitter_op_w)
1283   AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(blitter_ctrl_r, blitter_ctrl_w)
1284   AM_RANGE(0xff9200, 0xff9201) AM_READ(config_r)
1285   AM_RANGE(0xff9202, 0xff9203) AM_READWRITE(lcd_contrast_r, lcd_contrast_w)
1286    AM_RANGE(0xff9210, 0xff9211) AM_READWRITE(power_r, power_w)
1287    AM_RANGE(0xff9214, 0xff9215) AM_READWRITE(reference_r, reference_w)*/
11791288ADDRESS_MAP_END
11801289
1181/* Input Ports */
11821290
1291
1292//**************************************************************************
1293//   INPUT PORTS
1294//**************************************************************************
1295
1296//-------------------------------------------------
1297//  INPUT_PORTS( ikbd )
1298//-------------------------------------------------
1299
11831300static INPUT_PORTS_START( ikbd )
11841301   PORT_START("P31")
11851302   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
r9971r9972
13111428   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter") PORT_CODE(KEYCODE_ENTER_PAD)
13121429INPUT_PORTS_END
13131430
1431
1432//-------------------------------------------------
1433//  INPUT_PORTS( st )
1434//-------------------------------------------------
1435
13141436static INPUT_PORTS_START( st )
13151437   PORT_START("config")
13161438   PORT_CONFNAME( 0x01, 0x00, "Input Port 0 Device")
r9971r9972
13441466   PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1)
13451467INPUT_PORTS_END
13461468
1469
1470//-------------------------------------------------
1471//  INPUT_PORTS( ste )
1472//-------------------------------------------------
1473
13471474static INPUT_PORTS_START( ste )
13481475   PORT_START("config")
13491476   PORT_CONFNAME( 0x01, 0x00, "Input Port 0 Device")
r9971r9972
13991526   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) PORT_PLAYER(1)
14001527INPUT_PORTS_END
14011528
1529
1530//-------------------------------------------------
1531//  INPUT_PORTS( stbook )
1532//-------------------------------------------------
1533
14021534static INPUT_PORTS_START( stbook )
14031535   PORT_START("SW400")
14041536   PORT_DIPNAME( 0x80, 0x80, "DMA sound hardware")
r9971r9972
14131545   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNUSED )
14141546INPUT_PORTS_END
14151547
1548
1549//-------------------------------------------------
1550//  INPUT_PORTS( tt030 )
1551//-------------------------------------------------
1552
14161553static INPUT_PORTS_START( tt030 )
14171554   PORT_INCLUDE(ste)
14181555INPUT_PORTS_END
14191556
1557
1558//-------------------------------------------------
1559//  INPUT_PORTS( falcon )
1560//-------------------------------------------------
1561
14201562static INPUT_PORTS_START( falcon )
14211563   PORT_INCLUDE(ste)
14221564INPUT_PORTS_END
14231565
1424/* Sound Interface */
14251566
1426static WRITE8_DEVICE_HANDLER( ym2149_port_a_w )
1567
1568//**************************************************************************
1569//   DEVICE CONFIGURATION
1570//**************************************************************************
1571
1572//-------------------------------------------------
1573//  ay8910_interface psg_intf
1574//-------------------------------------------------
1575
1576WRITE8_MEMBER( st_state::psg_pa_w )
14271577{
1428   atarist_state *state = device->machine->driver_data<atarist_state>();
1578   /*
14291579
1430   wd17xx_set_side(state->wd1772, BIT(data, 0) ? 0 : 1);
1580        bit description
14311581
1432   if (!BIT(data, 1))
1433   {
1434      wd17xx_set_drive(state->wd1772, 0);
1435   }
1582        0       SIDE 0
1583        1       DRIVE 0
1584        2       DRIVE 1
1585        3      RTS
1586        4       DTR
1587        5       STROBE
1588        6       GPO
1589        7       
14361590
1437   if (!BIT(data, 2))
1438   {
1439      wd17xx_set_drive(state->wd1772, 1);
1440   }
1591    */
14411592
1442   rs232_rts_w(state->rs232, BIT(data, 3));
1443   rs232_dtr_w(state->rs232, BIT(data, 4));
1593   // side select
1594   wd17xx_set_side(m_fdc, BIT(data, 0) ? 0 : 1);
14441595
1445   centronics_strobe_w(state->centronics, BIT(data, 5));
1596   // drive select
1597   if (!BIT(data, 1)) wd17xx_set_drive(m_fdc, 0);
1598   if (!BIT(data, 2)) wd17xx_set_drive(m_fdc, 1);
14461599
1447   // 0x40 = General Purpose Output
1448   // 0x80 = Reserved
1600   // request to send
1601   rs232_rts_w(m_rs232, BIT(data, 3));
1602
1603   // data terminal ready
1604   rs232_dtr_w(m_rs232, BIT(data, 4));
1605
1606   // centronics strobe
1607   centronics_strobe_w(m_centronics, BIT(data, 5));
14491608}
14501609
14511610static const ay8910_interface psg_intf =
r9971r9972
14541613   { RES_K(1) },
14551614   DEVCB_NULL,
14561615   DEVCB_NULL,
1457   DEVCB_HANDLER(ym2149_port_a_w),
1616   DEVCB_DRIVER_MEMBER(st_state, psg_pa_w),
14581617   DEVCB_DEVICE_HANDLER(CENTRONICS_TAG, centronics_data_w)
14591618};
14601619
1461/* Machine Drivers */
14621620
1463static READ_LINE_DEVICE_HANDLER( ikbd_rx )
1621//-------------------------------------------------
1622//  ay8910_interface stbook_psg_intf
1623//-------------------------------------------------
1624
1625WRITE8_MEMBER( stbook_state::psg_pa_w )
14641626{
1465   atarist_state *driver_state = device->machine->driver_data<atarist_state>();
1627   /*
14661628
1467   return driver_state->ikbd_rx;
1629        bit     description
1630
1631        0       SIDE 0
1632        1       DRIVE 0
1633        2       DRIVE 1
1634        3      RTS
1635        4       DTR
1636        5       STROBE
1637        6       IDE RESET
1638        7       DDEN
1639
1640    */
1641
1642   // side select
1643   wd17xx_set_side(m_fdc, BIT(data, 0) ? 0 : 1);
1644
1645   // drive select
1646   if (!BIT(data, 1)) wd17xx_set_drive(m_fdc, 0);
1647   if (!BIT(data, 2)) wd17xx_set_drive(m_fdc, 1);
1648
1649   // request to send
1650   rs232_rts_w(m_rs232, BIT(data, 3));
1651
1652   // data terminal ready
1653   rs232_dtr_w(m_rs232, BIT(data, 4));
1654
1655   // centronics strobe
1656   centronics_strobe_w(m_centronics, BIT(data, 5));
1657   
1658   // density select
1659   wd17xx_dden_w(m_fdc, BIT(data, 7));
14681660}
14691661
1470static WRITE_LINE_DEVICE_HANDLER( ikbd_tx )
1662static const ay8910_interface stbook_psg_intf =
14711663{
1472   atarist_state *driver_state = device->machine->driver_data<atarist_state>();
1664   AY8910_SINGLE_OUTPUT,
1665   { RES_K(1) },
1666   DEVCB_NULL,
1667   DEVCB_NULL,
1668   DEVCB_DRIVER_MEMBER(stbook_state, psg_pa_w),
1669   DEVCB_DEVICE_HANDLER(CENTRONICS_TAG, centronics_data_w)
1670};
14731671
1474   driver_state->ikbd_tx = state;
1475}
14761672
1477static READ_LINE_DEVICE_HANDLER( midi_rx )
1673//-------------------------------------------------
1674//  ACIA6850_INTERFACE( acia_ikbd_intf )
1675//-------------------------------------------------
1676
1677READ_LINE_MEMBER( st_state::ikbd_rx_r )
14781678{
1479   atarist_state *driver_state = device->machine->driver_data<atarist_state>();
1480
1481   return driver_state->midi_rx;
1679   return m_ikbd_rx;
14821680}
14831681
1484static WRITE_LINE_DEVICE_HANDLER( midi_tx )
1682WRITE_LINE_MEMBER( st_state::ikbd_tx_w )
14851683{
1486   atarist_state *driver_state = device->machine->driver_data<atarist_state>();
1487
1488   driver_state->midi_tx = state;
1684   m_ikbd_tx = state;
14891685}
14901686
1491static WRITE_LINE_DEVICE_HANDLER( acia_interrupt )
1687WRITE_LINE_MEMBER( st_state::acia_irq_w )
14921688{
1493   atarist_state *driver_state = device->machine->driver_data<atarist_state>();
1494
1495   driver_state->acia_irq = state;
1689   m_acia_irq = state;
14961690}
14971691
14981692static ACIA6850_INTERFACE( acia_ikbd_intf )
14991693{
15001694   Y2/64,
15011695   Y2/64,
1502   DEVCB_LINE(ikbd_rx),
1503   DEVCB_LINE(ikbd_tx),
1696   DEVCB_DRIVER_LINE_MEMBER(st_state, ikbd_rx_r),
1697   DEVCB_DRIVER_LINE_MEMBER(st_state, ikbd_tx_w),
15041698   DEVCB_NULL,
15051699   DEVCB_NULL,
15061700   DEVCB_NULL,
1507   DEVCB_LINE(acia_interrupt)
1701   DEVCB_DRIVER_LINE_MEMBER(st_state, acia_irq_w)
15081702};
15091703
1704
1705//-------------------------------------------------
1706//  ACIA6850_INTERFACE( stbook_acia_ikbd_intf )
1707//-------------------------------------------------
1708
1709static ACIA6850_INTERFACE( stbook_acia_ikbd_intf )
1710{
1711   U517/2/16, // 500kHz
1712   U517/2/2, // 1MHZ
1713   DEVCB_DRIVER_LINE_MEMBER(st_state, ikbd_rx_r),
1714   DEVCB_DRIVER_LINE_MEMBER(st_state, ikbd_tx_w),
1715   DEVCB_NULL,
1716   DEVCB_NULL,
1717   DEVCB_NULL,
1718   DEVCB_DRIVER_LINE_MEMBER(st_state, acia_irq_w)
1719};
1720
1721
1722//-------------------------------------------------
1723//  ACIA6850_INTERFACE( acia_midi_intf )
1724//-------------------------------------------------
1725
15101726static ACIA6850_INTERFACE( acia_midi_intf )
15111727{
15121728   Y2/64,
15131729   Y2/64,
1514   DEVCB_LINE(midi_rx),
1515   DEVCB_LINE(midi_tx),
15161730   DEVCB_NULL,
15171731   DEVCB_NULL,
15181732   DEVCB_NULL,
1519   DEVCB_LINE(acia_interrupt)
1733   DEVCB_NULL,
1734   DEVCB_NULL,
1735   DEVCB_DRIVER_LINE_MEMBER(st_state, acia_irq_w)
15201736};
15211737
1522static IRQ_CALLBACK( atarist_int_ack )
1523{
1524   atarist_state *state = device->machine->driver_data<atarist_state>();
15251738
1526   if (irqline == M68K_IRQ_6)
1527   {
1528      return mc68901_get_vector(state->mc68901);
1529   }
1739//-------------------------------------------------
1740//  MC68901_INTERFACE( mfp_intf )
1741//-------------------------------------------------
15301742
1531   return M68K_INT_ACK_AUTOVECTOR;
1532}
1533
1534static READ8_DEVICE_HANDLER( mfp_gpio_r )
1743READ8_MEMBER( st_state::mfp_gpio_r )
15351744{
15361745   /*
15371746
r9971r9972
15481757
15491758    */
15501759
1551   atarist_state *state = device->machine->driver_data<atarist_state>();
1760   UINT8 data = 0;
1761   
1762   // centronics busy
1763   data |= centronics_busy_r(m_centronics);
15521764
1553   UINT8 data = centronics_busy_r(state->centronics);
1765   // data carrier detect
1766   data |= rs232_dcd_r(m_rs232) << 1;
15541767
1555   mc68901_tai_w(device, data & 0x01);
1768   // clear to send
1769   data |= rs232_cts_r(m_rs232) << 2;
15561770
1557   data |= rs232_dcd_r(state->rs232) << 1;
1558   data |= rs232_cts_r(state->rs232) << 2;
1559   data |= (state->acia_irq << 4);
1560   data |= (state->fdc_irq << 5);
1561   data |= rs232_ri_r(state->rs232) << 6;
1562   data |= (input_port_read(device->machine, "config") & 0x80);
1771   // blitter done
1772   data |= m_blitter_done << 3;
15631773
1774   // keyboard/MIDI interrupt
1775   data |= m_acia_irq << 4;
1776
1777   // floppy data request
1778   data |= !wd17xx_intrq_r(m_fdc) << 5;
1779
1780   // ring indicator
1781   data |= rs232_ri_r(m_rs232) << 6;
1782
1783   // monochrome monitor detect
1784   data |= input_port_read(machine, "config") & 0x80;
1785
15641786   return data;
15651787}
15661788
1567static WRITE8_DEVICE_HANDLER( mfp_tdo_w )
1789WRITE_LINE_MEMBER( st_state::mfp_tdo_w )
15681790{
1569   mc68901_rx_clock_w(device, data);
1570   mc68901_tx_clock_w(device, data);
1791   m_mfp->rc_w(state);
1792   m_mfp->tc_w(state);
15711793}
15721794
1573static WRITE_LINE_DEVICE_HANDLER( mfp_so_w )
1795WRITE_LINE_MEMBER( st_state::mfp_so_w )
15741796{
1575   atarist_state *driver_state = device->machine->driver_data<atarist_state>();
1576
1577   rs232_td_w(driver_state->rs232, device, state);
1797   rs232_td_w(m_rs232, m_mfp, state);
15781798}
15791799
15801800static MC68901_INTERFACE( mfp_intf )
r9971r9972
15821802   Y1,                                       /* timer clock */
15831803   0,                                       /* receive clock */
15841804   0,                                       /* transmit clock */
1585   DEVCB_DEVICE_HANDLER(MC68901_TAG, mfp_gpio_r),      /* GPIO read */
1805   DEVCB_CPU_INPUT_LINE(M68000_TAG, M68K_IRQ_6),      /* interrupt */
1806   DEVCB_DRIVER_MEMBER(st_state, mfp_gpio_r),         /* GPIO read */
15861807   DEVCB_NULL,                                 /* GPIO write */
1587   DEVCB_DEVICE_LINE(RS232_TAG, rs232_rd_r),         /* serial input */
1588   DEVCB_LINE(mfp_so_w),                        /* serial output */
15891808   DEVCB_NULL,                                 /* TAO */
15901809   DEVCB_NULL,                                 /* TBO */
15911810   DEVCB_NULL,                                 /* TCO */
1592   DEVCB_DEVICE_HANDLER(MC68901_TAG, mfp_tdo_w),      /* TDO */
1593   DEVCB_CPU_INPUT_LINE(M68000_TAG, M68K_IRQ_6)      /* interrupt */
1811   DEVCB_DRIVER_LINE_MEMBER(st_state, mfp_tdo_w),      /* TDO */
1812   DEVCB_DEVICE_LINE(RS232_TAG, rs232_rd_r),         /* serial input */
1813   DEVCB_DRIVER_LINE_MEMBER(st_state, mfp_so_w)      /* serial output */
15941814};
15951815
1596static void atarist_configure_memory(running_machine *machine)
1597{
1598   address_space *program = cputag_get_address_space(machine, M68000_TAG, ADDRESS_SPACE_PROGRAM);
1599   UINT8 *RAM = ram_get_ptr(machine->device(RAM_TAG));
16001816
1601   switch (ram_get_size(machine->device(RAM_TAG)))
1602   {
1603   case 256 * 1024:
1604      memory_install_ram(program, 0x000008, 0x03ffff, 0, 0, RAM + 8);
1605      memory_unmap_readwrite(program, 0x040000, 0x3fffff, 0, 0);
1606      break;
1607   case 512 * 1024:
1608      memory_install_ram(program, 0x000008, 0x07ffff, 0, 0, RAM + 8);
1609      memory_unmap_readwrite(program, 0x080000, 0x3fffff, 0, 0);
1610      break;
1611   case 1024 * 1024:
1612      memory_install_ram(program, 0x000008, 0x0fffff, 0, 0, RAM + 8);
1613      memory_unmap_readwrite(program, 0x100000, 0x3fffff, 0, 0);
1614      break;
1615   case 2048 * 1024:
1616      memory_install_ram(program, 0x000008, 0x1fffff, 0, 0, RAM + 8);
1617      memory_unmap_readwrite(program, 0x200000, 0x3fffff, 0, 0);
1618      break;
1619   case 4096 * 1024:
1620      memory_install_ram(program, 0x000008, 0x3fffff, 0, 0, RAM + 8);
1621      break;
1622   }
1623}
1817//-------------------------------------------------
1818//  MC68901_INTERFACE( atariste_mfp_intf )
1819//-------------------------------------------------
16241820
1625static void atarist_state_save(running_machine *machine)
1821READ8_MEMBER( ste_state::mfp_gpio_r )
16261822{
1627   atarist_state *state = machine->driver_data<atarist_state>();
1823   /*
16281824
1629   state->fdc_status |= DMA_STATUS_ERROR;
1825        bit     description
16301826
1631   state_save_register_global(machine, state->mmu);
1632   state_save_register_global(machine, state->fdc_dmabase);
1633   state_save_register_global(machine, state->fdc_status);
1634   state_save_register_global(machine, state->fdc_mode);
1635   state_save_register_global(machine, state->fdc_sectors);
1636   state_save_register_global(machine, state->fdc_dmabytes);
1637   state_save_register_global(machine, state->fdc_irq);
1638   state_save_register_global(machine, state->ikbd_keylatch);
1639   state_save_register_global(machine, state->ikbd_mouse_x);
1640   state_save_register_global(machine, state->ikbd_mouse_y);
1641   state_save_register_global(machine, state->ikbd_mouse_px);
1642   state_save_register_global(machine, state->ikbd_mouse_py);
1643   state_save_register_global(machine, state->ikbd_mouse_pc);
1644   state_save_register_global(machine, state->ikbd_rx);
1645   state_save_register_global(machine, state->ikbd_tx);
1646   state_save_register_global(machine, state->midi_rx);
1647   state_save_register_global(machine, state->midi_tx);
1648   state_save_register_global(machine, state->acia_irq);
1649}
1827        0       Centronics BUSY
1828        1       RS232 DCD
1829        2       RS232 CTS
1830        3       Blitter done
1831        4       Keyboard/MIDI
1832        5       FDC
1833        6       RS232 RI
1834        7       Monochrome monitor detect / DMA sound active
16501835
1651static MACHINE_START( atarist )
1652{
1653   atarist_state *state = machine->driver_data<atarist_state>();
1836    */
16541837
1655   /* configure RAM banking */
1656   atarist_configure_memory(machine);
1838   UINT8 data = 0;
1839   
1840   // centronics busy
1841   data |= centronics_busy_r(m_centronics);
16571842
1658   /* set CPU interrupt callback */
1659   cpu_set_irq_callback(machine->device(M68000_TAG), atarist_int_ack);
1843   // data carrier detect
1844   data |= rs232_dcd_r(m_rs232) << 1;
16601845
1661   /* find devices */
1662   state->mc68901 = machine->device(MC68901_TAG);
1663   state->wd1772 = machine->device(WD1772_TAG);
1664   state->centronics = machine->device(CENTRONICS_TAG);
1665   state->rs232 = machine->device(RS232_TAG);
1846   // clear to send
1847   data |= rs232_cts_r(m_rs232) << 2;
16661848
1667   /* register for state saving */
1668   atarist_state_save(machine);
1849   // blitter done
1850   data |= m_blitter_done << 3;
16691851
1670   address_space *program = cputag_get_address_space(machine, M68000_TAG, ADDRESS_SPACE_PROGRAM);
1671   program->write_word(0, 0x60ae);
1672   program->write_word(2, 0x0104);
1673   program->write_word(4, 0x00fc);
1674   program->write_word(6, 0x0030);
1852   // keyboard/MIDI interrupt
1853   data |= m_acia_irq << 4;
1854
1855   // floppy data request
1856   data |= !wd17xx_intrq_r(m_fdc) << 5;
1857
1858   // ring indicator
1859   data |= rs232_ri_r(m_rs232) << 6;
1860
1861   // monochrome monitor detect, DMA sound active
1862   data |= (input_port_read(machine, "config") & 0x80) ^ (m_dmasnd_active << 7);
1863
1864   return data;
16751865}
16761866
1677static const struct rp5c15_interface rtc_intf =
1867static MC68901_INTERFACE( atariste_mfp_intf )
16781868{
1679   NULL
1869   Y1,                                       /* timer clock */
1870   0,                                       /* receive clock */
1871   0,                                       /* transmit clock */
1872   DEVCB_CPU_INPUT_LINE(M68000_TAG, M68K_IRQ_6),      /* interrupt */
1873   DEVCB_DRIVER_MEMBER(ste_state, mfp_gpio_r),         /* GPIO read */
1874   DEVCB_NULL,                                 /* GPIO write */
1875   DEVCB_NULL,                                 /* TAO */
1876   DEVCB_NULL,                                 /* TBO */
1877   DEVCB_NULL,                                 /* TCO */
1878   DEVCB_DRIVER_LINE_MEMBER(st_state, mfp_tdo_w),      /* TDO */
1879   DEVCB_DEVICE_LINE(RS232_TAG, rs232_rd_r),         /* serial input */
1880   DEVCB_DRIVER_LINE_MEMBER(st_state, mfp_so_w)      /* serial output */
16801881};
16811882
1682static MACHINE_START( megast )
1683{
1684   MACHINE_START_CALL(atarist);
1685}
16861883
1687static READ8_DEVICE_HANDLER( atariste_mfp_gpio_r )
1884//-------------------------------------------------
1885//  MC68901_INTERFACE( stbook_mfp_intf )
1886//-------------------------------------------------
1887
1888READ8_MEMBER( stbook_state::mfp_gpio_r )
16881889{
16891890   /*
16901891
r9971r9972
16971898        4       Keyboard/MIDI
16981899        5       FDC
16991900        6       RS232 RI
1700        7       Monochrome monitor detect / DMA sound active
1901        7       POWER ALARMS
17011902
17021903    */
17031904
1704   atarist_state *state = device->machine->driver_data<atarist_state>();
1905   UINT8 data = 0;
1906     
1907   // centronics busy
1908   data |= centronics_busy_r(m_centronics);
17051909
1706   UINT8 data = centronics_busy_r(state->centronics);
1910   // data carrier detect
1911   data |= rs232_dcd_r(m_rs232) << 1;
17071912
1708   data |= rs232_dcd_r(state->rs232) << 1;
1709   data |= rs232_cts_r(state->rs232) << 2;
1710   data |= (state->acia_irq << 4);
1711   data |= (state->fdc_irq << 5);
1712   data |= rs232_ri_r(state->rs232) << 6;
1713   data |= (input_port_read(device->machine, "config") & 0x80) ^ (state->dmasnd_active << 7);
1913   // clear to send
1914   data |= rs232_cts_r(m_rs232) << 2;
17141915
1916   // blitter done
1917   data |= m_blitter_done << 3;
1918
1919   // keyboard/MIDI interrupt
1920   data |= m_acia_irq << 4;
1921
1922   // floppy data request
1923   data |= !wd17xx_intrq_r(m_fdc) << 5;
1924
1925   // ring indicator
1926   data |= rs232_ri_r(m_rs232) << 6;
1927
1928   // TODO power alarms
1929
17151930   return data;
17161931}
17171932
1718static MC68901_INTERFACE( atariste_mfp_intf )
1933static MC68901_INTERFACE( stbook_mfp_intf )
17191934{
17201935   Y1,                                       /* timer clock */
17211936   0,                                       /* receive clock */
17221937   0,                                       /* transmit clock */
1723   DEVCB_DEVICE_HANDLER(MC68901_TAG, atariste_mfp_gpio_r),   /* GPIO read */
1938   DEVCB_CPU_INPUT_LINE(M68000_TAG, M68K_IRQ_6),      /* interrupt */
1939   DEVCB_DRIVER_MEMBER(stbook_state, mfp_gpio_r),      /* GPIO read */
17241940   DEVCB_NULL,                                 /* GPIO write */
1725   DEVCB_DEVICE_LINE(RS232_TAG, rs232_rd_r),         /* serial input */
1726   DEVCB_LINE(mfp_so_w),                        /* serial output */
17271941   DEVCB_NULL,                                 /* TAO */
17281942   DEVCB_NULL,                                 /* TBO */
17291943   DEVCB_NULL,                                 /* TCO */
1730   DEVCB_DEVICE_HANDLER(MC68901_TAG, mfp_tdo_w),   /* TDO */
1731   DEVCB_CPU_INPUT_LINE(M68000_TAG, M68K_IRQ_6)      /* interrupt */
1944   DEVCB_DRIVER_LINE_MEMBER(st_state, mfp_tdo_w),      /* TDO */
1945   DEVCB_DEVICE_LINE(RS232_TAG, rs232_rd_r),         /* serial input */
1946   DEVCB_DRIVER_LINE_MEMBER(st_state, mfp_so_w)      /* serial output */
17321947};
17331948
1734static void atariste_state_save(running_machine *machine)
1949
1950
1951//-------------------------------------------------
1952//  wd17xx_interface fdc_intf
1953//-------------------------------------------------
1954
1955static const floppy_config atarist_floppy_config =
17351956{
1736   atarist_state *state = machine->driver_data<atarist_state>();
1957   DEVCB_NULL,
1958   DEVCB_NULL,
1959   DEVCB_NULL,
1960   DEVCB_NULL,
1961   DEVCB_NULL,
1962   FLOPPY_STANDARD_3_5_DSDD,
1963   FLOPPY_OPTIONS_NAME(atarist),
1964   NULL
1965};
17371966
1738   atarist_state_save(machine);
1967static const floppy_config megaste_floppy_config =
1968{
1969   DEVCB_NULL,
1970   DEVCB_NULL,
1971   DEVCB_NULL,
1972   DEVCB_NULL,
1973   DEVCB_NULL,
1974   FLOPPY_STANDARD_3_5_DSHD,
1975   FLOPPY_OPTIONS_NAME(atarist),
1976   NULL
1977};
17391978
1740   state_save_register_global(machine, state->dmasnd_base);
1741   state_save_register_global(machine, state->dmasnd_end);
1742   state_save_register_global(machine, state->dmasnd_cntr);
1743   state_save_register_global(machine, state->dmasnd_baselatch);
1744   state_save_register_global(machine, state->dmasnd_endlatch);
1745   state_save_register_global(machine, state->dmasnd_ctrl);
1746   state_save_register_global(machine, state->dmasnd_mode);
1747   state_save_register_global_array(machine, state->dmasnd_fifo);
1748   state_save_register_global(machine, state->dmasnd_samples);
1749   state_save_register_global(machine, state->dmasnd_active);
1750   state_save_register_global(machine, state->mw_data);
1751   state_save_register_global(machine, state->mw_mask);
1752   state_save_register_global(machine, state->mw_shift);
1979WRITE_LINE_MEMBER( st_state::fdc_intrq_w )
1980{
1981   m_mfp->i5_w(!state);
17531982}
17541983
1755static MACHINE_START( atariste )
1984WRITE_LINE_MEMBER( st_state::fdc_drq_w )
17561985{
1757   atarist_state *state = machine->driver_data<atarist_state>();
1986   if (state && (!(m_fdc_mode & DMA_MODE_ENABLED)) && (m_fdc_mode & DMA_MODE_FDC_HDC_ACK))
1987   {
1988      fdc_dma_transfer();
1989   }
1990}
17581991
1759   /* configure RAM banking */
1760   atarist_configure_memory(machine);
1992static const wd17xx_interface fdc_intf =
1993{
1994   DEVCB_LINE_GND,
1995   DEVCB_DRIVER_LINE_MEMBER(st_state, fdc_intrq_w),
1996   DEVCB_DRIVER_LINE_MEMBER(st_state, fdc_drq_w),
1997   { FLOPPY_0, FLOPPY_1, NULL, NULL }
1998};
17611999
1762   /* set CPU interrupt callback */
1763   cpu_set_irq_callback(machine->device(M68000_TAG), atarist_int_ack);
17642000
1765   /* allocate timers */
1766   state->dmasound_timer = timer_alloc(machine, atariste_dmasound_tick, NULL);
1767   state->microwire_timer = timer_alloc(machine, atariste_microwire_tick, NULL);
2001//-------------------------------------------------
2002//  wd17xx_interface stbook_fdc_intf
2003//-------------------------------------------------
17682004
1769   /* find devices */
1770   state->mc68901 = machine->device(MC68901_TAG);
1771   state->wd1772 = machine->device(WD1772_TAG);
1772   state->lmc1992 = machine->device(LMC1992_TAG);
1773   state->centronics = machine->device(CENTRONICS_TAG);
1774   state->rs232 = machine->device(RS232_TAG);
2005static const wd17xx_interface stbook_fdc_intf =
2006{
2007   DEVCB_NULL,
2008   DEVCB_DRIVER_LINE_MEMBER(st_state, fdc_intrq_w),
2009   DEVCB_DRIVER_LINE_MEMBER(st_state, fdc_drq_w),
2010   { FLOPPY_0, FLOPPY_1, NULL, NULL }
2011};
17752012
1776   /* register for state saving */
1777   atariste_state_save(machine);
1778}
17792013
1780static MACHINE_START( megaste )
2014//-------------------------------------------------
2015//  RS232_INTERFACE( rs232_intf )
2016//-------------------------------------------------
2017
2018static RS232_INTERFACE( rs232_intf )
17812019{
1782   atarist_state *state = machine->driver_data<atarist_state>();
2020   { MC68901_TAG },
2021   { NULL }
2022};
17832023
1784   MACHINE_START_CALL(atariste);
17852024
1786   state_save_register_global(machine, state->megaste_cache);
2025//-------------------------------------------------
2026//  rp5c15_interface rtc_intf
2027//-------------------------------------------------
2028
2029static const struct rp5c15_interface rtc_intf =
2030{
2031   NULL
2032};
2033
2034
2035
2036//**************************************************************************
2037//   MACHINE INITIALIZATION
2038//**************************************************************************
2039
2040//-------------------------------------------------
2041//  IRQ_CALLBACK( atarist_int_ack )
2042//-------------------------------------------------
2043
2044static IRQ_CALLBACK( atarist_int_ack )
2045{
2046   st_state *state = device->machine->driver_data<st_state>();
2047
2048   if (irqline == M68K_IRQ_6)
2049   {
2050      return state->m_mfp->get_vector();
2051   }
2052
2053   return M68K_INT_ACK_AUTOVECTOR;
17872054}
17882055
1789static void stbook_configure_memory(running_machine *machine)
2056
2057//-------------------------------------------------
2058//  configure_memory -
2059//-------------------------------------------------
2060
2061void st_state::configure_memory()
17902062{
1791   address_space *program = cputag_get_address_space(machine, M68000_TAG, ADDRESS_SPACE_PROGRAM);
1792   UINT8 *RAM = ram_get_ptr(machine->device(RAM_TAG));
2063   address_space *program = cpu_get_address_space(m_maincpu, ADDRESS_SPACE_PROGRAM);
2064   UINT8 *ram = ram_get_ptr(m_ram);
17932065
1794   switch (ram_get_size(machine->device(RAM_TAG)))
2066   switch (ram_get_size(m_ram))
17952067   {
2068   case 256 * 1024:
2069      memory_unmap_readwrite(program, 0x040000, 0x3fffff, 0, 0);
2070      break;
2071
2072   case 512 * 1024:
2073      memory_unmap_readwrite(program, 0x080000, 0x3fffff, 0, 0);
2074      break;
2075
17962076   case 1024 * 1024:
1797      memory_install_ram(program, 0x000008, 0x07ffff, 0, 0x080000, RAM + 8);
17982077      memory_unmap_readwrite(program, 0x100000, 0x3fffff, 0, 0);
17992078      break;
1800   case 4096 * 1024:
1801      memory_install_ram(program, 0x000008, 0x3fffff, 0, 0, RAM + 8);
2079
2080   case 2048 * 1024:
2081      memory_unmap_readwrite(program, 0x200000, 0x3fffff, 0, 0);
18022082      break;
18032083   }
1804
18052084}
18062085
1807static WRITE8_DEVICE_HANDLER( stbook_ym2149_port_a_w )
2086//-------------------------------------------------
2087//  state_save -
2088//-------------------------------------------------
2089
2090void st_state::state_save()
18082091{
1809   atarist_state *state = device->machine->driver_data<atarist_state>();
2092   m_dma_error = 1;
18102093
1811   wd17xx_set_side(state->wd1772, (data & 0x01) ? 0 : 1);
2094   state_save_register_global(machine, m_mmu);
2095   state_save_register_global(machine, m_dma_base);
2096   state_save_register_global(machine, m_dma_error);
2097   state_save_register_global(machine, m_fdc_mode);
2098   state_save_register_global(machine, m_fdc_sectors);
2099   state_save_register_global(machine, m_fdc_dmabytes);
2100   state_save_register_global(machine, m_ikbd_keylatch);
2101   state_save_register_global(machine, m_ikbd_mouse_x);
2102   state_save_register_global(machine, m_ikbd_mouse_y);
2103   state_save_register_global(machine, m_ikbd_mouse_px);
2104   state_save_register_global(machine, m_ikbd_mouse_py);
2105   state_save_register_global(machine, m_ikbd_mouse_pc);
2106   state_save_register_global(machine, m_ikbd_rx);
2107   state_save_register_global(machine, m_ikbd_tx);
2108   state_save_register_global(machine, m_midi_rx);
2109   state_save_register_global(machine, m_midi_tx);
2110   state_save_register_global(machine, m_acia_irq);
2111}
18122112
1813   if (!(data & 0x02))
1814   {
1815      wd17xx_set_drive(state->wd1772, 0);
1816   }
18172113
1818   if (!(data & 0x04))
1819   {
1820      wd17xx_set_drive(state->wd1772, 1);
1821   }
2114//-------------------------------------------------
2115//   MACHINE_START( st )
2116//-------------------------------------------------
18222117
1823   rs232_rts_w(state->rs232, BIT(data, 3));
1824   rs232_dtr_w(state->rs232, BIT(data, 4));
2118void st_state::machine_start()
2119{
2120   /* configure RAM banking */
2121   configure_memory();
18252122
1826   centronics_strobe_w(state->centronics, BIT(data, 5));
2123   /* set CPU interrupt callback */
2124   cpu_set_irq_callback(m_maincpu, atarist_int_ack);
18272125
1828   // 0x40 = IDE RESET
1829
1830   wd17xx_dden_w(state->wd1772, BIT(data, 7));
2126   /* register for state saving */
2127   state_save();
2128   
2129   // boot shadow
2130   address_space *program = cpu_get_address_space(m_maincpu, ADDRESS_SPACE_PROGRAM);
2131   program->write_word(0, 0x60ae);
2132   program->write_word(2, 0x0104);
2133   program->write_word(4, 0x00fc);
2134   program->write_word(6, 0x0030);
18312135}
18322136
1833static const ay8910_interface stbook_psg_intf =
1834{
1835   AY8910_SINGLE_OUTPUT,
1836   { RES_K(1) },
1837   DEVCB_NULL,
1838   DEVCB_NULL,
1839   DEVCB_HANDLER(stbook_ym2149_port_a_w),
1840   DEVCB_DEVICE_HANDLER(CENTRONICS_TAG, centronics_data_w)
1841};
18422137
1843static ACIA6850_INTERFACE( stbook_acia_ikbd_intf )
1844{
1845   U517/2/16, // 500kHz
1846   U517/2/2, // 1MHZ
1847   DEVCB_LINE(ikbd_rx),
1848   DEVCB_LINE(ikbd_tx),
1849   DEVCB_NULL,
1850   DEVCB_NULL,
1851   DEVCB_NULL,
1852   DEVCB_LINE(acia_interrupt)
1853};
2138//-------------------------------------------------
2139//  state_save -
2140//-------------------------------------------------
18542141
1855static READ8_DEVICE_HANDLER( stbook_mfp_gpio_r )
2142void ste_state::state_save()
18562143{
1857   /*
2144   st_state::state_save();
18582145
1859        bit     description
2146   state_save_register_global(machine, m_dmasnd_base);
2147   state_save_register_global(machine, m_dmasnd_end);
2148   state_save_register_global(machine, m_dmasnd_cntr);
2149   state_save_register_global(machine, m_dmasnd_baselatch);
2150   state_save_register_global(machine, m_dmasnd_endlatch);
2151   state_save_register_global(machine, m_dmasnd_ctrl);
2152   state_save_register_global(machine, m_dmasnd_mode);
2153   state_save_register_global_array(machine, m_dmasnd_fifo);
2154   state_save_register_global(machine, m_dmasnd_samples);
2155   state_save_register_global(machine, m_dmasnd_active);
2156   state_save_register_global(machine, m_mw_data);
2157   state_save_register_global(machine, m_mw_mask);
2158   state_save_register_global(machine, m_mw_shift);
2159}
18602160
1861        0       Centronics BUSY
1862        1       RS232 DCD
1863        2       RS232 CTS
1864        3       Blitter done
1865        4       Keyboard/MIDI
1866        5       FDC
1867        6       RS232 RI
1868        7       POWER ALARMS
18692161
1870    */
2162//-------------------------------------------------
2163//   MACHINE_START( ste )
2164//-------------------------------------------------
18712165
1872   atarist_state *state = device->machine->driver_data<atarist_state>();
2166void ste_state::machine_start()
2167{
2168   /* configure RAM banking */
2169   configure_memory();
18732170
1874   UINT8 data = centronics_busy_r(state->centronics);
2171   /* set CPU interrupt callback */
2172   cpu_set_irq_callback(m_maincpu, atarist_int_ack);
18752173
1876   data |= rs232_dcd_r(state->rs232) << 1;
1877   data |= rs232_cts_r(state->rs232) << 2;
1878   data |= (state->acia_irq << 4);
1879   data |= (state->fdc_irq << 5);
1880   data |= rs232_ri_r(state->rs232) << 6;
2174   /* allocate timers */
2175   m_dmasound_timer = timer_alloc(machine, atariste_dmasound_tick, NULL);
2176   m_microwire_timer = timer_alloc(machine, atariste_microwire_tick, NULL);
18812177
1882   return data;
2178   /* register for state saving */
2179   state_save();
18832180}
18842181
1885static MC68901_INTERFACE( stbook_mfp_intf )
2182
2183//-------------------------------------------------
2184//   MACHINE_START( megaste )
2185//-------------------------------------------------
2186
2187void megaste_state::machine_start()
18862188{
1887   Y1,                                       /* timer clock */
1888   0,                                       /* receive clock */
1889   0,                                       /* transmit clock */
1890   DEVCB_DEVICE_HANDLER(MC68901_TAG, stbook_mfp_gpio_r),   /* GPIO read */
1891   DEVCB_NULL,                                 /* GPIO write */
1892   DEVCB_DEVICE_LINE(RS232_TAG, rs232_rd_r),         /* serial input */
1893   DEVCB_LINE(mfp_so_w),                        /* serial output */
1894   DEVCB_NULL,                                 /* TAO */
1895   DEVCB_NULL,                                 /* TBO */
1896   DEVCB_NULL,                                 /* TCO */
1897   DEVCB_DEVICE_HANDLER(MC68901_TAG, mfp_tdo_w),      /* TDO */
1898   DEVCB_CPU_INPUT_LINE(M68000_TAG, M68K_IRQ_6)      /* interrupt */
1899};
2189   ste_state::machine_start();
19002190
1901static MACHINE_START( stbook )
2191   state_save_register_global(machine, m_megaste_cache);
2192}
2193
2194
2195//-------------------------------------------------
2196//   MACHINE_START( stbook )
2197//-------------------------------------------------
2198
2199void stbook_state::machine_start()
19022200{
1903   atarist_state *state = machine->driver_data<atarist_state>();
1904
19052201   /* configure RAM banking */
1906   stbook_configure_memory(machine);
2202   address_space *program = cpu_get_address_space(m_maincpu, ADDRESS_SPACE_PROGRAM);
2203   UINT8 *ram = ram_get_ptr(m_ram);
19072204
2205   switch (ram_get_size(m_ram))
2206   {
2207   case 1024 * 1024:
2208      memory_unmap_readwrite(program, 0x100000, 0x3fffff, 0, 0);
2209      break;
2210   }
2211
19082212   /* set CPU interrupt callback */
19092213   cpu_set_irq_callback(machine->device(M68000_TAG), atarist_int_ack);
19102214
1911   /* find devices */
1912   state->mc68901 = machine->device(MC68901_TAG);
1913   state->wd1772 = machine->device(WD1772_TAG);
1914   state->centronics = machine->device(CENTRONICS_TAG);
1915   state->rs232 = machine->device(RS232_TAG);
1916
19172215   /* register for state saving */
1918   atariste_state_save(machine);
2216   ste_state::state_save();
19192217}
19202218
1921static DEVICE_IMAGE_LOAD( atarist_cart )
1922{
1923   return IMAGE_INIT_FAIL;
1924}
19252219
1926static const floppy_config atarist_floppy_config =
1927{
1928   DEVCB_NULL,
1929   DEVCB_NULL,
1930   DEVCB_NULL,
1931   DEVCB_NULL,
1932   DEVCB_NULL,
1933   FLOPPY_STANDARD_3_5_DSDD,
1934   FLOPPY_OPTIONS_NAME(atarist),
1935   NULL
1936};
19372220
1938static const floppy_config megaste_floppy_config =
1939{
1940   DEVCB_NULL,
1941   DEVCB_NULL,
1942   DEVCB_NULL,
1943   DEVCB_NULL,
1944   DEVCB_NULL,
1945   FLOPPY_STANDARD_3_5_DSHD,
1946   FLOPPY_OPTIONS_NAME(atarist),
1947   NULL
1948};
2221//**************************************************************************
2222//   MACHINE CONFIGURATION
2223//**************************************************************************
19492224
1950static MACHINE_CONFIG_FRAGMENT( atarist_cartslot )
1951   MCFG_CARTSLOT_ADD("cart")
1952   MCFG_CARTSLOT_EXTENSION_LIST("stc")
1953   MCFG_CARTSLOT_NOT_MANDATORY
1954   MCFG_CARTSLOT_LOAD(atarist_cart)
1955MACHINE_CONFIG_END
2225//-------------------------------------------------
2226//  MACHINE_CONFIG( st )
2227//-------------------------------------------------
19562228
1957static RS232_INTERFACE( rs232_intf )
1958{
1959   { MC68901_TAG },
1960   { NULL }
1961};
1962
1963static MACHINE_CONFIG_START( st, atarist_state )
2229static MACHINE_CONFIG_START( st, st_state )
19642230   // basic machine hardware
19652231   MCFG_CPU_ADD(M68000_TAG, M68000, Y2/4)
19662232   MCFG_CPU_PROGRAM_MAP(st_map)
19672233
1968   MCFG_CPU_ADD(HD6301_TAG, HD63701, XTAL_4MHz)  /* HD6301 */
2234   MCFG_CPU_ADD(HD6301V1_TAG, HD63701, XTAL_4MHz)
19692235   MCFG_CPU_PROGRAM_MAP(ikbd_map)
19702236   MCFG_CPU_IO_MAP(ikbd_io_map)
19712237
1972   MCFG_MACHINE_START(atarist)
1973
1974   // device hardware
1975   MCFG_MC68901_ADD(MC68901_TAG, Y2/8, mfp_intf)
1976   MCFG_SCC8530_ADD("scc", Y2/4)
1977   MCFG_RS232_ADD(RS232_TAG, rs232_intf)
1978
19792238   // video hardware
19802239   MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
19812240   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
2241   MCFG_SCREEN_RAW_PARAMS(Y2/4, ATARIST_HTOT_PAL, ATARIST_HBEND_PAL, ATARIST_HBSTART_PAL, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL)
2242
19822243   MCFG_PALETTE_LENGTH(16)
1983   MCFG_VIDEO_START( atarist )
1984   MCFG_VIDEO_UPDATE( generic_bitmapped )
19852244
1986   MCFG_SCREEN_RAW_PARAMS(Y2/4, ATARIST_HTOT_PAL, ATARIST_HBEND_PAL, ATARIST_HBSTART_PAL, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL)
2245   MCFG_VIDEO_UPDATE(generic_bitmapped)
19872246
19882247   // sound hardware
19892248   MCFG_SPEAKER_STANDARD_MONO("mono")
r9971r9972
19912250   MCFG_SOUND_CONFIG(psg_intf)
19922251   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
19932252
1994   /* printer */
1995   MCFG_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics)
1996
1997   /* acia */
2253   // devices
19982254   MCFG_ACIA6850_ADD(MC6850_0_TAG, acia_ikbd_intf)
19992255   MCFG_ACIA6850_ADD(MC6850_1_TAG, acia_midi_intf)
2000
2001   MCFG_WD1772_ADD(WD1772_TAG, fdc_intf )
2002
2256   MCFG_MC68901_ADD(MC68901_TAG, Y2/8, mfp_intf)
2257   MCFG_WD1772_ADD(WD1772_TAG, fdc_intf)
20032258   MCFG_FLOPPY_2_DRIVES_ADD(atarist_floppy_config)
2259   MCFG_RS232_ADD(RS232_TAG, rs232_intf)
2260   MCFG_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics)
20042261
2005   MCFG_FRAGMENT_ADD(atarist_cartslot)
2262   // cartridge
2263   MCFG_CARTSLOT_ADD("cart")
2264   MCFG_CARTSLOT_EXTENSION_LIST("bin,rom")
2265   MCFG_CARTSLOT_NOT_MANDATORY
2266   MCFG_CARTSLOT_INTERFACE("st_cart")
2267//   MCFG_SOFTWARE_LIST_ADD("cart_list", "st")
20062268
2007   /* internal ram */
2269   // internal ram
20082270   MCFG_RAM_ADD(RAM_TAG)
2009   MCFG_RAM_DEFAULT_SIZE("1024K")  // 1040ST
2271   MCFG_RAM_DEFAULT_SIZE("1M")  // 1040ST
20102272   MCFG_RAM_EXTRA_OPTIONS("512K,256K") // 520ST, 260ST
20112273MACHINE_CONFIG_END
20122274
2275
2276//-------------------------------------------------
2277//  MACHINE_CONFIG( megast )
2278//-------------------------------------------------
2279
20132280static MACHINE_CONFIG_DERIVED( megast, st )
20142281   MCFG_CPU_MODIFY(M68000_TAG)
20152282   MCFG_CPU_PROGRAM_MAP(megast_map)
20162283   MCFG_RP5C15_ADD(RP5C15_TAG, rtc_intf)
20172284
2018   MCFG_MACHINE_START(megast)
2019
20202285   /* internal ram */
20212286   MCFG_RAM_MODIFY(RAM_TAG)
20222287   MCFG_RAM_DEFAULT_SIZE("4M")  //  Mega ST 4
20232288   MCFG_RAM_EXTRA_OPTIONS("2M,1M") //  Mega ST 2 ,Mega ST 1
20242289MACHINE_CONFIG_END
20252290
2026static MACHINE_CONFIG_START( ste, atarist_state )
2291
2292//-------------------------------------------------
2293//  MACHINE_CONFIG( ste )
2294//-------------------------------------------------
2295
2296static MACHINE_CONFIG_START( ste, ste_state )
20272297   // basic machine hardware
20282298   MCFG_CPU_ADD(M68000_TAG, M68000, Y2/4)
20292299   MCFG_CPU_PROGRAM_MAP(ste_map)
20302300
2031   MCFG_CPU_ADD(HD6301_TAG, HD63701, XTAL_4MHz)  /* HD6301 */
2301   MCFG_CPU_ADD(HD6301V1_TAG, HD63701, XTAL_4MHz)
20322302   MCFG_CPU_PROGRAM_MAP(ikbd_map)
20332303   MCFG_CPU_IO_MAP(ikbd_io_map)
20342304
2035   MCFG_MACHINE_START(atariste)
2036
2037   // device hardware
2038   MCFG_MC68901_ADD(MC68901_TAG, Y2/8, atariste_mfp_intf)
2039   MCFG_SCC8530_ADD("scc", Y2/4)
2040   MCFG_RS232_ADD(RS232_TAG, rs232_intf)
2041
20422305   // video hardware
20432306   MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
20442307   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
20452308   MCFG_PALETTE_LENGTH(512)
2046   MCFG_VIDEO_START( atarist )
20472309   MCFG_VIDEO_UPDATE( generic_bitmapped )
20482310
20492311   MCFG_SCREEN_RAW_PARAMS(Y2/4, ATARIST_HTOT_PAL, ATARIST_HBEND_PAL, ATARIST_HBSTART_PAL, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL)
r9971r9972
20622324*/
20632325   MCFG_LMC1992_ADD(LMC1992_TAG /* ,atariste_lmc1992_intf */)
20642326
2065   /* printer */
2066   MCFG_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics)
2067
2068   /* acia */
2327   // devices
20692328   MCFG_ACIA6850_ADD(MC6850_0_TAG, acia_ikbd_intf)
20702329   MCFG_ACIA6850_ADD(MC6850_1_TAG, acia_midi_intf)
2071
2330   MCFG_MC68901_ADD(MC68901_TAG, Y2/8, atariste_mfp_intf)
20722331   MCFG_WD1772_ADD(WD1772_TAG, fdc_intf )
2073
20742332   MCFG_FLOPPY_2_DRIVES_ADD(atarist_floppy_config)
2333   MCFG_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics)
2334   MCFG_RS232_ADD(RS232_TAG, rs232_intf)
20752335
2076   MCFG_FRAGMENT_ADD(atarist_cartslot)
2336   // cartridge
2337   MCFG_CARTSLOT_ADD("cart")
2338   MCFG_CARTSLOT_EXTENSION_LIST("bin,rom")
2339   MCFG_CARTSLOT_NOT_MANDATORY
2340   MCFG_CARTSLOT_INTERFACE("st_cart")
2341//   MCFG_SOFTWARE_LIST_ADD("cart_list", "st")
20772342
2078   /* internal ram */
2343   // internal ram
20792344   MCFG_RAM_ADD(RAM_TAG)
2080   MCFG_RAM_DEFAULT_SIZE("1024K")  // 1040STe
2345   MCFG_RAM_DEFAULT_SIZE("1M")  // 1040STe
20812346   MCFG_RAM_EXTRA_OPTIONS("512K") //  520STe
20822347MACHINE_CONFIG_END
20832348
2349
2350//-------------------------------------------------
2351//  MACHINE_CONFIG( megaste )
2352//-------------------------------------------------
2353
20842354static MACHINE_CONFIG_DERIVED( megaste, ste )
20852355   MCFG_CPU_MODIFY(M68000_TAG)
20862356   MCFG_CPU_PROGRAM_MAP(megaste_map)
20872357   MCFG_RP5C15_ADD(RP5C15_TAG, rtc_intf)
2358   MCFG_SCC8530_ADD(Z8530_TAG, Y2/4)
20882359
2089   MCFG_MACHINE_START(megaste)
2090
20912360   MCFG_FLOPPY_2_DRIVES_MODIFY(megaste_floppy_config)
20922361
20932362   /* internal ram */
r9971r9972
20962365   MCFG_RAM_EXTRA_OPTIONS("2M,1M") //  Mega STe 2 ,Mega STe 1
20972366MACHINE_CONFIG_END
20982367
2099static MACHINE_CONFIG_START( stbook, atarist_state )
2368
2369//-------------------------------------------------
2370//  MACHINE_CONFIG( stbook )
2371//-------------------------------------------------
2372
2373static MACHINE_CONFIG_START( stbook, stbook_state )
21002374   // basic machine hardware
21012375   MCFG_CPU_ADD(M68000_TAG, M68000, U517/2)
21022376   MCFG_CPU_PROGRAM_MAP(stbook_map)
21032377
21042378   //MCFG_CPU_ADD(COP888_TAG, COP888, Y700)
21052379
2106   MCFG_MACHINE_START(stbook)
2107
2108   // device hardware
2109   MCFG_MC68901_ADD(MC68901_TAG, U517/8, stbook_mfp_intf)
2110   MCFG_RP5C15_ADD(RP5C15_TAG, rtc_intf)
2111   MCFG_SCC8530_ADD("scc", U517/2)
2112   MCFG_RS232_ADD(RS232_TAG, rs232_intf)
2113
21142380   // video hardware
21152381   MCFG_SCREEN_ADD(SCREEN_TAG, LCD)
21162382   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
r9971r9972
21292395   MCFG_SOUND_CONFIG(stbook_psg_intf)
21302396   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
21312397
2132   /* printer */
2133   MCFG_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics)
2134
2135   /* acia */
2398   // device hardware
21362399   MCFG_ACIA6850_ADD(MC6850_0_TAG, stbook_acia_ikbd_intf)
21372400   MCFG_ACIA6850_ADD(MC6850_1_TAG, acia_midi_intf)
2138
2401   MCFG_MC68901_ADD(MC68901_TAG, U517/8, stbook_mfp_intf)
21392402   MCFG_WD1772_ADD(WD1772_TAG, stbook_fdc_intf )
2140
21412403   MCFG_FLOPPY_2_DRIVES_ADD(megaste_floppy_config)
2404   MCFG_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics)
2405   MCFG_RS232_ADD(RS232_TAG, rs232_intf)
21422406
2143   MCFG_FRAGMENT_ADD(atarist_cartslot)
2407   // cartridge
2408   MCFG_CARTSLOT_ADD("cart")
2409   MCFG_CARTSLOT_EXTENSION_LIST("bin,rom")
2410   MCFG_CARTSLOT_NOT_MANDATORY
2411   MCFG_CARTSLOT_INTERFACE("st_cart")
2412//   MCFG_SOFTWARE_LIST_ADD("cart_list", "st")
21442413
21452414   /* internal ram */
21462415   MCFG_RAM_ADD(RAM_TAG)
r9971r9972
21482417   MCFG_RAM_EXTRA_OPTIONS("1M")
21492418MACHINE_CONFIG_END
21502419
2420
2421//-------------------------------------------------
2422//  MACHINE_CONFIG( tt030 )
2423//-------------------------------------------------
2424
21512425static MACHINE_CONFIG_DERIVED( tt030, st )
21522426MACHINE_CONFIG_END
21532427
2428
2429//-------------------------------------------------
2430//  MACHINE_CONFIG( falcon )
2431//-------------------------------------------------
2432
21542433static MACHINE_CONFIG_DERIVED( falcon, st )
21552434MACHINE_CONFIG_END
21562435
2436
2437//-------------------------------------------------
2438//  MACHINE_CONFIG( falcon40 )
2439//-------------------------------------------------
2440
21572441static MACHINE_CONFIG_DERIVED( falcon40, st )
21582442MACHINE_CONFIG_END
21592443
2160/* ROMs */
21612444
2445
2446//**************************************************************************
2447//   ROMS
2448//**************************************************************************
2449
2450//-------------------------------------------------
2451//  ROM( st )
2452//-------------------------------------------------
2453
21622454ROM_START( st )
21632455   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
21642456   ROM_DEFAULT_BIOS("tos104")
r9971r9972
21712463   ROM_SYSTEM_BIOS( 3, "tos104", "TOS 1.04 (Rainbow TOS)" )
21722464   ROMX_LOAD( "tos104.bin", 0x00000, 0x30000, BAD_DUMP CRC(90f4fbff) SHA1(2487f330b0895e5d88d580d4ecb24061125e88ad), ROM_BIOS(4) )
21732465
2174   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2466   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
21752467   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
21762468ROM_END
21772469
2470
2471//-------------------------------------------------
2472//  ROM( st )
2473//-------------------------------------------------
2474
21782475ROM_START( st_uk )
21792476   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
21802477   ROM_DEFAULT_BIOS("tos104")
r9971r9972
21852482   ROM_SYSTEM_BIOS( 2, "tos104", "TOS 1.04 (Rainbow TOS)" )
21862483   ROMX_LOAD( "tos104uk.bin", 0x00000, 0x30000, BAD_DUMP CRC(a50d1d43) SHA1(9526ef63b9cb1d2a7109e278547ae78a5c1db6c6), ROM_BIOS(3) )
21872484
2188   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2485   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
21892486   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
21902487ROM_END
21912488
2489
2490//-------------------------------------------------
2491//  ROM( st )
2492//-------------------------------------------------
2493
21922494ROM_START( st_de )
21932495   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
21942496   ROM_DEFAULT_BIOS("tos104")
r9971r9972
22062508   ROMX_LOAD( "st 7c1 a2.u2", 0x20000, 0x08000, CRC(d0513329) SHA1(49855a3585e2f75b2af932dd4414ed64e6d9501f), ROM_SKIP(1) | ROM_BIOS(4) )
22072509   ROMX_LOAD( "st 7c1 b1.u5", 0x20001, 0x08000, CRC(c115cbc8) SHA1(2b52b81a1a4e0818d63f98ee4b25c30e2eba61cb), ROM_SKIP(1) | ROM_BIOS(4) )
22082510
2209   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2511   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
22102512   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
22112513ROM_END
22122514
2515
2516//-------------------------------------------------
2517//  ROM( st )
2518//-------------------------------------------------
2519
22132520ROM_START( st_fr )
22142521   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
22152522   ROM_DEFAULT_BIOS("tos104")
r9971r9972
22202527   ROM_SYSTEM_BIOS( 2, "tos104", "TOS 1.04 (Rainbow TOS)" )
22212528   ROMX_LOAD( "tos104fr.bin", 0x00000, 0x30000, BAD_DUMP CRC(a305a404) SHA1(20dba880344b810cf63cec5066797c5a971db870), ROM_BIOS(3) )
22222529
2223   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2530   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
22242531   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
22252532ROM_END
22262533
2534
2535//-------------------------------------------------
2536//  ROM( st )
2537//-------------------------------------------------
2538
22272539ROM_START( st_es )
22282540   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
22292541   ROM_DEFAULT_BIOS("tos104")
22302542   ROM_SYSTEM_BIOS( 0, "tos104", "TOS 1.04 (Rainbow TOS)" )
22312543   ROMX_LOAD( "tos104es.bin", 0x00000, 0x30000, BAD_DUMP CRC(f4e8ecd2) SHA1(df63f8ac09125d0877b55d5ba1282779b7f99c16), ROM_BIOS(1) )
22322544
2233   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2545   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
22342546   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
22352547ROM_END
22362548
2549
2550//-------------------------------------------------
2551//  ROM( st )
2552//-------------------------------------------------
2553
22372554ROM_START( st_nl )
22382555   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
22392556   ROM_DEFAULT_BIOS("tos104")
22402557   ROM_SYSTEM_BIOS( 0, "tos104", "TOS 1.04 (Rainbow TOS)" )
22412558   ROMX_LOAD( "tos104nl.bin", 0x00000, 0x30000, BAD_DUMP CRC(bb4370d4) SHA1(6de7c96b2d2e5c68778f4bce3eaf85a4e121f166), ROM_BIOS(1) )
22422559
2243   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2560   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
22442561   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
22452562ROM_END
22462563
2564
2565//-------------------------------------------------
2566//  ROM( st )
2567//-------------------------------------------------
2568
22472569ROM_START( st_se )
22482570   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
22492571   ROM_DEFAULT_BIOS("tos104")
r9971r9972
22522574   ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" )
22532575   ROMX_LOAD( "tos104se.bin", 0x00000, 0x30000, BAD_DUMP CRC(80ecfdce) SHA1(b7ad34d5cdfbe86ea74ae79eca11dce421a7bbfd), ROM_BIOS(2) )
22542576
2255   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2577   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
22562578   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
22572579ROM_END
22582580
2581
2582//-------------------------------------------------
2583//  ROM( st )
2584//-------------------------------------------------
2585
22592586ROM_START( st_sg )
22602587   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
22612588   ROM_DEFAULT_BIOS("tos104")
r9971r9972
22642591   ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" )
22652592   ROMX_LOAD( "tos104sg.bin", 0x00000, 0x30000, BAD_DUMP CRC(e58f0bdf) SHA1(aa40bf7203f02b2251b9e4850a1a73ff1c7da106), ROM_BIOS(2) )
22662593
2267   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2594   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
22682595   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
22692596ROM_END
22702597
2598
2599//-------------------------------------------------
2600//  ROM( st )
2601//-------------------------------------------------
2602
22712603ROM_START( megast )
22722604   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
22732605   ROM_DEFAULT_BIOS("tos104")
r9971r9972
22762608   ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" )
22772609   ROMX_LOAD( "tos104.bin", 0x00000, 0x30000, BAD_DUMP CRC(90f4fbff) SHA1(2487f330b0895e5d88d580d4ecb24061125e88ad), ROM_BIOS(2) )
22782610
2279   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2611   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
22802612   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
22812613ROM_END
22822614
2615
2616//-------------------------------------------------
2617//  ROM( st )
2618//-------------------------------------------------
2619
22832620ROM_START( megast_uk )
22842621   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
22852622   ROM_DEFAULT_BIOS("tos104")
r9971r9972
22882625   ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" )
22892626   ROMX_LOAD( "tos104uk.bin", 0x00000, 0x30000, BAD_DUMP CRC(a50d1d43) SHA1(9526ef63b9cb1d2a7109e278547ae78a5c1db6c6), ROM_BIOS(2) )
22902627
2291   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2628   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
22922629   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
22932630ROM_END
22942631
2632
2633//-------------------------------------------------
2634//  ROM( st )
2635//-------------------------------------------------
2636
22952637ROM_START( megast_de )
22962638   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
22972639   ROM_DEFAULT_BIOS("tos104")
r9971r9972
23002642   ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" )
23012643   ROMX_LOAD( "tos104de.bin", 0x00000, 0x30000, BAD_DUMP CRC(62b82b42) SHA1(5313733f91b083c6265d93674cb9d0b7efd02da8), ROM_BIOS(2) )
23022644
2303   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2645   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
23042646   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
23052647ROM_END
23062648
2649
2650//-------------------------------------------------
2651//  ROM( st )
2652//-------------------------------------------------
2653
23072654ROM_START( megast_fr )
23082655   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
23092656   ROM_DEFAULT_BIOS("tos104")
r9971r9972
23122659   ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" )
23132660   ROMX_LOAD( "tos104fr.bin", 0x00000, 0x30000, BAD_DUMP CRC(a305a404) SHA1(20dba880344b810cf63cec5066797c5a971db870), ROM_BIOS(2) )
23142661
2315   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2662   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
23162663   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
23172664ROM_END
23182665
2666
2667//-------------------------------------------------
2668//  ROM( st )
2669//-------------------------------------------------
2670
23192671ROM_START( megast_se )
23202672   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
23212673   ROM_DEFAULT_BIOS("tos104")
r9971r9972
23242676   ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" )
23252677   ROMX_LOAD( "tos104se.bin", 0x00000, 0x30000, BAD_DUMP CRC(80ecfdce) SHA1(b7ad34d5cdfbe86ea74ae79eca11dce421a7bbfd), ROM_BIOS(2) )
23262678
2327   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2679   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
23282680   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
23292681ROM_END
23302682
2683
2684//-------------------------------------------------
2685//  ROM( st )
2686//-------------------------------------------------
2687
23312688ROM_START( megast_sg )
23322689   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
23332690   ROM_DEFAULT_BIOS("tos104")
r9971r9972
23362693   ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" )
23372694   ROMX_LOAD( "tos104sg.bin", 0x00000, 0x30000, BAD_DUMP CRC(e58f0bdf) SHA1(aa40bf7203f02b2251b9e4850a1a73ff1c7da106), ROM_BIOS(2) )
23382695
2339   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2696   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
23402697   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
23412698ROM_END
23422699
2700
2701//-------------------------------------------------
2702//  ROM( st )
2703//-------------------------------------------------
2704
23432705ROM_START( stacy )
23442706   ROM_REGION16_BE( 0x30000, M68000_TAG, 0 )
23452707   ROM_SYSTEM_BIOS( 0, "tos104", "TOS 1.04 (Rainbow TOS)" )
23462708   ROMX_LOAD( "tos104.bin", 0x00000, 0x30000, BAD_DUMP CRC(a50d1d43) SHA1(9526ef63b9cb1d2a7109e278547ae78a5c1db6c6), ROM_BIOS(1) )
23472709
2348   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2710   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
23492711   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
23502712ROM_END
23512713
2714
2715//-------------------------------------------------
2716//  ROM( st )
2717//-------------------------------------------------
2718
23522719ROM_START( ste )
23532720   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
23542721   ROM_DEFAULT_BIOS("tos206")
r9971r9972
23592726   ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" )
23602727   ROMX_LOAD( "tos206.bin", 0x00000, 0x40000, BAD_DUMP CRC(3f2f840f) SHA1(ee58768bdfc602c9b14942ce5481e97dd24e7c83), ROM_BIOS(3) )
23612728
2362   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2729   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
23632730   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
23642731ROM_END
23652732
2733
2734//-------------------------------------------------
2735//  ROM( st )
2736//-------------------------------------------------
2737
23662738ROM_START( ste_uk )
23672739   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
23682740   ROM_DEFAULT_BIOS("tos206")
r9971r9972
23732745   ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" )
23742746   ROMX_LOAD( "tos206uk.bin", 0x00000, 0x40000, BAD_DUMP CRC(08538e39) SHA1(2400ea95f547d6ea754a99d05d8530c03f8b28e3), ROM_BIOS(3) )
23752747
2376   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2748   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
23772749   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
23782750ROM_END
23792751
2752
2753//-------------------------------------------------
2754//  ROM( st )
2755//-------------------------------------------------
2756
23802757ROM_START( ste_de )
23812758   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
23822759   ROM_DEFAULT_BIOS("tos206")
r9971r9972
23872764   ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" )
23882765   ROMX_LOAD( "tos206de.bin", 0x00000, 0x40000, BAD_DUMP CRC(143cd2ab) SHA1(d1da866560734289c4305f1028c36291d331d417), ROM_BIOS(3) )
23892766
2390   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2767   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
23912768   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
23922769ROM_END
23932770
2771
2772//-------------------------------------------------
2773//  ROM( st )
2774//-------------------------------------------------
2775
23942776ROM_START( ste_es )
23952777   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
23962778   ROM_DEFAULT_BIOS("tos106")
23972779   ROM_SYSTEM_BIOS( 0, "tos106", "TOS 1.06 (STE TOS, Revision 1)" )
23982780   ROMX_LOAD( "tos106es.bin", 0x00000, 0x40000, BAD_DUMP CRC(5cd2a540) SHA1(3a18f342c8288c0bc1879b7a209c73d5d57f7e81), ROM_BIOS(1) )
23992781
2400   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2782   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
24012783   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
24022784ROM_END
24032785
2786
2787//-------------------------------------------------
2788//  ROM( st )
2789//-------------------------------------------------
2790
24042791ROM_START( ste_fr )
24052792   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
24062793   ROM_DEFAULT_BIOS("tos206")
r9971r9972
24112798   ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" )
24122799   ROMX_LOAD( "tos206fr.bin", 0x00000, 0x40000, BAD_DUMP CRC(e3a99ca7) SHA1(387da431e6e3dd2e0c4643207e67d06cf33618c3), ROM_BIOS(3) )
24132800
2414   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2801   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
24152802   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
24162803ROM_END
24172804
2805
2806//-------------------------------------------------
2807//  ROM( st )
2808//-------------------------------------------------
2809
24182810ROM_START( ste_it )
24192811   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
24202812   ROM_DEFAULT_BIOS("tos106")
24212813   ROM_SYSTEM_BIOS( 0, "tos106", "TOS 1.06 (STE TOS, Revision 1)" )
24222814   ROMX_LOAD( "tos106it.bin", 0x00000, 0x40000, BAD_DUMP CRC(d3a55216) SHA1(28dc74e5e0fa56b685bbe15f9837f52684fee9fd), ROM_BIOS(1) )
24232815
2424   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2816   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
24252817   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
24262818ROM_END
24272819
2820
2821//-------------------------------------------------
2822//  ROM( st )
2823//-------------------------------------------------
2824
24282825ROM_START( ste_se )
24292826   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
24302827   ROM_DEFAULT_BIOS("tos206")
r9971r9972
24332830   ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" )
24342831   ROMX_LOAD( "tos206se.bin", 0x00000, 0x40000, BAD_DUMP CRC(be61906d) SHA1(ebdf5a4cf08471cd315a91683fcb24e0f029d451), ROM_BIOS(2) )
24352832
2436   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2833   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
24372834   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
24382835ROM_END
24392836
2837
2838//-------------------------------------------------
2839//  ROM( st )
2840//-------------------------------------------------
2841
24402842ROM_START( ste_sg )
24412843   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
24422844   ROM_DEFAULT_BIOS("tos206")
24432845   ROM_SYSTEM_BIOS( 0, "tos206", "TOS 2.06 (ST/STE TOS)" )
24442846   ROMX_LOAD( "tos206sg.bin", 0x00000, 0x40000, BAD_DUMP CRC(8c4fe57d) SHA1(c7a9ae3162f020dcac0c2a46cf0c033f91b98644), ROM_BIOS(1) )
24452847
2446   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2848   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
24472849   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
24482850ROM_END
24492851
2852
2853//-------------------------------------------------
2854//  ROM( st )
2855//-------------------------------------------------
2856
24502857ROM_START( megaste )
24512858   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
24522859   ROM_DEFAULT_BIOS("tos206")
r9971r9972
24552862   ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" )
24562863   ROMX_LOAD( "tos206.bin", 0x00000, 0x40000, BAD_DUMP CRC(3f2f840f) SHA1(ee58768bdfc602c9b14942ce5481e97dd24e7c83), ROM_BIOS(2) )
24572864
2458   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2865   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
24592866   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
24602867ROM_END
24612868
2869
2870//-------------------------------------------------
2871//  ROM( st )
2872//-------------------------------------------------
2873
24622874ROM_START( megaste_uk )
24632875   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
24642876   ROM_DEFAULT_BIOS("tos206")
r9971r9972
24692881   ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" )
24702882   ROMX_LOAD( "tos206uk.bin", 0x00000, 0x40000, BAD_DUMP CRC(08538e39) SHA1(2400ea95f547d6ea754a99d05d8530c03f8b28e3), ROM_BIOS(3) )
24712883
2472   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2884   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
24732885   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
24742886ROM_END
24752887
2888
2889//-------------------------------------------------
2890//  ROM( st )
2891//-------------------------------------------------
2892
24762893ROM_START( megaste_fr )
24772894   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
24782895   ROM_DEFAULT_BIOS("tos206")
r9971r9972
24812898   ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" )
24822899   ROMX_LOAD( "tos206fr.bin", 0x00000, 0x40000, BAD_DUMP CRC(e3a99ca7) SHA1(387da431e6e3dd2e0c4643207e67d06cf33618c3), ROM_BIOS(2) )
24832900
2484   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2901   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
24852902   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
24862903ROM_END
24872904
2905
2906//-------------------------------------------------
2907//  ROM( st )
2908//-------------------------------------------------
2909
24882910ROM_START( megaste_de )
24892911   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
24902912   ROM_DEFAULT_BIOS("tos206")
r9971r9972
24932915   ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" )
24942916   ROMX_LOAD( "tos206de.bin", 0x00000, 0x40000, BAD_DUMP CRC(143cd2ab) SHA1(d1da866560734289c4305f1028c36291d331d417), ROM_BIOS(2) )
24952917
2496   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2918   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
24972919   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
24982920ROM_END
24992921
2922
2923//-------------------------------------------------
2924//  ROM( st )
2925//-------------------------------------------------
2926
25002927ROM_START( megaste_es )
25012928   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
25022929   ROM_DEFAULT_BIOS("tos205")
25032930   ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05 (Mega STE TOS)" )
25042931   ROMX_LOAD( "tos205es.bin", 0x00000, 0x40000, BAD_DUMP CRC(2a426206) SHA1(317715ad8de718b5acc7e27ecf1eb833c2017c91), ROM_BIOS(1) )
25052932
2506   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2933   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
25072934   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
25082935ROM_END
25092936
2937
2938//-------------------------------------------------
2939//  ROM( st )
2940//-------------------------------------------------
2941
25102942ROM_START( megaste_it )
25112943   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
25122944   ROM_DEFAULT_BIOS("tos205")
25132945   ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05 (Mega STE TOS)" )
25142946   ROMX_LOAD( "tos205it.bin", 0x00000, 0x40000, BAD_DUMP CRC(b28bf5a1) SHA1(8e0581b442384af69345738849cf440d72f6e6ab), ROM_BIOS(1) )
25152947
2516   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2948   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
25172949   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
25182950ROM_END
25192951
2952
2953//-------------------------------------------------
2954//  ROM( st )
2955//-------------------------------------------------
2956
25202957ROM_START( megaste_se )
25212958   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
25222959   ROM_DEFAULT_BIOS("tos206")
r9971r9972
25252962   ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" )
25262963   ROMX_LOAD( "tos206se.bin", 0x00000, 0x40000, BAD_DUMP CRC(be61906d) SHA1(ebdf5a4cf08471cd315a91683fcb24e0f029d451), ROM_BIOS(2) )
25272964
2528   ROM_REGION( 0x1000, HD6301_TAG, 0 )
2965   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
25292966   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
25302967ROM_END
25312968
2969
2970//-------------------------------------------------
2971//  ROM( st )
2972//-------------------------------------------------
2973
25322974ROM_START( stbook )
25332975   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
25342976   ROM_SYSTEM_BIOS( 0, "tos208", "TOS 2.08" )
r9971r9972
25382980   ROM_LOAD( "cop888c0.u703", 0x0000, 0x1000, NO_DUMP )
25392981ROM_END
25402982
2983
2984//-------------------------------------------------
2985//  ROM( st )
2986//-------------------------------------------------
2987
25412988ROM_START( stpad )
25422989   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
25432990   ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05" )
25442991   ROMX_LOAD( "tos205.bin", 0x00000, 0x40000, NO_DUMP, ROM_BIOS(1) )
25452992ROM_END
25462993
2994
2995//-------------------------------------------------
2996//  ROM( st )
2997//-------------------------------------------------
2998
25472999ROM_START( tt030 )
25483000   ROM_REGION32_BE( 0x80000, M68000_TAG, 0 )
25493001   ROM_DEFAULT_BIOS("tos306")
25503002   ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" )
25513003   ROMX_LOAD( "tos306.bin", 0x00000, 0x80000, BAD_DUMP CRC(e65adbd7) SHA1(b15948786278e1f2abc4effbb6d40786620acbe8), ROM_BIOS(1) )
25523004
2553   ROM_REGION( 0x1000, HD6301_TAG, 0 )
3005   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
25543006   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
25553007ROM_END
25563008
3009
3010//-------------------------------------------------
3011//  ROM( st )
3012//-------------------------------------------------
3013
25573014ROM_START( tt030_uk )
25583015   ROM_REGION32_BE( 0x80000, M68000_TAG, 0 )
25593016   ROM_DEFAULT_BIOS("tos306")
25603017   ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" )
25613018   ROMX_LOAD( "tos306uk.bin", 0x00000, 0x80000, BAD_DUMP CRC(75dda215) SHA1(6325bdfd83f1b4d3afddb2b470a19428ca79478b), ROM_BIOS(1) )
25623019
2563   ROM_REGION( 0x1000, HD6301_TAG, 0 )
3020   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
25643021   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
25653022ROM_END
25663023
3024
3025//-------------------------------------------------
3026//  ROM( st )
3027//-------------------------------------------------
3028
25673029ROM_START( tt030_de )
25683030   ROM_REGION32_BE( 0x80000, M68000_TAG, 0 )
25693031   ROM_DEFAULT_BIOS("tos306")
25703032   ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" )
25713033   ROMX_LOAD( "tos306de.bin", 0x00000, 0x80000, BAD_DUMP CRC(4fcbb59d) SHA1(80af04499d1c3b8551fc4d72142ff02c2182e64a), ROM_BIOS(1) )
25723034
2573   ROM_REGION( 0x1000, HD6301_TAG, 0 )
3035   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
25743036   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
25753037ROM_END
25763038
3039
3040//-------------------------------------------------
3041//  ROM( st )
3042//-------------------------------------------------
3043
25773044ROM_START( tt030_fr )
25783045   ROM_REGION32_BE( 0x80000, M68000_TAG, 0 )
25793046   ROM_DEFAULT_BIOS("tos306")
25803047   ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" )
25813048   ROMX_LOAD( "tos306fr.bin", 0x00000, 0x80000, BAD_DUMP CRC(1945511c) SHA1(6bb19874e1e97dba17215d4f84b992c224a81b95), ROM_BIOS(1) )
25823049
2583   ROM_REGION( 0x1000, HD6301_TAG, 0 )
3050   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
25843051   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
25853052ROM_END
25863053
3054
3055//-------------------------------------------------
3056//  ROM( st )
3057//-------------------------------------------------
3058
25873059ROM_START( tt030_pl )
25883060   ROM_REGION32_BE( 0x80000, M68000_TAG, 0 )
25893061   ROM_DEFAULT_BIOS("tos306")
25903062   ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" )
25913063   ROMX_LOAD( "tos306pl.bin", 0x00000, 0x80000, BAD_DUMP CRC(4f2404bc) SHA1(d122b8ceb202b52754ff0d442b1c81f8b4de3436), ROM_BIOS(1) )
25923064
2593   ROM_REGION( 0x1000, HD6301_TAG, 0 )
3065   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
25943066   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
25953067ROM_END
25963068
3069
3070//-------------------------------------------------
3071//  ROM( st )
3072//-------------------------------------------------
3073
25973074ROM_START( fx1 )
25983075   ROM_REGION16_BE( 0x40000, M68000_TAG, 0 )
25993076   ROM_SYSTEM_BIOS( 0, "tos207", "TOS 2.07" )
26003077   ROMX_LOAD( "tos207.bin", 0x00000, 0x40000, NO_DUMP, ROM_BIOS(1) )
26013078
2602   ROM_REGION( 0x1000, HD6301_TAG, 0 )
3079   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
26033080   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
26043081ROM_END
26053082
3083
3084//-------------------------------------------------
3085//  ROM( st )
3086//-------------------------------------------------
3087
26063088ROM_START( falcon30 )
26073089   ROM_REGION32_BE( 0x80000, M68000_TAG, 0 )
26083090   ROM_DEFAULT_BIOS("tos404")
r9971r9972
26153097   ROM_SYSTEM_BIOS( 3, "tos404", "TOS 4.04" )
26163098   ROMX_LOAD( "tos404.bin", 0x00000, 0x80000, BAD_DUMP CRC(028b561d) SHA1(27dcdb31b0951af99023b2fb8c370d8447ba6ebc), ROM_BIOS(4) )
26173099
2618   ROM_REGION( 0x1000, HD6301_TAG, 0 )
3100   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
26193101   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
26203102ROM_END
26213103
3104
3105//-------------------------------------------------
3106//  ROM( st )
3107//-------------------------------------------------
3108
26223109ROM_START( falcon40 )
26233110   ROM_REGION32_BE( 0x80000, M68000_TAG, 0 )
26243111   ROM_SYSTEM_BIOS( 0, "tos492", "TOS 4.92" )
26253112   ROMX_LOAD( "tos492.bin", 0x00000, 0x7d314, BAD_DUMP CRC(bc8e497f) SHA1(747a38042844a6b632dcd9a76d8525fccb5eb892), ROM_BIOS(2) )
26263113
2627   ROM_REGION( 0x1000, HD6301_TAG, 0 )
3114   ROM_REGION( 0x1000, HD6301V1_TAG, 0 )
26283115   ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) )
26293116ROM_END
26303117
2631/* System Drivers */
26323118
2633/*    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT       INIT     COMPANY    FULLNAME                FLAGS */
3119
3120//**************************************************************************
3121//   SYSTEM DRIVERS
3122//**************************************************************************
3123
3124//    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT       INIT     COMPANY    FULLNAME                FLAGS
26343125COMP( 1985,   st,         0,         0,      st,         st,         0,      "Atari",   "ST (USA)",            GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
26353126COMP( 1985,   st_uk,      st,         0,      st,         st,         0,      "Atari",   "ST (UK)",            GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
26363127COMP( 1985, st_de,      st,         0,      st,         st,         0,      "Atari",   "ST (Germany)",         GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
src/mess/drivers/x68k.c
r9971r9972
26502650   MCFG_MACHINE_RESET( x68000 )
26512651
26522652   /* device hardware */
2653   MCFG_MC68901_ADD(MC68901_TAG, 4000000, mfp_interface)
2653   MCFG_MK68901_ADD(MC68901_TAG, 4000000, mfp_interface)
26542654
26552655   MCFG_I8255A_ADD( "ppi8255",  ppi_interface )
26562656

Previous 15994 Revisions Next


© 1998-2018 The MESS Team