Previous 199869 Revisions Next

r24559 Monday 29th July, 2013 at 21:10:15 UTC by Curt Coder
(MESS) Cleanup. (nw)
[src/mess/machine]c1541.c c1541.h c1571.c c1571.h c1581.c c1581.h cbmiec.c cbmiec.h

trunk/src/mess/machine/c1541.c
r24558r24559
155155#define CENTRONICS_TAG  "centronics"
156156
157157
158enum
159{
160   LED_POWER = 0,
161   LED_ACT
162};
163158
164
165
166159//**************************************************************************
167160//  DEVICE DEFINITIONS
168161//**************************************************************************
r24558r24559
178171const device_type C1541_PROFESSIONAL_DOS_V1 = &device_creator<c1541_professional_dos_v1_device>;
179172const device_type C1541_PROLOGIC_DOS_CLASSIC = &device_creator<c1541_prologic_dos_classic_device>;
180173
174
181175//-------------------------------------------------
182176//  ROM( c1540 )
183177//-------------------------------------------------
r24558r24559
190184
191185
192186//-------------------------------------------------
187//  rom_region - device-specific ROM region
188//-------------------------------------------------
189
190const rom_entry *c1540_device::device_rom_region() const
191{
192   return ROM_NAME( c1540 );
193}
194
195
196//-------------------------------------------------
193197//  ROM( c1541 )
194198//-------------------------------------------------
195199
r24558r24559
224228
225229
226230//-------------------------------------------------
231//  rom_region - device-specific ROM region
232//-------------------------------------------------
233
234const rom_entry *c1541_device::device_rom_region() const
235{
236   return ROM_NAME( c1541 );
237}
238
239
240//-------------------------------------------------
227241//  ROM( c1541c )
228242//-------------------------------------------------
229243
r24558r24559
238252
239253
240254//-------------------------------------------------
255//  rom_region - device-specific ROM region
256//-------------------------------------------------
257
258const rom_entry *c1541c_device::device_rom_region() const
259{
260   return ROM_NAME( c1541c );
261}
262
263
264//-------------------------------------------------
241265//  ROM( c1541ii )
242266//-------------------------------------------------
243267
r24558r24559
254278
255279
256280//-------------------------------------------------
281//  rom_region - device-specific ROM region
282//-------------------------------------------------
283
284const rom_entry *c1541ii_device::device_rom_region() const
285{
286   return ROM_NAME( c1541ii );
287}
288
289
290//-------------------------------------------------
257291//  ROM( sx1541 )
258292//-------------------------------------------------
259293
r24558r24559
272306
273307
274308//-------------------------------------------------
309//  rom_region - device-specific ROM region
310//-------------------------------------------------
311
312const rom_entry *sx1541_device::device_rom_region() const
313{
314   return ROM_NAME( sx1541 );
315}
316
317
318//-------------------------------------------------
275319//  ROM( fsd2 )
276320//-------------------------------------------------
277321
r24558r24559
288332
289333
290334//-------------------------------------------------
335//  rom_region - device-specific ROM region
336//-------------------------------------------------
337
338const rom_entry *fsd2_device::device_rom_region() const
339{
340   return ROM_NAME( fsd2 );
341}
342
343
344//-------------------------------------------------
291345//  ROM( csd1 )
292346//-------------------------------------------------
293347
r24558r24559
299353
300354
301355//-------------------------------------------------
356//  rom_region - device-specific ROM region
357//-------------------------------------------------
358
359const rom_entry *csd1_device::device_rom_region() const
360{
361   return ROM_NAME( csd1 );
362}
363
364
365//-------------------------------------------------
302366//  ROM( c1541dd )
303367//-------------------------------------------------
304368
r24558r24559
309373
310374
311375//-------------------------------------------------
376//  rom_region - device-specific ROM region
377//-------------------------------------------------
378
379const rom_entry *c1541_dolphin_dos_device::device_rom_region() const
380{
381   return ROM_NAME( c1541dd );
382}
383
384
385//-------------------------------------------------
312386//  ROM( c1541pd )
313387//-------------------------------------------------
314388
r24558r24559
320394
321395
322396//-------------------------------------------------
397//  rom_region - device-specific ROM region
398//-------------------------------------------------
399
400const rom_entry *c1541_professional_dos_v1_device::device_rom_region() const
401{
402   return ROM_NAME( c1541pd );
403}
404
405
406//-------------------------------------------------
323407//  ROM( c1541pdc )
324408//-------------------------------------------------
325409
r24558r24559
338422//  rom_region - device-specific ROM region
339423//-------------------------------------------------
340424
341const rom_entry *base_c1541_device::device_rom_region() const
425const rom_entry *c1541_prologic_dos_classic_device::device_rom_region() const
342426{
343   switch (m_variant)
344   {
345   case TYPE_1540:
346      return ROM_NAME( c1540 );
347
348   default:
349   case TYPE_1541:
350      return ROM_NAME( c1541 );
351
352   case TYPE_1541C:
353      return ROM_NAME( c1541c );
354
355   case TYPE_1541II:
356      return ROM_NAME( c1541ii );
357
358   case TYPE_SX1541:
359      return ROM_NAME( sx1541 );
360
361   case TYPE_FSD2: // aka Excelerator PLUS / Oceanic OC-118N
362      return ROM_NAME( fsd2 );
363
364   case TYPE_CSD1:
365      return ROM_NAME( csd1 );
366
367   case TYPE_1541_DOLPHIN_DOS:
368      return ROM_NAME( c1541dd );
369
370   case TYPE_1541_PROFESSIONAL_DOS_V1:
371      return ROM_NAME( c1541pd );
372
373   case TYPE_1541_PROLOGIC_DOS_CLASSIC:
374      return ROM_NAME( c1541pdc );
375   }
427   return ROM_NAME( c1541pdc );
376428}
377429
378430
379
380431//-------------------------------------------------
381432//  read -
382433//-------------------------------------------------
r24558r24559
839890
840891
841892//-------------------------------------------------
893//  machine_config_additions - device-specific
894//  machine configurations
895//-------------------------------------------------
896
897machine_config_constructor base_c1541_device::device_mconfig_additions() const
898{
899   return MACHINE_CONFIG_NAME( c1541 );
900}
901
902
903//-------------------------------------------------
842904//  MACHINE_DRIVER( c1541c )
843905//-------------------------------------------------
844906
r24558r24559
851913
852914
853915//-------------------------------------------------
916//  machine_config_additions - device-specific
917//  machine configurations
918//-------------------------------------------------
919
920machine_config_constructor c1541c_device::device_mconfig_additions() const
921{
922   return MACHINE_CONFIG_NAME( c1541c );
923}
924
925
926//-------------------------------------------------
854927//  MACHINE_DRIVER( c1541dd )
855928//-------------------------------------------------
856929
r24558r24559
863936
864937
865938//-------------------------------------------------
939//  machine_config_additions - device-specific
940//  machine configurations
941//-------------------------------------------------
942
943machine_config_constructor c1541_dolphin_dos_device::device_mconfig_additions() const
944{
945   return MACHINE_CONFIG_NAME( c1541dd );
946}
947
948
949//-------------------------------------------------
866950//  MACHINE_DRIVER( c1541pd )
867951//-------------------------------------------------
868952
r24558r24559
875959
876960
877961//-------------------------------------------------
962//  machine_config_additions - device-specific
963//  machine configurations
964//-------------------------------------------------
965
966machine_config_constructor c1541_professional_dos_v1_device::device_mconfig_additions() const
967{
968   return MACHINE_CONFIG_NAME( c1541pd );
969}
970
971
972//-------------------------------------------------
878973//  MACHINE_DRIVER( c1541pdc )
879974//-------------------------------------------------
880975
r24558r24559
894989//  machine configurations
895990//-------------------------------------------------
896991
897machine_config_constructor base_c1541_device::device_mconfig_additions() const
992machine_config_constructor c1541_prologic_dos_classic_device::device_mconfig_additions() const
898993{
899   switch (m_variant)
900   {
901   default:
902      return MACHINE_CONFIG_NAME( c1541 );
903
904   case TYPE_1541C:
905      return MACHINE_CONFIG_NAME( c1541c );
906
907   case TYPE_1541_DOLPHIN_DOS:
908      return MACHINE_CONFIG_NAME( c1541dd );
909
910   case TYPE_1541_PROFESSIONAL_DOS_V1:
911      return MACHINE_CONFIG_NAME( c1541pd );
912
913   case TYPE_1541_PROLOGIC_DOS_CLASSIC:
914      return MACHINE_CONFIG_NAME( c1541pdc );
915   }
994   return MACHINE_CONFIG_NAME( c1541pdc );
916995}
917996
918997
r24558r24559
9661045//  base_c1541_device - constructor
9671046//-------------------------------------------------
9681047
969base_c1541_device:: base_c1541_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source)
1048base_c1541_device:: base_c1541_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
9701049   : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
9711050      device_cbm_iec_interface(mconfig, *this),
9721051      device_c64_floppy_parallel_interface(mconfig, *this),
r24558r24559
9781057      m_address(*this, "ADDRESS"),
9791058      m_data_out(1),
9801059      m_via0_irq(CLEAR_LINE),
981      m_via1_irq(CLEAR_LINE),
982      m_variant(variant)
1060      m_via1_irq(CLEAR_LINE)
9831061{
9841062}
9851063
r24558r24559
9891067//-------------------------------------------------
9901068
9911069c1540_device::c1540_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
992   : base_c1541_device(mconfig, C1540, "C1540", tag, owner, clock, TYPE_1540, "c1540", __FILE__) { }
1070   : base_c1541_device(mconfig, C1540, "C1540", tag, owner, clock, "c1540", __FILE__) { }
9931071
9941072
9951073//-------------------------------------------------
r24558r24559
9971075//-------------------------------------------------
9981076
9991077c1541_device::c1541_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1000   : base_c1541_device(mconfig, C1541, "C1541", tag, owner, clock, TYPE_1541, "c1541", __FILE__) { }
1078   : base_c1541_device(mconfig, C1541, "C1541", tag, owner, clock, "c1541", __FILE__) { }
10011079
10021080
10031081//-------------------------------------------------
r24558r24559
10051083//-------------------------------------------------
10061084
10071085c1541c_device::c1541c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1008   : base_c1541_device(mconfig, C1541C, "C1541C", tag, owner, clock, TYPE_1541C, "c1541c", __FILE__) {  }
1086   : base_c1541_device(mconfig, C1541C, "C1541C", tag, owner, clock, "c1541c", __FILE__) {  }
10091087
10101088
10111089//-------------------------------------------------
r24558r24559
10131091//-------------------------------------------------
10141092
10151093c1541ii_device::c1541ii_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1016   : base_c1541_device(mconfig, C1541II, "C1541-II", tag, owner, clock, TYPE_1541II, "c1541ii", __FILE__) {  }
1094   : base_c1541_device(mconfig, C1541II, "C1541-II", tag, owner, clock, "c1541ii", __FILE__) {  }
10171095
10181096
10191097//-------------------------------------------------
r24558r24559
10211099//-------------------------------------------------
10221100
10231101sx1541_device::sx1541_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1024   : base_c1541_device(mconfig, SX1541, "SX1541", tag, owner, clock, TYPE_SX1541, "sx1541", __FILE__) { }
1102   : base_c1541_device(mconfig, SX1541, "SX1541", tag, owner, clock, "sx1541", __FILE__) { }
10251103
10261104
10271105//-------------------------------------------------
r24558r24559
10291107//-------------------------------------------------
10301108
10311109fsd2_device::fsd2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1032   : base_c1541_device(mconfig, FSD2, "FSD-2", tag, owner, clock, TYPE_FSD2, "fsd2", __FILE__) { }
1110   : base_c1541_device(mconfig, FSD2, "FSD-2", tag, owner, clock, "fsd2", __FILE__) { }
10331111
10341112
10351113//-------------------------------------------------
r24558r24559
10371115//-------------------------------------------------
10381116
10391117csd1_device::csd1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1040   : base_c1541_device(mconfig, CSD1, "CSD-1", tag, owner, clock, TYPE_CSD1, "csd1", __FILE__) { }
1118   : base_c1541_device(mconfig, CSD1, "CSD-1", tag, owner, clock, "csd1", __FILE__) { }
10411119
10421120
10431121//-------------------------------------------------
r24558r24559
10451123//-------------------------------------------------
10461124
10471125c1541_dolphin_dos_device::c1541_dolphin_dos_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1048   : base_c1541_device(mconfig, C1541_DOLPHIN_DOS, "C1541 Dolphin-DOS 2.0", tag, owner, clock, TYPE_1541_DOLPHIN_DOS, "c1541dd", __FILE__) {  }
1126   : base_c1541_device(mconfig, C1541_DOLPHIN_DOS, "C1541 Dolphin-DOS 2.0", tag, owner, clock, "c1541dd", __FILE__) {  }
10491127
10501128
10511129//-------------------------------------------------
r24558r24559
10531131//-------------------------------------------------
10541132
10551133c1541_professional_dos_v1_device::c1541_professional_dos_v1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1056   : base_c1541_device(mconfig, C1541_PROFESSIONAL_DOS_V1, "C1541 Professional-DOS v1", tag, owner, clock, TYPE_1541_PROFESSIONAL_DOS_V1, "c1541pd", __FILE__) {  }
1134   : base_c1541_device(mconfig, C1541_PROFESSIONAL_DOS_V1, "C1541 Professional-DOS v1", tag, owner, clock, "c1541pd", __FILE__) {  }
10571135
10581136
10591137//-------------------------------------------------
r24558r24559
10611139//-------------------------------------------------
10621140
10631141c1541_prologic_dos_classic_device::c1541_prologic_dos_classic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1064   : base_c1541_device(mconfig, C1541_PROLOGIC_DOS_CLASSIC, "C1541 ProLogic-DOS Classic", tag, owner, clock, TYPE_1541_PROLOGIC_DOS_CLASSIC, "c1541pdc", __FILE__),
1142   : base_c1541_device(mconfig, C1541_PROLOGIC_DOS_CLASSIC, "C1541 ProLogic-DOS Classic", tag, owner, clock, "c1541pdc", __FILE__),
10651143      m_pia(*this, MC6821_TAG),
10661144      m_centronics(*this, CENTRONICS_TAG),
10671145      m_mmu_rom(*this, "mmu")
trunk/src/mess/machine/c1541.h
r24558r24559
4747{
4848public:
4949   // construction/destruction
50   base_c1541_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source);
50   base_c1541_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
5151
52   enum
53   {
54      TYPE_1540 = 0,
55      TYPE_1541,
56      TYPE_1541C,
57      TYPE_1541II,
58      TYPE_SX1541,
59      TYPE_FSD2,
60      TYPE_CSD1,
61
62      // extended hardware
63      TYPE_1541_DOLPHIN_DOS,
64      TYPE_1541_PROFESSIONAL_DOS_V1,
65      TYPE_1541_PROLOGIC_DOS_CLASSIC
66   };
67
6852   DECLARE_WRITE_LINE_MEMBER( via0_irq_w );
6953   DECLARE_READ8_MEMBER( via0_pa_r );
7054   DECLARE_WRITE8_MEMBER( via0_pa_w );
r24558r24559
7963   DECLARE_WRITE_LINE_MEMBER( byte_w );
8064
8165   // optional information overrides
82   virtual const rom_entry *device_rom_region() const;
8366   virtual machine_config_constructor device_mconfig_additions() const;
8467   virtual ioport_constructor device_input_ports() const;
8568
r24558r24559
9679   virtual void parallel_data_w(UINT8 data);
9780   virtual void parallel_strobe_w(int state);
9881
82   enum
83   {
84      LED_POWER = 0,
85      LED_ACT
86   };
87
9988   inline void set_iec_data();
10089
10190   required_device<m6502_device> m_maincpu;
r24558r24559
111100   // interrupts
112101   int m_via0_irq;                         // VIA #0 interrupt request
113102   int m_via1_irq;                         // VIA #1 interrupt request
114
115   int m_variant;
116103};
117104
118105
r24558r24559
123110public:
124111   // construction/destruction
125112   c1540_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
113
114   // optional information overrides
115   virtual const rom_entry *device_rom_region() const;
126116};
127117
128118
r24558r24559
133123public:
134124   // construction/destruction
135125   c1541_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
126
127   // optional information overrides
128   virtual const rom_entry *device_rom_region() const;
136129};
137130
138131
r24558r24559
144137   // construction/destruction
145138   c1541c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
146139
140   // optional information overrides
141   virtual const rom_entry *device_rom_region() const;
142   virtual machine_config_constructor device_mconfig_additions() const;
143
147144   // not really public
148145   DECLARE_READ8_MEMBER( via0_pa_r );
149146};
r24558r24559
156153public:
157154   // construction/destruction
158155   c1541ii_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
156
157   // optional information overrides
158   virtual const rom_entry *device_rom_region() const;
159159};
160160
161161
r24558r24559
166166public:
167167   // construction/destruction
168168   sx1541_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
169
170   // optional information overrides
171   virtual const rom_entry *device_rom_region() const;
169172};
170173
171174
r24558r24559
177180   // construction/destruction
178181   fsd2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
179182
183   // optional information overrides
184   virtual const rom_entry *device_rom_region() const;
185
180186   // device-level overrides
181187   virtual void device_start();
182188};
r24558r24559
189195public:
190196   // construction/destruction
191197   csd1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
198
199   // optional information overrides
200   virtual const rom_entry *device_rom_region() const;
192201};
193202
194203
r24558r24559
199208public:
200209   // construction/destruction
201210   c1541_dolphin_dos_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
211
212   // optional information overrides
213   virtual const rom_entry *device_rom_region() const;
214   virtual machine_config_constructor device_mconfig_additions() const;
202215};
203216
204217
r24558r24559
209222public:
210223   // construction/destruction
211224   c1541_professional_dos_v1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
225
226   // optional information overrides
227   virtual const rom_entry *device_rom_region() const;
228   virtual machine_config_constructor device_mconfig_additions() const;
212229};
213230
214231
r24558r24559
220237   // construction/destruction
221238   c1541_prologic_dos_classic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
222239
240   // optional information overrides
241   virtual const rom_entry *device_rom_region() const;
242   virtual machine_config_constructor device_mconfig_additions() const;
243
223244   // not really public
224245   DECLARE_READ8_MEMBER( read );
225246   DECLARE_WRITE8_MEMBER( write );
trunk/src/mess/machine/cbmiec.c
r24558r24559
190190    5)  Tei minimum must be 80us for external device to be a listener.
191191*/
192192
193/*
194
195    TODO:
196
197    - refactor into an actual daisy chain instead of this convenient hack
198
199*/
200
201193#include "cbmiec.h"
202194
203195
r24558r24559
275267
276268
277269//**************************************************************************
278//  INLINE HELPERS
279//**************************************************************************
280
281//-------------------------------------------------
282//  set_signal -
283//-------------------------------------------------
284
285inline void cbm_iec_device::set_signal(device_t *device, int signal, int state)
286{
287   bool changed = false;
288
289   if (device == this)
290   {
291      if (m_line[signal] != state)
292      {
293         if (LOG) logerror("CBM IEC: '%s' %s %u\n", tag(), SIGNAL_NAME[signal], state);
294         m_line[signal] = state;
295         changed = true;
296      }
297   }
298   else
299   {
300      daisy_entry *entry = m_device_list.first();
301
302      while (entry)
303      {
304         if (!strcmp(entry->m_device->tag(), device->tag()))
305         {
306            if (entry->m_line[signal] != state)
307            {
308               if (LOG) logerror("CBM IEC: '%s' %s %u\n", device->tag(), SIGNAL_NAME[signal], state);
309               entry->m_line[signal] = state;
310               changed = true;
311            }
312         }
313
314         entry = entry->next();
315      }
316   }
317
318   if (changed)
319   {
320      switch (signal)
321      {
322      case SRQ:   m_write_srq(state);  break;
323      case ATN:   m_write_atn(state);  break;
324      case CLK:   m_write_clk(state);  break;
325      case DATA:  m_write_data(state); break;
326      case RESET: m_write_reset(state);break;
327      }
328
329      daisy_entry *entry = m_device_list.first();
330
331      while (entry)
332      {
333         switch (signal)
334         {
335         case SRQ:
336            entry->m_interface->cbm_iec_srq(state);
337            break;
338
339         case ATN:
340            entry->m_interface->cbm_iec_atn(state);
341            break;
342
343         case CLK:
344            entry->m_interface->cbm_iec_clk(state);
345            break;
346
347         case DATA:
348            entry->m_interface->cbm_iec_data(state);
349            break;
350
351         case RESET:
352            entry->m_interface->cbm_iec_reset(state);
353            break;
354         }
355
356         entry = entry->next();
357      }
358
359      if (LOG) logerror("CBM IEC: SRQ %u ATN %u CLK %u DATA %u RESET %u\n",
360         get_signal(SRQ), get_signal(ATN), get_signal(CLK), get_signal(DATA), get_signal(RESET));
361   }
362}
363
364
365//-------------------------------------------------
366//  get_signal -
367//-------------------------------------------------
368
369inline int cbm_iec_device::get_signal(int signal)
370{
371   int state = m_line[signal];
372
373   if (state)
374   {
375      daisy_entry *entry = m_device_list.first();
376
377      while (entry)
378      {
379         if (!entry->m_line[signal])
380         {
381            state = 0;
382            break;
383         }
384
385         entry = entry->next();
386      }
387   }
388
389   return state;
390}
391
392
393
394//**************************************************************************
395270//  LIVE DEVICE
396271//**************************************************************************
397272
r24558r24559
483358
484359
485360//-------------------------------------------------
486//  srq_r -
361//  set_signal -
487362//-------------------------------------------------
488363
489READ_LINE_MEMBER( cbm_iec_device::srq_r )
364void cbm_iec_device::set_signal(device_t *device, int signal, int state)
490365{
491   return get_signal(SRQ);
492}
366   bool changed = false;
493367
368   if (device == this)
369   {
370      if (m_line[signal] != state)
371      {
372         if (LOG) logerror("CBM IEC: '%s' %s %u\n", tag(), SIGNAL_NAME[signal], state);
373         m_line[signal] = state;
374         changed = true;
375      }
376   }
377   else
378   {
379      daisy_entry *entry = m_device_list.first();
494380
495//-------------------------------------------------
496//  atn_r -
497//-------------------------------------------------
381      while (entry)
382      {
383         if (!strcmp(entry->m_device->tag(), device->tag()))
384         {
385            if (entry->m_line[signal] != state)
386            {
387               if (LOG) logerror("CBM IEC: '%s' %s %u\n", device->tag(), SIGNAL_NAME[signal], state);
388               entry->m_line[signal] = state;
389               changed = true;
390            }
391         }
498392
499READ_LINE_MEMBER( cbm_iec_device::atn_r )
500{
501   return get_signal(ATN);
502}
393         entry = entry->next();
394      }
395   }
503396
397   if (changed)
398   {
399      switch (signal)
400      {
401      case SRQ:   m_write_srq(state);  break;
402      case ATN:   m_write_atn(state);  break;
403      case CLK:   m_write_clk(state);  break;
404      case DATA:  m_write_data(state); break;
405      case RESET: m_write_reset(state);break;
406      }
504407
505//-------------------------------------------------
506//  clk_r -
507//-------------------------------------------------
408      daisy_entry *entry = m_device_list.first();
508409
509READ_LINE_MEMBER( cbm_iec_device::clk_r )
510{
511   return get_signal(CLK);
512}
410      while (entry)
411      {
412         switch (signal)
413         {
414         case SRQ:
415            entry->m_interface->cbm_iec_srq(state);
416            break;
513417
418         case ATN:
419            entry->m_interface->cbm_iec_atn(state);
420            break;
514421
515//-------------------------------------------------
516//  data_r -
517//-------------------------------------------------
422         case CLK:
423            entry->m_interface->cbm_iec_clk(state);
424            break;
518425
519READ_LINE_MEMBER( cbm_iec_device::data_r )
520{
521   return get_signal(DATA);
522}
426         case DATA:
427            entry->m_interface->cbm_iec_data(state);
428            break;
523429
430         case RESET:
431            entry->m_interface->cbm_iec_reset(state);
432            break;
433         }
524434
525//-------------------------------------------------
526//  reset_r -
527//-------------------------------------------------
435         entry = entry->next();
436      }
528437
529READ_LINE_MEMBER( cbm_iec_device::reset_r )
530{
531   return get_signal(RESET);
438      if (LOG) logerror("CBM IEC: SRQ %u ATN %u CLK %u DATA %u RESET %u\n",
439         get_signal(SRQ), get_signal(ATN), get_signal(CLK), get_signal(DATA), get_signal(RESET));
440   }
532441}
533442
534443
535444//-------------------------------------------------
536//  srq_w -
445//  get_signal -
537446//-------------------------------------------------
538447
539WRITE_LINE_MEMBER( cbm_iec_device::srq_w )
448int cbm_iec_device::get_signal(int signal)
540449{
541   set_signal(this, SRQ, state);
542}
450   int state = m_line[signal];
543451
452   if (state)
453   {
454      daisy_entry *entry = m_device_list.first();
544455
545//-------------------------------------------------
546//  atn_w -
547//-------------------------------------------------
456      while (entry)
457      {
458         if (!entry->m_line[signal])
459         {
460            state = 0;
461            break;
462         }
548463
549WRITE_LINE_MEMBER( cbm_iec_device::atn_w )
550{
551   set_signal(this, ATN, state);
552}
464         entry = entry->next();
465      }
466   }
553467
554
555//-------------------------------------------------
556//  clk_w -
557//-------------------------------------------------
558
559WRITE_LINE_MEMBER( cbm_iec_device::clk_w )
560{
561   set_signal(this, CLK, state);
468   return state;
562469}
563
564
565//-------------------------------------------------
566//  data_w -
567//-------------------------------------------------
568
569WRITE_LINE_MEMBER( cbm_iec_device::data_w )
570{
571   set_signal(this, DATA, state);
572}
573
574
575//-------------------------------------------------
576//  reset_w -
577//-------------------------------------------------
578
579WRITE_LINE_MEMBER( cbm_iec_device::reset_w )
580{
581   set_signal(this, RESET, state);
582}
583
584
585//-------------------------------------------------
586//  srq_w -
587//-------------------------------------------------
588
589void cbm_iec_device::srq_w(device_t *device, int state)
590{
591   set_signal(device, SRQ, state);
592}
593
594
595//-------------------------------------------------
596//  atn_w -
597//-------------------------------------------------
598
599void cbm_iec_device::atn_w(device_t *device, int state)
600{
601   set_signal(device, ATN, state);
602}
603
604
605//-------------------------------------------------
606//  clk_w -
607//-------------------------------------------------
608
609void cbm_iec_device::clk_w(device_t *device, int state)
610{
611   set_signal(device, CLK, state);
612}
613
614
615//-------------------------------------------------
616//  data_w -
617//-------------------------------------------------
618
619void cbm_iec_device::data_w(device_t *device, int state)
620{
621   set_signal(device, DATA, state);
622}
623
624
625//-------------------------------------------------
626//  reset_w -
627//-------------------------------------------------
628
629void cbm_iec_device::reset_w(device_t *device, int state)
630{
631   set_signal(device, RESET, state);
632}
trunk/src/mess/machine/cbmiec.h
r24558r24559
7777   void add_device(device_t *target);
7878
7979   // reads for both host and peripherals
80   DECLARE_READ_LINE_MEMBER( srq_r );
81   DECLARE_READ_LINE_MEMBER( atn_r );
82   DECLARE_READ_LINE_MEMBER( clk_r );
83   DECLARE_READ_LINE_MEMBER( data_r );
84   DECLARE_READ_LINE_MEMBER( reset_r );
80   DECLARE_READ_LINE_MEMBER( srq_r ) { return get_signal(SRQ); }
81   DECLARE_READ_LINE_MEMBER( atn_r ) { return get_signal(ATN); }
82   DECLARE_READ_LINE_MEMBER( clk_r ) { return get_signal(CLK); }
83   DECLARE_READ_LINE_MEMBER( data_r ) { return get_signal(DATA); }
84   DECLARE_READ_LINE_MEMBER( reset_r ) { return get_signal(RESET); }
8585
8686   // writes for host (driver_device)
87   DECLARE_WRITE_LINE_MEMBER( srq_w );
88   DECLARE_WRITE_LINE_MEMBER( atn_w );
89   DECLARE_WRITE_LINE_MEMBER( clk_w );
90   DECLARE_WRITE_LINE_MEMBER( data_w );
91   DECLARE_WRITE_LINE_MEMBER( reset_w );
87   DECLARE_WRITE_LINE_MEMBER( srq_w ) { set_signal(this, SRQ, state); }
88   DECLARE_WRITE_LINE_MEMBER( atn_w ) { set_signal(this, ATN, state); }
89   DECLARE_WRITE_LINE_MEMBER( clk_w ) { set_signal(this, CLK, state); }
90   DECLARE_WRITE_LINE_MEMBER( data_w ) { set_signal(this, DATA, state); }
91   DECLARE_WRITE_LINE_MEMBER( reset_w ) { set_signal(this, RESET, state); }
9292
9393   // writes for peripherals (device_t)
94   void srq_w(device_t *device, int state);
95   void atn_w(device_t *device, int state);
96   void clk_w(device_t *device, int state);
97   void data_w(device_t *device, int state);
98   void reset_w(device_t *device, int state);
94   void srq_w(device_t *device, int state) { set_signal(device, SRQ, state); }
95   void atn_w(device_t *device, int state) { set_signal(device, ATN, state); }
96   void clk_w(device_t *device, int state) { set_signal(device, CLK, state); }
97   void data_w(device_t *device, int state) { set_signal(device, DATA, state); }
98   void reset_w(device_t *device, int state) { set_signal(device, RESET, state); }
9999
100100protected:
101101   enum
r24558r24559
135135   devcb2_write_line   m_write_data;
136136   devcb2_write_line   m_write_reset;
137137
138   inline void set_signal(device_t *device, int signal, int state);
139   inline int get_signal(int signal);
138   void set_signal(device_t *device, int signal, int state);
139   int get_signal(int signal);
140140
141141   int m_line[SIGNAL_COUNT];
142142};
trunk/src/mess/machine/c1571.c
r24558r24559
1212    TODO:
1313
1414    - modernize floppy
15        - add wpt callback to floppy.c
16        - refactor d64/g64
1715        - refactor 64H156
1816    - 1571CR
1917        - MOS5710
r24558r24559
4341#define ISA_BUS_TAG     "isabus"
4442
4543
46enum
47{
48   LED_POWER = 0,
49   LED_ACT
50};
5144
52
53
5445//**************************************************************************
5546//  DEVICE DEFINITIONS
5647//**************************************************************************
r24558r24559
7263
7364
7465//-------------------------------------------------
66//  rom_region - device-specific ROM region
67//-------------------------------------------------
68
69const rom_entry *c1570_device::device_rom_region() const
70{
71   return ROM_NAME( c1570 );
72}
73
74
75//-------------------------------------------------
7576//  ROM( c1571 )
7677//-------------------------------------------------
7778
r24558r24559
8889
8990
9091//-------------------------------------------------
92//  rom_region - device-specific ROM region
93//-------------------------------------------------
94
95const rom_entry *c1571_device::device_rom_region() const
96{
97   return ROM_NAME( c1571 );
98}
99
100
101//-------------------------------------------------
91102//  ROM( c1571cr )
92103//-------------------------------------------------
93104
r24558r24559
102113
103114
104115//-------------------------------------------------
116//  rom_region - device-specific ROM region
117//-------------------------------------------------
118
119const rom_entry *c1571cr_device::device_rom_region() const
120{
121   return ROM_NAME( c1571cr );
122}
123
124
125//-------------------------------------------------
105126//  ROM( minichief )
106127//-------------------------------------------------
107128
r24558r24559
118139//  rom_region - device-specific ROM region
119140//-------------------------------------------------
120141
121const rom_entry *c1571_device::device_rom_region() const
142const rom_entry *mini_chief_device::device_rom_region() const
122143{
123   switch (m_variant)
124   {
125   case TYPE_1570:
126      return ROM_NAME( c1570 );
127
128   default:
129   case TYPE_1571:
130      return ROM_NAME( c1571 );
131
132   case TYPE_1571CR:
133      return ROM_NAME( c1571cr );
134
135   case TYPE_MINI_CHIEF:
136      return ROM_NAME( minichief );
137   }
144   return ROM_NAME( minichief );
138145}
139146
140147
r24558r24559
755762
756763
757764//-------------------------------------------------
765//  machine_config_additions - device-specific
766//  machine configurations
767//-------------------------------------------------
768
769machine_config_constructor c1570_device::device_mconfig_additions() const
770{
771   return MACHINE_CONFIG_NAME( c1570 );
772}
773
774
775//-------------------------------------------------
758776//  MACHINE_DRIVER( c1571 )
759777//-------------------------------------------------
760778
r24558r24559
779797
780798
781799//-------------------------------------------------
800//  machine_config_additions - device-specific
801//  machine configurations
802//-------------------------------------------------
803
804machine_config_constructor c1571_device::device_mconfig_additions() const
805{
806   return MACHINE_CONFIG_NAME( c1571 );
807}
808
809
810//-------------------------------------------------
782811//  MACHINE_DRIVER( c1571cr )
783812//-------------------------------------------------
784813
r24558r24559
803832
804833
805834//-------------------------------------------------
835//  machine_config_additions - device-specific
836//  machine configurations
837//-------------------------------------------------
838
839machine_config_constructor c1571cr_device::device_mconfig_additions() const
840{
841   return MACHINE_CONFIG_NAME( c1571cr );
842}
843
844
845//-------------------------------------------------
806846//  MACHINE_DRIVER( mini_chief )
807847//-------------------------------------------------
808848
r24558r24559
834874//  machine configurations
835875//-------------------------------------------------
836876
837machine_config_constructor c1571_device::device_mconfig_additions() const
877machine_config_constructor mini_chief_device::device_mconfig_additions() const
838878{
839   switch (m_variant)
840   {
841   case TYPE_1570:
842      return MACHINE_CONFIG_NAME( c1570 );
843
844   default:
845   case TYPE_1571:
846      return MACHINE_CONFIG_NAME( c1571 );
847
848   case TYPE_1571CR:
849      return MACHINE_CONFIG_NAME( c1571cr );
850
851   case TYPE_MINI_CHIEF:
852      return MACHINE_CONFIG_NAME( mini_chief );
853   }
879   return MACHINE_CONFIG_NAME( mini_chief );
854880}
855881
856882
r24558r24559
887913//  c1571_device - constructor
888914//-------------------------------------------------
889915
890c1571_device::c1571_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source)
916c1571_device::c1571_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
891917   : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
892918      device_cbm_iec_interface(mconfig, *this),
893919      device_c64_floppy_parallel_interface(mconfig, *this),
r24558r24559
906932      m_cnt_out(1),
907933      m_via0_irq(CLEAR_LINE),
908934      m_via1_irq(CLEAR_LINE),
909      m_cia_irq(CLEAR_LINE),
910      m_variant(variant)
935      m_cia_irq(CLEAR_LINE)
911936{
912937}
913938
r24558r24559
930955      m_cnt_out(1),
931956      m_via0_irq(CLEAR_LINE),
932957      m_via1_irq(CLEAR_LINE),
933      m_cia_irq(CLEAR_LINE),
934      m_variant(TYPE_1571)
958      m_cia_irq(CLEAR_LINE)
935959      //m_floppy(*this, WD1770_TAG":0:525dd")
936960{
937961}
r24558r24559
942966//-------------------------------------------------
943967
944968c1570_device::c1570_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
945   : c1571_device(mconfig, C1570, "C1570", tag, owner, clock, TYPE_1570, "c1570", __FILE__)
969   : c1571_device(mconfig, C1570, "C1570", tag, owner, clock, "c1570", __FILE__)
946970      //m_floppy(*this, WD1770_TAG":0:525ssdd")
947971{
948972}
r24558r24559
953977//-------------------------------------------------
954978
955979c1571cr_device::c1571cr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
956   : c1571_device(mconfig, C1571CR, "C1571CR", tag, owner, clock, TYPE_1571CR, "c1571cr", __FILE__)
980   : c1571_device(mconfig, C1571CR, "C1571CR", tag, owner, clock, "c1571cr", __FILE__)
957981      //m_floppy(*this, WD1770_TAG":0:525dd")
958982{
959983}
r24558r24559
964988//-------------------------------------------------
965989
966990mini_chief_device::mini_chief_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
967   : c1571_device(mconfig, MINI_CHIEF, "ICT Mini Chief", tag, owner, clock, TYPE_MINI_CHIEF, "minichif", __FILE__)
991   : c1571_device(mconfig, MINI_CHIEF, "ICT Mini Chief", tag, owner, clock, "minichif", __FILE__)
968992      //m_floppy(*this, WD1770_TAG":0:525dd")
969993{
970994}
trunk/src/mess/machine/c1571.h
r24558r24559
4747                  public device_c64_floppy_parallel_interface
4848{
4949public:
50   enum
51   {
52      TYPE_1570,
53      TYPE_1571,
54      TYPE_1571CR,
55      TYPE_MINI_CHIEF
56   };
57
5850   // construction/destruction
59   c1571_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source);
51   c1571_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
6052   c1571_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
6153
6254   // optional information overrides
r24558r24559
10496   virtual void parallel_data_w(UINT8 data);
10597   virtual void parallel_strobe_w(int state);
10698
99   enum
100   {
101      LED_POWER = 0,
102      LED_ACT
103   };
104
107105   void update_iec();
108106
109107   required_device<cpu_device> m_maincpu;
r24558r24559
129127   int m_via0_irq;                         // VIA #0 interrupt request
130128   int m_via1_irq;                         // VIA #1 interrupt request
131129   int m_cia_irq;                          // CIA interrupt request
132
133   int m_variant;
134130};
135131
136132
r24558r24559
141137public:
142138   // construction/destruction
143139   c1570_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
140
141   // optional information overrides
142   virtual const rom_entry *device_rom_region() const;
143   virtual machine_config_constructor device_mconfig_additions() const;
144144};
145145
146146
r24558r24559
152152   // construction/destruction
153153   c1571cr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
154154
155   // optional information overrides
156   virtual const rom_entry *device_rom_region() const;
157   virtual machine_config_constructor device_mconfig_additions() const;
158
155159   DECLARE_WRITE8_MEMBER( via0_pa_w );
156160   DECLARE_WRITE8_MEMBER( via0_pb_w );
157161};
r24558r24559
165169   // construction/destruction
166170   mini_chief_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
167171
172   // optional information overrides
173   virtual const rom_entry *device_rom_region() const;
174   virtual machine_config_constructor device_mconfig_additions() const;
175
168176   DECLARE_READ8_MEMBER( cia_pa_r );
169177   DECLARE_WRITE8_MEMBER( cia_pa_w );
170178   DECLARE_WRITE8_MEMBER( cia_pb_w );
trunk/src/mess/machine/c1581.c
r24558r24559
3030#define WD1772_TAG      "u4"
3131
3232
33enum
34{
35   LED_POWER = 0,
36   LED_ACT
37};
3833
39
40
4134//**************************************************************************
4235//  DEVICE DEFINITIONS
4336//**************************************************************************
r24558r24559
6558
6659
6760//-------------------------------------------------
61//  rom_region - device-specific ROM region
62//-------------------------------------------------
63
64const rom_entry *c1581_device::device_rom_region() const
65{
66   return ROM_NAME( c1581 );
67}
68
69
70//-------------------------------------------------
6871//  ROM( c1563 )
6972//-------------------------------------------------
7073
r24558r24559
7881//  rom_region - device-specific ROM region
7982//-------------------------------------------------
8083
81const rom_entry *c1581_device::device_rom_region() const
84const rom_entry *c1563_device::device_rom_region() const
8285{
83   switch (m_variant)
84   {
85   default:
86   case TYPE_1581:
87      return ROM_NAME( c1581 );
88
89   case TYPE_1563:
90      return ROM_NAME( c1563 );
91   }
86   return ROM_NAME( c1563 );
9287}
9388
9489
r24558r24559
332327//  c1581_device - constructor
333328//-------------------------------------------------
334329
335c1581_device::c1581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source)
330c1581_device::c1581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
336331   : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
337332      device_cbm_iec_interface(mconfig, *this),
338333      m_maincpu(*this, M6502_TAG),
r24558r24559
344339      m_atn_ack(0),
345340      m_fast_ser_dir(0),
346341      m_sp_out(1),
347      m_cnt_out(1),
348      m_variant(variant)
342      m_cnt_out(1)
349343{
350344}
351345
r24558r24559
361355      m_atn_ack(0),
362356      m_fast_ser_dir(0),
363357      m_sp_out(1),
364      m_cnt_out(1),
365      m_variant(TYPE_1581)
358      m_cnt_out(1)
366359{
367360}
368361
r24558r24559
372365//-------------------------------------------------
373366
374367c1563_device::c1563_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
375   : c1581_device(mconfig, C1563, "C1563", tag, owner, clock, TYPE_1563, "c1563", __FILE__) { }
368   : c1581_device(mconfig, C1563, "C1563", tag, owner, clock, "c1563", __FILE__) { }
376369
377370
378371//-------------------------------------------------
trunk/src/mess/machine/c1581.h
r24558r24559
4141{
4242public:
4343   // construction/destruction
44   c1581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source);
44   c1581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
4545   c1581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
4646
47   enum
48   {
49      TYPE_1563,
50      TYPE_1581
51   };
52
5347   // optional information overrides
5448   virtual const rom_entry *device_rom_region() const;
5549   virtual machine_config_constructor device_mconfig_additions() const;
r24558r24559
7670   virtual void cbm_iec_data(int state);
7771   virtual void cbm_iec_reset(int state);
7872
73   enum
74   {
75      LED_POWER = 0,
76      LED_ACT
77   };
78
7979   void update_iec();
8080
8181   required_device<cpu_device> m_maincpu;
r24558r24559
8989   int m_fast_ser_dir;         // fast serial direction
9090   int m_sp_out;               // fast serial data out
9191   int m_cnt_out;              // fast serial clock out
92
93   int m_variant;
9492};
9593
9694
r24558r24559
10199public:
102100   // construction/destruction
103101   c1563_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
102
103   // optional information overrides
104   virtual const rom_entry *device_rom_region() const;
104105};
105106
106107

Previous 199869 Revisions Next


© 1997-2024 The MAME Team