Previous 15994 Revisions Next

r6634 Tuesday 15th December, 2009 at 07:37:21 UTC by Curt Coder
Added device skeletons for Commodore 1551/1570/1571/1571CR/1581.
[src/mess]mess.mak
[src/mess/machine]c1541.c c1551.c* c1551.h* c1571.c c1581.c* c1581.h*

src/mess/machine/c1581.c
r0r6634
1/**********************************************************************
2
3    Commodore 1581 Single Disk Drive emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "driver.h"
11#include "c1581.h"
12#include "cpu/m6502/m6502.h"
13#include "devices/flopdrv.h"
14#include "formats/g64_dsk.h"
15#include "machine/6526cia.h"
16#include "machine/cbmserial.h"
17#include "machine/wd17xx.h"
18
19/***************************************************************************
20    PARAMETERS
21***************************************************************************/
22
23#define LOG 0
24
25#define M6502_TAG      "u1"
26#define M8520_TAG      "u5"
27#define WD1770_TAG      "u4"
28
29/***************************************************************************
30    TYPE DEFINITIONS
31***************************************************************************/
32
33typedef struct _c1581_t c1581_t;
34struct _c1581_t
35{
36   /* devices */
37   const device_config *cpu;
38   const device_config *cia;
39   const device_config *wd1770;
40   const device_config *serial_bus;
41   const device_config *image;
42};
43
44/***************************************************************************
45    INLINE FUNCTIONS
46***************************************************************************/
47
48INLINE c1581_t *get_safe_token(const device_config *device)
49{
50   assert(device != NULL);
51   assert(device->token != NULL);
52   assert(device->type == C1581);
53   return (c1581_t *)device->token;
54}
55
56INLINE c1581_config *get_safe_config(const device_config *device)
57{
58   assert(device != NULL);
59   assert(device->type == C1581);
60   return (c1581_config *)device->inline_config;
61}
62
63/***************************************************************************
64    IMPLEMENTATION
65***************************************************************************/
66
67/*-------------------------------------------------
68    ADDRESS_MAP( c1581_map )
69-------------------------------------------------*/
70
71static ADDRESS_MAP_START( c1581_map, ADDRESS_SPACE_PROGRAM, 8 )
72   AM_RANGE(0x0000, 0x1fff) AM_RAM
73   AM_RANGE(0x4000, 0x4010) AM_DEVREADWRITE(M8520_TAG, cia_r, cia_w)
74   AM_RANGE(0x6000, 0x6003) AM_DEVREADWRITE(WD1770_TAG, wd17xx_r, wd17xx_w)
75   AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("c1581", 0)
76ADDRESS_MAP_END
77
78/*-------------------------------------------------
79    cia6526_interface c1581_cia_intf
80-------------------------------------------------*/
81
82static const cia6526_interface c1581_cia_intf =
83{
84   DEVCB_NULL,
85   DEVCB_NULL,
86   10, /* 1/10 second */
87   {
88      { DEVCB_NULL, DEVCB_NULL },
89      { DEVCB_NULL, DEVCB_NULL }
90   }
91};
92
93/*-------------------------------------------------
94    wd17xx_interface c1581_wd1770_intf
95-------------------------------------------------*/
96
97static const wd17xx_interface c1581_wd1770_intf =
98{
99   DEVCB_NULL,
100   DEVCB_NULL,
101   { FLOPPY_0, NULL, NULL, NULL }
102};
103
104/*-------------------------------------------------
105    FLOPPY_OPTIONS( c1581 )
106-------------------------------------------------*/
107
108static FLOPPY_OPTIONS_START( c1581 )
109//   FLOPPY_OPTION( c1581, "d81", "Commodore 1581 Disk Image", d64_dsk_identify, d64_dsk_construct, NULL )
110FLOPPY_OPTIONS_END
111
112/*-------------------------------------------------
113    floppy_config c1581_floppy_config
114-------------------------------------------------*/
115
116static const floppy_config c1581_floppy_config =
117{
118   DEVCB_NULL,
119   DEVCB_NULL,
120   DEVCB_NULL,
121   DEVCB_NULL,
122   DEVCB_NULL,
123   FLOPPY_DRIVE_DS_80,
124   FLOPPY_OPTIONS_NAME(c1581),
125   DO_NOT_KEEP_GEOMETRY
126};
127
128/*-------------------------------------------------
129    MACHINE_DRIVER( c1581 )
130-------------------------------------------------*/
131
132static MACHINE_DRIVER_START( c1581 )
133   MDRV_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/16)
134   MDRV_CPU_PROGRAM_MAP(c1581_map)
135
136   MDRV_CIA8520_ADD(M8520_TAG, XTAL_16MHz/16, c1581_cia_intf)
137   MDRV_WD1770_ADD(WD1770_TAG, c1581_wd1770_intf)
138
139   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, c1581_floppy_config)
140MACHINE_DRIVER_END
141
142/*-------------------------------------------------
143    ROM( c1581 )
144-------------------------------------------------*/
145
146ROM_START( c1581 )
147   ROM_REGION( 0x8000, "c1581", ROMREGION_LOADBYNAME )
148   ROM_LOAD( "beta.u2",     0x0000, 0x8000, CRC(ecc223cd) SHA1(a331d0d46ead1f0275b4ca594f87c6694d9d9594) )
149   ROM_LOAD( "318045-01.u2", 0x0000, 0x8000, CRC(113af078) SHA1(3fc088349ab83e8f5948b7670c866a3c954e6164) )
150   ROM_LOAD( "318045-02.u2", 0x0000, 0x8000, CRC(a9011b84) SHA1(01228eae6f066bd9b7b2b6a7fa3f667e41dad393) )
151ROM_END
152
153/*-------------------------------------------------
154    ROM( c1563 )
155-------------------------------------------------*/
156
157ROM_START( c1563 )
158   ROM_REGION( 0x8000, "c1563", ROMREGION_LOADBYNAME )
159   ROM_LOAD( "1563-rom.bin", 0x0000, 0x8000, CRC(1d184687) SHA1(2c5111a9c15be7b7955f6c8775fea25ec10c0ca0) )
160ROM_END
161
162/*-------------------------------------------------
163    DEVICE_START( c1581 )
164-------------------------------------------------*/
165
166static DEVICE_START( c1581 )
167{
168}
169
170/*-------------------------------------------------
171    DEVICE_RESET( c1581 )
172-------------------------------------------------*/
173
174static DEVICE_RESET( c1581 )
175{
176}
177
178/*-------------------------------------------------
179    DEVICE_GET_INFO( c1581 )
180-------------------------------------------------*/
181
182DEVICE_GET_INFO( c1581 )
183{
184   switch (state)
185   {
186      /* --- the following bits of info are returned as 64-bit signed integers --- */
187      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(c1581_t);                           break;
188      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = sizeof(c1581_config);                        break;
189      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;                     break;
190
191      /* --- the following bits of info are returned as pointers --- */
192      case DEVINFO_PTR_ROM_REGION:               info->romregion = ROM_NAME(c1581);                     break;
193      case DEVINFO_PTR_MACHINE_CONFIG:            info->machine_config = MACHINE_DRIVER_NAME(c1581);         break;
194
195      /* --- the following bits of info are returned as pointers to data or functions --- */
196      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(c1581);                  break;
197      case DEVINFO_FCT_STOP:                     /* Nothing */                                    break;
198      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(c1581);                  break;
199
200      /* --- the following bits of info are returned as NULL-terminated strings --- */
201      case DEVINFO_STR_NAME:                     strcpy(info->s, "Commodore 1581");                     break;
202      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Commodore 1581");                     break;
203      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                              break;
204      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                           break;
205      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");             break;
206   }
207}
src/mess/machine/c1581.h
r0r6634
1/**********************************************************************
2
3    Commodore 1581 Single Disk Drive emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#ifndef __C1581__
11#define __C1581__
12
13#include "driver.h"
14
15/***************************************************************************
16    MACROS / CONSTANTS
17***************************************************************************/
18
19#define C1581 DEVICE_GET_INFO_NAME( c1581 )
20
21#define MDRV_C1581_ADD(_tag, _serial_bus_tag, _address) \
22   MDRV_DEVICE_ADD(_tag, C1581, 0) \
23   MDRV_DEVICE_CONFIG_DATAPTR(c1581_config, serial_bus_tag, _serial_bus_tag) \
24   MDRV_DEVICE_CONFIG_DATA32(c1581_config, address, _address)
25
26/***************************************************************************
27    TYPE DEFINITIONS
28***************************************************************************/
29
30typedef struct _c1581_config c1581_config;
31struct _c1581_config
32{
33   const char *serial_bus_tag;   /* serial bus device */
34   int address;            /* serial address */
35};
36
37/***************************************************************************
38    PROTOTYPES
39***************************************************************************/
40
41/* device interface */
42DEVICE_GET_INFO( c1581 );
43
44#endif
src/mess/machine/c1541.c
r6633r6634
154154#define M6522_1_TAG      "ucd4"
155155#define TIMER_BIT_TAG   "ue7"
156156
157#define FLOPPY_TAG      "c1541_floppy"
158
159157static const double C1541_BITRATE[4] =
160158{
161159   XTAL_16MHz/13.0,   /* tracks 1-17 */
r6633r6634
676674   MDRV_VIA6522_ADD(M6522_0_TAG, XTAL_16MHz/16, c1541_via0_intf)
677675   MDRV_VIA6522_ADD(M6522_1_TAG, XTAL_16MHz/16, c1541_via1_intf)
678676
679   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_TAG, c1541_floppy_config)
677   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, c1541_floppy_config)
680678MACHINE_DRIVER_END
681679
682680/*-------------------------------------------------
r6633r6634
788786   c1541->via0 = device_find_child_by_tag(device, M6522_0_TAG);
789787   c1541->via1 = device_find_child_by_tag(device, M6522_1_TAG);
790788   c1541->serial_bus = devtag_get_device(device->machine, config->serial_bus_tag);
791   c1541->image = device_find_child_by_tag(device, FLOPPY_TAG);
789   c1541->image = device_find_child_by_tag(device, FLOPPY_0);
792790
793791   /* allocate track buffer */
794792//   c1541->track_buffer = auto_alloc_array(device->machine, UINT8, TRACK_BUFFER_SIZE);
src/mess/machine/c1551.c
r0r6634
1/**********************************************************************
2
3    Commodore 1551 Single Disk Drive emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "driver.h"
11#include "c1551.h"
12#include "cpu/m6502/m6502.h"
13#include "devices/flopdrv.h"
14#include "formats/g64_dsk.h"
15#include "machine/6525tpi.h"
16#include "machine/cbmserial.h"
17
18/***************************************************************************
19    PARAMETERS
20***************************************************************************/
21
22#define LOG 0
23
24#define M6510T_TAG      "u2"
25#define M6525_TAG      "u3"
26
27#define FLOPPY_TAG      "c1551_floppy"
28
29/***************************************************************************
30    TYPE DEFINITIONS
31***************************************************************************/
32
33typedef struct _c1551_t c1551_t;
34struct _c1551_t
35{
36   /* devices */
37   const device_config *cpu;
38   const device_config *tpi;
39   const device_config *image;
40};
41
42/***************************************************************************
43    INLINE FUNCTIONS
44***************************************************************************/
45
46INLINE c1551_t *get_safe_token(const device_config *device)
47{
48   assert(device != NULL);
49   assert(device->token != NULL);
50   assert(device->type == C1551);
51   return (c1551_t *)device->token;
52}
53
54/***************************************************************************
55    IMPLEMENTATION
56***************************************************************************/
57
58/*-------------------------------------------------
59    ADDRESS_MAP( c1551_map )
60-------------------------------------------------*/
61
62static ADDRESS_MAP_START( c1551_map, ADDRESS_SPACE_PROGRAM, 8 )
63//   AM_RANGE(0x0000, 0x0001) AM_READWRITE(c1551_port_r, c1551_port_w)
64   AM_RANGE(0x0002, 0x07ff) AM_RAM
65   AM_RANGE(0x4000, 0x4007) AM_DEVREADWRITE(M6525_TAG, tpi6525_r, tpi6525_w)
66   AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("c1551", 0)
67ADDRESS_MAP_END
68
69/*-------------------------------------------------
70    tpi6525_interface c1551_tpi_intf
71-------------------------------------------------*/
72
73static const tpi6525_interface c1551_tpi_intf =
74{
75   NULL,
76   NULL,
77   NULL,
78   NULL,
79   NULL,
80   NULL,
81   NULL,
82   NULL,
83   NULL
84};
85
86/*-------------------------------------------------
87    FLOPPY_OPTIONS( c1551 )
88-------------------------------------------------*/
89
90static FLOPPY_OPTIONS_START( c1551 )
91//   FLOPPY_OPTION( c1551, "d64", "Commodore 1541 Disk Image", d64_dsk_identify, d64_dsk_construct, NULL )
92   FLOPPY_OPTION( c1551, "g64", "Commodore 1551 GCR Disk Image", g64_dsk_identify, g64_dsk_construct, NULL )
93FLOPPY_OPTIONS_END
94
95/*-------------------------------------------------
96    floppy_config c1551_floppy_config
97-------------------------------------------------*/
98
99static const floppy_config c1551_floppy_config =
100{
101   DEVCB_NULL,
102   DEVCB_NULL,
103   DEVCB_NULL,
104   DEVCB_NULL,
105   DEVCB_NULL,
106   FLOPPY_DRIVE_SS_80,
107   FLOPPY_OPTIONS_NAME(c1551),
108   DO_NOT_KEEP_GEOMETRY
109};
110
111/*-------------------------------------------------
112    MACHINE_DRIVER( c1551 )
113-------------------------------------------------*/
114
115static MACHINE_DRIVER_START( c1551 )
116   MDRV_CPU_ADD(M6510T_TAG, M6510T, 2000000)
117   MDRV_CPU_PROGRAM_MAP(c1551_map)
118
119   MDRV_TPI6525_ADD(M6525_TAG, c1551_tpi_intf)
120
121   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_TAG, c1551_floppy_config)
122MACHINE_DRIVER_END
123
124/*-------------------------------------------------
125    ROM( c1551 )
126-------------------------------------------------*/
127
128ROM_START( c1551 )
129   ROM_REGION( 0x4000, "c1551", ROMREGION_LOADBYNAME )
130   ROM_LOAD( "318001-01.u4", 0x0000, 0x4000, CRC(6d16d024) SHA1(fae3c788ad9a6cc2dbdfbcf6c0264b2ca921d55e) )
131ROM_END
132
133/*-------------------------------------------------
134    DEVICE_START( c1551 )
135-------------------------------------------------*/
136
137static DEVICE_START( c1551 )
138{
139}
140
141/*-------------------------------------------------
142    DEVICE_RESET( c1551 )
143-------------------------------------------------*/
144
145static DEVICE_RESET( c1551 )
146{
147}
148
149/*-------------------------------------------------
150    DEVICE_GET_INFO( c1551 )
151-------------------------------------------------*/
152
153DEVICE_GET_INFO( c1551 )
154{
155   switch (state)
156   {
157      /* --- the following bits of info are returned as 64-bit signed integers --- */
158      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(c1551_t);                           break;
159      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                                    break;
160      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;                     break;
161
162      /* --- the following bits of info are returned as pointers --- */
163      case DEVINFO_PTR_ROM_REGION:               info->romregion = ROM_NAME(c1551);                     break;
164      case DEVINFO_PTR_MACHINE_CONFIG:            info->machine_config = MACHINE_DRIVER_NAME(c1551);         break;
165
166      /* --- the following bits of info are returned as pointers to data or functions --- */
167      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(c1551);                  break;
168      case DEVINFO_FCT_STOP:                     /* Nothing */                                    break;
169      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(c1551);                  break;
170
171      /* --- the following bits of info are returned as NULL-terminated strings --- */
172      case DEVINFO_STR_NAME:                     strcpy(info->s, "Commodore 1551");                     break;
173      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Commodore VIC-1540");                  break;
174      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                              break;
175      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                           break;
176      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");             break;
177   }
178}
src/mess/machine/c1551.h
r0r6634
1/**********************************************************************
2
3    Commodore 1551 Single Disk Drive emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#ifndef __C1551__
11#define __C1551__
12
13#include "driver.h"
14
15/***************************************************************************
16    MACROS / CONSTANTS
17***************************************************************************/
18
19#define C1551 DEVICE_GET_INFO_NAME( c1551 )
20
21#define MDRV_C1551_ADD(_tag) \
22   MDRV_DEVICE_ADD(_tag, C1551, 0)
23
24/***************************************************************************
25    PROTOTYPES
26***************************************************************************/
27
28/* device interface */
29DEVICE_GET_INFO( c1551 );
30
31#endif
src/mess/machine/c1571.c
r6633r6634
2929#define M6526_TAG      "u20"
3030#define WD1770_TAG      "u11"
3131 
32#define FLOPPY_TAG      "c1571_floppy"
33 
3432/***************************************************************************
3533    TYPE DEFINITIONS
3634***************************************************************************/
r6633r6634
231229-------------------------------------------------*/
232230 
233231static MACHINE_DRIVER_START( c1570 )
234   MDRV_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/16)
232   MDRV_CPU_ADD(M6502_TAG, M6502, 2000000)
235233   MDRV_CPU_PROGRAM_MAP(c1570_map)
236234 
237   MDRV_VIA6522_ADD(M6522_0_TAG, XTAL_16MHz/16, c1571_via0_intf)
238   MDRV_VIA6522_ADD(M6522_1_TAG, XTAL_16MHz/16, c1571_via1_intf)
239   MDRV_CIA6526_ADD(M6526_TAG, CIA6526R1, XTAL_16MHz/16, c1571_cia_intf)
235   MDRV_VIA6522_ADD(M6522_0_TAG, 2000000, c1571_via0_intf)
236   MDRV_VIA6522_ADD(M6522_1_TAG, 2000000, c1571_via1_intf)
237   MDRV_CIA6526_ADD(M6526_TAG, CIA6526R1, 2000000, c1571_cia_intf)
240238   MDRV_WD1770_ADD(WD1770_TAG, c1571_wd1770_intf)
241239 
242   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_TAG, c1570_floppy_config)
240   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, c1570_floppy_config)
243241MACHINE_DRIVER_END
244242 
245243/*-------------------------------------------------
r6633r6634
247245-------------------------------------------------*/
248246 
249247static MACHINE_DRIVER_START( c1571 )
250   MDRV_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/16)
248   MDRV_CPU_ADD(M6502_TAG, M6502, 2000000)
251249   MDRV_CPU_PROGRAM_MAP(c1571_map)
252250 
253   MDRV_VIA6522_ADD(M6522_0_TAG, XTAL_16MHz/16, c1571_via0_intf)
254   MDRV_VIA6522_ADD(M6522_1_TAG, XTAL_16MHz/16, c1571_via1_intf)
255   MDRV_CIA6526_ADD(M6526_TAG, CIA6526R1, XTAL_16MHz/16, c1571_cia_intf)
251   MDRV_VIA6522_ADD(M6522_0_TAG, 2000000, c1571_via0_intf)
252   MDRV_VIA6522_ADD(M6522_1_TAG, 2000000, c1571_via1_intf)
253   MDRV_CIA6526_ADD(M6526_TAG, CIA6526R1, 2000000, c1571_cia_intf)
256254   MDRV_WD1770_ADD(WD1770_TAG, c1571_wd1770_intf)
257255 
258   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_TAG, c1571_floppy_config)
256   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, c1571_floppy_config)
259257MACHINE_DRIVER_END
260258 
261259/*-------------------------------------------------
r6633r6634
263261-------------------------------------------------*/
264262 
265263static MACHINE_DRIVER_START( c1571cr )
266   MDRV_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/16)
264   MDRV_CPU_ADD(M6502_TAG, M6502, 2000000)
267265   MDRV_CPU_PROGRAM_MAP(c1571cr_map)
268266 
269   MDRV_VIA6522_ADD(M6522_0_TAG, XTAL_16MHz/16, c1571_via0_intf)
270   MDRV_VIA6522_ADD(M6522_1_TAG, XTAL_16MHz/16, c1571_via1_intf)
271   MDRV_CIA6526_ADD(M6526_TAG, CIA6526R1, XTAL_16MHz/16, c1571_cia_intf)
267   MDRV_VIA6522_ADD(M6522_0_TAG, 2000000, c1571_via0_intf)
268   MDRV_VIA6522_ADD(M6522_1_TAG, 2000000, c1571_via1_intf)
269   MDRV_CIA6526_ADD(M6526_TAG, CIA6526R1, 2000000, c1571_cia_intf)
272270   MDRV_WD1770_ADD(WD1770_TAG, c1571_wd1770_intf)
273271 
274   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_TAG, c1571_floppy_config)
272   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, c1571_floppy_config)
275273MACHINE_DRIVER_END
276274 
277275/*-------------------------------------------------
r6633r6634
380378   }
381379}
382380 
383 
384381/*-------------------------------------------------
385382    DEVICE_GET_INFO( c1571cr )
386383-------------------------------------------------*/
src/mess/mess.mak
r6633r6634
687687   $(MESS_VIDEO)/vic6560.o      \
688688   $(MESS_MACHINE)/cbmserial.o   \
689689   $(MESS_MACHINE)/c1541.o      \
690   $(MESS_MACHINE)/c1551.o      \
690691   $(MESS_MACHINE)/c1571.o      \
692   $(MESS_MACHINE)/c1581.o      \
691693   $(MESS_FORMATS)/g64_dsk.o   \
692694
693695$(MESSOBJ)/cbmshare.a:         \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team