Previous 15994 Revisions Next

r11288 Sunday 24th April, 2011 at 21:25:15 UTC by Curt Coder
Refactored Commodore 9060/9090 hard disk into a C++ device. (no whatsnew)
[src/mess]mess.mak
[src/mess/machine]c2040.h c8280.c c8280.h c9060.c c9060.h

src/mess/machine/c2040.h
r11287r11288
184184   required_device<ieee488_device> m_bus;
185185
186186   struct {
187      /* motors */
188      int m_stp;                        /* stepper motor phase */
189      int m_mtr;                        /* spindle motor on */
187      // motors
188      int m_stp;                        // stepper motor phase
189      int m_mtr;                        // spindle motor on
190190
191      /* track */
192      UINT8 m_track_buffer[G64_BUFFER_SIZE];   /* track data buffer */
193      int m_track_len;                  /* track length */
194      int m_buffer_pos;                  /* byte position within track buffer */
195      int m_bit_pos;                     /* bit position within track buffer byte */
191      // track
192      UINT8 m_track_buffer[G64_BUFFER_SIZE];   // track data buffer
193      int m_track_len;                  // track length
194      int m_buffer_pos;                  // byte position within track buffer
195      int m_bit_pos;                     // bit position within track buffer byte
196196
197      /* devices */
197      // devices
198198      device_t *m_image;
199199   } m_unit[2];
200200
201   int m_drive;                  /* selected drive */
202   int m_side;                     /* selected side */
201   int m_drive;                  // selected drive
202   int m_side;                     // selected side
203203
204   /* IEEE-488 bus */
205   int m_rfdo;                     /* not ready for data output */
206   int m_daco;                     /* not data accepted output */
207   int m_atna;                     /* attention acknowledge */
204   // IEEE-488 bus
205   int m_rfdo;                     // not ready for data output
206   int m_daco;                     // not data accepted output
207   int m_atna;                     // attention acknowledge
208208
209   /* track */
210   int m_ds;                     /* density select */
211   int m_bit_count;               /* GCR bit counter */
212   UINT16 m_sr;                  /* GCR data shift register */
213   UINT8 m_pi;                     /* parallel data input */
214   UINT8* m_gcr;                  /* GCR encoder/decoder ROM */
215   UINT16 m_i;                     /* GCR encoder/decoded ROM address */
216   UINT8 m_e;                     /* GCR encoder/decoded ROM data */
209   // track
210   int m_ds;                     // density select
211   int m_bit_count;               // GCR bit counter
212   UINT16 m_sr;                  // GCR data shift register
213   UINT8 m_pi;                     // parallel data input
214   UINT8* m_gcr;                  // GCR encoder/decoder ROM
215   UINT16 m_i;                     // GCR encoder/decoded ROM address
216   UINT8 m_e;                     // GCR encoder/decoded ROM data
217217
218   /* signals */
219   int m_ready;                  /* byte ready */
220   int m_mode;                     /* mode select */
221   int m_rw;                     /* read/write select */
222   int m_miot_irq;                  /* MIOT interrupt */
218   // signals
219   int m_ready;                  // byte ready
220   int m_mode;                     // mode select
221   int m_rw;                     // read/write select
222   int m_miot_irq;                  // MIOT interrupt
223223
224   /* timers */
224   // timers
225225   emu_timer *m_bit_timer;
226226
227227    const c2040_device_config &m_config;
src/mess/machine/c8280.c
r11287r11288
250250   address_space *main = m_maincpu->memory().space(AS_PROGRAM);
251251   address_space *fdc = m_fdccpu->memory().space(AS_PROGRAM);
252252
253   main->install_rom(0x5000, 0x7fff, subregion(M6502_DOS_TAG)->base());
254   fdc->install_rom(0x1c00, 0x1fff, subregion(M6502_FDC_TAG)->base());
253   main->install_rom(0xc000, 0xffff, subregion(M6502_DOS_TAG)->base());
254   fdc->install_rom(0x1800, 0x1fff, subregion(M6502_FDC_TAG)->base());
255255}
256256
257257
src/mess/machine/c8280.h
r11287r11288
9999   required_device<riot6532_device> m_riot0;
100100   required_device<riot6532_device> m_riot1;
101101   required_device<device_t> m_image0;
102   optional_device<device_t> m_image1;
102   required_device<device_t> m_image1;
103103   required_device<ieee488_device> m_bus;
104104
105105    const c8280_device_config &m_config;
src/mess/machine/c9060.c
r11287r11288
77
88**********************************************************************/
99
10/*
10#include "c9060.h"
1111
12    TODO:
1312
14    - everything
1513
16*/
14//**************************************************************************
15//  MACROS / CONSTANTS
16//**************************************************************************
1717
18#include "emu.h"
19#include "c9060.h"
20#include "cpu/m6502/m6502.h"
21#include "machine/6522via.h"
22#include "machine/6532riot.h"
23#include "machine/ieee488.h"
24
25/***************************************************************************
26    PARAMETERS
27***************************************************************************/
28
29#define LOG 0
30
3118#define M6502_TAG      "7e"
3219#define M6532_0_TAG      "7f"
3320#define M6532_1_TAG      "7g"
r11287r11288
3522#define M6504_TAG      "4a"
3623#define M6522_TAG      "4b"
3724
38#define C9060_REGION   "c9060"
3925
40/***************************************************************************
41    TYPE DEFINITIONS
42***************************************************************************/
4326
44typedef struct _c9060_t c9060_t;
45struct _c9060_t
46{
47   /* IEEE-488 bus */
48   int address;                  /* device address - 8 */
49   int rfdo;                     /* not ready for data output */
50   int daco;                     /* not data accepted output */
51   int atna;                     /* attention acknowledge */
27//**************************************************************************
28//  DEVICE DEFINITIONS
29//**************************************************************************
5230
53   /* devices */
54   device_t *cpu_dos;
55   device_t *cpu_hdc;
56   device_t *riot0;
57   device_t *riot1;
58   device_t *via;
59   device_t *bus;
60};
31const device_type C9060 = c9060_device_config::static_alloc_device_config;
32const device_type C9090 = c9060_device_config::static_alloc_device_config;
6133
62/***************************************************************************
63    INLINE FUNCTIONS
64***************************************************************************/
6534
66INLINE c9060_t *get_safe_token(device_t *device)
35
36//**************************************************************************
37//  DEVICE CONFIGURATION
38//**************************************************************************
39
40//-------------------------------------------------
41//  c9060_device_config - constructor
42//-------------------------------------------------
43
44c9060_device_config::c9060_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
45   : device_config(mconfig, static_alloc_device_config, "C9060", tag, owner, clock),
46     device_config_ieee488_interface(mconfig, *this)
6747{
68   assert(device != NULL);
69   assert((device->type() == C9060) || (device->type() == C9090));
70   return (c9060_t *)downcast<legacy_device_base *>(device)->token();
7148}
7249
73INLINE c9060_config *get_safe_config(device_t *device)
50
51//-------------------------------------------------
52//  static_alloc_device_config - allocate a new
53//  configuration object
54//-------------------------------------------------
55
56device_config *c9060_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
7457{
75   assert(device != NULL);
76   assert((device->type() == C9060) || (device->type() == C9090));
77   return (c9060_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config();
58   return global_alloc(c9060_device_config(mconfig, tag, owner, clock));
7859}
7960
80INLINE void update_ieee_signals(device_t *device)
61
62//-------------------------------------------------
63//  alloc_device - allocate a new device object
64//-------------------------------------------------
65
66device_t *c9060_device_config::alloc_device(running_machine &machine) const
8167{
82   c9060_t *c9060 = get_safe_token(device);
68   return auto_alloc(machine, c9060_device(machine, *this));
69}
8370
84   int atn = ieee488_atn_r(c9060->bus);
85   int atna = c9060->atna;
86   int rfdo = c9060->rfdo;
87   int daco = c9060->daco;
8871
89   int nrfd = !(!(!(atn&atna)&rfdo)|!(atn|atna));
90   int ndac = !(daco|!(atn|atna));
72//-------------------------------------------------
73//  device_config_complete - perform any
74//  operations now that the configuration is
75//  complete
76//-------------------------------------------------
9177
92   ieee488_nrfd_w(c9060->bus, device, nrfd);
93   ieee488_ndac_w(c9060->bus, device, ndac);
78void c9060_device_config::device_config_complete()
79{
80   m_shortname = "c9060";
9481}
9582
96/***************************************************************************
97    IMPLEMENTATION
98***************************************************************************/
9983
100/*-------------------------------------------------
101    c9060_ieee488_atn_w - IEEE-488 bus attention
102-------------------------------------------------*/
84//-------------------------------------------------
85//  static_set_config - configuration helper
86//-------------------------------------------------
10387
104WRITE_LINE_DEVICE_HANDLER( c9060_ieee488_atn_w )
88void c9060_device_config::static_set_config(device_config *device, int address, int variant)
10589{
106   c9060_t *c9060 = get_safe_token(device);
90   c9060_device_config *c9060 = downcast<c9060_device_config *>(device);
10791
108   update_ieee_signals(device);
92   assert((address > 7) && (address < 12));
10993
110   /* set RIOT PA7 */
111   riot6532_porta_in_set(c9060->riot1, !state << 7, 0x80);
94   c9060->m_variant = variant;
95   c9060->m_address = address - 8;
11296}
11397
114/*-------------------------------------------------
115    c9060_ieee488_ifc_w - IEEE-488 bus reset
116-------------------------------------------------*/
11798
118WRITE_LINE_DEVICE_HANDLER( c9060_ieee488_ifc_w )
99//-------------------------------------------------
100//  ROM( c9060 )
101//-------------------------------------------------
102
103ROM_START( c9060 )
104   ROM_REGION( 0x4000, M6502_TAG, 0 )
105   ROM_LOAD_OPTIONAL( "300516-revb.7c", 0x0000, 0x2000, CRC(2d758a14) SHA1(c959cc9dde84fc3d64e95e58a0a096a26d8107fd) )
106   ROM_LOAD( "300516-revc.7c", 0x0000, 0x2000, CRC(d6a3e88f) SHA1(bb1ddb5da94a86266012eca54818aa21dc4cef6a) )
107   ROM_LOAD_OPTIONAL( "300517-reva.7d", 0x2000, 0x2000, CRC(566df630) SHA1(b1602dfff408b165ee52a6a4ca3e2ec27e689ba9) )
108   ROM_LOAD_OPTIONAL( "300517-revb.7d", 0x2000, 0x2000, CRC(f0382bc3) SHA1(0b0a8dc520f5b41ffa832e4a636b3d226ccbb7f1) )
109   ROM_LOAD( "300517-revc.7d", 0x2000, 0x2000, CRC(2a9ad4ad) SHA1(4c17d014de48c906871b9b6c7d037d8736b1fd52) )
110
111   ROM_REGION( 0x800, M6504_TAG, 0 )
112   ROM_LOAD_OPTIONAL( "300515-reva.4c", 0x000, 0x800, CRC(99e096f7) SHA1(a3d1deb27bf5918b62b89c27fa3e488eb8f717a4) )
113   ROM_LOAD( "300515-revb.4c", 0x000, 0x800, CRC(49adf4fb) SHA1(59dafbd4855083074ba8dc96a04d4daa5b76e0d6) )
114ROM_END
115
116
117//-------------------------------------------------
118//  rom_region - device-specific ROM region
119//-------------------------------------------------
120
121const rom_entry *c9060_device_config::device_rom_region() const
119122{
120   if (!state)
121   {
122      device->reset();
123   }
123   return ROM_NAME( c9060 );
124124}
125125
126/*-------------------------------------------------
127    ADDRESS_MAP( c9060_dos_map )
128-------------------------------------------------*/
129126
130static ADDRESS_MAP_START( c9060_dos_map, AS_PROGRAM, 8 )
127//-------------------------------------------------
128//  ADDRESS_MAP( c9060_main_mem )
129//-------------------------------------------------
130
131static ADDRESS_MAP_START( c9060_main_mem, AS_PROGRAM, 8, c9060_device )
131132   AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0100) AM_RAM // 6532 #1
132133   AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0100) AM_RAM // 6532 #2
133   AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_0_TAG, riot6532_r, riot6532_w)
134   AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_1_TAG, riot6532_r, riot6532_w)
134   AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE_LEGACY(M6532_0_TAG, riot6532_r, riot6532_w)
135   AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE_LEGACY(M6532_1_TAG, riot6532_r, riot6532_w)
135136   AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share1")
136137   AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share2")
137138   AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share3")
138139   AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share4")
139   AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("c9060:c9060", 0x0000)
140   AM_RANGE(0xc000, 0xffff) // AM_ROM
140141ADDRESS_MAP_END
141142
142/*-------------------------------------------------
143    ADDRESS_MAP( c9060_fdc_map )
144-------------------------------------------------*/
145143
146static ADDRESS_MAP_START( c9060_fdc_map, AS_PROGRAM, 8 )
144//-------------------------------------------------
145//  ADDRESS_MAP( c9060_hdc_mem )
146//-------------------------------------------------
147
148static ADDRESS_MAP_START( c9060_hdc_mem, AS_PROGRAM, 8, c9060_device )
147149   ADDRESS_MAP_GLOBAL_MASK(0x1fff)
148150   AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530
149   AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE_MODERN(M6522_TAG, via6522_device, read, write)
151   AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6522_TAG, via6522_device, read, write)
150152   AM_RANGE(0x0400, 0x07ff) AM_RAM AM_SHARE("share1")
151153   AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("share2")
152154   AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_SHARE("share3")
153155   AM_RANGE(0x1000, 0x13ff) AM_RAM AM_SHARE("share4")
154   AM_RANGE(0x1800, 0x1fff) AM_ROM AM_REGION("c9060:c9060", 0x2000) // 6530
156   AM_RANGE(0x1800, 0x1fff) // AM_ROM 6530
155157ADDRESS_MAP_END
156158
157/*-------------------------------------------------
158    riot6532_interface riot0_intf 7f
159-------------------------------------------------*/
160159
161static READ8_DEVICE_HANDLER( dio_r )
160//-------------------------------------------------
161//  riot6532_interface riot0_intf
162//-------------------------------------------------
163
164READ8_MEMBER( c9060_device::dio_r )
162165{
163166   /*
164167
r11287r11288
175178
176179    */
177180
178   c9060_t *c9060 = get_safe_token(device->owner());
179
180   return ieee488_dio_r(c9060->bus, 0);
181   return m_bus->dio_r();
181182}
182183
183static WRITE8_DEVICE_HANDLER( dio_w )
184
185WRITE8_MEMBER( c9060_device::dio_w )
184186{
185187   /*
186188
r11287r11288
197199
198200    */
199201
200   c9060_t *c9060 = get_safe_token(device->owner());
201
202   ieee488_dio_w(c9060->bus, device->owner(), data);
202   m_bus->dio_w(this, data);
203203}
204204
205
205206static const riot6532_interface riot0_intf =
206207{
207   DEVCB_HANDLER(dio_r),
208   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, dio_r),
208209   DEVCB_NULL,
209210   DEVCB_NULL,
210   DEVCB_HANDLER(dio_w),
211   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, dio_w),
211212   DEVCB_NULL
212213};
213214
214/*-------------------------------------------------
215    riot6532_interface riot1_intf ue1
216-------------------------------------------------*/
217215
218static READ8_DEVICE_HANDLER( riot1_pa_r )
216//-------------------------------------------------
217//  riot6532_interface riot1_intf
218//-------------------------------------------------
219
220READ8_MEMBER( c9060_device::riot1_pa_r )
219221{
220222   /*
221223
r11287r11288
232234
233235    */
234236
235   c9060_t *c9060 = get_safe_token(device->owner());
236
237237   UINT8 data = 0;
238238
239239   /* end or identify in */
240   data |= ieee488_eoi_r(c9060->bus) << 5;
240   data |= m_bus->eoi_r() << 5;
241241
242242   /* data valid in */
243   data |= ieee488_dav_r(c9060->bus) << 6;
243   data |= m_bus->dav_r() << 6;
244244
245245   /* attention */
246   data |= !ieee488_atn_r(c9060->bus) << 7;
246   data |= !m_bus->atn_r() << 7;
247247
248248   return data;
249249}
250250
251static WRITE8_DEVICE_HANDLER( riot1_pa_w )
251
252WRITE8_MEMBER( c9060_device::riot1_pa_w )
252253{
253254   /*
254255
r11287r11288
265266
266267    */
267268
268   c9060_t *c9060 = get_safe_token(device->owner());
269
270269   /* attention acknowledge */
271   c9060->atna = BIT(data, 0);
270   m_atna = BIT(data, 0);
272271
273272   /* data accepted out */
274   c9060->daco = BIT(data, 1);
273   m_daco = BIT(data, 1);
275274
276275   /* not ready for data out */
277   c9060->rfdo = BIT(data, 2);
276   m_rfdo = BIT(data, 2);
278277
279278   /* end or identify out */
280   ieee488_eoi_w(c9060->bus, device->owner(), BIT(data, 3));
279   m_bus->eoi_w(this, BIT(data, 3));
281280
282281   /* data valid out */
283   ieee488_dav_w(c9060->bus, device->owner(), BIT(data, 4));
282   m_bus->dav_w(this, BIT(data, 4));
284283
285   update_ieee_signals(device->owner());
284   update_ieee_signals();
286285}
287286
288static READ8_DEVICE_HANDLER( riot1_pb_r )
287
288READ8_MEMBER( c9060_device::riot1_pb_r )
289289{
290290   /*
291291
r11287r11288
302302
303303    */
304304
305   c9060_t *c9060 = get_safe_token(device->owner());
306
307305   UINT8 data = 0;
308306
309307   /* data accepted in */
310   data |= ieee488_ndac_r(c9060->bus) << 6;
308   data |= m_bus->ndac_r() << 6;
311309
312310   /* ready for data in */
313   data |= ieee488_nrfd_r(c9060->bus) << 7;
311   data |= m_bus->nrfd_r() << 7;
314312
315313   return data;
316314}
317315
318static WRITE8_DEVICE_HANDLER( riot1_pb_w )
316
317WRITE8_MEMBER( c9060_device::riot1_pb_w )
319318{
320319   /*
321320
r11287r11288
333332    */
334333}
335334
336static WRITE_LINE_DEVICE_HANDLER( riot1_irq_w )
337{
338   c9060_t *c9060 = get_safe_token(device->owner());
339335
340   device_set_input_line(c9060->cpu_dos, M6502_IRQ_LINE, state);
341}
342
343336static const riot6532_interface riot1_intf =
344337{
345   DEVCB_HANDLER(riot1_pa_r),
346   DEVCB_HANDLER(riot1_pb_r),
347   DEVCB_HANDLER(riot1_pa_w),
348   DEVCB_HANDLER(riot1_pb_w),
349   DEVCB_LINE(riot1_irq_w)
338   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, riot1_pa_r),
339   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, riot1_pb_r),
340   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, riot1_pa_w),
341   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, riot1_pb_w),
342   DEVCB_CPU_INPUT_LINE(M6502_TAG, INPUT_LINE_IRQ0)
350343};
351344
352/*-------------------------------------------------
353    via6522_interface via_intf 4b
354-------------------------------------------------*/
355345
356static READ8_DEVICE_HANDLER( via_pa_r )
346//-------------------------------------------------
347//  via6522_interface via_intf
348//-------------------------------------------------
349
350READ8_MEMBER( c9060_device::via_pa_r )
357351{
358352   /*
359353
r11287r11288
373367   return 0;
374368}
375369
376static WRITE8_DEVICE_HANDLER( via_pa_w )
370WRITE8_MEMBER( c9060_device::via_pa_w )
377371{
378372   /*
379373
r11287r11288
391385    */
392386}
393387
394static READ8_DEVICE_HANDLER( via_pb_r )
388READ8_MEMBER( c9060_device::via_pb_r )
395389{
396390   /*
397391
r11287r11288
411405   return 0;
412406}
413407
414static WRITE8_DEVICE_HANDLER( via_pb_w )
408WRITE8_MEMBER( c9060_device::via_pb_w )
415409{
416410   /*
417411
r11287r11288
431425
432426static const via6522_interface via_intf =
433427{
434   DEVCB_HANDLER(via_pa_r),
435   DEVCB_HANDLER(via_pb_r),
428   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, via_pa_r),
429   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, via_pb_r),
436430   DEVCB_NULL, // ACK
437431   DEVCB_NULL,
438432   DEVCB_NULL, // MSG
439433   DEVCB_NULL, // ?
440434
441   DEVCB_HANDLER(via_pa_w),
442   DEVCB_HANDLER(via_pb_w),
435   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, via_pa_w),
436   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, via_pb_w),
443437   DEVCB_NULL,
444438   DEVCB_NULL,
445439   DEVCB_NULL,
r11287r11288
448442   DEVCB_NULL
449443};
450444
451/*-------------------------------------------------
452    MACHINE_DRIVER( c9060 )
453-------------------------------------------------*/
454445
446//-------------------------------------------------
447//  MACHINE_CONFIG_FRAGMENT( c9060 )
448//-------------------------------------------------
449
455450static MACHINE_CONFIG_FRAGMENT( c9060 )
456   /* DOS */
451   // DOS
457452   MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/16)
458   MCFG_CPU_PROGRAM_MAP(c9060_dos_map)
453   MCFG_CPU_PROGRAM_MAP(c9060_main_mem)
459454
460455   MCFG_RIOT6532_ADD(M6532_0_TAG, XTAL_16MHz/16, riot0_intf)
461456   MCFG_RIOT6532_ADD(M6532_1_TAG, XTAL_16MHz/16, riot1_intf)
462457
463   /* controller */
458   // controller
464459   MCFG_CPU_ADD(M6504_TAG, M6504, XTAL_16MHz/16)
465   MCFG_CPU_PROGRAM_MAP(c9060_fdc_map)
460   MCFG_CPU_PROGRAM_MAP(c9060_hdc_mem)
466461
467462   MCFG_VIA6522_ADD(M6522_TAG, XTAL_16MHz/16, via_intf)
468463
469464   // Tandon TM602S
470465MACHINE_CONFIG_END
471466
472/*-------------------------------------------------
473    MACHINE_DRIVER( c9090 )
474-------------------------------------------------*/
475467
468//-------------------------------------------------
469//  MACHINE_CONFIG_FRAGMENT( c9090 )
470//-------------------------------------------------
471
476472static MACHINE_CONFIG_FRAGMENT( c9090 )
477473   MCFG_FRAGMENT_ADD(c9060)
478
479474   // Tandon TM603S
480475MACHINE_CONFIG_END
481476
482/*-------------------------------------------------
483    ROM( c9060 )
484-------------------------------------------------*/
485477
486ROM_START( c9060 ) // schematic 300010
487   ROM_REGION( 0x4800, C9060_REGION, ROMREGION_LOADBYNAME )
488   ROM_LOAD_OPTIONAL( "300516-revb.7c", 0x0000, 0x2000, CRC(2d758a14) SHA1(c959cc9dde84fc3d64e95e58a0a096a26d8107fd) )
489   ROM_LOAD( "300516-revc.7c", 0x0000, 0x2000, CRC(d6a3e88f) SHA1(bb1ddb5da94a86266012eca54818aa21dc4cef6a) )
490   ROM_LOAD_OPTIONAL( "300517-reva.7d", 0x2000, 0x2000, CRC(566df630) SHA1(b1602dfff408b165ee52a6a4ca3e2ec27e689ba9) )
491   ROM_LOAD_OPTIONAL( "300517-revb.7d", 0x2000, 0x2000, CRC(f0382bc3) SHA1(0b0a8dc520f5b41ffa832e4a636b3d226ccbb7f1) )
492   ROM_LOAD( "300517-revc.7d", 0x2000, 0x2000, CRC(2a9ad4ad) SHA1(4c17d014de48c906871b9b6c7d037d8736b1fd52) )
478//-------------------------------------------------
479//  machine_config_additions - device-specific
480//  machine configurations
481//-------------------------------------------------
493482
494   ROM_LOAD_OPTIONAL( "300515-reva.4c", 0x4000, 0x0800, CRC(99e096f7) SHA1(a3d1deb27bf5918b62b89c27fa3e488eb8f717a4) )
495   ROM_LOAD( "300515-revb.4c", 0x4000, 0x0800, CRC(49adf4fb) SHA1(59dafbd4855083074ba8dc96a04d4daa5b76e0d6) )
496ROM_END
483machine_config_constructor c9060_device_config::device_mconfig_additions() const
484{
485   switch (m_variant)
486   {
487   default:
488   case TYPE_9060:
489      return MACHINE_CONFIG_NAME( c9060 );
497490
498/*-------------------------------------------------
499    DEVICE_START( c9060 )
500-------------------------------------------------*/
491   case TYPE_9090:
492      return MACHINE_CONFIG_NAME( c9090 );
493   }
494}
501495
502static DEVICE_START( c9060 )
496
497
498//**************************************************************************
499//  INLINE HELPERS
500//**************************************************************************
501
502//-------------------------------------------------
503//  update_ieee_signals -
504//-------------------------------------------------
505
506inline void c9060_device::update_ieee_signals()
503507{
504   c9060_t *c9060 = get_safe_token(device);
505   const c9060_config *config = get_safe_config(device);
508   int atn = m_bus->atn_r();
509   int nrfd = !(!(!(atn & m_atna) & m_rfdo) | !(atn | m_atna));
510   int ndac = !(m_daco | !(atn | m_atna));
506511
507   /* find our CPU */
508   c9060->cpu_dos = device->subdevice(M6502_TAG);
509   c9060->cpu_hdc = device->subdevice(M6504_TAG);
512   m_bus->nrfd_w(this, nrfd);
513   m_bus->ndac_w(this, ndac);
514}
510515
511   /* find devices */
512   c9060->riot0 = device->subdevice(M6532_0_TAG);
513   c9060->riot1 = device->subdevice(M6532_1_TAG);
514   c9060->via = device->subdevice(M6522_TAG);
515   c9060->bus = device->machine().device(config->bus_tag);
516516
517   /* register for state saving */
518//  device->save_item(NAME(c9060->));
517
518//**************************************************************************
519//  LIVE DEVICE
520//**************************************************************************
521
522//-------------------------------------------------
523//  c9060_device - constructor
524//-------------------------------------------------
525
526c9060_device::c9060_device(running_machine &_machine, const c9060_device_config &_config)
527    : device_t(_machine, _config),
528     device_ieee488_interface(_machine, _config, *this),
529     m_maincpu(*this, M6502_TAG),
530     m_hdccpu(*this, M6504_TAG),
531     m_riot0(*this, M6532_0_TAG),
532     m_riot1(*this, M6532_1_TAG),
533     m_via(*this, M6522_TAG),
534     m_bus(*this->owner(), IEEE488_TAG),
535      m_config(_config)
536{
519537}
520538
521/*-------------------------------------------------
522    DEVICE_RESET( c9060 )
523-------------------------------------------------*/
524539
525static DEVICE_RESET( c9060 )
540//-------------------------------------------------
541//  device_start - device-specific startup
542//-------------------------------------------------
543
544void c9060_device::device_start()
526545{
527   c9060_t *c9060 = get_safe_token(device);
546   address_space *main = m_maincpu->memory().space(AS_PROGRAM);
547   address_space *hdc = m_hdccpu->memory().space(AS_PROGRAM);
528548
529   /* reset devices */
530   c9060->cpu_dos->reset();
531   c9060->cpu_hdc->reset();
532   c9060->riot0->reset();
533   c9060->riot1->reset();
534   c9060->via->reset();
549   main->install_rom(0xc000, 0xffff, subregion(M6502_TAG)->base());
550   hdc->install_rom(0x1800, 0x1fff, subregion(M6504_TAG)->base());
535551
536   /* toggle M6502 SO */
537   device_set_input_line(c9060->cpu_dos, M6502_SET_OVERFLOW, ASSERT_LINE);
538   device_set_input_line(c9060->cpu_dos, M6502_SET_OVERFLOW, CLEAR_LINE);
552   // state saving
553   save_item(NAME(m_rfdo));
554   save_item(NAME(m_daco));
555   save_item(NAME(m_atna));
539556}
540557
541/*-------------------------------------------------
542    DEVICE_GET_INFO( c9060 )
543-------------------------------------------------*/
544558
545DEVICE_GET_INFO( c9060 )
559//-------------------------------------------------
560//  device_reset - device-specific reset
561//-------------------------------------------------
562
563void c9060_device::device_reset()
546564{
547   switch (state)
548   {
549      /* --- the following bits of info are returned as 64-bit signed integers --- */
550      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(c9060_t);                           break;
551      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = sizeof(c9060_config);                        break;
565   m_maincpu->set_input_line(M6502_SET_OVERFLOW, ASSERT_LINE);
566   m_maincpu->set_input_line(M6502_SET_OVERFLOW, CLEAR_LINE);
567}
552568
553      /* --- the following bits of info are returned as pointers --- */
554      case DEVINFO_PTR_ROM_REGION:               info->romregion = ROM_NAME(c9060);                     break;
555      case DEVINFO_PTR_MACHINE_CONFIG:            info->machine_config = MACHINE_CONFIG_NAME(c9060);         break;
556569
557      /* --- the following bits of info are returned as pointers to data or functions --- */
558      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(c9060);                  break;
559      case DEVINFO_FCT_STOP:                     /* Nothing */                                    break;
560      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(c9060);                  break;
570//-------------------------------------------------
571//  device_timer - handler timer events
572//-------------------------------------------------
561573
562      /* --- the following bits of info are returned as NULL-terminated strings --- */
563      case DEVINFO_STR_NAME:                     strcpy(info->s, "Commodore 9060");                     break;
564      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Commodore PET");                     break;
565      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                              break;
566      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                           break;
567      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");             break;
568   }
574void c9060_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
575{
569576}
570577
571/*-------------------------------------------------
572    DEVICE_GET_INFO( c9090 )
573-------------------------------------------------*/
574578
575DEVICE_GET_INFO( c9090 )
579//-------------------------------------------------
580//  m_bus->atn -
581//-------------------------------------------------
582
583void c9060_device::ieee488_atn(int state)
576584{
577   switch (state)
578   {
579      /* --- the following bits of info are returned as pointers --- */
580      case DEVINFO_PTR_MACHINE_CONFIG:            info->machine_config = MACHINE_CONFIG_NAME(c9090);         break;
585   update_ieee_signals();
581586
582      /* --- the following bits of info are returned as NULL-terminated strings --- */
583      case DEVINFO_STR_NAME:                     strcpy(info->s, "Commodore 9090");                     break;
587   // set RIOT PA7
588   riot6532_porta_in_set(m_riot1, !state << 7, 0x80);
589}
584590
585      default:                              DEVICE_GET_INFO_CALL(c9060);                        break;
591
592//-------------------------------------------------
593//  m_bus->ifc -
594//-------------------------------------------------
595
596void c9060_device::ieee488_ifc(int state)
597{
598   if (!state)
599   {
600      device_reset();
586601   }
587602}
588
589DEFINE_LEGACY_DEVICE(C9060, c9060);
590DEFINE_LEGACY_DEVICE(C9090, c9090);
src/mess/machine/c9060.h
r11287r11288
77
88**********************************************************************/
99
10#pragma once
11
1012#ifndef __C9060__
1113#define __C9060__
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/6522via.h"
21#include "machine/6532riot.h"
22#include "machine/ieee488.h"
1423
15/***************************************************************************
16    MACROS / CONSTANTS
17***************************************************************************/
1824
19DECLARE_LEGACY_DEVICE(C9060, c9060);
20DECLARE_LEGACY_DEVICE(C9090, c9090);
2125
22#define MCFG_C9060_ADD(_tag, _bus_tag, _address) \
23   MCFG_DEVICE_ADD(_tag, C9060, 0) \
24   MCFG_DEVICE_CONFIG_DATAPTR(c9060_config, bus_tag, _bus_tag) \
25   MCFG_DEVICE_CONFIG_DATA32(c9060_config, address, _address)
26//**************************************************************************
27//  MACROS / CONSTANTS
28//**************************************************************************
2629
27#define MCFG_C9090_ADD(_tag, _bus_tag, _address) \
28   MCFG_DEVICE_ADD(_tag, C9090, 0) \
29   MCFG_DEVICE_CONFIG_DATAPTR(c9060_config, bus_tag, _bus_tag) \
30   MCFG_DEVICE_CONFIG_DATA32(c9060_config, address, _address)
30#define C9060_TAG         "c9060"
31#define C9090_TAG         "c9090"
3132
32#define C9060_IEEE488(_tag) \
33   _tag, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_DEVICE_LINE(_tag, c9060_ieee488_ifc_w), DEVCB_NULL, DEVCB_DEVICE_LINE(_tag, c9060_ieee488_atn_w), DEVCB_NULL
3433
35/***************************************************************************
36    TYPE DEFINITIONS
37***************************************************************************/
3834
39typedef struct _c9060_config c9060_config;
40struct _c9060_config
35//**************************************************************************
36//  INTERFACE CONFIGURATION MACROS
37//**************************************************************************
38
39#define MCFG_C9060_ADD(_tag, _address) \
40    MCFG_DEVICE_ADD(_tag, C9060, 0) \
41   c9060_device_config::static_set_config(device, _address, TYPE_9060);
42
43
44#define MCFG_C9090_ADD(_tag, _address) \
45    MCFG_DEVICE_ADD(_tag, C9090, 0) \
46   c9060_device_config::static_set_config(device, _address, TYPE_9090);
47
48
49
50//**************************************************************************
51//  TYPE DEFINITIONS
52//**************************************************************************
53
54// ======================> c9060_device_config
55
56class c9060_device_config :   public device_config,
57                       public device_config_ieee488_interface
4158{
42   const char *bus_tag;      /* bus device */
43   int address;            /* bus address */
59    friend class c9060_device;
60
61    // construction/destruction
62    c9060_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
63
64public:
65   enum
66   {
67      TYPE_9060 = 0,
68      TYPE_9090
69   };
70
71   // allocators
72    static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
73    virtual device_t *alloc_device(running_machine &machine) const;
74
75   // inline configuration helpers
76   static void static_set_config(device_config *device, int address, int variant);
77
78   // optional information overrides
79   virtual const rom_entry *device_rom_region() const;
80   virtual machine_config_constructor device_mconfig_additions() const;
81
82protected:
83   // device_config overrides
84    virtual void device_config_complete();
85   
86   int m_address;
87   int m_variant;
4488};
4589
46/***************************************************************************
47    PROTOTYPES
48***************************************************************************/
49/* IEEE-488 interface */
50WRITE_LINE_DEVICE_HANDLER( c9060_ieee488_atn_w );
51WRITE_LINE_DEVICE_HANDLER( c9060_ieee488_ifc_w );
5290
91// ======================> c9060_device
92
93class c9060_device :  public device_t,
94                 public device_ieee488_interface
95{
96    friend class c9060_device_config;
97
98    // construction/destruction
99    c9060_device(running_machine &_machine, const c9060_device_config &_config);
100
101public:
102   // not really public
103   DECLARE_READ8_MEMBER( dio_r );
104   DECLARE_WRITE8_MEMBER( dio_w );
105   DECLARE_READ8_MEMBER( riot1_pa_r );
106   DECLARE_WRITE8_MEMBER( riot1_pa_w );
107   DECLARE_READ8_MEMBER( riot1_pb_r );
108   DECLARE_WRITE8_MEMBER( riot1_pb_w );
109   DECLARE_READ8_MEMBER( via_pa_r );
110   DECLARE_READ8_MEMBER( via_pb_r );
111   DECLARE_WRITE8_MEMBER( via_pa_w );
112   DECLARE_WRITE8_MEMBER( via_pb_w );
113
114protected:
115    // device-level overrides
116    virtual void device_start();
117   virtual void device_reset();
118   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
119
120   // device_ieee488_interface overrides
121   void ieee488_atn(int state);
122   void ieee488_ifc(int state);
123
124private:
125   inline void update_ieee_signals();
126
127   required_device<cpu_device> m_maincpu;
128   required_device<cpu_device> m_hdccpu;
129   required_device<riot6532_device> m_riot0;
130   required_device<riot6532_device> m_riot1;
131   required_device<via6522_device> m_via;
132   required_device<ieee488_device> m_bus;
133   
134   // IEEE-488 bus
135   int m_rfdo;                     // not ready for data output
136   int m_daco;                     // not data accepted output
137   int m_atna;                     // attention acknowledge
138
139    const c9060_device_config &m_config;
140};
141
142
143// device type definition
144extern const device_type C9060;
145extern const device_type C9090;
146
147
148
53149#endif
src/mess/mess.mak
r11287r11288
766766   $(MESS_MACHINE)/c2031.o      \
767767   $(MESS_MACHINE)/c2040.o      \
768768   $(MESS_MACHINE)/c8280.o      \
769   $(MESS_MACHINE)/c9060.o      \
769770   $(MESS_DRIVERS)/clcd.o      \
770771   $(MESS_MACHINE)/6525tpi.o   \
771772   $(MESS_MACHINE)/cbm.o      \
r11287r11288
782783   $(MESS_FORMATS)/d81_dsk.o   \
783784   $(MESS_FORMATS)/cbm_tap.o   \
784785   $(MESS_FORMATS)/cbm_snqk.o   \
785#   $(MESS_MACHINE)/c9060.o      \
786786
787787$(MESSOBJ)/cccp.a:            \
788788   $(MESS_DRIVERS)/argo.o      \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team