Previous 15994 Revisions Next

r7184 Wednesday 27th January, 2010 at 06:21:32 UTC by Curt Coder
[C2040] WIP, added MOS6530 emulation.
[src/mess]mess.mak
[src/mess/machine]c2040.c mos6530.c* mos6530.h*

src/mess/machine/mos6530.c
r0r7184
1/**********************************************************************
2
3    MOS Technology 6530 Memory, I/O, Timer Array 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   - interrupt flag register
15   - internal RAM
16   - internal ROM
17
18*/
19
20#include "mos6530.h"
21
22/***************************************************************************
23    PARAMETERS
24***************************************************************************/
25
26#define LOG 1
27
28enum
29{
30   REGISTER_PORT_A = 0,
31   REGISTER_PORT_A_DDR,
32   REGISTER_PORT_B,
33   REGISTER_PORT_B_DDR,
34   REGISTER_TIMER_1T, REGISTER_TIMER = REGISTER_TIMER_1T,
35   REGISTER_TIMER_8T, REGISTER_INTERRUPT_FLAG = REGISTER_TIMER_8T,
36   REGISTER_TIMER_64T,
37   REGISTER_TIMER_1024T
38};
39
40enum
41{
42   PORT_A = 0,
43   PORT_B,
44   PORT_COUNT
45};
46
47static const int PRESCALER[] = { 1, 8, 64, 1024 };
48
49/***************************************************************************
50    TYPE DEFINITIONS
51***************************************************************************/
52
53typedef struct _mos6530_t mos6530_t;
54struct _mos6530_t
55{
56   devcb_resolved_write_line   out_irq_func;
57
58   devcb_resolved_read8      in_port_func[PORT_COUNT];
59   devcb_resolved_write8      out_port_func[PORT_COUNT];
60
61   /* registers */
62   UINT8 output[PORT_COUNT];   /* output latches */
63   UINT8 ddr[PORT_COUNT];      /* DDR latches */
64   UINT8 counter;            /* counter */
65   int irq_enabled;
66
67   /* timers */
68   emu_timer *timer;         /* timer */
69};
70
71/***************************************************************************
72    INLINE FUNCTIONS
73***************************************************************************/
74
75INLINE mos6530_t *get_safe_token(const device_config *device)
76{
77   assert(device != NULL);
78   assert(device->token != NULL);
79   return (mos6530_t *)device->token;
80}
81
82INLINE const mos6530_interface *get_interface(const device_config *device)
83{
84   assert(device != NULL);
85   assert(device->type == MOS6530);
86   return (const mos6530_interface *) device->static_config;
87}
88
89INLINE UINT8 read_port(mos6530_t *mos6530, int port)
90{
91   UINT8 data = mos6530->output[port] & mos6530->ddr[port];
92
93   if (mos6530->ddr[port] != 0xff)
94   {
95      data |= devcb_call_read8(&mos6530->in_port_func[port], 0) & ~mos6530->ddr[port];
96   }
97
98   return data;
99}
100
101INLINE void write_port(mos6530_t *mos6530, int port, UINT8 data)
102{
103   mos6530->output[port] = data;
104
105   devcb_call_write8(&mos6530->out_port_func[port], 0, mos6530->output[port] & mos6530->ddr[port]);
106}
107
108/***************************************************************************
109    IMPLEMENTATION
110***************************************************************************/
111
112/*-------------------------------------------------
113    TIMER_CALLBACK( timer_tick )
114-------------------------------------------------*/
115
116static TIMER_CALLBACK( timer_tick )
117{
118   const device_config *device = (const device_config *)ptr;
119   mos6530_t *mos6530 = get_safe_token(device);
120
121   if (mos6530->counter == 0xff)
122   {
123      if (mos6530->irq_enabled)
124      {
125         /* interrupt */
126         logerror("MOS6530 '%s' Interrupt\n", device->tag.cstr());
127         devcb_call_write_line(&mos6530->out_irq_func, ASSERT_LINE);
128      }
129   }
130
131   mos6530->counter--;
132}
133
134/*-------------------------------------------------
135    mos6530_register_r - register read
136-------------------------------------------------*/
137
138READ8_DEVICE_HANDLER( mos6530_r )
139{
140   mos6530_t *mos6530 = get_safe_token(device);
141   int port = BIT(offset, 1);
142
143   UINT8 data = 0;
144
145   switch (offset & 0x07)
146   {
147   case REGISTER_PORT_A:
148   case REGISTER_PORT_B:
149      data = read_port(mos6530, port);
150      break;
151
152   case REGISTER_PORT_A_DDR:
153   case REGISTER_PORT_B_DDR:
154      data = mos6530->ddr[port];
155      break;
156
157   default:
158      switch (offset & 0x05)
159      {
160      case REGISTER_TIMER:
161         data = mos6530->counter;
162         devcb_call_write_line(&mos6530->out_irq_func, CLEAR_LINE);
163         logerror("MOS6530 '%s' Interrupt Cleared\n", device->tag.cstr());
164         break;
165
166      case REGISTER_INTERRUPT_FLAG:
167         break;
168      }
169   }
170
171   return data;
172}
173
174/*-------------------------------------------------
175    mos6530_register_w - register write
176-------------------------------------------------*/
177
178WRITE8_DEVICE_HANDLER( mos6530_w )
179{
180   mos6530_t *mos6530 = get_safe_token(device);
181   int port = BIT(offset, 1);
182
183   switch (offset & 0x07)
184   {
185   case REGISTER_PORT_A:
186   case REGISTER_PORT_B:
187      if (LOG) logerror("MOS6530 '%s' Port %c Write %02x\n", device->tag.cstr(), 'A' + port, data);
188      write_port(mos6530, port, data);
189      break;
190
191   case REGISTER_PORT_A_DDR:
192   case REGISTER_PORT_B_DDR:
193      if (LOG) logerror("MOS6530 '%s' Port %c DDR: %02x\n", device->tag.cstr(), 'A' + port, data);
194      mos6530->ddr[port] = data;
195      write_port(mos6530, port, data);
196      break;
197
198   case REGISTER_TIMER_1T:
199   case REGISTER_TIMER_8T:
200   case REGISTER_TIMER_64T:
201   case REGISTER_TIMER_1024T:
202      if (LOG) logerror("MOS6530 '%s' Timer: %02x, %uT, IRQ %s\n", device->tag.cstr(), data, PRESCALER[offset & 0x03], BIT(offset, 3) ? "enabled" : "disabled");
203      mos6530->counter = data;
204      mos6530->irq_enabled = BIT(offset, 3);
205      timer_adjust_periodic(mos6530->timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / PRESCALER[offset & 0x03]));
206      devcb_call_write_line(&mos6530->out_irq_func, CLEAR_LINE);
207      break;
208   }
209}
210
211/*-------------------------------------------------
212    DEVICE_START( mos6530 )
213-------------------------------------------------*/
214
215static DEVICE_START( mos6530 )
216{
217   mos6530_t *mos6530 = (mos6530_t *)device->token;
218   const mos6530_interface *intf = get_interface(device);
219
220   /* resolve callbacks */
221   devcb_resolve_write_line(&mos6530->out_irq_func, &intf->out_irq_func, device);
222   devcb_resolve_read8(&mos6530->in_port_func[PORT_A], &intf->in_pa_func, device);
223   devcb_resolve_read8(&mos6530->in_port_func[PORT_B], &intf->in_pb_func, device);
224   devcb_resolve_write8(&mos6530->out_port_func[PORT_A], &intf->out_pa_func, device);
225   devcb_resolve_write8(&mos6530->out_port_func[PORT_B], &intf->out_pb_func, device);
226
227   /* allocate timer */
228   mos6530->timer = timer_alloc(device->machine, timer_tick, (void *)device);
229
230   /* register for state saving */
231   state_save_register_device_item_array(device, 0, mos6530->output);
232   state_save_register_device_item_array(device, 0, mos6530->ddr);
233}
234
235/*-------------------------------------------------
236    DEVICE_RESET( mos6530 )
237-------------------------------------------------*/
238
239static DEVICE_RESET( mos6530 )
240{
241   mos6530_t *mos6530 = (mos6530_t *)device->token;
242
243   /* set ports to input mode */
244   mos6530->ddr[PORT_A] = 0;
245   mos6530->ddr[PORT_B] = 0;
246}
247
248/*-------------------------------------------------
249    DEVICE_GET_INFO( mos6530 )
250-------------------------------------------------*/
251
252DEVICE_GET_INFO( mos6530 )
253{
254   switch (state)
255   {
256      /* --- the following bits of info are returned as 64-bit signed integers --- */
257      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
258      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
259      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(mos6530_t);            break;
260
261      /* --- the following bits of info are returned as pointers to data or functions --- */
262      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(mos6530);   break;
263      case DEVINFO_FCT_STOP:                     /* Nothing */                        break;
264      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(mos6530);   break;
265
266      /* --- the following bits of info are returned as NULL-terminated strings --- */
267      case DEVINFO_STR_NAME:                     strcpy(info->s, "MOS6530");               break;
268      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "MOS6500");               break;
269      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
270      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
271      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");   break;
272   }
273}
src/mess/machine/mos6530.h
r0r7184
1/**********************************************************************
2
3    MOS Technology 6530 Memory, I/O, Timer Array emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9                            _____   _____
10                   Vss   1 |*    \_/     | 40  PA1
11                   PA0   2 |             | 39  PA2
12                  phi2   3 |             | 38  PA3
13                   RS0   4 |             | 37  PA4
14                    A9   5 |             | 36  PA5
15                    A8   6 |             | 35  PA6
16                    A7   7 |             | 34  PA7
17                    A6   8 |             | 33  DB0
18                   R/W   9 |             | 32  DB1
19                    A5  10 |   MCS6530   | 31  DB2
20                    A4  11 |             | 30  DB3
21                    A3  12 |             | 29  DB4
22                    A2  13 |             | 28  DB5
23                    A1  14 |             | 27  DB6
24                    A0  15 |             | 26  DB7
25                  _RES  16 |             | 25  PB0
26               IRQ/PB7  17 |             | 24  PB1
27               CS1/PB6  18 |             | 23  PB2
28               CS2/PB5  19 |             | 22  PB3
29                   Vcc  20 |_____________| 21  PB4
30
31**********************************************************************/
32
33#ifndef __MOS6530__
34#define __MOS6530__
35
36#include "emu.h"
37#include "devcb.h"
38
39/***************************************************************************
40    MACROS / CONSTANTS
41***************************************************************************/
42
43#define MOS6530 DEVICE_GET_INFO_NAME( mos6530 )
44
45#define MDRV_MOS6530_ADD(_tag, _clock, _config) \
46   MDRV_DEVICE_ADD((_tag), MOS6530, _clock)   \
47   MDRV_DEVICE_CONFIG(_config)
48
49#define MOS6530_INTERFACE(name) \
50   const mos6530_interface (name) =
51
52/***************************************************************************
53    TYPE DEFINITIONS
54***************************************************************************/
55
56typedef struct _mos6530_interface mos6530_interface;
57struct _mos6530_interface
58{
59   devcb_write_line      out_irq_func;
60
61   devcb_read8            in_pa_func;
62   devcb_write8         out_pa_func;
63
64   devcb_read8            in_pb_func;
65   devcb_write8         out_pb_func;
66};
67
68/***************************************************************************
69    PROTOTYPES
70***************************************************************************/
71
72/* device interface */
73DEVICE_GET_INFO( mos6530 );
74
75/* register access */
76READ8_DEVICE_HANDLER( mos6530_r );
77WRITE8_DEVICE_HANDLER( mos6530_w );
78
79/* memory access */
80/*
81READ8_DEVICE_HANDLER( mos6530_ram_r );
82WRITE8_DEVICE_HANDLER( mos6530_ram_w );
83
84READ8_DEVICE_HANDLER( mos6530_rom_r );
85*/
86#endif
src/mess/machine/c2040.c
r7183r7184
1212   TODO:
1313
1414   - find GCR rom region
15   - read from disk
1516   - write to disk
1617
1718*/
r7183r7184
2425#include "formats/g64_dsk.h"
2526#include "machine/6522via.h"
2627#include "machine/6532riot.h"
28#include "machine/mos6530.h"
2729#include "machine/ieee488.h"
2830
2931/***************************************************************************
3032    PARAMETERS
3133***************************************************************************/
3234
33#define LOG
35#define LOG 1
3436
3537#define M6502_DOS_TAG   "un1"
3638#define M6532_0_TAG      "uc1"
r7183r7184
5456#define TRACK_DATA_START   2
5557
5658#define SYNC   ((c2040->sr & SYNC_MARK) == SYNC_MARK)
57#define ERROR   (!c2040->ready & !BIT(c2040->gcr_data, 3))
59#define ERROR   (!c2040->ready & !BIT(c2040->e, 3))
5860
5961/***************************************************************************
6062    TYPE DEFINITIONS
r7183r7184
8789   UINT16 sr;                     /* data shift register */
8890   int ds;                        /* density select */
8991   UINT8* gcr;                     /* GCR encoder/decoder ROM */
90   UINT8 gcr_data;                  /* GCR encoder/decoded ROM data */
92   UINT8 i;                     /* GCR encoder/decoded ROM address */
93   UINT8 e;                     /* GCR encoder/decoded ROM data */
9194   UINT8 pi;                     /* parallel data input */
9295
9396   /* IEEE-488 bus */
r7183r7184
153156
154157INLINE void update_gcr_data(c2040_t *c2040)
155158{
156   UINT16 gcr_addr;
157
158159   if (c2040->rw)
159160   {
160161      /*
r7183r7184
175176
176177      */
177178
178      gcr_addr = (c2040->rw << 10) | (c2040->sr & 0x3ff);
179      c2040->i = (c2040->rw << 10) | (c2040->sr & 0x3ff);
179180   }
180181   else
181182   {
r7183r7184
197198
198199      */
199200
200      gcr_addr = (c2040->rw << 10) | ((c2040->pi & 0xf0) << 1) | (c2040->mode << 4) | (c2040->pi & 0x0f);
201      c2040->i = (c2040->rw << 10) | ((c2040->pi & 0xf0) << 1) | (c2040->mode << 4) | (c2040->pi & 0x0f);
201202   }
202203
203   //   c2040->gcr_data = c2040->gcr[gcr_addr];
204   //c2040->e = c2040->gcr[c2040->i];
204205
206   if (LOG)
207   {
208      UINT16 i = c2040->i;
209      UINT8 e = c2040->e;
210      UINT8 pa = (BIT(e, 6) << 7) | (BIT(i, 7) << 6) | (e & 0x30) | (BIT(e, 2) << 3) | (i & 0x04) | (e & 0x03);
211
212      logerror("offs %04x G64 %02x READY %u PA %02x DATA %03x GCR %02x SYNC %u ERROR %u\n", c2040->unit[c2040->drive].buffer_pos,
213         c2040->unit[c2040->drive].track_buffer[c2040->unit[c2040->drive].buffer_pos],
214         c2040->ready, pa, c2040->sr & 0x3ff, c2040->e, SYNC, ERROR);
215   }
216
205217   via_cb1_w(c2040->via, ERROR);
206218}
207219
r7183r7184
243255      c2040->bit_count = 0;
244256   }
245257
246   if (c2040->bit_count > 7)
258   if (c2040->bit_count == 10)
247259   {
248260      /* byte ready */
249261      c2040->bit_count = 0;
250262      ready = 0;
251
252      if (!(c2040->sr & 0xff))
253      {
254         /* simulate weak bits with randomness */
255         c2040->sr = (c2040->sr & 0xff00) | (mame_rand(machine) & 0xff);
256      }
257263   }
258264
259265   if (c2040->ready != ready)
r7183r7184
301307   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
302308   AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0100) AM_RAM // 6532 #1
303309   AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0100) AM_RAM // 6532 #2
304   AM_RANGE(0x0200, 0x020f) AM_MIRROR(0x0d70) AM_DEVREADWRITE(M6532_0_TAG, riot6532_r, riot6532_w)
305   AM_RANGE(0x0280, 0x028f) AM_MIRROR(0x0d70) AM_DEVREADWRITE(M6532_1_TAG, riot6532_r, riot6532_w)
310   AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_0_TAG, riot6532_r, riot6532_w)
311   AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_1_TAG, riot6532_r, riot6532_w)
306312   AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share1")
307313   AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share2")
308314   AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share3")
r7183r7184
318324   ADDRESS_MAP_GLOBAL_MASK(0x1fff)
319325   AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530
320326   AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6522_TAG, via_r, via_w)
321   AM_RANGE(0x0080, 0x008f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6530_TAG, riot6532_r, riot6532_w)
327   AM_RANGE(0x0080, 0x009f) AM_MIRROR(0x0320) AM_DEVREADWRITE(M6530_TAG, mos6530_r, mos6530_w)
322328   AM_RANGE(0x0400, 0x07ff) AM_RAM AM_SHARE("share1")
323329   AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("share2")
324330   AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_SHARE("share3")
r7183r7184
334340   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
335341   AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0100) AM_RAM // 6532 #1
336342   AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0100) AM_RAM // 6532 #2
337   AM_RANGE(0x0200, 0x020f) /*AM_MIRROR(0x0d70)*/ AM_DEVREADWRITE(M6532_0_TAG, riot6532_r, riot6532_w)
338   AM_RANGE(0x0280, 0x028f) /*AM_MIRROR(0x0d70)*/ AM_DEVREADWRITE(M6532_1_TAG, riot6532_r, riot6532_w)
339   AM_RANGE(0x1000, 0x13ff) /*AM_MIRROR(0x0c00)*/ AM_RAM AM_SHARE("share1")
340   AM_RANGE(0x2000, 0x23ff) /*AM_MIRROR(0x0c00)*/ AM_RAM AM_SHARE("share2")
341   AM_RANGE(0x3000, 0x33ff) /*AM_MIRROR(0x0c00)*/ AM_RAM AM_SHARE("share3")
342   AM_RANGE(0x4000, 0x43ff) /*AM_MIRROR(0x0c00)*/ AM_RAM AM_SHARE("share4")
343   AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_0_TAG, riot6532_r, riot6532_w)
344   AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_1_TAG, riot6532_r, riot6532_w)
345   AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share1")
346   AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share2")
347   AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share3")
348   AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share4")
343349   AM_RANGE(0x5000, 0x7fff) AM_ROM AM_REGION("c4040", 0x0000)
344350ADDRESS_MAP_END
345351
r7183r7184
349355
350356static ADDRESS_MAP_START( c4040_fdc_map, ADDRESS_SPACE_PROGRAM, 8 )
351357   ADDRESS_MAP_GLOBAL_MASK(0x1fff)
352   AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0100) AM_RAM // 6530
353   AM_RANGE(0x0040, 0x004f) /*AM_MIRROR(0x0330)*/ AM_DEVREADWRITE(M6522_TAG, via_r, via_w)
354   AM_RANGE(0x0080, 0x008f) /*AM_MIRROR(0x0330)*/ AM_DEVREADWRITE(M6530_TAG, riot6532_r, riot6532_w)
358   AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530
359   AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6522_TAG, via_r, via_w)
360   AM_RANGE(0x0080, 0x009f) AM_MIRROR(0x0320) AM_DEVREADWRITE(M6530_TAG, mos6530_r, mos6530_w)
355361   AM_RANGE(0x0400, 0x07ff) AM_RAM AM_SHARE("share1")
356362   AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("share2")
357363   AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_SHARE("share3")
r7183r7184
364370-------------------------------------------------*/
365371
366372static ADDRESS_MAP_START( c8050_dos_map, ADDRESS_SPACE_PROGRAM, 8 )
367   AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0f00) AM_RAM // 6532 #1
368   AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0f00) AM_RAM // 6532 #2
369   AM_RANGE(0x0200, 0x020f) AM_MIRROR(0x0d70) AM_DEVREADWRITE(M6532_0_TAG, riot6532_r, riot6532_w)
370   AM_RANGE(0x0280, 0x028f) AM_MIRROR(0x0d70) AM_DEVREADWRITE(M6532_1_TAG, riot6532_r, riot6532_w)
373   AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0100) AM_RAM // 6532 #1
374   AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0100) AM_RAM // 6532 #2
375   AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_0_TAG, riot6532_r, riot6532_w)
376   AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_1_TAG, riot6532_r, riot6532_w)
371377   AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share1")
372378   AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share2")
373379   AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share3")
r7183r7184
383389   ADDRESS_MAP_GLOBAL_MASK(0x1fff)
384390   AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530
385391   AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6522_TAG, via_r, via_w)
386   AM_RANGE(0x0080, 0x008f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6530_TAG, riot6532_r, riot6532_w)
392   AM_RANGE(0x0080, 0x008f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6530_TAG, mos6530_r, mos6530_w)
387393   AM_RANGE(0x0400, 0x07ff) AM_RAM AM_SHARE("share1")
388394   AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("share2")
389395   AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_SHARE("share3")
r7183r7184
396402-------------------------------------------------*/
397403
398404static ADDRESS_MAP_START( sfd1001_dos_map, ADDRESS_SPACE_PROGRAM, 8 )
399   AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0f00) AM_RAM // 6532 #1
400   AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0f00) AM_RAM // 6532 #2
401   AM_RANGE(0x0200, 0x020f) AM_MIRROR(0x0d70) AM_DEVREADWRITE(M6532_0_TAG, riot6532_r, riot6532_w)
402   AM_RANGE(0x0280, 0x028f) AM_MIRROR(0x0d70) AM_DEVREADWRITE(M6532_1_TAG, riot6532_r, riot6532_w)
405   AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0100) AM_RAM // 6532 #1
406   AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0100) AM_RAM // 6532 #2
407   AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_0_TAG, riot6532_r, riot6532_w)
408   AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_1_TAG, riot6532_r, riot6532_w)
403409   AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share1")
404410   AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share2")
405411   AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share3")
r7183r7184
415421   ADDRESS_MAP_GLOBAL_MASK(0x1fff)
416422   AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530
417423   AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6522_TAG, via_r, via_w)
418   AM_RANGE(0x0080, 0x008f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6530_TAG, riot6532_r, riot6532_w)
424   AM_RANGE(0x0080, 0x008f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6530_TAG, mos6530_r, mos6530_w)
419425   AM_RANGE(0x0400, 0x07ff) AM_RAM AM_SHARE("share1")
420426   AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("share2")
421427   AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_SHARE("share3")
r7183r7184
650656
651657   c2040_t *c2040 = get_safe_token(device->owner);
652658
653   UINT16 i = c2040->sr;
654   UINT8 e = c2040->gcr_data;
659   UINT16 i = c2040->i;
660   UINT8 e = c2040->e;
655661
656662   return (BIT(e, 6) << 7) | (BIT(i, 7) << 6) | (e & 0x30) | (BIT(e, 2) << 3) | (i & 0x04) | (e & 0x03);
657663}
r7183r7184
706712         /* extract track length */
707713         c2040->unit[unit].track_len = (c2040->unit[unit].track_buffer[1] << 8) | c2040->unit[unit].track_buffer[0];
708714      }
715
716      c2040->unit[unit].stp = stp;
709717   }
710718}
711719
r7183r7184
731739   /* stepper motor 1 */
732740   int s1 = data & 0x03;
733741   step_motor(c2040, 1, s1);
734   logerror("S1 %u\n", s1);
735742
736743   /* stepper motor 0 */
737744   int s0 = (data >> 2) & 0x03;
738745   step_motor(c2040, 0, s0);
739   logerror("S0 %u\n", s1);
740746
741747   /* spindle motor 1 */
742748   int mtr1 = BIT(data, 4);
743749   floppy_mon_w(c2040->unit[1].image, !mtr1);
744   logerror("MTR1 %u\n", mtr1);
745750
746751   /* spindle motor 0 */
747752   int mtr0 = BIT(data, 5);
748753   floppy_mon_w(c2040->unit[0].image, !mtr0);
749   logerror("MTR0 %u\n", mtr0);
750754
751755   timer_enable(c2040->bit_timer, mtr1 | mtr0);
752756}
r7183r7184
871875};
872876
873877/*-------------------------------------------------
874    riot6532_interface c2040_riot2_intf uk3
878    mos6530_interface c2040_riot2_intf uk3
875879-------------------------------------------------*/
876880
877881static READ8_DEVICE_HANDLER( pi_r )
r7183r7184
10421046   cpu_set_input_line(c2040->cpu_fdc, M6502_IRQ_LINE, state);
10431047}
10441048
1045static const riot6532_interface c2040_riot2_intf =
1049static MOS6530_INTERFACE( c2040_riot2_intf )
10461050{
1051   DEVCB_LINE(c2040_riot2_irq_w),
10471052   DEVCB_HANDLER(pi_r),
1053   DEVCB_HANDLER(pi_w),
10481054   DEVCB_HANDLER(c2040_riot2_pb_r),
1049   DEVCB_HANDLER(pi_w),
1050   DEVCB_HANDLER(c2040_riot2_pb_w),
1051   DEVCB_LINE(c2040_riot2_irq_w)
1055   DEVCB_HANDLER(c2040_riot2_pb_w)
10521056};
10531057
1054static const riot6532_interface c8050_riot2_intf =
1058static MOS6530_INTERFACE( c8050_riot2_intf )
10551059{
1060   DEVCB_LINE(c2040_riot2_irq_w),
10561061   DEVCB_HANDLER(pi_r),
1062   DEVCB_HANDLER(pi_w),
10571063   DEVCB_HANDLER(c8050_riot2_pb_r),
1058   DEVCB_HANDLER(pi_w),
1059   DEVCB_HANDLER(c8050_riot2_pb_w),
1060   DEVCB_LINE(c2040_riot2_irq_w)
1064   DEVCB_HANDLER(c8050_riot2_pb_w)
10611065};
10621066
10631067/*-------------------------------------------------
r7183r7184
11751179   MDRV_CPU_PROGRAM_MAP(c2040_fdc_map)
11761180   
11771181   MDRV_VIA6522_ADD(M6522_TAG, XTAL_16MHz/16, c2040_via_intf)
1178   MDRV_RIOT6532_ADD(M6530_TAG, XTAL_16MHz/16, c2040_riot2_intf)
1182   MDRV_MOS6530_ADD(M6530_TAG, XTAL_16MHz/16, c2040_riot2_intf)
11791183
11801184   MDRV_FLOPPY_2_DRIVES_ADD(c2040_floppy_config)
11811185MACHINE_DRIVER_END
r7183r7184
11971201   MDRV_CPU_PROGRAM_MAP(c4040_fdc_map)
11981202
11991203   MDRV_VIA6522_ADD(M6522_TAG, XTAL_16MHz/16, c2040_via_intf)
1200   MDRV_RIOT6532_ADD(M6530_TAG, XTAL_16MHz/16, c2040_riot2_intf)
1204   MDRV_MOS6530_ADD(M6530_TAG, XTAL_16MHz/16, c2040_riot2_intf)
12011205
12021206   MDRV_FLOPPY_2_DRIVES_ADD(c4040_floppy_config)
12031207MACHINE_DRIVER_END
r7183r7184
12191223   MDRV_CPU_PROGRAM_MAP(c8050_fdc_map)
12201224   
12211225   MDRV_VIA6522_ADD(M6522_TAG, XTAL_12MHz/3, c8050_via_intf)
1222   MDRV_RIOT6532_ADD(M6530_TAG, XTAL_12MHz/3, c8050_riot2_intf)
1226   MDRV_MOS6530_ADD(M6530_TAG, XTAL_12MHz/3, c8050_riot2_intf)
12231227
12241228   MDRV_FLOPPY_2_DRIVES_ADD(c8050_floppy_config)
12251229MACHINE_DRIVER_END
r7183r7184
12411245   MDRV_CPU_PROGRAM_MAP(c8050_fdc_map)
12421246   
12431247   MDRV_VIA6522_ADD(M6522_TAG, XTAL_12MHz/3, c8050_via_intf)
1244   MDRV_RIOT6532_ADD(M6530_TAG, XTAL_12MHz/3, c8050_riot2_intf)
1248   MDRV_MOS6530_ADD(M6530_TAG, XTAL_12MHz/3, c8050_riot2_intf)
12451249
12461250   MDRV_FLOPPY_2_DRIVES_ADD(c8250_floppy_config)
12471251MACHINE_DRIVER_END
r7183r7184
12631267   MDRV_CPU_PROGRAM_MAP(sfd1001_fdc_map)
12641268   
12651269   MDRV_VIA6522_ADD(M6522_TAG, XTAL_12MHz/3, c8050_via_intf)
1266   MDRV_RIOT6532_ADD(M6530_TAG, XTAL_12MHz/3, c8050_riot2_intf)
1270   MDRV_MOS6530_ADD(M6530_TAG, XTAL_12MHz/3, c8050_riot2_intf)
12671271
12681272   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, c8250_floppy_config)
12691273MACHINE_DRIVER_END
r7183r7184
13921396   c2040->unit[1].image = device_find_child_by_tag(device, FLOPPY_1);
13931397
13941398   /* find GCR ROM */
1399   //c2040->gcr = memory_region(device->machine, "c4040:c4040") + 0x3400;
13951400
13961401   /* allocate data timer */
13971402   c2040->bit_timer = timer_alloc(device->machine, bit_tick, (void *)device);
src/mess/mess.mak
r7183r7184
465465   $(MESS_MACHINE)/mpc105.o   \
466466   $(MESS_MACHINE)/msm58321.o   \
467467   $(MESS_MACHINE)/msm8251.o   \
468   $(MESS_MACHINE)/mos6530.o   \
468469   $(MESS_MACHINE)/upd765.o   \
469470   $(MESS_MACHINE)/ncr5380.o   \
470471   $(MESS_MACHINE)/pc_lpt.o   \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team