Previous 15994 Revisions Next

r7032 Wednesday 13th January, 2010 at 12:52:54 UTC by Curt Coder
[VIC20] Added skeleton for VIC-1112 IEEE-488 cartridge.
[src/mess]mess.mak
[src/mess/machine]vic1112.c* vic1112.h*

src/mess/machine/vic1112.c
r0r7032
1/**********************************************************************
2
3    Commodore VIC-1112 IEEE-488 cartridge 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 "vic1112.h"
12#include "machine/6522via.h"
13
14/***************************************************************************
15    PARAMETERS
16***************************************************************************/
17
18#define M6522_0_TAG      "u4"
19#define M6522_1_TAG      "u5"
20
21/***************************************************************************
22    TYPE DEFINITIONS
23***************************************************************************/
24
25typedef struct _vic1112_t vic1112_t;
26struct _vic1112_t
27{
28   const device_config *via0;
29   const device_config *via1;
30   const device_config *ieee_bus;
31};
32
33/***************************************************************************
34    INLINE FUNCTIONS
35***************************************************************************/
36
37INLINE vic1112_t *get_safe_token(const device_config *device)
38{
39   assert(device != NULL);
40   assert(device->token != NULL);
41   assert(device->type == VIC1112);
42   return (vic1112_t *)device->token;
43}
44
45INLINE vic1112_config *get_safe_config(const device_config *device)
46{
47   assert(device != NULL);
48   assert(device->type == VIC1112);
49   return (vic1112_config *)device->inline_config;
50}
51
52/***************************************************************************
53    IMPLEMENTATION
54***************************************************************************/
55
56/*-------------------------------------------------
57    via6522_interface vic1112_via0_intf
58-------------------------------------------------*/
59
60static READ8_DEVICE_HANDLER( via0_pb_r )
61{
62   /*
63
64        bit     description
65
66        PB0     _DAV OUT
67        PB1     _NRFD OUT
68        PB2     _NDAC OUT
69        PB3     _EOI
70        PB4     _DAV IN
71        PB5     _NRFD IN
72        PB6     _NDAC IN
73        PB7     _ATN IN
74
75    */
76
77   return 0;
78}
79
80static WRITE8_DEVICE_HANDLER( via0_pb_w )
81{
82   /*
83
84        bit     description
85
86        PB0     _DAV OUT
87        PB1     _NRFD OUT
88        PB2     _NDAC OUT
89        PB3     _EOI
90        PB4     _DAV IN
91        PB5     _NRFD IN
92        PB6     _NDAC IN
93        PB7     _ATN IN
94
95    */
96}
97
98static const via6522_interface vic1112_via0_intf =
99{
100   DEVCB_NULL,
101   DEVCB_HANDLER(via0_pb_r),
102   DEVCB_NULL,
103   DEVCB_NULL,
104   DEVCB_NULL,
105   DEVCB_NULL,
106
107   DEVCB_NULL,
108   DEVCB_HANDLER(via0_pb_w),
109   DEVCB_NULL,
110   DEVCB_NULL,
111   DEVCB_NULL,
112   DEVCB_NULL,
113
114   DEVCB_NULL
115};
116
117/*-------------------------------------------------
118    via6522_interface vic1112_via1_intf
119-------------------------------------------------*/
120
121static READ8_DEVICE_HANDLER( via1_pa_r )
122{
123   /*
124
125        bit     description
126
127        PA0     DI1
128        PA1     DI2
129        PA2     DI3
130        PA3     DI4
131        PA4     DI5
132        PA5     DI6
133        PA6     DI7
134        PA7     DI8
135
136    */
137
138   return 0;
139}
140
141static WRITE8_DEVICE_HANDLER( via1_pb_w )
142{
143   /*
144
145        bit     description
146
147        PB0     DO1
148        PB1     DO2
149        PB2     DO3
150        PB3     DO4
151        PB4     DO5
152        PB5     DO6
153        PB6     DO7
154        PB7     DO8
155
156    */
157}
158
159static const via6522_interface vic1112_via1_intf =
160{
161   DEVCB_HANDLER(via1_pa_r),
162   DEVCB_NULL,
163   DEVCB_NULL,
164   DEVCB_NULL,
165   DEVCB_NULL,
166   DEVCB_NULL,
167
168   DEVCB_NULL,
169   DEVCB_HANDLER(via1_pb_w),
170   DEVCB_NULL,
171   DEVCB_NULL, // _SRQ IN
172   DEVCB_NULL, // _ATN OUT
173   DEVCB_NULL, // _EOI
174
175   DEVCB_NULL
176};
177
178/*-------------------------------------------------
179    MACHINE_DRIVER( vic1112 )
180-------------------------------------------------*/
181
182static MACHINE_DRIVER_START( vic1112 )
183   MDRV_VIA6522_ADD(M6522_0_TAG, 0, vic1112_via0_intf)
184   MDRV_VIA6522_ADD(M6522_1_TAG, 0, vic1112_via1_intf)
185MACHINE_DRIVER_END
186
187/*-------------------------------------------------
188    ROM( vic1112 )
189-------------------------------------------------*/
190
191ROM_START( vic1112 )
192   ROM_REGION( 0x800, "vic1112", ROMREGION_LOADBYNAME )
193   ROM_LOAD( "325329-03.u2", 0x000, 0x800, CRC(dd6147ba) SHA1(3945b9aa417f5905fa52f6f667a3e22add7ab15f) )
194ROM_END
195
196/*-------------------------------------------------
197    DEVICE_START( vic1112 )
198-------------------------------------------------*/
199
200static DEVICE_START( vic1112 )
201{
202   vic1112_t *vic1112 = get_safe_token(device);
203   const vic1112_config *config = get_safe_config(device);
204
205   /* set IEEE address */
206
207   /* find devices */
208   vic1112->via0 = device_find_child_by_tag(device, M6522_0_TAG);
209   vic1112->via1 = device_find_child_by_tag(device, M6522_1_TAG);
210   vic1112->ieee_bus = devtag_get_device(device->machine, config->ieee_bus_tag);
211
212   /* set VIA clocks */
213   device_set_clock(vic1112->via0, cpu_get_clock(device->machine->firstcpu));
214   device_set_clock(vic1112->via1, cpu_get_clock(device->machine->firstcpu));
215
216   /* register for state saving */
217//   state_save_register_device_item(device, 0, vic1112->);
218}
219
220/*-------------------------------------------------
221    DEVICE_RESET( vic1112 )
222-------------------------------------------------*/
223
224static DEVICE_RESET( vic1112 )
225{
226   vic1112_t *vic1112 = get_safe_token(device);
227
228   /* reset VIAs */
229   device_reset(vic1112->via0);
230   device_reset(vic1112->via1);
231
232   /* _IFC */
233}
234
235/*-------------------------------------------------
236    DEVICE_GET_INFO( vic1112 )
237-------------------------------------------------*/
238
239DEVICE_GET_INFO( vic1112 )
240{
241   switch (state)
242   {
243      /* --- the following bits of info are returned as 64-bit signed integers --- */
244      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(vic1112_t);                        break;
245      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = sizeof(vic1112_config);                     break;
246      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;                     break;
247
248      /* --- the following bits of info are returned as pointers --- */
249      case DEVINFO_PTR_ROM_REGION:               info->romregion = ROM_NAME(vic1112);                  break;
250      case DEVINFO_PTR_MACHINE_CONFIG:            info->machine_config = MACHINE_DRIVER_NAME(vic1112);      break;
251
252      /* --- the following bits of info are returned as pointers to data or functions --- */
253      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(vic1112);               break;
254      case DEVINFO_FCT_STOP:                     /* Nothing */                                    break;
255      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(vic1112);               break;
256
257      /* --- the following bits of info are returned as NULL-terminated strings --- */
258      case DEVINFO_STR_NAME:                     strcpy(info->s, "Commodore VIC-1112");                  break;
259      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Commodore VIC-20");                  break;
260      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                              break;
261      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                           break;
262      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");             break;
263   }
264}
src/mess/machine/vic1112.h
r0r7032
1/**********************************************************************
2
3    Commodore VIC-1112 IEEE-488 cartridge emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#ifndef __VIC1112__
11#define __VIC1112__
12
13#include "driver.h"
14
15/***************************************************************************
16    MACROS / CONSTANTS
17***************************************************************************/
18
19#define VIC1112_TAG   "vic1112"
20
21#define VIC1112   DEVICE_GET_INFO_NAME( vic1112 )
22
23#define MDRV_VIC1112_ADD(_ieee_bus_tag) \
24   MDRV_DEVICE_ADD(VIC1112_TAG, VIC1112, 0) \
25   MDRV_DEVICE_CONFIG_DATAPTR(vic1112_config, ieee_bus_tag, _ieee_bus_tag) \
26
27/***************************************************************************
28    TYPE DEFINITIONS
29***************************************************************************/
30
31typedef struct _vic1112_config vic1112_config;
32struct _vic1112_config
33{
34   const char *ieee_bus_tag;   /* IEEE bus device */
35};
36
37/***************************************************************************
38    PROTOTYPES
39***************************************************************************/
40
41/* device interface */
42DEVICE_GET_INFO( vic1112 );
43
44#endif
src/mess/mess.mak
r7031r7032
681681   $(MESS_MACHINE)/pet.o      \
682682   $(MESS_DRIVERS)/c64.o      \
683683   $(MESS_DRIVERS)/vic20.o      \
684   $(MESS_MACHINE)/vic1112.o   \
684685   $(MESS_AUDIO)/ted7360.o      \
685686   $(MESS_AUDIO)/t6721.o      \
686687   $(MESS_MACHINE)/c16.o      \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team