diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp index 61d811591b1..2419ba8eb2f 100644 --- a/src/devices/imagedev/floppy.cpp +++ b/src/devices/imagedev/floppy.cpp @@ -400,6 +400,31 @@ floppy_image_format_t *floppy_image_device::identify(std::string filename) return best_format; } +void floppy_image_device::init_floppy_load(bool write_supported) +{ + revolution_start_time = mon ? attotime::never : machine().time(); + revolution_count = 0; + + index_resync(); + + wpt = 1; // disk sleeve is covering the sensor + if (!cur_wpt_cb.isnull()) + cur_wpt_cb(this, wpt); + + wpt = is_readonly() || (!write_supported); + if (!cur_wpt_cb.isnull()) + cur_wpt_cb(this, wpt); + + if (motor_always_on) { + // When disk is inserted, start motor + mon_w(0); + } else if(!mon) + ready_counter = 2; + + if (dskchg_writable) + dskchg = 1; +} + image_init_result floppy_image_device::call_load() { io_generic io; @@ -434,32 +459,13 @@ image_init_result floppy_image_device::call_load() } output_format = is_readonly() ? nullptr : best_format; - revolution_start_time = mon ? attotime::never : machine().time(); - revolution_count = 0; - - index_resync(); image_dirty = false; - wpt = 1; // disk sleeve is covering the sensor - if (!cur_wpt_cb.isnull()) - cur_wpt_cb(this, wpt); - - wpt = is_readonly() || (output_format == nullptr); - if (!cur_wpt_cb.isnull()) - cur_wpt_cb(this, wpt); + init_floppy_load(output_format != nullptr); if (!cur_load_cb.isnull()) return cur_load_cb(this); - if (motor_always_on) { - // When disk is inserted, start motor - mon_w(0); - } else if(!mon) - ready_counter = 2; - - if (dskchg_writable) - dskchg = 1; - return image_init_result::PASS; } @@ -519,9 +525,7 @@ image_init_result floppy_image_device::call_create(int format_type, util::option return image_init_result::FAIL; } - if (motor_always_on) - // When disk is inserted, start motor - mon_w(0); + init_floppy_load(output_format != nullptr); return image_init_result::PASS; } @@ -2355,4 +2359,3 @@ void ibm_6360::handled_variants(uint32_t *variants, int &var_count) const var_count = 0; variants[var_count++] = floppy_image::SSSD; } - diff --git a/src/devices/imagedev/floppy.h b/src/devices/imagedev/floppy.h index 9e458b141cc..04b7fe722f0 100644 --- a/src/devices/imagedev/floppy.h +++ b/src/devices/imagedev/floppy.h @@ -162,6 +162,8 @@ protected: virtual void setup_characteristics() = 0; + void init_floppy_load(bool write_supported); + floppy_image_format_t *input_format; floppy_image_format_t *output_format; floppy_image *image;