Previous 15994 Revisions Next

r11287 Sunday 24th April, 2011 at 20:58:14 UTC by Curt Coder
Refactored Commodore 8280 disk drive into a C++ device. (no whatsnew)
[src/mess]mess.mak
[src/mess/machine]c2040.h c8280.c c8280.h

src/mess/machine/c2040.h
r11286r11287
154154   DECLARE_WRITE8_MEMBER( c8050_via_pb_w );
155155   DECLARE_READ8_MEMBER( c8050_miot_pb_r );
156156   DECLARE_WRITE8_MEMBER( c8050_miot_pb_w );
157
157158protected:
158159    // device-level overrides
159160    virtual void device_start();
src/mess/machine/c8280.c
r11286r11287
77
88**********************************************************************/
99
10#include "emu.h"
1110#include "c8280.h"
12#include "cpu/m6502/m6502.h"
13#include "imagedev/flopdrv.h"
14#include "machine/6532riot.h"
15#include "machine/ieee488.h"
1611
17/***************************************************************************
18    PARAMETERS
19***************************************************************************/
2012
21#define LOG 0
2213
14//**************************************************************************
15//  MACROS / CONSTANTS
16//**************************************************************************
17
2318#define M6502_DOS_TAG   "5c"
2419#define M6502_FDC_TAG   "9e"
2520#define M6532_0_TAG      "9f"
2621#define M6532_1_TAG      "9g"
2722
28/***************************************************************************
29    TYPE DEFINITIONS
30***************************************************************************/
3123
32typedef struct _c8280_t c8280_t;
33struct _c8280_t
24
25//**************************************************************************
26//  DEVICE DEFINITIONS
27//**************************************************************************
28
29const device_type C8280 = c8280_device_config::static_alloc_device_config;
30
31
32
33//**************************************************************************
34//  DEVICE CONFIGURATION
35//**************************************************************************
36
37//-------------------------------------------------
38//  c8280_device_config - constructor
39//-------------------------------------------------
40
41c8280_device_config::c8280_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
42   : device_config(mconfig, static_alloc_device_config, "C8280", tag, owner, clock),
43     device_config_ieee488_interface(mconfig, *this)
3444{
35   /* abstractions */
36   int address;                  /* bus address - 8 */
45}
3746
38   /* devices */
39   device_t *cpu_dos;
40   device_t *cpu_fdc;
41   device_t *riot0;
42   device_t *riot1;
43   device_t *bus;
44   device_t *image[2];
45};
4647
47/***************************************************************************
48    INLINE FUNCTIONS
49***************************************************************************/
48//-------------------------------------------------
49//  static_alloc_device_config - allocate a new
50//  configuration object
51//-------------------------------------------------
5052
51INLINE c8280_t *get_safe_token(device_t *device)
53device_config *c8280_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
5254{
53   assert(device != NULL);
54   assert(device->type() == C8280);
55   return (c8280_t *)downcast<legacy_device_base *>(device)->token();
55   return global_alloc(c8280_device_config(mconfig, tag, owner, clock));
5656}
5757
58INLINE c8280_config *get_safe_config(device_t *device)
58
59//-------------------------------------------------
60//  alloc_device - allocate a new device object
61//-------------------------------------------------
62
63device_t *c8280_device_config::alloc_device(running_machine &machine) const
5964{
60   assert(device != NULL);
61   assert(device->type() == C8280);
62   return (c8280_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config();
65   return auto_alloc(machine, c8280_device(machine, *this));
6366}
6467
65/***************************************************************************
66    IMPLEMENTATION
67***************************************************************************/
6868
69/*-------------------------------------------------
70    c8280_ieee488_atn_w - IEEE-488 bus attention
71-------------------------------------------------*/
69//-------------------------------------------------
70//  device_config_complete - perform any
71//  operations now that the configuration is
72//  complete
73//-------------------------------------------------
7274
73WRITE_LINE_DEVICE_HANDLER( c8280_ieee488_atn_w )
75void c8280_device_config::device_config_complete()
7476{
77   m_shortname = "c8280";
7578}
7679
77/*-------------------------------------------------
78    c8280_ieee488_ifc_w - IEEE-488 bus reset
79-------------------------------------------------*/
8080
81WRITE_LINE_DEVICE_HANDLER( c8280_ieee488_ifc_w )
81//-------------------------------------------------
82//  static_set_config - configuration helper
83//-------------------------------------------------
84
85void c8280_device_config::static_set_config(device_config *device, int address, int variant)
8286{
83   if (!state)
84   {
85      device->reset();
86   }
87   c8280_device_config *c8280 = downcast<c8280_device_config *>(device);
88
89   assert((address > 7) && (address < 12));
90
91   c8280->m_address = address - 8;
8792}
8893
89/*-------------------------------------------------
90    ADDRESS_MAP( c8280_dos_map )
91-------------------------------------------------*/
9294
93static ADDRESS_MAP_START( c8280_dos_map, AS_PROGRAM, 8 )
94   AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("c8280", 0x0000)
95//-------------------------------------------------
96//  ROM( c8280 )
97//-------------------------------------------------
98
99ROM_START( c8280 )
100   ROM_REGION( 0x4000, M6502_DOS_TAG, 0 )
101   ROM_LOAD( "300542-001.10c", 0x0000, 0x2000, CRC(3c6eee1e) SHA1(0726f6ab4de4fc9c18707fe87780ffd9f5ed72ab) )
102   ROM_LOAD( "300543-001.10d", 0x2000, 0x2000, CRC(f58e665e) SHA1(9e58b47c686c91efc6ef1a27f72dbb5e26c485ec) )
103   
104   ROM_REGION( 0x800, M6502_FDC_TAG, 0 )
105   ROM_LOAD( "300541-001.3c",  0x000, 0x800, CRC(cb07b2db) SHA1(a1f9c5a7bd3798f5a97dc0b465c3bf5e3513e148) )
106ROM_END
107
108
109//-------------------------------------------------
110//  rom_region - device-specific ROM region
111//-------------------------------------------------
112
113const rom_entry *c8280_device_config::device_rom_region() const
114{
115   return ROM_NAME( c8280 );
116}
117
118
119//-------------------------------------------------
120//  ADDRESS_MAP( c8280_main_mem )
121//-------------------------------------------------
122
123static ADDRESS_MAP_START( c8280_main_mem, AS_PROGRAM, 8, c8280_device )
124   AM_RANGE(0xc000, 0xffff) // AM_ROM
95125ADDRESS_MAP_END
96126
97/*-------------------------------------------------
98    ADDRESS_MAP( c8280_fdc_map )
99-------------------------------------------------*/
100127
101static ADDRESS_MAP_START( c8280_fdc_map, AS_PROGRAM, 8 )
128//-------------------------------------------------
129//  ADDRESS_MAP( c8280_fdc_mem )
130//-------------------------------------------------
131
132static ADDRESS_MAP_START( c8280_fdc_mem, AS_PROGRAM, 8, c8280_device )
133   ADDRESS_MAP_GLOBAL_MASK(0x1fff)
134   AM_RANGE(0x1c00, 0x1fff) // AM_ROM 6530
102135ADDRESS_MAP_END
103136
104/*-------------------------------------------------
105    riot6532_interface riot0_intf
106-------------------------------------------------*/
107137
138//-------------------------------------------------
139//  riot6532_interface riot0_intf
140//-------------------------------------------------
141
108142static const riot6532_interface riot0_intf =
109143{
110144   DEVCB_NULL,
r11286r11287
114148   DEVCB_NULL
115149};
116150
117/*-------------------------------------------------
118    riot6532_interface riot1_intf
119-------------------------------------------------*/
120151
152//-------------------------------------------------
153//  riot6532_interface riot1_intf
154//-------------------------------------------------
155
121156static const riot6532_interface riot1_intf =
122157{
123158   DEVCB_NULL,
r11286r11287
127162   DEVCB_NULL
128163};
129164
130/*-------------------------------------------------
131    FLOPPY_OPTIONS( c8280 )
132-------------------------------------------------*/
133165
166//-------------------------------------------------
167//  FLOPPY_OPTIONS( c8280 )
168//-------------------------------------------------
169
134170static FLOPPY_OPTIONS_START( c8280 )
135171FLOPPY_OPTIONS_END
136172
137/*-------------------------------------------------
138    floppy_config c8280_floppy_config
139-------------------------------------------------*/
140173
174//-------------------------------------------------
175//  floppy_config c8280_floppy_config
176//-------------------------------------------------
177
141178static const floppy_config c8280_floppy_config =
142179{
143180   DEVCB_NULL,
r11286r11287
145182   DEVCB_NULL,
146183   DEVCB_NULL,
147184   DEVCB_NULL,
148   FLOPPY_STANDARD_5_25_DSHD,
185   FLOPPY_STANDARD_8_DSDD,
149186   FLOPPY_OPTIONS_NAME(c8280),
150   NULL
187   "floppy_8"
151188};
152189
153/*-------------------------------------------------
154    MACHINE_DRIVER( c8280 )
155-------------------------------------------------*/
156190
191//-------------------------------------------------
192//  MACHINE_CONFIG_FRAGMENT( c8280 )
193//-------------------------------------------------
194
157195static MACHINE_CONFIG_FRAGMENT( c8280 )
158196   MCFG_CPU_ADD(M6502_DOS_TAG, M6502, 1000000)
159   MCFG_CPU_PROGRAM_MAP(c8280_dos_map)
197   MCFG_CPU_PROGRAM_MAP(c8280_main_mem)
160198
161199   MCFG_RIOT6532_ADD(M6532_0_TAG, 1000000, riot0_intf)
162200   MCFG_RIOT6532_ADD(M6532_1_TAG, 1000000, riot1_intf)
163201
164202   MCFG_CPU_ADD(M6502_FDC_TAG, M6502, 1000000)
165   MCFG_CPU_PROGRAM_MAP(c8280_fdc_map)
203   MCFG_CPU_PROGRAM_MAP(c8280_fdc_mem)
166204
167205   MCFG_FLOPPY_2_DRIVES_ADD(c8280_floppy_config)
168206MACHINE_CONFIG_END
169207
170/*-------------------------------------------------
171    ROM( c8280 )
172-------------------------------------------------*/
173208
174ROM_START( c8280 )
175   ROM_REGION( 0x4800, "c8280", ROMREGION_LOADBYNAME )
176   ROM_LOAD( "300542-001.10c", 0x0000, 0x2000, CRC(3c6eee1e) SHA1(0726f6ab4de4fc9c18707fe87780ffd9f5ed72ab) )
177   ROM_LOAD( "300543-001.10d", 0x2000, 0x2000, CRC(f58e665e) SHA1(9e58b47c686c91efc6ef1a27f72dbb5e26c485ec) )
178   ROM_LOAD( "300541-001.3c",  0x4000, 0x0800, CRC(cb07b2db) SHA1(a1f9c5a7bd3798f5a97dc0b465c3bf5e3513e148) )
179ROM_END
209//-------------------------------------------------
210//  machine_config_additions - device-specific
211//  machine configurations
212//-------------------------------------------------
180213
181/*-------------------------------------------------
182    DEVICE_START( c8280 )
183-------------------------------------------------*/
214machine_config_constructor c8280_device_config::device_mconfig_additions() const
215{
216   return MACHINE_CONFIG_NAME( c8280 );
217}
184218
185static DEVICE_START( c8280 )
219
220
221//**************************************************************************
222//  LIVE DEVICE
223//**************************************************************************
224
225//-------------------------------------------------
226//  c8280_device - constructor
227//-------------------------------------------------
228
229c8280_device::c8280_device(running_machine &_machine, const c8280_device_config &_config)
230    : device_t(_machine, _config),
231     device_ieee488_interface(_machine, _config, *this),
232     m_maincpu(*this, M6502_DOS_TAG),
233     m_fdccpu(*this, M6502_FDC_TAG),
234     m_riot0(*this, M6532_0_TAG),
235     m_riot1(*this, M6532_1_TAG),
236     m_image0(*this, FLOPPY_0),
237     m_image1(*this, FLOPPY_1),
238     m_bus(*this->owner(), IEEE488_TAG),
239      m_config(_config)
186240{
187   c8280_t *c8280 = get_safe_token(device);
188   const c8280_config *config = get_safe_config(device);
241}
189242
190   /* set serial address */
191   assert((config->address > 7) && (config->address < 16));
192   c8280->address = config->address - 8;
193243
194   /* find our CPU */
195   c8280->cpu_dos = device->subdevice(M6502_DOS_TAG);
196   c8280->cpu_fdc = device->subdevice(M6502_FDC_TAG);
244//-------------------------------------------------
245//  device_start - device-specific startup
246//-------------------------------------------------
247
248void c8280_device::device_start()
249{
250   address_space *main = m_maincpu->memory().space(AS_PROGRAM);
251   address_space *fdc = m_fdccpu->memory().space(AS_PROGRAM);
252
253   main->install_rom(0x5000, 0x7fff, subregion(M6502_DOS_TAG)->base());
254   fdc->install_rom(0x1c00, 0x1fff, subregion(M6502_FDC_TAG)->base());
197255}
198256
199/*-------------------------------------------------
200    DEVICE_RESET( c8280 )
201-------------------------------------------------*/
202257
203static DEVICE_RESET( c8280 )
258//-------------------------------------------------
259//  device_reset - device-specific reset
260//-------------------------------------------------
261
262void c8280_device::device_reset()
204263{
205   c8280_t *c8280 = get_safe_token(device);
264}
206265
207   c8280->cpu_dos->reset();
208   c8280->cpu_fdc->reset();
266
267//-------------------------------------------------
268//  device_timer - handler timer events
269//-------------------------------------------------
270
271void c8280_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
272{
209273}
210274
211/*-------------------------------------------------
212    DEVICE_GET_INFO( c8280 )
213-------------------------------------------------*/
214275
215DEVICE_GET_INFO( c8280 )
276//-------------------------------------------------
277//  ieee488_atn -
278//-------------------------------------------------
279
280void c8280_device::ieee488_atn(int state)
216281{
217   switch (state)
218   {
219      /* --- the following bits of info are returned as 64-bit signed integers --- */
220      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(c8280_t);                           break;
221      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = sizeof(c8280_config);                        break;
282}
222283
223      /* --- the following bits of info are returned as pointers --- */
224      case DEVINFO_PTR_ROM_REGION:               info->romregion = ROM_NAME(c8280);                     break;
225      case DEVINFO_PTR_MACHINE_CONFIG:            info->machine_config = MACHINE_CONFIG_NAME(c8280);         break;
226284
227      /* --- the following bits of info are returned as pointers to data or functions --- */
228      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(c8280);                  break;
229      case DEVINFO_FCT_STOP:                     /* Nothing */                                    break;
230      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(c8280);                  break;
285//-------------------------------------------------
286//  ieee488_ifc -
287//-------------------------------------------------
231288
232      /* --- the following bits of info are returned as NULL-terminated strings --- */
233      case DEVINFO_STR_NAME:                     strcpy(info->s, "Commodore 8280");                     break;
234      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Commodore PET");                     break;
235      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                              break;
236      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                           break;
237      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");             break;
289void c8280_device::ieee488_ifc(int state)
290{
291   if (!state)
292   {
293      device_reset();
238294   }
239295}
240
241DEFINE_LEGACY_DEVICE(C8280, c8280);
src/mess/machine/c8280.h
r11286r11287
77
88**********************************************************************/
99
10#pragma once
11
1012#ifndef __C8280__
1113#define __C8280__
1214
15#define ADDRESS_MAP_MODERN
16
1317#include "emu.h"
18#include "cpu/m6502/m6502.h"
19#include "imagedev/flopdrv.h"
20#include "machine/6532riot.h"
21#include "machine/ieee488.h"
1422
15/***************************************************************************
16    MACROS / CONSTANTS
17***************************************************************************/
1823
19DECLARE_LEGACY_DEVICE(C8280, c8280);
2024
21#define MCFG_C8280_ADD(_tag, _bus_tag, _address) \
22   MCFG_DEVICE_ADD(_tag, C8280, 0) \
23   MCFG_DEVICE_CONFIG_DATAPTR(c8280_config, bus_tag, _bus_tag) \
24   MCFG_DEVICE_CONFIG_DATA32(c8280_config, address, _address)
25//**************************************************************************
26//  MACROS / CONSTANTS
27//**************************************************************************
2528
26#define C8280_IEEE488(_tag) \
27   _tag, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_DEVICE_LINE(_tag, c8280_ieee488_ifc_w), DEVCB_NULL, DEVCB_DEVICE_LINE(_tag, c8280_ieee488_atn_w), DEVCB_NULL
29#define C8280_TAG         "c8280"
2830
29/***************************************************************************
30    TYPE DEFINITIONS
31***************************************************************************/
3231
33typedef struct _c8280_config c8280_config;
34struct _c8280_config
32
33//**************************************************************************
34//  INTERFACE CONFIGURATION MACROS
35//**************************************************************************
36
37#define MCFG_C8280_ADD(_tag, _address) \
38    MCFG_DEVICE_ADD(_tag, C8280, 0) \
39   c8280_device_config::static_set_config(device, _address);
40
41
42
43//**************************************************************************
44//  TYPE DEFINITIONS
45//**************************************************************************
46
47// ======================> c8280_device_config
48
49class c8280_device_config :   public device_config,
50                       public device_config_ieee488_interface
3551{
36   const char *bus_tag;      /* bus device */
37   int address;            /* bus address */
52    friend class c8280_device;
53
54    // construction/destruction
55    c8280_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
56
57public:
58   // allocators
59    static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
60    virtual device_t *alloc_device(running_machine &machine) const;
61
62   // inline configuration helpers
63   static void static_set_config(device_config *device, int address, int variant);
64
65   // optional information overrides
66   virtual const rom_entry *device_rom_region() const;
67   virtual machine_config_constructor device_mconfig_additions() const;
68
69protected:
70   // device_config overrides
71    virtual void device_config_complete();
72   
73   int m_address;
3874};
3975
40/***************************************************************************
41    PROTOTYPES
42***************************************************************************/
43/* IEEE-488 interface */
44WRITE_LINE_DEVICE_HANDLER( c8280_ieee488_atn_w );
45WRITE_LINE_DEVICE_HANDLER( c8280_ieee488_ifc_w );
4676
77// ======================> c8280_device
78
79class c8280_device :  public device_t,
80                 public device_ieee488_interface
81{
82    friend class c8280_device_config;
83
84    // construction/destruction
85    c8280_device(running_machine &_machine, const c8280_device_config &_config);
86
87protected:
88    // device-level overrides
89    virtual void device_start();
90   virtual void device_reset();
91   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
92
93   // device_ieee488_interface overrides
94   void ieee488_atn(int state);
95   void ieee488_ifc(int state);
96
97   required_device<cpu_device> m_maincpu;
98   required_device<cpu_device> m_fdccpu;
99   required_device<riot6532_device> m_riot0;
100   required_device<riot6532_device> m_riot1;
101   required_device<device_t> m_image0;
102   optional_device<device_t> m_image1;
103   required_device<ieee488_device> m_bus;
104
105    const c8280_device_config &m_config;
106};
107
108
109// device type definition
110extern const device_type C8280;
111
112
113
47114#endif
src/mess/mess.mak
r11286r11287
765765   $(MESS_MACHINE)/c1581.o      \
766766   $(MESS_MACHINE)/c2031.o      \
767767   $(MESS_MACHINE)/c2040.o      \
768   $(MESS_MACHINE)/c8280.o      \
768769   $(MESS_DRIVERS)/clcd.o      \
769770   $(MESS_MACHINE)/6525tpi.o   \
770771   $(MESS_MACHINE)/cbm.o      \
r11286r11287
781782   $(MESS_FORMATS)/d81_dsk.o   \
782783   $(MESS_FORMATS)/cbm_tap.o   \
783784   $(MESS_FORMATS)/cbm_snqk.o   \
784#   $(MESS_MACHINE)/c8280.o      \
785785#   $(MESS_MACHINE)/c9060.o      \
786786
787787$(MESSOBJ)/cccp.a:            \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team