Previous 199869 Revisions Next

r20324 Friday 18th January, 2013 at 21:11:04 UTC by Curt Coder
floppy: Fixed write protected signal and added a callback for it. [Curt Coder]
[src/emu/imagedev]floppy.c floppy.h

trunk/src/emu/imagedev/floppy.h
r20323r20324
4949   typedef delegate<void (floppy_image_device *)> unload_cb;
5050   typedef delegate<void (floppy_image_device *, int)> index_pulse_cb;
5151   typedef delegate<void (floppy_image_device *, int)> ready_cb;
52   typedef delegate<void (floppy_image_device *, int)> wpt_cb;
5253
5354   // construction/destruction
5455   floppy_image_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
r20323r20324
8485   void setup_unload_cb(unload_cb cb);
8586   void setup_index_pulse_cb(index_pulse_cb cb);
8687   void setup_ready_cb(ready_cb cb);
88   void setup_wpt_cb(wpt_cb cb);
8789
8890   UINT32* get_buffer() { return image->get_buffer(cyl, ss); }
8991   UINT32 get_len() { return image->get_track_size(cyl, ss); }
r20323r20324
9294   bool ready_r();
9395   double get_pos();
9496
95   bool wpt_r() { return output_format == 0; }
97   bool wpt_r() { return wpt; }
9698   int dskchg_r() { return dskchg; }
9799   bool trk00_r() { return cyl != 0; }
98100   int idx_r() { return idx; }
r20323r20324
166168   unload_cb cur_unload_cb;
167169   index_pulse_cb cur_index_pulse_cb;
168170   ready_cb cur_ready_cb;
171   wpt_cb cur_wpt_cb;
169172
170173   UINT32 find_position(attotime &base, attotime when);
171174   int find_index(UINT32 position, const UINT32 *buf, int buf_size);
trunk/src/emu/imagedev/floppy.c
r20323r20324
114114   cur_ready_cb = cb;
115115}
116116
117void floppy_image_device::setup_wpt_cb(wpt_cb cb)
118{
119   cur_wpt_cb = cb;
120}
121
117122void floppy_image_device::set_formats(const floppy_format_type *formats)
118123{
119124   image_device_format **formatptr;
r20323r20324
287292
288293   image = global_alloc(floppy_image(tracks, sides, form_factor));
289294   best_format->load(&io, form_factor, image);
295   output_format = is_readonly() ? 0 : best_format;
290296
291   if(!is_readonly())
292      output_format = best_format;
293
294297   revolution_start_time = motor_always_on ? machine().time() : attotime::never;
295298   revolution_count = 0;
296299
297300   index_resync();
298301   image_dirty = false;
299   output_format = 0;
300302
303   wpt = 1; // disk sleeve is covering the sensor
304   if (!cur_wpt_cb.isnull())
305      cur_wpt_cb(this, wpt);
306
307   wpt = is_readonly();
308   if (!cur_wpt_cb.isnull())
309      cur_wpt_cb(this, wpt);
310
301311   if (!cur_load_cb.isnull())
302312      return cur_load_cb(this);
303313
r20323r20324
317327      global_free(image);
318328      image = 0;
319329   }
330
331   wpt = 1; // disk sleeve is covering the sensor
332   if (!cur_wpt_cb.isnull())
333      cur_wpt_cb(this, wpt);
334
335   wpt = 0; // sensor is uncovered
336   if (!cur_wpt_cb.isnull())
337      cur_wpt_cb(this, wpt);
338
320339   if (!cur_unload_cb.isnull())
321340      cur_unload_cb(this);
322341   if(!ready) {

Previous 199869 Revisions Next


© 1997-2024 The MAME Team