Previous 15994 Revisions Next

r3911 Saturday 20th December, 2008 at 14:26:00 UTC by Miodrag Milanović
More deprecat.h removal
[src/mess/devices]appldriv.c appldriv.h sonydriv.c sonydriv.h
[src/mess/drivers]apple2.c apple2gs.c apple3.c lisa.c mac.c
[src/mess/includes]mac.h
[src/mess/machine]apple2.c apple3.c applefdc.c applefdc.h lisa.c mac.c

src/mess/includes/mac.h
r3910r3911
4848WRITE16_HANDLER ( macplus_scsi_w );
4949NVRAM_HANDLER( mac );
5050void mac_scc_mouse_irq( running_machine *machine, int x, int y );
51void mac_fdc_set_enable_lines(int enable_mask);
51void mac_fdc_set_enable_lines(const device_config *device, int enable_mask);
5252
5353
5454/*----------- defined in video/mac.c -----------*/
src/mess/machine/applefdc.c
r3910r3911
260260    * Bits 4-0   Same as IWM mode bits 4-0
261261    */
262262
263   status = iwm_enable2(device) ? 1 : (intf->read_status ? intf->read_status() : 0);
263   status = iwm_enable2(device) ? 1 : (intf->read_status ? intf->read_status(device) : 0);
264264
265265   result = (status ? 0x80 : 0x00);
266266
r3910r3911
318318                  logerror("applefdc_read_reg(): latch mode off not implemented\n");
319319            }
320320
321            result = (intf->read_data ? intf->read_data() : 0x00);
321            result = (intf->read_data ? intf->read_data(device) : 0x00);
322322         }
323323         break;
324324
r3910r3911
372372            }
373373
374374            if (intf->write_data != NULL)
375               intf->write_data(data);
375               intf->write_data(device,data);
376376         }
377377         break;
378378   }
r3910r3911
410410
411411   /* invoke callback, if present */
412412   if (intf->set_enable_lines != NULL)
413      intf->set_enable_lines(enable_lines);
413      intf->set_enable_lines(device,enable_lines);
414414
415415   if (LOG_APPLEFDC_EXTRA)
416416      logerror("iwm_turnmotor_onoff(): Turning motor %s\n", status ? "on" : "off");
r3910r3911
451451      fdc->lines &= ~(1 << (offset >> 1));
452452
453453   if ((offset < 0x08) && (intf->set_lines != NULL))
454      intf->set_lines(fdc->lines & 0x0f);
454      intf->set_lines(device,fdc->lines & 0x0f);
455455
456456   switch(offset)
457457   {
r3910r3911
469469      case 0x0A:
470470         /* turn off IWM_DRIVE */
471471         if ((fdc->lines & IWM_MOTOR) && (intf->set_enable_lines != NULL))
472            intf->set_enable_lines(1);
472            intf->set_enable_lines(device,1);
473473         break;
474474
475475      case 0x0B:
476476         /* turn on IWM_DRIVE */
477477         if ((fdc->lines & IWM_MOTOR) && (intf->set_enable_lines != NULL))
478            intf->set_enable_lines(2);
478            intf->set_enable_lines(device,2);
479479         break;
480480   }
481481}
r3910r3911
509509               if (fdc->lines & IWM_Q7)
510510               {
511511                  if (intf->write_data != NULL)
512                     intf->write_data(fdc->write_byte);
512                     intf->write_data(device,fdc->write_byte);
513513                  result = 0;
514514               }
515515               else
r3910r3911
568568               if (fdc->lines & IWM_Q7)
569569               {
570570                  if (intf->write_data != NULL)
571                     intf->write_data(fdc->write_byte);
571                     intf->write_data(device,fdc->write_byte);
572572               }
573573               break;
574574
src/mess/machine/applefdc.h
r3910r3911
4040typedef struct _applefdc_interface applefdc_interface;
4141struct _applefdc_interface
4242{
43   void (*set_lines)(UINT8 lines);
44   void (*set_enable_lines)(int enable_mask);
43   void (*set_lines)(const device_config *device, UINT8 lines);
44   void (*set_enable_lines)(const device_config *device, int enable_mask);
4545
46   UINT8 (*read_data)(void);
47   void (*write_data)(UINT8 data);
48   int (*read_status)(void);
46   UINT8 (*read_data)(const device_config *device);
47   void (*write_data)(const device_config *device, UINT8 data);
48   int (*read_status)(const device_config *device);
4949};
5050
5151
r3910r3911
7070/* accessor */
7171UINT8 applefdc_get_lines(const device_config *device);
7272
73/***************************************************************************
74    DEVICE CONFIGURATION MACROS
75***************************************************************************/
7376
77#define MDRV_APPLEFDC_ADD(_tag, _intrf) \
78   MDRV_DEVICE_ADD(_tag, APPLEFDC) \
79   MDRV_DEVICE_CONFIG(_intrf)
80
81#define MDRV_APPLEFDC_MODIFY(_tag, _intrf) \
82  MDRV_DEVICE_MODIFY(_tag, APPLEFDC)         \
83  MDRV_DEVICE_CONFIG(_intrf)
84
85#define MDRV_APPLEFDC_REMOVE(_tag)      \
86  MDRV_DEVICE_REMOVE(_tag, APPLEFDC)
87 
88#define MDRV_IWM_ADD(_tag, _intrf) \
89   MDRV_DEVICE_ADD(_tag, IWM) \
90   MDRV_DEVICE_CONFIG(_intrf)
91
92#define MDRV_IWM_MODIFY(_tag, _intrf) \
93  MDRV_DEVICE_MODIFY(_tag, IWM)         \
94  MDRV_DEVICE_CONFIG(_intrf)
95
96#define MDRV_IWM_REMOVE(_tag)      \
97  MDRV_DEVICE_REMOVE(_tag, IWM)
98 
99#define MDRV_SWIM_ADD(_tag, _intrf) \
100   MDRV_DEVICE_ADD(_tag, SWIM) \
101   MDRV_DEVICE_CONFIG(_intrf)
102
103#define MDRV_SWIM_MODIFY(_tag, _intrf) \
104  MDRV_DEVICE_MODIFY(_tag, SWIM)         \
105  MDRV_DEVICE_CONFIG(_intrf)
106
107#define MDRV_SWIM_REMOVE(_tag)      \
108  MDRV_DEVICE_REMOVE(_tag, SWIM)
109 
110
74111#endif /* __APPLEFDC_H__ */
src/mess/machine/apple3.c
r3910r3911
2626
2727UINT32 a3;
2828
29static void apple3_update_drives(void);
29static void apple3_update_drives(const device_config *device);
3030
3131static UINT8 via_0_a;
3232static UINT8 via_0_b;
r3910r3911
178178            a3 |= VAR_EXTA0 << ((offset - 0xD0) / 2);
179179         else
180180            a3 &= ~(VAR_EXTA0 << ((offset - 0xD0) / 2));
181         apple3_update_drives();
181         apple3_update_drives((device_config*)device_list_find_by_tag( space->machine->config->devicelist,APPLEFDC,"fdc"));
182182         result = 0x00;
183183         break;
184184
r3910r3911
246246            a3 |= VAR_EXTA0 << ((offset - 0xD0) / 2);
247247         else
248248            a3 &= ~(VAR_EXTA0 << ((offset - 0xD0) / 2));
249         apple3_update_drives();
249         apple3_update_drives((device_config*)device_list_find_by_tag( space->machine->config->devicelist,APPLEFDC,"fdc"));
250250         break;
251251
252252      case 0xDB:
r3910r3911
670670
671671
672672
673static void apple3_update_drives(void)
673static void apple3_update_drives(const device_config *device)
674674{
675675   int enable_mask = 0x00;
676676
r3910r3911
693693      }
694694   }
695695
696   apple525_set_enable_lines(enable_mask);
696   apple525_set_enable_lines(device,enable_mask);
697697}
698698
699699
700700
701static void apple3_set_enable_lines(int enable_mask)
701static void apple3_set_enable_lines(const device_config *device,int enable_mask)
702702{
703703   apple3_enable_mask = enable_mask;
704   apple3_update_drives();
704   apple3_update_drives(device);
705705}
706706
707707
r3910r3911
722722   memory_region(machine, "main")[0x0685] = 0x00;
723723
724724   apple3_enable_mask = 0;
725   apple3_update_drives();
725   apple3_update_drives((device_config*)device_list_find_by_tag( machine->config->devicelist,APPLEFDC,"fdc"));
726726
727727   AY3600_init(machine);
728728
src/mess/machine/mac.c
r3910r3911
160160}
161161
162162// handle disk enable lines
163void mac_fdc_set_enable_lines(int enable_mask)
163void mac_fdc_set_enable_lines(const device_config *device,int enable_mask)
164164{
165165   if (mac_model < MODEL_MAC_SE)
166166   {
167      sony_set_enable_lines(enable_mask);
167      sony_set_enable_lines(device,enable_mask);
168168   }
169169   else
170170   {
171171      if (enable_mask)
172172      {
173         sony_set_enable_lines(mac_drive_select ? 1 : 2);
173         sony_set_enable_lines(device,mac_drive_select ? 1 : 2);
174174      }
175175      else
176176      {
177         sony_set_enable_lines(enable_mask);
177         sony_set_enable_lines(device,enable_mask);
178178      }
179179   }
180180}
r3910r3911
16581658{
16591659   set_scc_waitrequest((data & 0x80) >> 7);
16601660   mac_set_screen_buffer((data & 0x40) >> 6);
1661   sony_set_sel_line((data & 0x20) >> 5);
1661   sony_set_sel_line((device_config*)device_list_find_by_tag( device->machine->config->devicelist,APPLEFDC,"fdc"),(data & 0x20) >> 5);
16621662   if (mac_model == MODEL_MAC_SE)   // on SE this selects which floppy drive (0 = upper, 1 = lower)
16631663   {
16641664      mac_drive_select = ((data & 0x10) >> 4);
src/mess/machine/lisa.c
r3910r3911
11771177   /* initialize floppy */
11781178   {
11791179      if (lisa_features.floppy_hardware == sony_lisa2)
1180         sony_set_enable_lines(1);   /* on lisa2, drive unit 1 is always selected (?) */
1180         sony_set_enable_lines((device_config*)device_list_find_by_tag( machine->config->devicelist,APPLEFDC,"fdc"),1);   /* on lisa2, drive unit 1 is always selected (?) */
11811181   }
11821182}
11831183
r3910r3911
13281328      /*if (lisa_features.floppy_hardware == twiggy)
13291329         twiggy_set_head_line(offset & 1);
13301330      else*/ if (lisa_features.floppy_hardware == sony_lisa210)
1331         sony_set_sel_line(offset & 1);
1331         sony_set_sel_line((device_config*)device_list_find_by_tag( machine->config->devicelist,APPLEFDC,"fdc"), offset & 1);
13321332      break;
13331333   case 6:
13341334      DISK_DIAG = offset & 1;
src/mess/machine/apple2.c
r3910r3911
11121112   return device_count_tag_from_machine(machine, "apple525driv") > 0;
11131113}
11141114
1115static void apple2_fdc_set_lines(UINT8 lines)
1115static void apple2_fdc_set_lines(const device_config *device, UINT8 lines)
11161116{
11171117   if (apple2_fdc_diskreg & 0x40)
11181118   {
1119      if (apple2_fdc_has_35(Machine))
1119      if (apple2_fdc_has_35(device->machine))
11201120      {
11211121         /* slot 5: 3.5" disks */
1122         sony_set_lines(lines);
1122         sony_set_lines(device,lines);
11231123      }
11241124   }
11251125   else
11261126   {
1127      if (apple2_fdc_has_525(Machine))
1127      if (apple2_fdc_has_525(device->machine))
11281128      {
11291129         /* slot 6: 5.25" disks */
1130         apple525_set_lines(lines);
1130         apple525_set_lines(device,lines);
11311131      }
11321132   }
11331133}
11341134
11351135
11361136
1137static void apple2_fdc_set_enable_lines(int enable_mask)
1137static void apple2_fdc_set_enable_lines(const device_config *device,int enable_mask)
11381138{
11391139   int slot5_enable_mask = 0;
11401140   int slot6_enable_mask = 0;
r3910r3911
11441144   else
11451145      slot6_enable_mask = enable_mask;
11461146
1147   if (apple2_fdc_has_35(Machine))
1147   if (apple2_fdc_has_35(device->machine))
11481148   {
11491149      /* set the 3.5" enable lines */
1150      sony_set_enable_lines(slot5_enable_mask);
1150      sony_set_enable_lines(device,slot5_enable_mask);
11511151   }
11521152
1153   if (apple2_fdc_has_525(Machine))
1153   if (apple2_fdc_has_525(device->machine))
11541154   {
11551155      /* set the 5.25" enable lines */
1156      apple525_set_enable_lines(slot6_enable_mask);
1156      apple525_set_enable_lines(device,slot6_enable_mask);
11571157   }
11581158}
11591159
11601160
11611161
1162static UINT8 apple2_fdc_read_data(void)
1162static UINT8 apple2_fdc_read_data(const device_config *device)
11631163{
11641164   UINT8 result = 0x00;
11651165
11661166   if (apple2_fdc_diskreg & 0x40)
11671167   {
1168      if (apple2_fdc_has_35(Machine))
1168      if (apple2_fdc_has_35(device->machine))
11691169      {
11701170         /* slot 5: 3.5" disks */
1171         result = sony_read_data();
1171         result = sony_read_data(device);
11721172      }
11731173   }
11741174   else
11751175   {
1176      if (apple2_fdc_has_525(Machine))
1176      if (apple2_fdc_has_525(device->machine))
11771177      {
11781178         /* slot 6: 5.25" disks */
1179         result = apple525_read_data();
1179         result = apple525_read_data(device);
11801180      }
11811181   }
11821182   return result;
r3910r3911
11841184
11851185
11861186
1187static void apple2_fdc_write_data(UINT8 data)
1187static void apple2_fdc_write_data(const device_config *device, UINT8 data)
11881188{
11891189   if (apple2_fdc_diskreg & 0x40)
11901190   {
1191      if (apple2_fdc_has_35(Machine))
1191      if (apple2_fdc_has_35(device->machine))
11921192      {
11931193         /* slot 5: 3.5" disks */
1194         sony_write_data(data);
1194         sony_write_data(device,data);
11951195      }
11961196   }
11971197   else
11981198   {
1199      if (apple2_fdc_has_525(Machine))
1199      if (apple2_fdc_has_525(device->machine))
12001200      {
12011201         /* slot 6: 5.25" disks */
1202         apple525_write_data(data);
1202         apple525_write_data(device,data);
12031203      }
12041204   }
12051205}
12061206
12071207
12081208
1209static int apple2_fdc_read_status(void)
1209static int apple2_fdc_read_status(const device_config *device)
12101210{
12111211   int result = 0;
12121212
12131213   if (apple2_fdc_diskreg & 0x40)
12141214   {
1215      if (apple2_fdc_has_35(Machine))
1215      if (apple2_fdc_has_35(device->machine))
12161216      {
12171217         /* slot 5: 3.5" disks */
1218         result = sony_read_status();
1218         result = sony_read_status(device);
12191219      }
12201220   }
12211221   else
12221222   {
1223      if (apple2_fdc_has_525(Machine))
1223      if (apple2_fdc_has_525(device->machine))
12241224      {
12251225         /* slot 6: 5.25" disks */
1226         result = apple525_read_status();
1226         result = apple525_read_status(device);
12271227      }
12281228   }
12291229   return result;
r3910r3911
12351235{
12361236   apple2_fdc_diskreg = data & 0xC0;
12371237   if (apple2_fdc_has_35(machine))
1238      sony_set_sel_line(apple2_fdc_diskreg & 0x80);
1238      sony_set_sel_line( (device_config*)device_list_find_by_tag( machine->config->devicelist,APPLEFDC,"fdc"),apple2_fdc_diskreg & 0x80);
12391239}
12401240
12411241
src/mess/devices/sonydriv.c
r3910r3911
3737*********************************************************************/
3838
3939#include "driver.h"
40#include "deprecat.h"
40#include "machine/applefdc.h"
4141#include "sonydriv.h"
4242#include "formats/ap_dsk35.h"
4343#include "flopdrv.h"
r3910r3911
114114#endif
115115
116116
117static void load_track_data(int floppy_select)
117static void load_track_data(const device_config *device,int floppy_select)
118118{
119119   int track_size;
120120   const device_config *cur_image;
r3910r3911
122122   floppy *f;
123123
124124   f = &sony_floppy[floppy_select];
125   cur_image = image_from_devtag_and_index(Machine, "sonydriv", floppy_select);
125   cur_image = image_from_devtag_and_index(device->machine, "sonydriv", floppy_select);
126126
127127   track_size = floppy_get_track_size(flopimg_get_image(cur_image), f->head, floppy_drive_get_current_track(cur_image));
128128   new_data = image_realloc(cur_image, f->loadedtrack_data, track_size);
r3910r3911
139139
140140
141141
142static void save_track_data(int floppy_select)
142static void save_track_data(const device_config *device, int floppy_select)
143143{
144144   const device_config *cur_image;
145145   floppy *f;
146146   int len;
147147
148148   f = &sony_floppy[floppy_select];
149   cur_image = image_from_devtag_and_index(Machine, "sonydriv", floppy_select);
149   cur_image = image_from_devtag_and_index(device->machine, "sonydriv", floppy_select);
150150
151151   if (f->loadedtrack_dirty)
152152   {
r3910r3911
158158
159159
160160
161UINT8 sony_read_data(void)
161UINT8 sony_read_data(const device_config *device)
162162{
163163   UINT8 result = 0;
164164   const device_config *cur_image;
r3910r3911
168168      return 0xFF;         /* right ??? */
169169
170170   f = &sony_floppy[sony_floppy_select];
171   cur_image = image_from_devtag_and_index(Machine, "sonydriv", sony_floppy_select);
171   cur_image = image_from_devtag_and_index(device->machine, "sonydriv", sony_floppy_select);
172172   if (!image_exists(cur_image))
173173      return 0xFF;
174174
175175   if (!f->loadedtrack_valid)
176      load_track_data(sony_floppy_select);
176      load_track_data(device, sony_floppy_select);
177177
178178   result = sony_fetchtrack(f->loadedtrack_data, f->loadedtrack_size, &f->loadedtrack_pos);
179179   return result;
r3910r3911
181181
182182
183183
184void sony_write_data(UINT8 data)
184void sony_write_data(const device_config *device,UINT8 data)
185185{
186186   const device_config *cur_image;
187187   floppy *f;
188188
189189   f = &sony_floppy[sony_floppy_select];
190   cur_image = image_from_devtag_and_index(Machine, "sonydriv", sony_floppy_select);
190   cur_image = image_from_devtag_and_index(device->machine, "sonydriv", sony_floppy_select);
191191   if (!image_exists(cur_image))
192192      return;
193193
194194   if (!f->loadedtrack_valid)
195      load_track_data(sony_floppy_select);
195      load_track_data(device,sony_floppy_select);
196196   sony_filltrack(f->loadedtrack_data, f->loadedtrack_size, &f->loadedtrack_pos, data);
197197   f->loadedtrack_dirty = 1;
198198}
r3910r3911
252252   return result;
253253}
254254
255int sony_read_status(void)
255int sony_read_status(const device_config *device)
256256{
257257   int result = 1;
258258   int action;
r3910r3911
264264   if (LOG_SONY_EXTRA)
265265   {
266266      logerror("sony_status(): action=%d pc=0x%08x%s\n",
267         action, (int) cpu_get_pc(Machine->cpu[0]), sony_floppy_enable ? "" : " (no drive enabled)");
267         action, (int) cpu_get_pc(device->machine->cpu[0]), sony_floppy_enable ? "" : " (no drive enabled)");
268268   }
269269
270270   if ((! sony_enable2()) && sony_floppy_enable)
271271   {
272272      f = &sony_floppy[sony_floppy_select];
273      cur_image = image_from_devtag_and_index(Machine, "sonydriv", sony_floppy_select);
273      cur_image = image_from_devtag_and_index(device->machine, "sonydriv", sony_floppy_select);
274274      if (!image_exists(cur_image))
275275         cur_image = NULL;
276276
r3910r3911
281281      case 0x01:   /* Lower head activate */
282282         if (f->head != 0)
283283         {
284            save_track_data(sony_floppy_select);
284            save_track_data(device,sony_floppy_select);
285285            f->head = 0;
286286            f->loadedtrack_valid = 0;
287287         }
r3910r3911
293293      case 0x03:   /* Upper head activate */
294294         if (f->head != 1)
295295         {
296            save_track_data(sony_floppy_select);
296            save_track_data(device,sony_floppy_select);
297297            f->head = 1;
298298            f->loadedtrack_valid = 0;
299299         }
r3910r3911
319319            result = floppy_get_heads_per_disk(flopimg_get_image(cur_image)) - 1;
320320         break;
321321      case 0x0a:   /* At track 0: 0=track zero 1=not track zero */
322         logerror("sony_status(): reading Track 0 pc=0x%08x\n", (int) cpu_get_pc(Machine->cpu[0]));
322         logerror("sony_status(): reading Track 0 pc=0x%08x\n", (int) cpu_get_pc(device->machine->cpu[0]));
323323         if (cur_image)
324324            result = floppy_drive_get_flag_state(cur_image, FLOPPY_DRIVE_HEAD_AT_TRACK_0) ? 0 : 1;
325325         else
r3910r3911
347347         break;
348348      case 0x0e:   /* Tachometer */
349349         /* (time in seconds) / (60 sec/minute) * (rounds/minute) * (60 pulses) * (2 pulse phases) */
350         result = ((int) (attotime_to_double(timer_get_time(Machine)) / 60.0 * sony_rpm(f, cur_image) * 60.0 * 2.0)) & 1;
350         result = ((int) (attotime_to_double(timer_get_time(device->machine)) / 60.0 * sony_rpm(f, cur_image) * 60.0 * 2.0)) & 1;
351351         break;
352352      case 0x0f:   /* Drive installed: 0=drive connected, 1=drive not connected */
353353         result = 0;
r3910r3911
364364
365365
366366
367static void sony_doaction(void)
367static void sony_doaction(const device_config *device)
368368{
369369   int action;
370370   floppy *f;
r3910r3911
375375   if (LOG_SONY)
376376   {
377377      logerror("sony_doaction(): action=%d pc=0x%08x%s\n",
378         action, (int) cpu_get_pc(Machine->cpu[0]), (sony_floppy_enable) ? "" : " (MOTOR OFF)");
378         action, (int) cpu_get_pc(device->machine->cpu[0]), (sony_floppy_enable) ? "" : " (MOTOR OFF)");
379379   }
380380
381381   if (sony_floppy_enable)
382382   {
383383      f = &sony_floppy[sony_floppy_select];
384      cur_image = image_from_devtag_and_index(Machine, "sonydriv", sony_floppy_select);
384      cur_image = image_from_devtag_and_index(device->machine, "sonydriv", sony_floppy_select);
385385      if (!image_exists(cur_image))
386386         cur_image = NULL;
387387
r3910r3911
399399      case 0x04:   /* Step disk */
400400         if (cur_image)
401401         {
402            save_track_data(sony_floppy_select);
402            save_track_data(device,sony_floppy_select);
403403            if (f->step)
404404               floppy_drive_seek(cur_image, -1);
405405            else
r3910r3911
429429
430430
431431
432void sony_set_lines(UINT8 lines)
432void sony_set_lines(const device_config *device,UINT8 lines)
433433{
434434   int old_sony_lines = sony_lines;
435435
r3910r3911
439439   if ((sony_lines & ~old_sony_lines) & SONY_LSTRB)
440440   {
441441      /* if so, write drive reg */
442      sony_doaction();
442      sony_doaction(device);
443443   }
444444
445445   if (LOG_SONY_EXTRA)
r3910r3911
448448
449449
450450
451void sony_set_enable_lines(int enable_mask)
451void sony_set_enable_lines(const device_config *device,int enable_mask)
452452{
453453   switch (enable_mask)
454454   {
r3910r3911
472472
473473
474474
475void sony_set_sel_line(int sel)
475void sony_set_sel_line(const device_config *device,int sel)
476476{
477477   sony_sel_line = sel ? 1 : 0;
478478
r3910r3911
495495   device_image_unload_func parent_unload;
496496
497497   id = image_index_in_device(image);
498   save_track_data(id);
498   save_track_data((device_config*)device_list_find_by_tag( image->machine->config->devicelist,APPLEFDC,"fdc"),id);
499499   memset(&sony_floppy[id], 0, sizeof(sony_floppy[id]));
500500
501501   parent_unload = (device_image_unload_func) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_UNLOAD);
src/mess/devices/sonydriv.h
r3910r3911
3030
3131void sonydriv_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
3232
33void sony_set_lines(UINT8 lines);
34void sony_set_enable_lines(int enable_mask);
35void sony_set_sel_line(int sel);
33void sony_set_lines(const device_config *device,UINT8 lines);
34void sony_set_enable_lines(const device_config *device,int enable_mask);
35void sony_set_sel_line(const device_config *device,int sel);
3636
3737void sony_set_speed(int speed);
3838
39UINT8 sony_read_data(void);
40void sony_write_data(UINT8 data);
41int sony_read_status(void);
39UINT8 sony_read_data(const device_config *device);
40void sony_write_data(const device_config *device,UINT8 data);
41int sony_read_status(const device_config *device);
4242
4343
4444#endif /* SONYDRIV_H */
src/mess/devices/appldriv.c
r3910r3911
99#include "appldriv.h"
1010#include "flopdrv.h"
1111#include "mflopimg.h"
12#include "deprecat.h"
1312#include "formats/ap2_dsk.h"
1413
1514
r3910r3911
3130
3231
3332
34void apple525_set_enable_lines(int enable_mask)
33void apple525_set_enable_lines(const device_config *device,int enable_mask)
3534{
3635   apple525_enable_mask = enable_mask;
3736}
r3910r3911
104103
105104
106105
107static void apple525_disk_set_lines(const device_config *image, UINT8 new_state)
106static void apple525_disk_set_lines(const device_config *device,const device_config *image, UINT8 new_state)
108107{
109108   struct apple525_disk *cur_disk;
110109   UINT8 old_state;
r3910r3911
145144
146145
147146
148void apple525_set_lines(UINT8 lines)
147void apple525_set_lines(const device_config *device,UINT8 lines)
149148{
150149   int i, count;
151150   const device_config *image;
152151
153   count = device_count_tag_from_machine(Machine, APPLE525TAG);
152   count = device_count_tag_from_machine(device->machine, APPLE525TAG);
154153
155154   for (i = 0; i < count; i++)
156155   {
157156      if (apple525_enable_mask & (1 << i))
158157      {
159         image = image_from_devtag_and_index(Machine, APPLE525TAG, i);
158         image = image_from_devtag_and_index(device->machine, APPLE525TAG, i);
160159         if (image)
161            apple525_disk_set_lines(image, lines);
160            apple525_disk_set_lines(device,image, lines);
162161      }
163162   }
164163}
r3910r3911
234233
235234
236235
237UINT8 apple525_read_data(void)
236UINT8 apple525_read_data(const device_config *device)
238237{
239238   const device_config *image;
240   image = apple525_selected_image(Machine);
239   image = apple525_selected_image(device->machine);
241240   return image ? apple525_process_byte(image, -1) : 0xFF;
242241}
243242
244243
245244
246void apple525_write_data(UINT8 data)
245void apple525_write_data(const device_config *device,UINT8 data)
247246{
248247   const device_config *image;
249   image = apple525_selected_image(Machine);
248   image = apple525_selected_image(device->machine);
250249   if (image)
251250      apple525_process_byte(image, data);
252251}
253252
254253
255254
256int apple525_read_status(void)
255int apple525_read_status(const device_config *device)
257256{
258257   int i, count, result = 0;
259258   const device_config *image;
260259
261   count = device_count_tag_from_machine(Machine, APPLE525TAG);
260   count = device_count_tag_from_machine(device->machine, APPLE525TAG);
262261
263262   for (i = 0; i < count; i++)
264263   {
265264      if (apple525_enable_mask & (1 << i))
266265      {
267         image = image_from_devtag_and_index(Machine, APPLE525TAG, i);
266         image = image_from_devtag_and_index(device->machine, APPLE525TAG, i);
268267         if (image && !image_is_writable(image))
269268            result = 1;
270269      }
src/mess/devices/appldriv.h
r3910r3911
2121
2222void apple525_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
2323
24void apple525_set_lines(UINT8 lines);
25void apple525_set_enable_lines(int enable_mask);
24void apple525_set_lines(const device_config *device,UINT8 lines);
25void apple525_set_enable_lines(const device_config *device,int enable_mask);
2626
27UINT8 apple525_read_data(void);
28void apple525_write_data(UINT8 data);
29int apple525_read_status(void);
27UINT8 apple525_read_data(const device_config *device);
28void apple525_write_data(const device_config *device,UINT8 data);
29int apple525_read_status(const device_config *device);
3030
3131
3232#endif /* APPLDRIV_H */
src/mess/drivers/apple2gs.c
r3910r3911
181181   MDRV_SOUND_ROUTE(1, "right", 1.0)
182182
183183   /* replace the old-style FDC with an IWM */
184   MDRV_DEVICE_REMOVE("fdc", APPLEFDC)
185   MDRV_DEVICE_ADD("fdc", IWM)
186   MDRV_DEVICE_CONFIG(apple2_fdc_interface)
187
184   MDRV_APPLEFDC_REMOVE("fdc")
185   MDRV_IWM_ADD("fdc", apple2_fdc_interface)
188186   /* SCC */
189187   MDRV_SCC8530_ADD("scc", apple2gs_scc8530_interface)
190188MACHINE_DRIVER_END
src/mess/drivers/apple3.c
r3910r3911
5353   MDRV_VIDEO_UPDATE( apple3 )
5454
5555   /* fdc */
56   MDRV_DEVICE_ADD("fdc", APPLEFDC)
57   MDRV_DEVICE_CONFIG(apple3_fdc_interface)
56   MDRV_APPLEFDC_ADD("fdc", apple3_fdc_interface)
5857
5958   /* acia */
6059   MDRV_DEVICE_ADD("acia", ACIA6551)
src/mess/drivers/mac.c
r3910r3911
129129   MDRV_NVRAM_HANDLER(mac)
130130
131131   /* devices */
132   MDRV_DEVICE_ADD("fdc", IWM)
133   MDRV_DEVICE_CONFIG(mac_iwm_interface)
132   MDRV_IWM_ADD("fdc", mac_iwm_interface)
134133   MDRV_SCC8530_ADD("scc", mac_scc8530_interface)
135134   MDRV_VIA6522_ADD("via6522_0", 1000000, mac_via6522_intf)
136135MACHINE_DRIVER_END
src/mess/drivers/lisa.c
r3910r3911
4848    DEVICE CONFIG
4949***************************************************************************/
5050
51static void lisa2_set_iwm_enable_lines(int enable_mask)
51static void lisa2_set_iwm_enable_lines(const device_config *device,int enable_mask)
5252{
5353   /* E1 & E2 is connected to the Sony SEL line (?) */
5454   /*logerror("new sel line state %d\n", (enable_mask) ? 0 : 1);*/
55   sony_set_sel_line((enable_mask) ? 0 : 1);
55   sony_set_sel_line(device,(enable_mask) ? 0 : 1);
5656}
5757
58static void lisa210_set_iwm_enable_lines(int enable_mask)
58static void lisa210_set_iwm_enable_lines(const device_config *device,int enable_mask)
5959{
6060   /* E2 is connected to the Sony enable line (?) */
61   sony_set_enable_lines(enable_mask >> 1);
61   sony_set_enable_lines(device,enable_mask >> 1);
6262}
6363
6464static const applefdc_interface lisa2_fdc_interface =
r3910r3911
122122   MDRV_NVRAM_HANDLER(lisa)
123123
124124   /* devices */
125   MDRV_DEVICE_ADD("fdc", IWM)
126   MDRV_DEVICE_CONFIG(lisa2_fdc_interface)
125   MDRV_IWM_ADD("fdc", lisa2_fdc_interface)
127126
128127   /* via */
129128   MDRV_VIA6522_ADD("via6522_0", 500000, lisa_via6522_0_intf)
r3910r3911
137136   MDRV_CPU_PROGRAM_MAP(lisa210_fdc_map, 0)
138137
139138   /* Lisa 2/10 and MacXL had a slightly different FDC interface */   
140   MDRV_DEVICE_MODIFY("fdc", IWM)
141   MDRV_DEVICE_CONFIG(lisa210_fdc_interface)
139   MDRV_IWM_MODIFY("fdc", lisa210_fdc_interface)
142140
143141   /* via */
144142   MDRV_VIA6522_REMOVE("via6522_0")
src/mess/drivers/apple2.c
r3910r3911
593593   /* slot devices */
594594   MDRV_DEVICE_ADD("langcard", APPLE2_LANGCARD)
595595   MDRV_DEVICE_ADD("mockingboard", MOCKINGBOARD)
596   MDRV_DEVICE_ADD("fdc", APPLEFDC)
597   MDRV_DEVICE_CONFIG(apple2_fdc_interface)
596   MDRV_APPLEFDC_ADD("fdc", apple2_fdc_interface)
598597
599598   /* slots */
600599   MDRV_APPLE2_SLOT_ADD(0, "langcard", apple2_langcard_r, apple2_langcard_w)
r3910r3911
639638
640639   /* replace the old-style FDC with an IWM */
641640   MDRV_DEVICE_REMOVE("fdc", APPLEFDC)
642   MDRV_DEVICE_ADD("fdc", IWM)
643   MDRV_DEVICE_CONFIG(apple2_fdc_interface)
641   MDRV_IWM_ADD("fdc", apple2_fdc_interface)
644642MACHINE_DRIVER_END
645643
646644

Previous 15994 Revisions Next


© 1998-2018 The MESS Team