diff --git a/src/emu/imagedev/floppy.c b/src/emu/imagedev/floppy.c index 2d16977978b..cd5dad2a6e6 100644 --- a/src/emu/imagedev/floppy.c +++ b/src/emu/imagedev/floppy.c @@ -114,6 +114,11 @@ void floppy_image_device::setup_ready_cb(ready_cb cb) cur_ready_cb = cb; } +void floppy_image_device::setup_wpt_cb(wpt_cb cb) +{ + cur_wpt_cb = cb; +} + void floppy_image_device::set_formats(const floppy_format_type *formats) { image_device_format **formatptr; @@ -287,16 +292,21 @@ bool floppy_image_device::call_load() image = global_alloc(floppy_image(tracks, sides, form_factor)); best_format->load(&io, form_factor, image); - - if(!is_readonly()) - output_format = best_format; + output_format = is_readonly() ? 0 : best_format; revolution_start_time = motor_always_on ? machine().time() : attotime::never; revolution_count = 0; index_resync(); image_dirty = false; - output_format = 0; + + wpt = 1; // disk sleeve is covering the sensor + if (!cur_wpt_cb.isnull()) + cur_wpt_cb(this, wpt); + + wpt = is_readonly(); + if (!cur_wpt_cb.isnull()) + cur_wpt_cb(this, wpt); if (!cur_load_cb.isnull()) return cur_load_cb(this); @@ -317,6 +327,15 @@ void floppy_image_device::call_unload() global_free(image); image = 0; } + + wpt = 1; // disk sleeve is covering the sensor + if (!cur_wpt_cb.isnull()) + cur_wpt_cb(this, wpt); + + wpt = 0; // sensor is uncovered + if (!cur_wpt_cb.isnull()) + cur_wpt_cb(this, wpt); + if (!cur_unload_cb.isnull()) cur_unload_cb(this); if(!ready) { diff --git a/src/emu/imagedev/floppy.h b/src/emu/imagedev/floppy.h index 67717a85824..c89b3d37654 100644 --- a/src/emu/imagedev/floppy.h +++ b/src/emu/imagedev/floppy.h @@ -49,6 +49,7 @@ public: typedef delegate unload_cb; typedef delegate index_pulse_cb; typedef delegate ready_cb; + typedef delegate wpt_cb; // construction/destruction floppy_image_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); @@ -84,6 +85,7 @@ public: void setup_unload_cb(unload_cb cb); void setup_index_pulse_cb(index_pulse_cb cb); void setup_ready_cb(ready_cb cb); + void setup_wpt_cb(wpt_cb cb); UINT32* get_buffer() { return image->get_buffer(cyl, ss); } UINT32 get_len() { return image->get_track_size(cyl, ss); } @@ -92,7 +94,7 @@ public: bool ready_r(); double get_pos(); - bool wpt_r() { return output_format == 0; } + bool wpt_r() { return wpt; } int dskchg_r() { return dskchg; } bool trk00_r() { return cyl != 0; } int idx_r() { return idx; } @@ -166,6 +168,7 @@ protected: unload_cb cur_unload_cb; index_pulse_cb cur_index_pulse_cb; ready_cb cur_ready_cb; + wpt_cb cur_wpt_cb; UINT32 find_position(attotime &base, attotime when); int find_index(UINT32 position, const UINT32 *buf, int buf_size);