~ubuntu-branches/ubuntu/raring/mame/raring-proposed

« back to all changes in this revision

Viewing changes to mess/src/mess/machine/c9060.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Jordi Mallach, Emmanuel Kasper
  • Date: 2011-12-19 22:56:27 UTC
  • mfrom: (0.1.2)
  • Revision ID: package-import@ubuntu.com-20111219225627-ub5oga1oys4ogqzm
Tags: 0.144-1
[ Jordi Mallach ]
* Fix syntax errors in DEP5 copyright file (lintian).
* Use a versioned copyright Format specification field.
* Update Vcs-* URLs.
* Move transitional packages to the new metapackages section, and make
  them priority extra.
* Remove references to GNU/Linux and MESS sources from copyright.
* Add build variables for s390x.
* Use .xz tarballs as it cuts 4MB for the upstream sources.
* Add nplayers.ini as a patch. Update copyright file to add CC-BY-SA-3.0.

[ Emmanuel Kasper ]
* New upstream release. Closes: #651538.
* Add Free Desktop compliant png icons of various sizes taken from
  the hydroxygen iconset
* Mess is now built from a new source package, to avoid possible source
  incompatibilities between mame and the mess overlay.
* Mame-tools are not built from the mame source package anymore, but
  from the mess source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**********************************************************************
2
 
 
3
 
    Commodore 9060/9090 Hard Disk Drive emulation
4
 
 
5
 
    Copyright MESS Team.
6
 
    Visit http://mamedev.org for licensing and usage restrictions.
7
 
 
8
 
**********************************************************************/
9
 
 
10
 
#include "c9060.h"
11
 
 
12
 
 
13
 
 
14
 
//**************************************************************************
15
 
//  MACROS / CONSTANTS
16
 
//**************************************************************************
17
 
 
18
 
#define M6502_TAG               "7e"
19
 
#define M6532_0_TAG             "7f"
20
 
#define M6532_1_TAG             "7g"
21
 
 
22
 
#define M6504_TAG               "4a"
23
 
#define M6522_TAG               "4b"
24
 
 
25
 
 
26
 
 
27
 
//**************************************************************************
28
 
//  DEVICE DEFINITIONS
29
 
//**************************************************************************
30
 
 
31
 
const device_type C9060 = &device_creator<c9060_device>;
32
 
const device_type C9090 = &device_creator<c9090_device>;
33
 
 
34
 
 
35
 
//-------------------------------------------------
36
 
//  device_config_complete - perform any
37
 
//  operations now that the configuration is
38
 
//  complete
39
 
//-------------------------------------------------
40
 
 
41
 
void base_c9060_device::device_config_complete()
42
 
{
43
 
        m_shortname = "c9060";
44
 
}
45
 
 
46
 
 
47
 
//-------------------------------------------------
48
 
//  static_set_config - configuration helper
49
 
//-------------------------------------------------
50
 
 
51
 
void base_c9060_device::static_set_config(device_t &device, int address)
52
 
{
53
 
        base_c9060_device &c9060 = downcast<base_c9060_device &>(device);
54
 
 
55
 
        assert((address > 7) && (address < 12));
56
 
 
57
 
        c9060.m_address = address - 8;
58
 
}
59
 
 
60
 
 
61
 
//-------------------------------------------------
62
 
//  ROM( c9060 )
63
 
//-------------------------------------------------
64
 
 
65
 
ROM_START( c9060 )
66
 
        ROM_REGION( 0x4000, M6502_TAG, 0 )
67
 
        ROM_LOAD_OPTIONAL( "300516-revb.7c", 0x0000, 0x2000, CRC(2d758a14) SHA1(c959cc9dde84fc3d64e95e58a0a096a26d8107fd) )
68
 
        ROM_LOAD( "300516-revc.7c", 0x0000, 0x2000, CRC(d6a3e88f) SHA1(bb1ddb5da94a86266012eca54818aa21dc4cef6a) )
69
 
        ROM_LOAD_OPTIONAL( "300517-reva.7d", 0x2000, 0x2000, CRC(566df630) SHA1(b1602dfff408b165ee52a6a4ca3e2ec27e689ba9) )
70
 
        ROM_LOAD_OPTIONAL( "300517-revb.7d", 0x2000, 0x2000, CRC(f0382bc3) SHA1(0b0a8dc520f5b41ffa832e4a636b3d226ccbb7f1) )
71
 
        ROM_LOAD( "300517-revc.7d", 0x2000, 0x2000, CRC(2a9ad4ad) SHA1(4c17d014de48c906871b9b6c7d037d8736b1fd52) )
72
 
 
73
 
        ROM_REGION( 0x800, M6504_TAG, 0 )
74
 
        ROM_LOAD_OPTIONAL( "300515-reva.4c", 0x000, 0x800, CRC(99e096f7) SHA1(a3d1deb27bf5918b62b89c27fa3e488eb8f717a4) )
75
 
        ROM_LOAD( "300515-revb.4c", 0x000, 0x800, CRC(49adf4fb) SHA1(59dafbd4855083074ba8dc96a04d4daa5b76e0d6) )
76
 
ROM_END
77
 
 
78
 
 
79
 
//-------------------------------------------------
80
 
//  rom_region - device-specific ROM region
81
 
//-------------------------------------------------
82
 
 
83
 
const rom_entry *base_c9060_device::device_rom_region() const
84
 
{
85
 
        return ROM_NAME( c9060 );
86
 
}
87
 
 
88
 
 
89
 
//-------------------------------------------------
90
 
//  ADDRESS_MAP( c9060_main_mem )
91
 
//-------------------------------------------------
92
 
 
93
 
static ADDRESS_MAP_START( c9060_main_mem, AS_PROGRAM, 8, base_c9060_device )
94
 
        AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0100) AM_RAM // 6532 #1
95
 
        AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0100) AM_RAM // 6532 #2
96
 
        AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE_LEGACY(M6532_0_TAG, riot6532_r, riot6532_w)
97
 
        AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE_LEGACY(M6532_1_TAG, riot6532_r, riot6532_w)
98
 
        AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share1")
99
 
        AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share2")
100
 
        AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share3")
101
 
        AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share4")
102
 
        AM_RANGE(0xc000, 0xffff) // AM_ROM
103
 
ADDRESS_MAP_END
104
 
 
105
 
 
106
 
//-------------------------------------------------
107
 
//  ADDRESS_MAP( c9060_hdc_mem )
108
 
//-------------------------------------------------
109
 
 
110
 
static ADDRESS_MAP_START( c9060_hdc_mem, AS_PROGRAM, 8, base_c9060_device )
111
 
        ADDRESS_MAP_GLOBAL_MASK(0x1fff)
112
 
        AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530
113
 
        AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6522_TAG, via6522_device, read, write)
114
 
        AM_RANGE(0x0400, 0x07ff) AM_RAM AM_SHARE("share1")
115
 
        AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("share2")
116
 
        AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_SHARE("share3")
117
 
        AM_RANGE(0x1000, 0x13ff) AM_RAM AM_SHARE("share4")
118
 
        AM_RANGE(0x1800, 0x1fff) // AM_ROM 6530
119
 
ADDRESS_MAP_END
120
 
 
121
 
 
122
 
//-------------------------------------------------
123
 
//  riot6532_interface riot0_intf
124
 
//-------------------------------------------------
125
 
 
126
 
READ8_MEMBER( base_c9060_device::dio_r )
127
 
{
128
 
        /*
129
 
 
130
 
        bit     description
131
 
 
132
 
        PA0     DI0
133
 
        PA1     DI1
134
 
        PA2     DI2
135
 
        PA3     DI3
136
 
        PA4     DI4
137
 
        PA5     DI5
138
 
        PA6     DI6
139
 
        PA7     DI7
140
 
 
141
 
    */
142
 
 
143
 
        return m_bus->dio_r();
144
 
}
145
 
 
146
 
 
147
 
WRITE8_MEMBER( base_c9060_device::dio_w )
148
 
{
149
 
        /*
150
 
 
151
 
        bit     description
152
 
 
153
 
        PB0     DO0
154
 
        PB1     DO1
155
 
        PB2     DO2
156
 
        PB3     DO3
157
 
        PB4     DO4
158
 
        PB5     DO5
159
 
        PB6     DO6
160
 
        PB7     DO7
161
 
 
162
 
    */
163
 
 
164
 
        m_bus->dio_w(this, data);
165
 
}
166
 
 
167
 
 
168
 
static const riot6532_interface riot0_intf =
169
 
{
170
 
        DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c9060_device, dio_r),
171
 
        DEVCB_NULL,
172
 
        DEVCB_NULL,
173
 
        DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c9060_device, dio_w),
174
 
        DEVCB_NULL
175
 
};
176
 
 
177
 
 
178
 
//-------------------------------------------------
179
 
//  riot6532_interface riot1_intf
180
 
//-------------------------------------------------
181
 
 
182
 
READ8_MEMBER( base_c9060_device::riot1_pa_r )
183
 
{
184
 
        /*
185
 
 
186
 
        bit     description
187
 
 
188
 
        PA0     ATNA
189
 
        PA1     DACO
190
 
        PA2     RFDO
191
 
        PA3     EOIO
192
 
        PA4     DAVO
193
 
        PA5     EOII
194
 
        PA6     DAVI
195
 
        PA7     _ATN
196
 
 
197
 
    */
198
 
 
199
 
        UINT8 data = 0;
200
 
 
201
 
        /* end or identify in */
202
 
        data |= m_bus->eoi_r() << 5;
203
 
 
204
 
        /* data valid in */
205
 
        data |= m_bus->dav_r() << 6;
206
 
 
207
 
        /* attention */
208
 
        data |= !m_bus->atn_r() << 7;
209
 
 
210
 
        return data;
211
 
}
212
 
 
213
 
 
214
 
WRITE8_MEMBER( base_c9060_device::riot1_pa_w )
215
 
{
216
 
        /*
217
 
 
218
 
        bit     description
219
 
 
220
 
        PA0     ATNA
221
 
        PA1     DACO
222
 
        PA2     RFDO
223
 
        PA3     EOIO
224
 
        PA4     DAVO
225
 
        PA5     EOII
226
 
        PA6     DAVI
227
 
        PA7     _ATN
228
 
 
229
 
    */
230
 
 
231
 
        /* attention acknowledge */
232
 
        m_atna = BIT(data, 0);
233
 
 
234
 
        /* data accepted out */
235
 
        m_daco = BIT(data, 1);
236
 
 
237
 
        /* not ready for data out */
238
 
        m_rfdo = BIT(data, 2);
239
 
 
240
 
        /* end or identify out */
241
 
        m_bus->eoi_w(this, BIT(data, 3));
242
 
 
243
 
        /* data valid out */
244
 
        m_bus->dav_w(this, BIT(data, 4));
245
 
 
246
 
        update_ieee_signals();
247
 
}
248
 
 
249
 
 
250
 
READ8_MEMBER( base_c9060_device::riot1_pb_r )
251
 
{
252
 
        /*
253
 
 
254
 
        bit     description
255
 
 
256
 
        PB0
257
 
        PB1
258
 
        PB2
259
 
        PB3
260
 
        PB4     DRIVE RDY
261
 
        PB5     PWR ON AND NO ERRORS
262
 
        PB6     DACI
263
 
        PB7     RFDI
264
 
 
265
 
    */
266
 
 
267
 
        UINT8 data = 0;
268
 
 
269
 
        /* data accepted in */
270
 
        data |= m_bus->ndac_r() << 6;
271
 
 
272
 
        /* ready for data in */
273
 
        data |= m_bus->nrfd_r() << 7;
274
 
 
275
 
        return data;
276
 
}
277
 
 
278
 
 
279
 
WRITE8_MEMBER( base_c9060_device::riot1_pb_w )
280
 
{
281
 
        /*
282
 
 
283
 
        bit     description
284
 
 
285
 
        PB0
286
 
        PB1
287
 
        PB2
288
 
        PB3
289
 
        PB4     DRIVE RDY
290
 
        PB5     PWR ON AND NO ERRORS
291
 
        PB6     DACI
292
 
        PB7     RFDI
293
 
 
294
 
    */
295
 
}
296
 
 
297
 
 
298
 
static const riot6532_interface riot1_intf =
299
 
{
300
 
        DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c9060_device, riot1_pa_r),
301
 
        DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c9060_device, riot1_pb_r),
302
 
        DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c9060_device, riot1_pa_w),
303
 
        DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c9060_device, riot1_pb_w),
304
 
        DEVCB_CPU_INPUT_LINE(M6502_TAG, INPUT_LINE_IRQ0)
305
 
};
306
 
 
307
 
 
308
 
//-------------------------------------------------
309
 
//  via6522_interface via_intf
310
 
//-------------------------------------------------
311
 
 
312
 
READ8_MEMBER( base_c9060_device::via_pa_r )
313
 
{
314
 
        /*
315
 
 
316
 
        bit     description
317
 
 
318
 
        PA0     DB0
319
 
        PA1     DB1
320
 
        PA2     DB2
321
 
        PA3     DB3
322
 
        PA4     DB4
323
 
        PA5     DB5
324
 
        PA6     DB6
325
 
        PA7     DB7
326
 
 
327
 
    */
328
 
 
329
 
        return 0;
330
 
}
331
 
 
332
 
WRITE8_MEMBER( base_c9060_device::via_pa_w )
333
 
{
334
 
        /*
335
 
 
336
 
        bit     description
337
 
 
338
 
        PA0     DB0
339
 
        PA1     DB1
340
 
        PA2     DB2
341
 
        PA3     DB3
342
 
        PA4     DB4
343
 
        PA5     DB5
344
 
        PA6     DB6
345
 
        PA7     DB7
346
 
 
347
 
    */
348
 
}
349
 
 
350
 
READ8_MEMBER( base_c9060_device::via_pb_r )
351
 
{
352
 
        /*
353
 
 
354
 
        bit     description
355
 
 
356
 
        PB0     SEL
357
 
        PB1     RST
358
 
        PB2     C/D
359
 
        PB3     BUSY
360
 
        PB4     J14
361
 
        PB5     J14
362
 
        PB6     I/O
363
 
        PB7     MSG
364
 
 
365
 
    */
366
 
 
367
 
        return 0;
368
 
}
369
 
 
370
 
WRITE8_MEMBER( base_c9060_device::via_pb_w )
371
 
{
372
 
        /*
373
 
 
374
 
        bit     description
375
 
 
376
 
        PB0     SEL
377
 
        PB1     RST
378
 
        PB2     C/D
379
 
        PB3     BUSY
380
 
        PB4     J14
381
 
        PB5     J14
382
 
        PB6     I/O
383
 
        PB7     MSG
384
 
 
385
 
    */
386
 
}
387
 
 
388
 
static const via6522_interface via_intf =
389
 
{
390
 
        DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c9060_device, via_pa_r),
391
 
        DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c9060_device, via_pb_r),
392
 
        DEVCB_NULL, // ACK
393
 
        DEVCB_NULL,
394
 
        DEVCB_NULL, // MSG
395
 
        DEVCB_NULL, // ?
396
 
 
397
 
        DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c9060_device, via_pa_w),
398
 
        DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c9060_device, via_pb_w),
399
 
        DEVCB_NULL,
400
 
        DEVCB_NULL,
401
 
        DEVCB_NULL,
402
 
        DEVCB_NULL,
403
 
 
404
 
        DEVCB_NULL
405
 
};
406
 
 
407
 
 
408
 
//-------------------------------------------------
409
 
//  MACHINE_CONFIG_FRAGMENT( c9060 )
410
 
//-------------------------------------------------
411
 
 
412
 
static MACHINE_CONFIG_FRAGMENT( c9060 )
413
 
        // DOS
414
 
        MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/16)
415
 
        MCFG_CPU_PROGRAM_MAP(c9060_main_mem)
416
 
 
417
 
        MCFG_RIOT6532_ADD(M6532_0_TAG, XTAL_16MHz/16, riot0_intf)
418
 
        MCFG_RIOT6532_ADD(M6532_1_TAG, XTAL_16MHz/16, riot1_intf)
419
 
 
420
 
        // controller
421
 
        MCFG_CPU_ADD(M6504_TAG, M6504, XTAL_16MHz/16)
422
 
        MCFG_CPU_PROGRAM_MAP(c9060_hdc_mem)
423
 
 
424
 
        MCFG_VIA6522_ADD(M6522_TAG, XTAL_16MHz/16, via_intf)
425
 
 
426
 
        // Tandon TM602S
427
 
MACHINE_CONFIG_END
428
 
 
429
 
 
430
 
//-------------------------------------------------
431
 
//  MACHINE_CONFIG_FRAGMENT( c9090 )
432
 
//-------------------------------------------------
433
 
 
434
 
static MACHINE_CONFIG_FRAGMENT( c9090 )
435
 
        MCFG_FRAGMENT_ADD(c9060)
436
 
        // Tandon TM603S
437
 
MACHINE_CONFIG_END
438
 
 
439
 
 
440
 
//-------------------------------------------------
441
 
//  machine_config_additions - device-specific
442
 
//  machine configurations
443
 
//-------------------------------------------------
444
 
 
445
 
machine_config_constructor base_c9060_device::device_mconfig_additions() const
446
 
{
447
 
        switch (m_variant)
448
 
        {
449
 
        default:
450
 
        case TYPE_9060:
451
 
                return MACHINE_CONFIG_NAME( c9060 );
452
 
 
453
 
        case TYPE_9090:
454
 
                return MACHINE_CONFIG_NAME( c9090 );
455
 
        }
456
 
}
457
 
 
458
 
 
459
 
 
460
 
//**************************************************************************
461
 
//  INLINE HELPERS
462
 
//**************************************************************************
463
 
 
464
 
//-------------------------------------------------
465
 
//  update_ieee_signals -
466
 
//-------------------------------------------------
467
 
 
468
 
inline void base_c9060_device::update_ieee_signals()
469
 
{
470
 
        int atn = m_bus->atn_r();
471
 
        int nrfd = !(!(!(atn & m_atna) & m_rfdo) | !(atn | m_atna));
472
 
        int ndac = !(m_daco | !(atn | m_atna));
473
 
 
474
 
        m_bus->nrfd_w(this, nrfd);
475
 
        m_bus->ndac_w(this, ndac);
476
 
}
477
 
 
478
 
 
479
 
 
480
 
//**************************************************************************
481
 
//  LIVE DEVICE
482
 
//**************************************************************************
483
 
 
484
 
//-------------------------------------------------
485
 
//  base_c9060_device - constructor
486
 
//-------------------------------------------------
487
 
 
488
 
base_c9060_device::base_c9060_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant)
489
 
    : device_t(mconfig, type, name, tag, owner, clock),
490
 
          device_ieee488_interface(mconfig, *this),
491
 
          m_maincpu(*this, M6502_TAG),
492
 
          m_hdccpu(*this, M6504_TAG),
493
 
          m_riot0(*this, M6532_0_TAG),
494
 
          m_riot1(*this, M6532_1_TAG),
495
 
          m_via(*this, M6522_TAG),
496
 
          m_bus(*this->owner(), IEEE488_TAG),
497
 
          m_variant(variant)
498
 
{
499
 
}
500
 
 
501
 
 
502
 
//-------------------------------------------------
503
 
//  c9060_device - constructor
504
 
//-------------------------------------------------
505
 
 
506
 
c9060_device::c9060_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
507
 
        : base_c9060_device(mconfig, C9060, "C9060", tag, owner, clock, TYPE_9060) { }
508
 
 
509
 
 
510
 
//-------------------------------------------------
511
 
//  c9090_device - constructor
512
 
//-------------------------------------------------
513
 
 
514
 
c9090_device::c9090_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
515
 
        : base_c9060_device(mconfig, C9090, "C9090", tag, owner, clock, TYPE_9090) { }
516
 
 
517
 
 
518
 
//-------------------------------------------------
519
 
//  device_start - device-specific startup
520
 
//-------------------------------------------------
521
 
 
522
 
void base_c9060_device::device_start()
523
 
{
524
 
        address_space *main = m_maincpu->memory().space(AS_PROGRAM);
525
 
        address_space *hdc = m_hdccpu->memory().space(AS_PROGRAM);
526
 
 
527
 
        main->install_rom(0xc000, 0xffff, subregion(M6502_TAG)->base());
528
 
        hdc->install_rom(0x1800, 0x1fff, subregion(M6504_TAG)->base());
529
 
 
530
 
        // state saving
531
 
        save_item(NAME(m_rfdo));
532
 
        save_item(NAME(m_daco));
533
 
        save_item(NAME(m_atna));
534
 
}
535
 
 
536
 
 
537
 
//-------------------------------------------------
538
 
//  device_reset - device-specific reset
539
 
//-------------------------------------------------
540
 
 
541
 
void base_c9060_device::device_reset()
542
 
{
543
 
        m_maincpu->set_input_line(M6502_SET_OVERFLOW, ASSERT_LINE);
544
 
        m_maincpu->set_input_line(M6502_SET_OVERFLOW, CLEAR_LINE);
545
 
}
546
 
 
547
 
 
548
 
//-------------------------------------------------
549
 
//  device_timer - handler timer events
550
 
//-------------------------------------------------
551
 
 
552
 
void base_c9060_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
553
 
{
554
 
}
555
 
 
556
 
 
557
 
//-------------------------------------------------
558
 
//  m_bus->atn -
559
 
//-------------------------------------------------
560
 
 
561
 
void base_c9060_device::ieee488_atn(int state)
562
 
{
563
 
        update_ieee_signals();
564
 
 
565
 
        // set RIOT PA7
566
 
        riot6532_porta_in_set(m_riot1, !state << 7, 0x80);
567
 
}
568
 
 
569
 
 
570
 
//-------------------------------------------------
571
 
//  m_bus->ifc -
572
 
//-------------------------------------------------
573
 
 
574
 
void base_c9060_device::ieee488_ifc(int state)
575
 
{
576
 
        if (!state)
577
 
        {
578
 
                device_reset();
579
 
        }
580
 
}