Previous 15994 Revisions Next

r11381 Thursday 28th April, 2011 at 20:46:26 UTC by Curt Coder
Fixed device inheritance. (nw)
[src/mess/machine]c1571.c c1571.h c1581.c c1581.h c2040.c c2040.h c8280.c c8280.h c9060.c c9060.h

src/mess/machine/c1581.c
r11380r11381
3232//  DEVICE DEFINITIONS
3333//**************************************************************************
3434
35const device_type C1563 = &device_creator<c1563_device>;
3536const device_type C1581 = &device_creator<c1581_device>;
36const device_type C1563 = &device_creator<c1563_device>;
3737
38c1563_device::c1563_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
39   :c1581_device(mconfig, tag, owner, clock) { }
4038
4139//-------------------------------------------------
4240//  device_config_complete - perform any
r11380r11381
4442//  complete
4543//-------------------------------------------------
4644
47void c1581_device::device_config_complete()
45void base_c1581_device::device_config_complete()
4846{
4947   switch (m_variant)
5048   {
r11380r11381
6462//  static_set_config - configuration helper
6563//-------------------------------------------------
6664
67void c1581_device::static_set_config(device_t &device, int address, int variant)
65void base_c1581_device::static_set_config(device_t &device, int address)
6866{
69   c1581_device &c1581 = downcast<c1581_device &>(device);
67   base_c1581_device &c1581 = downcast<base_c1581_device &>(device);
7068
7169   assert((address > 7) && (address < 12));
7270
7371   c1581.m_address = address - 8;
74   c1581.m_variant = variant;
7572}
7673
7774
r11380r11381
10299//  rom_region - device-specific ROM region
103100//-------------------------------------------------
104101
105const rom_entry *c1581_device::device_rom_region() const
102const rom_entry *base_c1581_device::device_rom_region() const
106103{
107104   switch (m_variant)
108105   {
r11380r11381
120117//  ADDRESS_MAP( c1581_mem )
121118//-------------------------------------------------
122119
123static ADDRESS_MAP_START( c1581_mem, AS_PROGRAM, 8, c1581_device )
120static ADDRESS_MAP_START( c1581_mem, AS_PROGRAM, 8, base_c1581_device )
124121   AM_RANGE(0x0000, 0x1fff) AM_MIRROR(0x2000) AM_RAM
125122   AM_RANGE(0x4000, 0x400f) AM_MIRROR(0x1ff0) AM_DEVREADWRITE_LEGACY(M8520_TAG, mos6526_r, mos6526_w)
126123   AM_RANGE(0x6000, 0x6003) AM_MIRROR(0x1ffc) AM_DEVREADWRITE_LEGACY(WD1770_TAG, wd17xx_r, wd17xx_w)
r11380r11381
132129//  MOS8520_INTERFACE( cia_intf )
133130//-------------------------------------------------
134131
135WRITE_LINE_MEMBER( c1581_device::cnt_w )
132WRITE_LINE_MEMBER( base_c1581_device::cnt_w )
136133{
137134   // fast serial clock out
138135   m_cnt_out = state;
r11380r11381
141138}
142139
143140
144WRITE_LINE_MEMBER( c1581_device::sp_w )
141WRITE_LINE_MEMBER( base_c1581_device::sp_w )
145142{
146143   // fast serial data out
147144   m_sp_out = state;
r11380r11381
150147}
151148
152149
153READ8_MEMBER( c1581_device::cia_pa_r )
150READ8_MEMBER( base_c1581_device::cia_pa_r )
154151{
155152   /*
156153
r11380r11381
182179}
183180
184181
185WRITE8_MEMBER( c1581_device::cia_pa_w )
182WRITE8_MEMBER( base_c1581_device::cia_pa_w )
186183{
187184   /*
188185
r11380r11381
215212}
216213
217214
218READ8_MEMBER( c1581_device::cia_pb_r )
215READ8_MEMBER( base_c1581_device::cia_pb_r )
219216{
220217   /*
221218
r11380r11381
250247}
251248
252249
253WRITE8_MEMBER( c1581_device::cia_pb_w )
250WRITE8_MEMBER( base_c1581_device::cia_pb_w )
254251{
255252   /*
256253
r11380r11381
289286   XTAL_16MHz/8,
290287   DEVCB_CPU_INPUT_LINE(M6502_TAG, INPUT_LINE_IRQ0),
291288   DEVCB_NULL,
292   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1581_device, cnt_w),
293   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1581_device, sp_w),
294   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1581_device, cia_pa_r),
295   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1581_device, cia_pa_w),
296   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1581_device, cia_pb_r),
297   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1581_device, cia_pb_w)
289   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1581_device, cnt_w),
290   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1581_device, sp_w),
291   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1581_device, cia_pa_r),
292   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1581_device, cia_pa_w),
293   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1581_device, cia_pb_r),
294   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1581_device, cia_pb_w)
298295};
299296
300297
r11380r11381
357354//  machine configurations
358355//-------------------------------------------------
359356
360machine_config_constructor c1581_device::device_mconfig_additions() const
357machine_config_constructor base_c1581_device::device_mconfig_additions() const
361358{
362359   return MACHINE_CONFIG_NAME( c1581 );
363360}
r11380r11381
369366//**************************************************************************
370367
371368//-------------------------------------------------
372//  c1581_device - constructor
369//  base_c1581_device - constructor
373370//-------------------------------------------------
374371
375inline void c1581_device::set_iec_data()
372inline void base_c1581_device::set_iec_data()
376373{
377374   int atn = m_bus->atn_r();
378375   int data = !m_data_out & !(m_atn_ack & !atn);
r11380r11381
385382
386383
387384//-------------------------------------------------
388//  c1581_device - constructor
385//  base_c1581_device - constructor
389386//-------------------------------------------------
390387
391inline void c1581_device::set_iec_srq()
388inline void base_c1581_device::set_iec_srq()
392389{
393390   int srq = 1;
394391
r11380r11381
405402//**************************************************************************
406403
407404//-------------------------------------------------
408//  c1581_device - constructor
405//  base_c1581_device - constructor
409406//-------------------------------------------------
410407
411c1581_device::c1581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
412    : device_t(mconfig, C1581, "C1581", tag, owner, clock),
408base_c1581_device::base_c1581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant)
409    : device_t(mconfig, type, name, tag, owner, clock),
413410     device_cbm_iec_interface(mconfig, *this),
414411     m_maincpu(*this, M6502_TAG),
415412     m_cia(*this, M8520_TAG),
416413     m_fdc(*this, WD1770_TAG),
417414     m_image(*this, FLOPPY_0),
418     m_bus(*this->owner(), CBM_IEC_TAG)
415     m_bus(*this->owner(), CBM_IEC_TAG),
416     m_variant(variant)
419417{
420418}
421419
422420
423421//-------------------------------------------------
422//  c1563_device - constructor
423//-------------------------------------------------
424
425c1563_device::c1563_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
426   : base_c1581_device(mconfig, C1563, "C1563", tag, owner, clock, TYPE_1563) { }
427
428
429//-------------------------------------------------
430//  c1581_device - constructor
431//-------------------------------------------------
432
433c1581_device::c1581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
434   : base_c1581_device(mconfig, C1581, "C1581", tag, owner, clock, TYPE_1581) { }
435
436
437//-------------------------------------------------
424438//  device_start - device-specific startup
425439//-------------------------------------------------
426440
427void c1581_device::device_start()
441void base_c1581_device::device_start()
428442{
429443   // map ROM
430444   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
r11380r11381
443457//  device_reset - device-specific reset
444458//-------------------------------------------------
445459
446void c1581_device::device_reset()
460void base_c1581_device::device_reset()
447461{
448462   m_sp_out = 1;
449463   m_cnt_out = 1;
r11380r11381
454468//  cbm_iec_srq -
455469//-------------------------------------------------
456470
457void c1581_device::cbm_iec_srq(int state)
471void base_c1581_device::cbm_iec_srq(int state)
458472{
459473   if (!m_fast_ser_dir)
460474   {
r11380r11381
467481//  cbm_iec_atn -
468482//-------------------------------------------------
469483
470void c1581_device::cbm_iec_atn(int state)
484void base_c1581_device::cbm_iec_atn(int state)
471485{
472486   m_cia->flag_w(state);
473487
r11380r11381
479493//  cbm_iec_data -
480494//-------------------------------------------------
481495
482void c1581_device::cbm_iec_data(int state)
496void base_c1581_device::cbm_iec_data(int state)
483497{
484498   if (!m_fast_ser_dir)
485499   {
r11380r11381
492506//  cbm_iec_reset -
493507//-------------------------------------------------
494508
495void c1581_device::cbm_iec_reset(int state)
509void base_c1581_device::cbm_iec_reset(int state)
496510{
497511   if (!state)
498512   {
src/mess/machine/c1581.h
r11380r11381
3838
3939#define MCFG_C1581_ADD(_tag, _address) \
4040    MCFG_DEVICE_ADD(_tag, C1581, 0) \
41   c1581_device::static_set_config(*device, _address, c1581_device::TYPE_1581);
41   base_c1581_device::static_set_config(*device, _address);
4242
43
4344#define MCFG_C1563_ADD(_tag, _address) \
4445    MCFG_DEVICE_ADD(_tag, C1563, 0) \
45   c1581_device::static_set_config(*device, _address, c1581_device::TYPE_1563);
46   base_c1581_device::static_set_config(*device, _address);
4647
4748
4849
r11380r11381
5051//  TYPE DEFINITIONS
5152//**************************************************************************
5253
53// ======================> c1581_device
54// ======================> base_c1581_device
5455
55class c1581_device :  public device_t,
56                 public device_cbm_iec_interface
56class base_c1581_device :  public device_t,
57                     public device_cbm_iec_interface
5758{
5859
5960public:
6061    // construction/destruction
61    c1581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
62    base_c1581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant);
6263
6364   enum
6465   {
65      TYPE_1581 = 0,
66      TYPE_1563
66      TYPE_1563,
67      TYPE_1581
6768   };
6869
6970   // inline configuration helpers
70   static void static_set_config(device_t &device, int address, int variant);
71   static void static_set_config(device_t &device, int address);
7172
7273   // optional information overrides
7374   virtual const rom_entry *device_rom_region() const;
r11380r11381
9293   void cbm_iec_data(int state);
9394   void cbm_iec_reset(int state);
9495
95private:
9696   inline void set_iec_data();
9797   inline void set_iec_srq();
9898
r11380r11381
115115
116116// ======================> c1563_device
117117
118class c1563_device :  public c1581_device
118class c1563_device :  public base_c1581_device
119119{
120120public:
121121    // construction/destruction
r11380r11381
123123};
124124
125125
126// ======================> c1581_device
127
128class c1581_device :  public base_c1581_device
129{
130public:
131    // construction/destruction
132    c1581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
133};
134
135
126136// device type definition
137extern const device_type C1563;
127138extern const device_type C1581;
128extern const device_type C1563;
129139
130140
131141
src/mess/machine/c2040.c
r11380r11381
1717        104D: m6502_brk#$00
1818
1919    - Micropolis 8x50 stepper motor is same as 4040, except it takes 4 pulses to step a track instead of 1
20    - 8250 cannot read d80 images
2120
2221*/
2322
r11380r11381
6665const device_type C8250 = &device_creator<c8250_device>;
6766const device_type SFD1001 = &device_creator<sfd1001_device>;
6867
69c3040_device::c3040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
70   :c2040_device(mconfig, tag, owner, clock) { }
71
72c4040_device::c4040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
73   :c2040_device(mconfig, tag, owner, clock) { }
74
75c8050_device::c8050_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
76   :c2040_device(mconfig, tag, owner, clock) { }
77
78c8250_device::c8250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
79   :c8050_device(mconfig, tag, owner, clock) { }
80
81sfd1001_device::sfd1001_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
82   :c8050_device(mconfig, tag, owner, clock) { }
83
8468   
8569//-------------------------------------------------
8670//  device_config_complete - perform any
r11380r11381
8872//  complete
8973//-------------------------------------------------
9074
91void c2040_device::device_config_complete()
75void base_c2040_device::device_config_complete()
9276{
9377   switch (m_variant)
9478   {
r11380r11381
121105//  static_set_config - configuration helper
122106//-------------------------------------------------
123107
124void c2040_device::static_set_config(device_t &device, int address, int variant)
108void base_c2040_device::static_set_config(device_t &device, int address)
125109{
126   c2040_device &c2040 = downcast<c2040_device &>(device);
110   base_c2040_device &c2040 = downcast<base_c2040_device &>(device);
127111
128112   assert((address > 7) && (address < 12));
129113
130114   c2040.m_address = address - 8;
131   c2040.m_variant = variant;
132115}
133116
134117
r11380r11381
239222//  rom_region - device-specific ROM region
240223//-------------------------------------------------
241224
242const rom_entry *c2040_device::device_rom_region() const
225const rom_entry *base_c2040_device::device_rom_region() const
243226{
244227   switch (m_variant)
245228   {
r11380r11381
265248//  ADDRESS_MAP( c2040_main_mem )
266249//-------------------------------------------------
267250
268static ADDRESS_MAP_START( c2040_main_mem, AS_PROGRAM, 8, c2040_device )
251static ADDRESS_MAP_START( c2040_main_mem, AS_PROGRAM, 8, base_c2040_device )
269252   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
270253   AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0100) AM_RAM // 6532 #1
271254   AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0100) AM_RAM // 6532 #2
r11380r11381
283266//  ADDRESS_MAP( c2040_fdc_mem )
284267//-------------------------------------------------
285268
286static ADDRESS_MAP_START( c2040_fdc_mem, AS_PROGRAM, 8, c2040_device )
269static ADDRESS_MAP_START( c2040_fdc_mem, AS_PROGRAM, 8, base_c2040_device )
287270   ADDRESS_MAP_GLOBAL_MASK(0x1fff)
288271   AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530
289272   AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6522_TAG, via6522_device, read, write)
r11380r11381
300283//  ADDRESS_MAP( c8050_main_mem )
301284//-------------------------------------------------
302285
303static ADDRESS_MAP_START( c8050_main_mem, AS_PROGRAM, 8, c2040_device )
286static ADDRESS_MAP_START( c8050_main_mem, AS_PROGRAM, 8, base_c2040_device )
304287   AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0100) AM_RAM // 6532 #1
305288   AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0100) AM_RAM // 6532 #2
306289   AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE_LEGACY(M6532_0_TAG, riot6532_r, riot6532_w)
r11380r11381
317300//  ADDRESS_MAP( c8050_fdc_mem )
318301//-------------------------------------------------
319302
320static ADDRESS_MAP_START( c8050_fdc_mem, AS_PROGRAM, 8, c2040_device )
303static ADDRESS_MAP_START( c8050_fdc_mem, AS_PROGRAM, 8, base_c2040_device )
321304   ADDRESS_MAP_GLOBAL_MASK(0x1fff)
322305   AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530
323306   AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6522_TAG, via6522_device, read, write)
r11380r11381
334317//  ADDRESS_MAP( sfd1001_fdc_mem )
335318//-------------------------------------------------
336319
337static ADDRESS_MAP_START( sfd1001_fdc_mem, AS_PROGRAM, 8, c2040_device )
320static ADDRESS_MAP_START( sfd1001_fdc_mem, AS_PROGRAM, 8, base_c2040_device )
338321   ADDRESS_MAP_GLOBAL_MASK(0x1fff)
339322   AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530
340323   AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6522_TAG, via6522_device, read, write)
r11380r11381
351334//  riot6532_interface riot0_intf uc1
352335//-------------------------------------------------
353336
354READ8_MEMBER( c2040_device::dio_r )
337READ8_MEMBER( base_c2040_device::dio_r )
355338{
356339   /*
357340
r11380r11381
372355}
373356
374357
375WRITE8_MEMBER( c2040_device::dio_w )
358WRITE8_MEMBER( base_c2040_device::dio_w )
376359{
377360   /*
378361
r11380r11381
395378
396379static const riot6532_interface riot0_intf =
397380{
398   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, dio_r),
381   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, dio_r),
399382   DEVCB_NULL,
400383   DEVCB_NULL,
401   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, dio_w),
384   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, dio_w),
402385   DEVCB_NULL
403386};
404387
r11380r11381
407390//  riot6532_interface riot1_intf ue1
408391//-------------------------------------------------
409392
410READ8_MEMBER( c2040_device::riot1_pa_r )
393READ8_MEMBER( base_c2040_device::riot1_pa_r )
411394{
412395   /*
413396
r11380r11381
439422}
440423
441424
442WRITE8_MEMBER( c2040_device::riot1_pa_w )
425WRITE8_MEMBER( base_c2040_device::riot1_pa_w )
443426{
444427   /*
445428
r11380r11381
475458}
476459
477460
478READ8_MEMBER( c2040_device::riot1_pb_r )
461READ8_MEMBER( base_c2040_device::riot1_pb_r )
479462{
480463   /*
481464
r11380r11381
507490}
508491
509492
510WRITE8_MEMBER( c2040_device::riot1_pb_w )
493WRITE8_MEMBER( base_c2040_device::riot1_pb_w )
511494{
512495   /*
513496
r11380r11381
537520
538521static const riot6532_interface riot1_intf =
539522{
540   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, riot1_pa_r),
541   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, riot1_pb_r),
542   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, riot1_pa_w),
543   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, riot1_pb_w),
523   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, riot1_pa_r),
524   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, riot1_pb_r),
525   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, riot1_pa_w),
526   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, riot1_pb_w),
544527   DEVCB_CPU_INPUT_LINE(M6502_TAG, INPUT_LINE_IRQ0)
545528};
546529
r11380r11381
549532//  via6522_interface via_intf um3
550533//-------------------------------------------------
551534
552READ8_MEMBER( c2040_device::via_pa_r )
535READ8_MEMBER( base_c2040_device::via_pa_r )
553536{
554537   /*
555538
r11380r11381
574557}
575558
576559
577WRITE8_MEMBER( c2040_device::via_pb_w )
560WRITE8_MEMBER( base_c2040_device::via_pb_w )
578561{
579562   /*
580563
r11380r11381
611594}
612595
613596
614READ_LINE_MEMBER( c2040_device::ready_r )
597READ_LINE_MEMBER( base_c2040_device::ready_r )
615598{
616599   return m_ready;
617600}
618601
619602
620READ_LINE_MEMBER( c2040_device::err_r )
603READ_LINE_MEMBER( base_c2040_device::err_r )
621604{
622605   return ERROR;
623606}
624607
625608
626WRITE_LINE_MEMBER( c2040_device::mode_sel_w )
609WRITE_LINE_MEMBER( base_c2040_device::mode_sel_w )
627610{
628611   // mode select
629612   m_mode = state;
r11380r11381
632615   m_via->write_cb1(ERROR);
633616}
634617
635WRITE_LINE_MEMBER( c2040_device::rw_sel_w )
618WRITE_LINE_MEMBER( base_c2040_device::rw_sel_w )
636619{
637620   // read/write select
638621   m_rw = state;
r11380r11381
644627
645628static const via6522_interface via_intf =
646629{
647   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, via_pa_r),
630   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, via_pa_r),
648631   DEVCB_NULL,
649   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, ready_r),
650   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, err_r),
632   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, ready_r),
633   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, err_r),
651634   DEVCB_NULL,
652635   DEVCB_NULL,
653636
654637   DEVCB_NULL,
655   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, via_pb_w),
638   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, via_pb_w),
656639   DEVCB_NULL,
657640   DEVCB_NULL,
658   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, mode_sel_w),
659   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, rw_sel_w),
641   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, mode_sel_w),
642   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, rw_sel_w),
660643
661644   DEVCB_NULL
662645};
r11380r11381
666649//  via6522_interface c8050_via_intf um3
667650//-------------------------------------------------
668651
669READ8_MEMBER( c2040_device::c8050_via_pb_r )
652READ8_MEMBER( base_c2040_device::c8050_via_pb_r )
670653{
671654   /*
672655
r11380r11381
692675}
693676
694677
695WRITE8_MEMBER( c2040_device::c8050_via_pb_w )
678WRITE8_MEMBER( base_c2040_device::c8050_via_pb_w )
696679{
697680   /*
698681
r11380r11381
731714
732715static const via6522_interface c8050_via_intf =
733716{
734   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, via_pa_r),
735   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, c8050_via_pb_r),
736   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, ready_r),
737   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, err_r),
717   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, via_pa_r),
718   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, c8050_via_pb_r),
719   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, ready_r),
720   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, err_r),
738721   DEVCB_NULL,
739722   DEVCB_NULL,
740723
741724   DEVCB_NULL,
742   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, c8050_via_pb_w),
725   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, c8050_via_pb_w),
743726   DEVCB_NULL,
744727   DEVCB_NULL,
745   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, mode_sel_w),
746   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, rw_sel_w),
728   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, mode_sel_w),
729   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, rw_sel_w),
747730
748731   DEVCB_NULL
749732};
r11380r11381
753736//  mos6530_interface miot_intf uk3
754737//-------------------------------------------------
755738
756READ8_MEMBER( c2040_device::pi_r )
739READ8_MEMBER( base_c2040_device::pi_r )
757740{
758741   /*
759742
r11380r11381
773756   return m_pi;
774757}
775758
776WRITE8_MEMBER( c2040_device::pi_w )
759WRITE8_MEMBER( base_c2040_device::pi_w )
777760{
778761   /*
779762
r11380r11381
793776   m_pi = data;
794777}
795778
796READ8_MEMBER( c2040_device::miot_pb_r )
779READ8_MEMBER( base_c2040_device::miot_pb_r )
797780{
798781   /*
799782
r11380r11381
821804   return data;
822805}
823806
824WRITE8_MEMBER( c2040_device::miot_pb_w )
807WRITE8_MEMBER( base_c2040_device::miot_pb_w )
825808{
826809   /*
827810
r11380r11381
860843
861844static MOS6530_INTERFACE( miot_intf )
862845{
863   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, pi_r),
864   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, pi_w),
865   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, miot_pb_r),
866   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, miot_pb_w)
846   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, pi_r),
847   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, pi_w),
848   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, miot_pb_r),
849   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, miot_pb_w)
867850};
868851
869852
r11380r11381
871854//  mos6530_interface c8050_miot_intf uk3
872855//-------------------------------------------------
873856
874READ8_MEMBER( c2040_device::c8050_miot_pb_r )
857READ8_MEMBER( base_c2040_device::c8050_miot_pb_r )
875858{
876859   /*
877860
r11380r11381
897880   data |= 0x10;
898881
899882   // single/dual sided
900   if (m_variant == c2040_device::TYPE_8050)
883   if (m_variant == base_c2040_device::TYPE_8050)
901884   {
902885      data |= 0x40;
903886   }
r11380r11381
905888   return data;
906889}
907890
908WRITE8_MEMBER( c2040_device::c8050_miot_pb_w )
891WRITE8_MEMBER( base_c2040_device::c8050_miot_pb_w )
909892{
910893   /*
911894
r11380r11381
923906    */
924907
925908   // drive select
926   if ((m_variant == c2040_device::TYPE_8050) ||
927      (m_variant == c2040_device::TYPE_8250))
909   if ((m_variant == base_c2040_device::TYPE_8050) ||
910      (m_variant == base_c2040_device::TYPE_8250))
928911   {
929912      m_drive = BIT(data, 0);
930913   }
r11380r11381
939922   }
940923
941924   // side select
942   if ((m_variant == c2040_device::TYPE_8250) ||
943      (m_variant == c2040_device::TYPE_SFD1001))
925   if ((m_variant == base_c2040_device::TYPE_8250) ||
926      (m_variant == base_c2040_device::TYPE_SFD1001))
944927   {
945928      m_side = !BIT(data, 4);
946929   }
r11380r11381
955938
956939static MOS6530_INTERFACE( c8050_miot_intf )
957940{
958   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, pi_r),
959   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, pi_w),
960   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, c8050_miot_pb_r),
961   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, c8050_miot_pb_w)
941   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, pi_r),
942   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, pi_w),
943   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, c8050_miot_pb_r),
944   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c2040_device, c8050_miot_pb_w)
962945};
963946
964947
r11380r11381
11891172//  machine configurations
11901173//-------------------------------------------------
11911174
1192machine_config_constructor c2040_device::device_mconfig_additions() const
1175machine_config_constructor base_c2040_device::device_mconfig_additions() const
11931176{
11941177   switch (m_variant)
11951178   {
r11380r11381
12221205//  update_ieee_signals -
12231206//-------------------------------------------------
12241207
1225inline void c2040_device::update_ieee_signals()
1208inline void base_c2040_device::update_ieee_signals()
12261209{
12271210   int atn = m_bus->atn_r();
12281211   int nrfd = !(!(!(atn & m_atna) & m_rfdo) | !(atn | m_atna));
r11380r11381
12371220//  update_gcr_data -
12381221//-------------------------------------------------
12391222
1240inline void c2040_device::update_gcr_data()
1223inline void base_c2040_device::update_gcr_data()
12411224{
12421225   if (m_rw)
12431226   {
r11380r11381
12921275//  update_ieee_signals -
12931276//-------------------------------------------------
12941277
1295inline void c2040_device::read_current_track(int unit)
1278inline void base_c2040_device::read_current_track(int unit)
12961279{
12971280   m_unit[unit].m_track_len = G64_BUFFER_SIZE;
12981281   m_unit[unit].m_buffer_pos = 0;
r11380r11381
13111294//  spindle_motor -
13121295//-------------------------------------------------
13131296
1314inline void c2040_device::spindle_motor(int unit, int mtr)
1297inline void base_c2040_device::spindle_motor(int unit, int mtr)
13151298{
13161299   if (m_unit[unit].m_mtr != mtr)
13171300   {
r11380r11381
13321315//  micropolis_step_motor -
13331316//-------------------------------------------------
13341317
1335inline void c2040_device::micropolis_step_motor(int unit, int stp)
1318inline void base_c2040_device::micropolis_step_motor(int unit, int stp)
13361319{
13371320   if (!m_unit[unit].m_mtr && (m_unit[unit].m_stp != stp))
13381321   {
r11380r11381
13641347//  mpi_step_motor -
13651348//-------------------------------------------------
13661349
1367inline void c2040_device::mpi_step_motor(int unit, int stp)
1350inline void base_c2040_device::mpi_step_motor(int unit, int stp)
13681351{
13691352   if (!m_unit[unit].m_mtr && (m_unit[unit].m_stp != stp))
13701353   {
r11380r11381
13961379//  initialize -
13971380//-------------------------------------------------
13981381
1399inline void c2040_device::initialize(int drives)
1382inline void base_c2040_device::initialize(int drives)
14001383{
14011384   // find GCR ROM
14021385   m_gcr = subregion("gcr")->base();
r11380r11381
14041387   // install image callbacks
14051388   m_unit[0].m_image = m_image0;
14061389
1407   floppy_install_unload_proc(m_image0, c2040_device::on_disk0_change);
1408   floppy_install_load_proc(m_image0, c2040_device::on_disk0_change);
1390   floppy_install_unload_proc(m_image0, base_c2040_device::on_disk0_change);
1391   floppy_install_load_proc(m_image0, base_c2040_device::on_disk0_change);
14091392
14101393   if (drives == 2)
14111394   {
14121395      m_unit[1].m_image = m_image1;
14131396
1414      floppy_install_unload_proc(m_image1, c2040_device::on_disk1_change);
1415      floppy_install_load_proc(m_image1, c2040_device::on_disk1_change);
1397      floppy_install_unload_proc(m_image1, base_c2040_device::on_disk1_change);
1398      floppy_install_load_proc(m_image1, base_c2040_device::on_disk1_change);
14161399   }
14171400
14181401   // register for state saving
r11380r11381
14541437//**************************************************************************
14551438
14561439//-------------------------------------------------
1457//  c2040_device - constructor
1440//  base_c2040_device - constructor
14581441//-------------------------------------------------
14591442
1460c2040_device::c2040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1461    : device_t(mconfig, C2040, "C2040", tag, owner, clock),
1443base_c2040_device::base_c2040_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant)
1444    : device_t(mconfig, type, name, tag, owner, clock),
14621445     device_ieee488_interface(mconfig, *this),
14631446     m_maincpu(*this, M6502_TAG),
14641447     m_fdccpu(*this, M6504_TAG),
r11380r11381
14791462     m_ready(0),
14801463     m_mode(0),
14811464     m_rw(0),
1482     m_miot_irq(CLEAR_LINE)   
1465     m_miot_irq(CLEAR_LINE),
1466     m_variant(variant)
14831467{
14841468   for (int i = 0; i < 2; i++)
14851469   {
r11380r11381
14931477
14941478
14951479//-------------------------------------------------
1480//  base_c2040_device - constructor
1481//-------------------------------------------------
1482
1483c2040_device::c2040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1484   : base_c2040_device(mconfig, C2040, "C2040", tag, owner, clock, TYPE_2040) { }
1485
1486
1487//-------------------------------------------------
1488//  c3040_device - constructor
1489//-------------------------------------------------
1490
1491c3040_device::c3040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1492   : base_c2040_device(mconfig, C3040, "C3040", tag, owner, clock, TYPE_3040) { }
1493
1494
1495//-------------------------------------------------
1496//  c4040_device - constructor
1497//-------------------------------------------------
1498
1499c4040_device::c4040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1500   : base_c2040_device(mconfig, C4040, "C4040", tag, owner, clock, TYPE_4040) { }
1501
1502
1503//-------------------------------------------------
1504//  c8050_device - constructor
1505//-------------------------------------------------
1506
1507c8050_device::c8050_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1508   : base_c2040_device(mconfig, C8050, "C8050", tag, owner, clock, TYPE_8050) { }
1509
1510
1511//-------------------------------------------------
1512//  c8250_device - constructor
1513//-------------------------------------------------
1514
1515c8250_device::c8250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1516   : base_c2040_device(mconfig, C8250, "C8250", tag, owner, clock, TYPE_8250) { }
1517
1518
1519//-------------------------------------------------
1520//  sfd1001_device - constructor
1521//-------------------------------------------------
1522
1523sfd1001_device::sfd1001_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1524   : base_c2040_device(mconfig, SFD1001, "SFD1001", tag, owner, clock, TYPE_SFD1001) { }
1525
1526
1527//-------------------------------------------------
14961528//  device_start - device-specific startup
14971529//-------------------------------------------------
14981530
1499void c2040_device::device_start()
1531void base_c2040_device::device_start()
15001532{
15011533   address_space *main = m_maincpu->memory().space(AS_PROGRAM);
15021534   address_space *fdc = m_fdccpu->memory().space(AS_PROGRAM);
r11380r11381
15121544      initialize(2);
15131545      break;
15141546
1515   case c2040_device::TYPE_8050:
1516   case c2040_device::TYPE_8250:
1547   case base_c2040_device::TYPE_8050:
1548   case base_c2040_device::TYPE_8250:
15171549      main->install_rom(0xc000, 0xffff, subregion(M6502_TAG)->base());
15181550      fdc->install_rom(0x1c00, 0x1fff, subregion(M6504_TAG)->base());
15191551
15201552      initialize(2);
15211553      break;
15221554
1523   case c2040_device::TYPE_SFD1001:
1555   case base_c2040_device::TYPE_SFD1001:
15241556      main->install_rom(0xc000, 0xffff, subregion(M6502_TAG)->base());
15251557      fdc->install_rom(0x1800, 0x1fff, subregion(M6504_TAG)->base());
15261558
r11380r11381
15341566//  device_reset - device-specific reset
15351567//-------------------------------------------------
15361568
1537void c2040_device::device_reset()
1569void base_c2040_device::device_reset()
15381570{
15391571   // toggle M6502 SO
15401572   m_fdccpu->set_input_line(M6502_SET_OVERFLOW, ASSERT_LINE);
r11380r11381
15491581//  device_timer - handler timer events
15501582//-------------------------------------------------
15511583
1552void c2040_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
1584void base_c2040_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
15531585{
15541586   int ready = 1;
15551587
r11380r11381
15971629      m_via->write_ca1(ready);
15981630      m_via->write_cb1(ERROR);
15991631
1600      if ((m_variant == c2040_device::TYPE_8050) ||
1601         (m_variant == c2040_device::TYPE_8250) ||
1602         (m_variant == c2040_device::TYPE_SFD1001))
1632      if ((m_variant == base_c2040_device::TYPE_8050) ||
1633         (m_variant == base_c2040_device::TYPE_8250) ||
1634         (m_variant == base_c2040_device::TYPE_SFD1001))
16031635      {
16041636         m_fdccpu->set_input_line(M6502_SET_OVERFLOW, ready ? CLEAR_LINE : ASSERT_LINE);
16051637      }
r11380r11381
16111643//  ieee488_atn -
16121644//-------------------------------------------------
16131645
1614void c2040_device::ieee488_atn(int state)
1646void base_c2040_device::ieee488_atn(int state)
16151647{
16161648   update_ieee_signals();
16171649
r11380r11381
16241656//  ieee488_ifc -
16251657//-------------------------------------------------
16261658
1627void c2040_device::ieee488_ifc(int state)
1659void base_c2040_device::ieee488_ifc(int state)
16281660{
16291661   if (!state)
16301662   {
r11380r11381
16371669//  on_disk0_change -
16381670//-------------------------------------------------
16391671
1640void c2040_device::on_disk0_change(device_image_interface &image)
1672void base_c2040_device::on_disk0_change(device_image_interface &image)
16411673{
1642    c2040_device *c2040 = static_cast<c2040_device *>(image.device().owner());
1674    base_c2040_device *c2040 = static_cast<base_c2040_device *>(image.device().owner());
16431675
16441676   c2040->read_current_track(0);
16451677}
r11380r11381
16491681//  on_disk_change -
16501682//-------------------------------------------------
16511683
1652void c2040_device::on_disk1_change(device_image_interface &image)
1684void base_c2040_device::on_disk1_change(device_image_interface &image)
16531685{
1654    c2040_device *c2040 = static_cast<c2040_device *>(image.device().owner());
1686    base_c2040_device *c2040 = static_cast<base_c2040_device *>(image.device().owner());
16551687
16561688   c2040->read_current_track(1);
16571689}
src/mess/machine/c2040.h
r11380r11381
4545
4646#define MCFG_C2040_ADD(_tag, _address) \
4747    MCFG_DEVICE_ADD(_tag, C2040, 0) \
48   c2040_device::static_set_config(*device, _address, c2040_device::TYPE_2040);
48   base_c2040_device::static_set_config(*device, _address);
4949
50
5051#define MCFG_C3040_ADD(_tag, _address) \
5152    MCFG_DEVICE_ADD(_tag, C3040, 0) \
52   c2040_device::static_set_config(*device, _address, c2040_device::TYPE_3040);
53   base_c2040_device::static_set_config(*device, _address);
5354
55
5456#define MCFG_C4040_ADD(_tag, _address) \
5557    MCFG_DEVICE_ADD(_tag, C4040, 0) \
56   c2040_device::static_set_config(*device, _address, c2040_device::TYPE_4040);
58   base_c2040_device::static_set_config(*device, _address);
5759
60
5861#define MCFG_C8050_ADD(_tag, _address) \
5962    MCFG_DEVICE_ADD(_tag, C8050, 0) \
60   c2040_device::static_set_config(*device, _address, c2040_device::TYPE_8050);
63   base_c2040_device::static_set_config(*device, _address);
6164
65
6266#define MCFG_C8250_ADD(_tag, _address) \
6367    MCFG_DEVICE_ADD(_tag, C8250, 0) \
64   c2040_device::static_set_config(*device, _address, c2040_device::TYPE_8250);
68   base_c2040_device::static_set_config(*device, _address);
6569
70
6671#define MCFG_SFD1001_ADD(_tag, _address) \
6772    MCFG_DEVICE_ADD(_tag, SFD1001, 0) \
68   c2040_device::static_set_config(*device, _address, c2040_device::TYPE_SFD1001);
73   base_c2040_device::static_set_config(*device, _address);
6974
7075
7176
r11380r11381
7378//  TYPE DEFINITIONS
7479//**************************************************************************
7580
76// ======================> c2040_device
81// ======================> base_c2040_device
7782
78class c2040_device :  public device_t,
79                 public device_ieee488_interface
83class base_c2040_device :  public device_t,
84                     public device_ieee488_interface
8085{
8186public:
82    // construction/destruction
83    c2040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
87   enum
88   {
89      TYPE_2040,
90      TYPE_3040,
91      TYPE_4040,
92      TYPE_8050,
93      TYPE_8250,
94      TYPE_SFD1001
95   };
8496
97   // construction/destruction
98    base_c2040_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant);
99
85100   // not really public
86101   static void on_disk0_change(device_image_interface &image);
87102   static void on_disk1_change(device_image_interface &image);
r11380r11381
106121   DECLARE_WRITE8_MEMBER( c8050_via_pb_w );
107122   DECLARE_READ8_MEMBER( c8050_miot_pb_r );
108123   DECLARE_WRITE8_MEMBER( c8050_miot_pb_w );
109   enum
110   {
111      TYPE_2040 = 0,
112      TYPE_3040,
113      TYPE_4040,
114      TYPE_8050,
115      TYPE_8250,
116      TYPE_SFD1001,
117   };
118124
119125   // inline configuration helpers
120   static void static_set_config(device_t &device, int address, int variant);
126   static void static_set_config(device_t &device, int address);
121127
122128   // optional information overrides
123129   virtual const rom_entry *device_rom_region() const;
r11380r11381
171177   int m_side;                     // selected side
172178
173179   // IEEE-488 bus
180   int m_address;                  // bus address
174181   int m_rfdo;                     // not ready for data output
175182   int m_daco;                     // not data accepted output
176183   int m_atna;                     // attention acknowledge
r11380r11381
193200   // timers
194201   emu_timer *m_bit_timer;
195202
196      int m_address;
197203   int m_variant;
198204};
199205
200206
207// ======================> c2040_device
208
209class c2040_device :  public base_c2040_device
210{
211public:
212    // construction/destruction
213    c2040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
214};
215
216
201217// ======================> c3040_device
202218
203class c3040_device :  public c2040_device
219class c3040_device :  public base_c2040_device
204220{
205221public:
206222    // construction/destruction
r11380r11381
210226
211227// ======================> c4040_device
212228
213class c4040_device :  public c2040_device
229class c4040_device :  public base_c2040_device
214230{
215231public:
216232    // construction/destruction
r11380r11381
220236
221237// ======================> c8050_device
222238
223class c8050_device :  public c2040_device
239class c8050_device :  public base_c2040_device
224240{
225241public:
226242   // construction/destruction
r11380r11381
230246
231247// ======================> c8250_device
232248
233class c8250_device :  public c8050_device
249class c8250_device :  public base_c2040_device
234250{
235251public:
236252    // construction/destruction
r11380r11381
240256
241257// ======================> sfd1001_device
242258
243class sfd1001_device :  public c8050_device
259class sfd1001_device :  public base_c2040_device
244260{
245261public:
246262    // construction/destruction
src/mess/machine/c8280.c
r11380r11381
4444//  static_set_config - configuration helper
4545//-------------------------------------------------
4646
47void c8280_device::static_set_config(device_t &device, int address, int variant)
47void c8280_device::static_set_config(device_t &device, int address)
4848{
4949   c8280_device &c8280 = downcast<c8280_device &>(device);
5050
src/mess/machine/c8280.h
r11380r11381
5454    c8280_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
5555   
5656   // inline configuration helpers
57   static void static_set_config(device_t &device, int address, int variant);
57   static void static_set_config(device_t &device, int address);
5858
5959   // optional information overrides
6060   virtual const rom_entry *device_rom_region() const;
src/mess/machine/c9060.c
r11380r11381
2929//**************************************************************************
3030
3131const device_type C9060 = &device_creator<c9060_device>;
32const device_type C9090 = &device_creator<c9060_device>;
32const device_type C9090 = &device_creator<c9090_device>;
3333
34
3435//-------------------------------------------------
3536//  device_config_complete - perform any
3637//  operations now that the configuration is
3738//  complete
3839//-------------------------------------------------
3940
40void c9060_device::device_config_complete()
41void base_c9060_device::device_config_complete()
4142{
4243   m_shortname = "c9060";
4344}
r11380r11381
4748//  static_set_config - configuration helper
4849//-------------------------------------------------
4950
50void c9060_device::static_set_config(device_t &device, int address, int variant)
51void base_c9060_device::static_set_config(device_t &device, int address)
5152{
52   c9060_device &c9060 = downcast<c9060_device &>(device);
53   base_c9060_device &c9060 = downcast<base_c9060_device &>(device);
5354
5455   assert((address > 7) && (address < 12));
5556
56   c9060.m_variant = variant;
5757   c9060.m_address = address - 8;
5858}
5959
r11380r11381
8080//  rom_region - device-specific ROM region
8181//-------------------------------------------------
8282
83const rom_entry *c9060_device::device_rom_region() const
83const rom_entry *base_c9060_device::device_rom_region() const
8484{
8585   return ROM_NAME( c9060 );
8686}
r11380r11381
9090//  ADDRESS_MAP( c9060_main_mem )
9191//-------------------------------------------------
9292
93static ADDRESS_MAP_START( c9060_main_mem, AS_PROGRAM, 8, c9060_device )
93static ADDRESS_MAP_START( c9060_main_mem, AS_PROGRAM, 8, base_c9060_device )
9494   AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0100) AM_RAM // 6532 #1
9595   AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0100) AM_RAM // 6532 #2
9696   AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE_LEGACY(M6532_0_TAG, riot6532_r, riot6532_w)
r11380r11381
107107//  ADDRESS_MAP( c9060_hdc_mem )
108108//-------------------------------------------------
109109
110static ADDRESS_MAP_START( c9060_hdc_mem, AS_PROGRAM, 8, c9060_device )
110static ADDRESS_MAP_START( c9060_hdc_mem, AS_PROGRAM, 8, base_c9060_device )
111111   ADDRESS_MAP_GLOBAL_MASK(0x1fff)
112112   AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530
113113   AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6522_TAG, via6522_device, read, write)
r11380r11381
123123//  riot6532_interface riot0_intf
124124//-------------------------------------------------
125125
126READ8_MEMBER( c9060_device::dio_r )
126READ8_MEMBER( base_c9060_device::dio_r )
127127{
128128   /*
129129
r11380r11381
144144}
145145
146146
147WRITE8_MEMBER( c9060_device::dio_w )
147WRITE8_MEMBER( base_c9060_device::dio_w )
148148{
149149   /*
150150
r11380r11381
167167
168168static const riot6532_interface riot0_intf =
169169{
170   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, dio_r),
170   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c9060_device, dio_r),
171171   DEVCB_NULL,
172172   DEVCB_NULL,
173   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, dio_w),
173   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c9060_device, dio_w),
174174   DEVCB_NULL
175175};
176176
r11380r11381
179179//  riot6532_interface riot1_intf
180180//-------------------------------------------------
181181
182READ8_MEMBER( c9060_device::riot1_pa_r )
182READ8_MEMBER( base_c9060_device::riot1_pa_r )
183183{
184184   /*
185185
r11380r11381
211211}
212212
213213
214WRITE8_MEMBER( c9060_device::riot1_pa_w )
214WRITE8_MEMBER( base_c9060_device::riot1_pa_w )
215215{
216216   /*
217217
r11380r11381
247247}
248248
249249
250READ8_MEMBER( c9060_device::riot1_pb_r )
250READ8_MEMBER( base_c9060_device::riot1_pb_r )
251251{
252252   /*
253253
r11380r11381
276276}
277277
278278
279WRITE8_MEMBER( c9060_device::riot1_pb_w )
279WRITE8_MEMBER( base_c9060_device::riot1_pb_w )
280280{
281281   /*
282282
r11380r11381
297297
298298static const riot6532_interface riot1_intf =
299299{
300   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, riot1_pa_r),
301   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, riot1_pb_r),
302   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, riot1_pa_w),
303   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, riot1_pb_w),
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),
304304   DEVCB_CPU_INPUT_LINE(M6502_TAG, INPUT_LINE_IRQ0)
305305};
306306
r11380r11381
309309//  via6522_interface via_intf
310310//-------------------------------------------------
311311
312READ8_MEMBER( c9060_device::via_pa_r )
312READ8_MEMBER( base_c9060_device::via_pa_r )
313313{
314314   /*
315315
r11380r11381
329329   return 0;
330330}
331331
332WRITE8_MEMBER( c9060_device::via_pa_w )
332WRITE8_MEMBER( base_c9060_device::via_pa_w )
333333{
334334   /*
335335
r11380r11381
347347    */
348348}
349349
350READ8_MEMBER( c9060_device::via_pb_r )
350READ8_MEMBER( base_c9060_device::via_pb_r )
351351{
352352   /*
353353
r11380r11381
367367   return 0;
368368}
369369
370WRITE8_MEMBER( c9060_device::via_pb_w )
370WRITE8_MEMBER( base_c9060_device::via_pb_w )
371371{
372372   /*
373373
r11380r11381
387387
388388static const via6522_interface via_intf =
389389{
390   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, via_pa_r),
391   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, via_pb_r),
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),
392392   DEVCB_NULL, // ACK
393393   DEVCB_NULL,
394394   DEVCB_NULL, // MSG
395395   DEVCB_NULL, // ?
396396
397   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, via_pa_w),
398   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, via_pb_w),
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),
399399   DEVCB_NULL,
400400   DEVCB_NULL,
401401   DEVCB_NULL,
r11380r11381
442442//  machine configurations
443443//-------------------------------------------------
444444
445machine_config_constructor c9060_device::device_mconfig_additions() const
445machine_config_constructor base_c9060_device::device_mconfig_additions() const
446446{
447447   switch (m_variant)
448448   {
r11380r11381
465465//  update_ieee_signals -
466466//-------------------------------------------------
467467
468inline void c9060_device::update_ieee_signals()
468inline void base_c9060_device::update_ieee_signals()
469469{
470470   int atn = m_bus->atn_r();
471471   int nrfd = !(!(!(atn & m_atna) & m_rfdo) | !(atn | m_atna));
r11380r11381
482482//**************************************************************************
483483
484484//-------------------------------------------------
485//  c9060_device - constructor
485//  base_c9060_device - constructor
486486//-------------------------------------------------
487487
488c9060_device::c9060_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
489    : device_t(mconfig, C9060, "C9060", tag, owner, clock),
488base_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),
490490     device_ieee488_interface(mconfig, *this),
491491     m_maincpu(*this, M6502_TAG),
492492     m_hdccpu(*this, M6504_TAG),
493493     m_riot0(*this, M6532_0_TAG),
494494     m_riot1(*this, M6532_1_TAG),
495495     m_via(*this, M6522_TAG),
496     m_bus(*this->owner(), IEEE488_TAG)
496     m_bus(*this->owner(), IEEE488_TAG),
497     m_variant(variant)
497498{
498499}
499500
500501
501502//-------------------------------------------------
503//  c9060_device - constructor
504//-------------------------------------------------
505
506c9060_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
514c9090_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//-------------------------------------------------
502519//  device_start - device-specific startup
503520//-------------------------------------------------
504521
505void c9060_device::device_start()
522void base_c9060_device::device_start()
506523{
507524   address_space *main = m_maincpu->memory().space(AS_PROGRAM);
508525   address_space *hdc = m_hdccpu->memory().space(AS_PROGRAM);
r11380r11381
521538//  device_reset - device-specific reset
522539//-------------------------------------------------
523540
524void c9060_device::device_reset()
541void base_c9060_device::device_reset()
525542{
526543   m_maincpu->set_input_line(M6502_SET_OVERFLOW, ASSERT_LINE);
527544   m_maincpu->set_input_line(M6502_SET_OVERFLOW, CLEAR_LINE);
r11380r11381
532549//  device_timer - handler timer events
533550//-------------------------------------------------
534551
535void c9060_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
552void base_c9060_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
536553{
537554}
538555
r11380r11381
541558//  m_bus->atn -
542559//-------------------------------------------------
543560
544void c9060_device::ieee488_atn(int state)
561void base_c9060_device::ieee488_atn(int state)
545562{
546563   update_ieee_signals();
547564
r11380r11381
554571//  m_bus->ifc -
555572//-------------------------------------------------
556573
557void c9060_device::ieee488_ifc(int state)
574void base_c9060_device::ieee488_ifc(int state)
558575{
559576   if (!state)
560577   {
src/mess/machine/c9060.h
r11380r11381
3838
3939#define MCFG_C9060_ADD(_tag, _address) \
4040    MCFG_DEVICE_ADD(_tag, C9060, 0) \
41   c9060_device::static_set_config(*device, _address, TYPE_9060);
41   base_c9060_device::static_set_config(*device, _address);
4242
4343
4444#define MCFG_C9090_ADD(_tag, _address) \
4545    MCFG_DEVICE_ADD(_tag, C9090, 0) \
46   c9060_device::static_set_config(*device, _address, TYPE_9090);
46   base_c9060_device::static_set_config(*device, _address);
4747
4848
4949
r11380r11381
5252//**************************************************************************
5353
5454
55// ======================> c9060_device
55// ======================> base_c9060_device
5656
57class c9060_device :  public device_t,
57class base_c9060_device :  public device_t,
5858                 public device_ieee488_interface
5959{
6060
6161public:
62    // construction/destruction
63    c9060_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
62   enum
63   {
64      TYPE_9060,
65      TYPE_9090
66   };
6467
68   // construction/destruction
69    base_c9060_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant);
70
6571   // inline configuration helpers
66   static void static_set_config(device_t &device, int address, int variant);
72   static void static_set_config(device_t &device, int address);
6773
6874   // optional information overrides
6975   virtual const rom_entry *device_rom_region() const;
r11380r11381
8086   DECLARE_READ8_MEMBER( via_pb_r );
8187   DECLARE_WRITE8_MEMBER( via_pa_w );
8288   DECLARE_WRITE8_MEMBER( via_pb_w );
83   enum
84   {
85      TYPE_9060 = 0,
86      TYPE_9090
87   };
8889
8990protected:
9091    // device-level overrides
r11380r11381
108109   required_device<ieee488_device> m_bus;
109110
110111   // IEEE-488 bus
112   int m_address;                  // bus address
111113   int m_rfdo;                     // not ready for data output
112114   int m_daco;                     // not data accepted output
113115   int m_atna;                     // attention acknowledge
114116
115   int m_address;
116117   int m_variant;
117118};
118119
119120
121// ======================> c9060_device
122
123class c9060_device :  public base_c9060_device
124{
125public:
126    // construction/destruction
127    c9060_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
128};
129
130
131// ======================> c9090_device
132
133class c9090_device :  public base_c9060_device
134{
135public:
136    // construction/destruction
137    c9090_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
138};
139
140
120141// device type definition
121142extern const device_type C9060;
122143extern const device_type C9090;
src/mess/machine/c1571.c
r11380r11381
4949const device_type C1571 = &device_creator<c1571_device>;
5050const device_type C1571CR = &device_creator<c1571cr_device>;
5151
52c1570_device::c1570_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
53   :c1571_device(mconfig, tag, owner, clock) { }
54
55c1571cr_device::c1571cr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
56   :c1571_device(mconfig, tag, owner, clock) { }
5752   
5853//-------------------------------------------------
5954//  device_config_complete - perform any
r11380r11381
6156//  complete
6257//-------------------------------------------------
6358
64void c1571_device::device_config_complete()
59void base_c1571_device::device_config_complete()
6560{
6661   switch (m_variant)
6762   {
r11380r11381
8580//  static_set_config - configuration helper
8681//-------------------------------------------------
8782
88void c1571_device::static_set_config(device_t &device, int address, int variant)
83void base_c1571_device::static_set_config(device_t &device, int address)
8984{
90   c1571_device &c1571 = downcast<c1571_device &>(device);
85   base_c1571_device &c1571 = downcast<base_c1571_device &>(device);
9186
9287   assert((address > 7) && (address < 12));
9388
9489   c1571.m_address = address - 8;
95   c1571.m_variant = variant;
9690}
9791
9892
r11380r11381
133127//  rom_region - device-specific ROM region
134128//-------------------------------------------------
135129
136const rom_entry *c1571_device::device_rom_region() const
130const rom_entry *base_c1571_device::device_rom_region() const
137131{
138132   switch (m_variant)
139133   {
r11380r11381
154148//  ADDRESS_MAP( c1571_mem )
155149//-------------------------------------------------
156150
157static ADDRESS_MAP_START( c1571_mem, AS_PROGRAM, 8, c1571_device )
151static ADDRESS_MAP_START( c1571_mem, AS_PROGRAM, 8, base_c1571_device )
158152   AM_RANGE(0x0000, 0x07ff) AM_RAM
159153   AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x03f0) AM_DEVREADWRITE(M6522_0_TAG, via6522_device, read, write)
160154   AM_RANGE(0x1c00, 0x1c0f) AM_MIRROR(0x03f0) AM_DEVREADWRITE(M6522_1_TAG, via6522_device, read, write)
r11380r11381
168162//  via6522_interface via0_intf
169163//-------------------------------------------------
170164
171WRITE_LINE_MEMBER( c1571_device::via0_irq_w )
165WRITE_LINE_MEMBER( base_c1571_device::via0_irq_w )
172166{
173167   m_via0_irq = state;
174168
r11380r11381
176170}
177171
178172
179READ8_MEMBER( c1571_device::via0_pa_r )
173READ8_MEMBER( base_c1571_device::via0_pa_r )
180174{
181175   /*
182176
r11380r11381
205199}
206200
207201
208WRITE8_MEMBER( c1571_device::via0_pa_w )
202WRITE8_MEMBER( base_c1571_device::via0_pa_w )
209203{
210204   /*
211205
r11380r11381
263257}
264258
265259
266READ8_MEMBER( c1571_device::via0_pb_r )
260READ8_MEMBER( base_c1571_device::via0_pb_r )
267261{
268262   /*
269263
r11380r11381
298292}
299293
300294
301WRITE8_MEMBER( c1571_device::via0_pb_w )
295WRITE8_MEMBER( base_c1571_device::via0_pb_w )
302296{
303297   /*
304298
r11380r11381
326320}
327321
328322
329READ_LINE_MEMBER( c1571_device::atn_in_r )
323READ_LINE_MEMBER( base_c1571_device::atn_in_r )
330324{
331325   return !m_bus->atn_r();
332326}
333327
334328
335READ_LINE_MEMBER( c1571_device::wprt_r )
329READ_LINE_MEMBER( base_c1571_device::wprt_r )
336330{
337331   return !floppy_wpt_r(m_image);
338332}
r11380r11381
340334
341335static const via6522_interface via0_intf =
342336{
343   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via0_pa_r),
344   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via0_pb_r),
345   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, atn_in_r),
337   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via0_pa_r),
338   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via0_pb_r),
339   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, atn_in_r),
346340   DEVCB_NULL,
347   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, wprt_r),
341   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, wprt_r),
348342   DEVCB_NULL,
349343
350   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via0_pa_w),
351   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via0_pb_w),
344   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via0_pa_w),
345   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via0_pb_w),
352346   DEVCB_NULL,
353347   DEVCB_NULL,
354348   DEVCB_NULL,
355349   DEVCB_NULL,
356350
357   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via0_irq_w)
351   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via0_irq_w)
358352};
359353
360354
r11380r11381
362356//  via6522_interface via1_intf
363357//-------------------------------------------------
364358
365WRITE_LINE_MEMBER( c1571_device::via1_irq_w )
359WRITE_LINE_MEMBER( base_c1571_device::via1_irq_w )
366360{
367361   m_via1_irq = state;
368362
r11380r11381
370364}
371365
372366
373READ8_MEMBER( c1571_device::via1_pb_r )
367READ8_MEMBER( base_c1571_device::via1_pb_r )
374368{
375369   /*
376370
r11380r11381
398392   return data;
399393}
400394
401WRITE8_MEMBER( c1571_device::via1_pb_w )
395WRITE8_MEMBER( base_c1571_device::via1_pb_w )
402396{
403397   /*
404398
r11380r11381
432426static const via6522_interface via1_intf =
433427{
434428   DEVCB_DEVICE_MEMBER(C64H156_TAG, c64h156_device, yb_r),
435   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via1_pb_r),
429   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via1_pb_r),
436430   DEVCB_DEVICE_LINE_MEMBER(C64H156_TAG, c64h156_device, byte_r),
437431   DEVCB_NULL,
438432   DEVCB_NULL,
439433   DEVCB_NULL,
440434
441435   DEVCB_DEVICE_MEMBER(C64H156_TAG, c64h156_device, yb_w),
442   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via1_pb_w),
436   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via1_pb_w),
443437   DEVCB_NULL,
444438   DEVCB_NULL,
445439   DEVCB_DEVICE_LINE_MEMBER(C64H156_TAG, c64h156_device, soe_w),
446440   DEVCB_DEVICE_LINE_MEMBER(C64H156_TAG, c64h156_device, oe_w),
447441
448   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via1_irq_w)
442   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via1_irq_w)
449443};
450444
451445
r11380r11381
453447//  mos6526_interface cia_intf
454448//-------------------------------------------------
455449
456WRITE_LINE_MEMBER( c1571_device::cia_irq_w )
450WRITE_LINE_MEMBER( base_c1571_device::cia_irq_w )
457451{
458452   m_cia_irq = state;
459453
r11380r11381
461455}
462456
463457
464WRITE_LINE_MEMBER( c1571_device::cia_cnt_w )
458WRITE_LINE_MEMBER( base_c1571_device::cia_cnt_w )
465459{
466460   // fast serial clock out
467461   m_cnt_out = state;
r11380r11381
469463}
470464
471465
472WRITE_LINE_MEMBER( c1571_device::cia_sp_w )
466WRITE_LINE_MEMBER( base_c1571_device::cia_sp_w )
473467{
474468   // fast serial data out
475469   m_sp_out = state;
r11380r11381
480474static MOS6526_INTERFACE( cia_intf )
481475{
482476   0,
483   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, cia_irq_w),
477   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, cia_irq_w),
484478   DEVCB_NULL,
485   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, cia_cnt_w),
486   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, cia_sp_w),
479   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, cia_cnt_w),
480   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, cia_sp_w),
487481   DEVCB_NULL,
488482   DEVCB_NULL,
489483   DEVCB_NULL,
r11380r11381
495489//  C64H156_INTERFACE( ga_intf )
496490//-------------------------------------------------
497491
498WRITE_LINE_MEMBER( c1571_device::atn_w )
492WRITE_LINE_MEMBER( base_c1571_device::atn_w )
499493{
500494   set_iec_data();
501495}
502496
503497
504WRITE_LINE_MEMBER( c1571_device::byte_w )
498WRITE_LINE_MEMBER( base_c1571_device::byte_w )
505499{
506500   m_maincpu->set_input_line(M6502_SET_OVERFLOW, state);
507501   m_via1->write_ca1(state);
r11380r11381
510504
511505static C64H156_INTERFACE( ga_intf )
512506{
513   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, atn_w),
507   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, atn_w),
514508   DEVCB_NULL,
515   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, byte_w)
509   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, byte_w)
516510};
517511
518512
r11380r11381
544538//  floppy_config c1571_floppy_config
545539//-------------------------------------------------
546540
547WRITE_LINE_MEMBER( c1571_device::wpt_w )
541WRITE_LINE_MEMBER( base_c1571_device::wpt_w )
548542{
549543   m_via0->write_ca2(!state);
550544}
r11380r11381
555549   DEVCB_NULL,
556550   DEVCB_NULL,
557551   DEVCB_NULL,
558   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, wpt_w),
552   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, wpt_w),
559553   DEVCB_NULL,
560554   FLOPPY_STANDARD_5_25_DSDD,
561555   FLOPPY_OPTIONS_NAME(c1571),
r11380r11381
582576   DEVCB_NULL,
583577   DEVCB_NULL,
584578   DEVCB_NULL,
585   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, wpt_w),
579   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, wpt_w),
586580   DEVCB_NULL,
587581   FLOPPY_STANDARD_5_25_SSDD,
588582   FLOPPY_OPTIONS_NAME(c1570),
r11380r11381
631625//  machine configurations
632626//-------------------------------------------------
633627
634machine_config_constructor c1571_device::device_mconfig_additions() const
628machine_config_constructor base_c1571_device::device_mconfig_additions() const
635629{
636630   switch (m_variant)
637631   {
r11380r11381
650644//**************************************************************************
651645
652646//-------------------------------------------------
653//  c1571_device - constructor
647//  base_c1571_device - constructor
654648//-------------------------------------------------
655649
656inline void c1571_device::set_iec_data()
650inline void base_c1571_device::set_iec_data()
657651{
658652   int data = !m_data_out & !m_ga->atn_r();
659653
r11380r11381
665659
666660
667661//-------------------------------------------------
668//  c1571_device - constructor
662//  base_c1571_device - constructor
669663//-------------------------------------------------
670664
671inline void c1571_device::set_iec_srq()
665inline void base_c1571_device::set_iec_srq()
672666{
673667   int srq = 1;
674668
r11380r11381
685679//**************************************************************************
686680
687681//-------------------------------------------------
688//  c1571_device - constructor
682//  base_c1571_device - constructor
689683//-------------------------------------------------
690684
691c1571_device::c1571_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
692    : device_t(mconfig, C1571, "C1571", tag, owner, clock),
685base_c1571_device::base_c1571_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant)
686    : device_t(mconfig, type, name, tag, owner, clock),
693687     device_cbm_iec_interface(mconfig, *this),
694688     m_maincpu(*this, M6502_TAG),
695689     m_via0(*this, M6522_0_TAG),
r11380r11381
706700     m_cnt_out(1),
707701     m_via0_irq(0),
708702     m_via1_irq(0),
709     m_cia_irq(0)
703     m_cia_irq(0),
704     m_variant(variant)
710705{
711706}
712707
713708
714709//-------------------------------------------------
710//  c1570_device - constructor
711//-------------------------------------------------
712
713c1570_device::c1570_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
714   : base_c1571_device(mconfig, C1570, "C1570", tag, owner, clock, TYPE_1570) { }
715
716
717//-------------------------------------------------
718//  c1571_device - constructor
719//-------------------------------------------------
720
721c1571_device::c1571_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
722   : base_c1571_device(mconfig, C1571, "C1571", tag, owner, clock, TYPE_1571) { }
723
724
725//-------------------------------------------------
726//  c1571cr_device - constructor
727//-------------------------------------------------
728
729c1571cr_device::c1571cr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
730   : base_c1571_device(mconfig, C1571CR, "C1571CR", tag, owner, clock, TYPE_1571CR) { }
731
732
733//-------------------------------------------------
715734//  device_start - device-specific startup
716735//-------------------------------------------------
717736
718void c1571_device::device_start()
737void base_c1571_device::device_start()
719738{
720739   // map ROM
721740   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
722741   program->install_rom(0x8000, 0xffff, subregion(M6502_TAG)->base());
723742
724743   // install image callbacks
725   floppy_install_unload_proc(m_image, c1571_device::on_disk_change);
726   floppy_install_load_proc(m_image, c1571_device::on_disk_change);
744   floppy_install_unload_proc(m_image, base_c1571_device::on_disk_change);
745   floppy_install_load_proc(m_image, base_c1571_device::on_disk_change);
727746
728747   // register for state saving
729748   save_item(NAME(m_1_2mhz));
r11380r11381
741760//  device_reset - device-specific reset
742761//-------------------------------------------------
743762
744void c1571_device::device_reset()
763void base_c1571_device::device_reset()
745764{
746765   m_sp_out = 1;
747766   set_iec_data();
r11380r11381
755774//  cbm_iec_srq -
756775//-------------------------------------------------
757776
758void c1571_device::cbm_iec_srq(int state)
777void base_c1571_device::cbm_iec_srq(int state)
759778{
760779   if (!m_ser_dir)
761780   {
r11380r11381
768787//  cbm_iec_atn -
769788//-------------------------------------------------
770789
771void c1571_device::cbm_iec_atn(int state)
790void base_c1571_device::cbm_iec_atn(int state)
772791{
773792   m_via0->write_ca1(!state);
774793   m_ga->atni_w(!state);
r11380r11381
781800//  cbm_iec_data -
782801//-------------------------------------------------
783802
784void c1571_device::cbm_iec_data(int state)
803void base_c1571_device::cbm_iec_data(int state)
785804{
786805   if (!m_ser_dir)
787806   {
r11380r11381
794813//  cbm_iec_reset -
795814//-------------------------------------------------
796815
797void c1571_device::cbm_iec_reset(int state)
816void base_c1571_device::cbm_iec_reset(int state)
798817{
799818   if (!state)
800819   {
r11380r11381
807826//  on_disk_change -
808827//-------------------------------------------------
809828
810void c1571_device::on_disk_change(device_image_interface &image)
829void base_c1571_device::on_disk_change(device_image_interface &image)
811830{
812    c1571_device *c1571 = static_cast<c1571_device *>(image.device().owner());
831    base_c1571_device *c1571 = static_cast<base_c1571_device *>(image.device().owner());
813832
814833   c1571->m_ga->on_disk_changed();
815834}
src/mess/machine/c1571.h
r11380r11381
4141
4242#define MCFG_C1570_ADD(_tag, _address) \
4343    MCFG_DEVICE_ADD(_tag, C1570, 0) \
44   c1571_device::static_set_config(*device, _address, c1571_device::TYPE_1570);
44   base_c1571_device::static_set_config(*device, _address);
4545
46
4647#define MCFG_C1571_ADD(_tag, _address) \
4748    MCFG_DEVICE_ADD(_tag, C1571, 0) \
48   c1571_device::static_set_config(*device, _address, c1571_device::TYPE_1571);
49   base_c1571_device::static_set_config(*device, _address);
4950
51
5052#define MCFG_C1571CR_ADD(_tag, _address) \
5153    MCFG_DEVICE_ADD(_tag, C1571CR, 0) \
52   c1571_device::static_set_config(*device, _address, c1571_device::TYPE_1571CR);
54   base_c1571_device::static_set_config(*device, _address);
5355
5456
5557
r11380r11381
5961
6062// ======================> c1571_device
6163
62class c1571_device :  public device_t,
63                 public device_cbm_iec_interface
64class base_c1571_device :  public device_t,
65                     public device_cbm_iec_interface
6466{
6567public:
66
67    // construction/destruction
68    c1571_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
69
7068   enum
7169   {
72      TYPE_1570 = 0,
70      TYPE_1570,
7371      TYPE_1571,
7472      TYPE_1571CR
7573   };
7674
75    // construction/destruction
76    base_c1571_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant);
77
7778   // inline configuration helpers
78   static void static_set_config(device_t &device, int address, int variant);
79   static void static_set_config(device_t &device, int address);
7980
8081   // optional information overrides
8182   virtual const rom_entry *device_rom_region() const;
r11380r11381
113114   void cbm_iec_data(int state);
114115   void cbm_iec_reset(int state);
115116
116private:
117117   inline void set_iec_data();
118118   inline void set_iec_srq();
119119
r11380r11381
130130   int m_1_2mhz;                     // clock speed
131131
132132   // IEC bus
133    int m_address;                     // serial address
133134   int m_data_out;                     // serial data out
134135   int m_ser_dir;                     // fast serial direction
135136   int m_sp_out;                     // fast serial data out
r11380r11381
140141   int m_via1_irq;                     // VIA #1 interrupt request
141142   int m_cia_irq;                     // CIA interrupt request
142143
143    int m_address;
144144   int m_variant;
145145};
146146
147147
148148// ======================> c1570_device
149149
150class c1570_device :  public c1571_device
150class c1570_device :  public base_c1571_device
151151{
152152public:
153153    // construction/destruction
r11380r11381
155155};
156156
157157
158// ======================> c1571_device
159
160class c1571_device :  public base_c1571_device
161{
162public:
163    // construction/destruction
164    c1571_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
165};
166
167
158168// ======================> c1571cr_device
159169
160class c1571cr_device :  public c1571_device
170class c1571cr_device :  public base_c1571_device
161171{
162172public:
163173    // construction/destruction

Previous 15994 Revisions Next


© 1998-2018 The MESS Team