From 49594f73b7d3b67a7dbbe4af6f92cc0c0d5e29bb Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 18 Jun 2018 14:47:48 +0200 Subject: [PATCH] Revert "floppy: Add an optional spinup delay to prevent unrealistic fast responses. Defaults to 0." This reverts commit 3c144c5b48a340bb796e2b311c36588a7e75f48d. Returning attotime::never from get_next_transition when there eventually is going to be transitions without any externally imposed state change is incorrect. --- src/devices/imagedev/floppy.cpp | 70 +++++++-------------------------- src/devices/imagedev/floppy.h | 13 ------ 2 files changed, 14 insertions(+), 69 deletions(-) diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp index 5ed2ad1985d..a18308b5f36 100644 --- a/src/devices/imagedev/floppy.cpp +++ b/src/devices/imagedev/floppy.cpp @@ -13,16 +13,13 @@ #include "formats/imageutl.h" #include "zippath.h" -#define LOG_WARN (1U<<1) // Warnings -#define LOG_STEP (1U<<2) // Step motor operation -#define LOG_MOTOR (1U<<3) // Spindle motor operation -#define LOG_AUDIO (1U<<4) // Audio output -#define LOG_READY (1U<<5) // Drive ready -#define LOG_SPINUP (1U<<6) // Drive still spinning up +/* + Debugging flags. Set to 0 or 1. +*/ -#define VERBOSE ( LOG_GENERAL | LOG_WARN ) - -#include "logmacro.h" +// Show step operation +#define TRACE_STEP 0 +#define TRACE_AUDIO 0 #define PITCH_SEEK_SAMPLES 1 @@ -140,8 +137,7 @@ floppy_connector::floppy_connector(const machine_config &mconfig, const char *ta device_t(mconfig, FLOPPY_CONNECTOR, tag, owner, clock), device_slot_interface(mconfig, *this), formats(nullptr), - m_enable_sound(false), - m_spinup_time(0) + m_enable_sound(false) { } @@ -165,7 +161,6 @@ void floppy_connector::device_config_complete() { dev->set_formats(formats); dev->enable_sound(m_enable_sound); - dev->set_spinup_time(m_spinup_time); } } @@ -187,7 +182,6 @@ floppy_image_device::floppy_image_device(const machine_config &mconfig, device_t image(nullptr), fif_list(nullptr), index_timer(nullptr), - spinup_timer(nullptr), tracks(0), sides(0), form_factor(0), @@ -204,9 +198,7 @@ floppy_image_device::floppy_image_device(const machine_config &mconfig, device_t image_dirty(false), ready_counter(0), m_make_sound(false), - m_sound_out(nullptr), - m_spun_up(true), - m_spinup_time(0) + m_sound_out(nullptr) { extension_list[0] = '\0'; m_err = IMAGE_ERROR_INVALIDIMAGE; @@ -346,7 +338,6 @@ void floppy_image_device::device_start() wpt = 0; dskchg = exists() ? 1 : 0; index_timer = timer_alloc(0); - spinup_timer = timer_alloc(1); image_dirty = false; ready = true; ready_counter = 0; @@ -377,18 +368,7 @@ void floppy_image_device::device_reset() void floppy_image_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - switch (id) - { - case 0: - index_resync(); - break; - case 1: - LOGMASKED(LOG_MOTOR, "Speed reached\n"); - m_spun_up = true; - break; - default: - break; - } + index_resync(); } floppy_image_format_t *floppy_image_device::identify(std::string filename) @@ -561,7 +541,6 @@ void floppy_image_device::mon_w(int state) /* off -> on */ if (!mon && image) { - LOGMASKED(LOG_MOTOR, "Motor on, spinup time %d\n", m_spinup_time); revolution_start_time = machine().time(); if (motor_always_on) { // Drives with motor that is always spinning are immediately ready when a disk is loaded @@ -571,24 +550,15 @@ void floppy_image_device::mon_w(int state) ready_counter = 2; } index_resync(); - if (m_spinup_time > 0) - { - m_spun_up = false; - spinup_timer->adjust(attotime::from_msec(m_spinup_time)); - } - else - m_spun_up = true; } /* on -> off */ else { - LOGMASKED(LOG_MOTOR, "Motor off\n"); if(image_dirty) commit_image(); revolution_start_time = attotime::never; index_timer->adjust(attotime::zero); set_ready(true); - m_spun_up = false; } // Create a motor sound (loaded or empty) @@ -635,7 +605,7 @@ void floppy_image_device::index_resync() if(idx && ready) { ready_counter--; if(!ready_counter) { - LOGMASKED(LOG_READY, "Drive ready\n"); + // logerror("Drive spun up\n"); set_ready(false); } } @@ -698,7 +668,7 @@ void floppy_image_device::stp_w(int state) } if(ocyl != cyl) { - LOGMASKED(LOG_STEP, "track %d\n", cyl); + if (TRACE_STEP) logerror("track %d\n", cyl); // Do we want a stepper sound? // We plan for 5 zones with possibly specific sounds if (m_make_sound) m_sound_out->step(cyl*5/tracks); @@ -745,8 +715,8 @@ void floppy_image_device::seek_phase_w(int phases) cyl = next_pos >> 2; subcyl = next_pos & 3; - if (next_pos != cur_pos) - LOGMASKED(LOG_STEP, "track %d.%d\n", cyl, subcyl); + if(TRACE_STEP && (next_pos != cur_pos)) + logerror("track %d.%d\n", cyl, subcyl); /* Update disk detection if applicable */ if (exists() && !dskchg_writable) @@ -819,18 +789,6 @@ attotime floppy_image_device::get_next_transition(const attotime &from_when) if(!image || mon) return attotime::never; - // (mz) If the drive is still spinning up, pretend that no transitions - // will come - // - // Should be solved with a proper ramp, but for now suffice it to use - // a static config line to set a spinup time in msec. - // The default is 0, which means m_spun_up is true at all times. - // tandy2k has issues with too long spinup times - if (!m_spun_up) { - LOGMASKED(LOG_SPINUP, "Spinning up..."); - return attotime::never; - } - std::vector &buf = image->get_buffer(cyl, ss, subcyl); uint32_t cells = buf.size(); if(cells <= 1) @@ -1265,7 +1223,7 @@ void floppy_sound_device::step(int zone) // Changing the pitch does not always sound convincing if (!PITCH_SEEK_SAMPLES) m_seek_pitch = 1; - LOGMASKED(LOG_AUDIO, "Seek sample = %d, pitch = %f\n", m_seek_playback_sample, m_seek_pitch); + if (TRACE_AUDIO) logerror("Seek sample = %d, pitch = %f\n", m_seek_playback_sample, m_seek_pitch); // Set the timeout for the seek sound. When it expires, // we assume that the seek process is over, and we'll play the diff --git a/src/devices/imagedev/floppy.h b/src/devices/imagedev/floppy.h index 5d00a51c2ea..04b7fe722f0 100644 --- a/src/devices/imagedev/floppy.h +++ b/src/devices/imagedev/floppy.h @@ -38,11 +38,6 @@ #define MCFG_FLOPPY_DRIVE_SOUND(_doit) \ static_cast(device)->enable_sound(_doit); -// Add a spinup delay. This should better become a property of a selected drive. -// Default is 0 -#define MCFG_FLOPPY_DRIVE_SPINUP_TIME(_time) \ - static_cast(device)->set_spinup_time(_time); - #define DECLARE_FLOPPY_FORMATS(_name) \ static const floppy_format_type _name [] @@ -154,7 +149,6 @@ public: // Enable sound void enable_sound(bool doit) { m_make_sound = doit; } - void set_spinup_time(int ms) { m_spinup_time = ms; } protected: floppy_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); @@ -176,7 +170,6 @@ protected: char extension_list[256]; floppy_image_format_t *fif_list; emu_timer *index_timer; - emu_timer *spinup_timer; /* Physical characteristics, filled by setup_characteristics */ int tracks; /* addressable tracks */ @@ -231,10 +224,6 @@ protected: // Sound bool m_make_sound; floppy_sound_device* m_sound_out; - - // Spinup - bool m_spun_up; - int m_spinup_time; }; #define DECLARE_FLOPPY_IMAGE_DEVICE(Type, Name, Interface) \ @@ -333,7 +322,6 @@ public: void set_formats(const floppy_format_type *formats); floppy_image_device *get_device(); void enable_sound(bool doit) { m_enable_sound = doit; } - void set_spinup_time(int ms) { m_spinup_time = ms; } protected: virtual void device_start() override; @@ -342,7 +330,6 @@ protected: private: const floppy_format_type *formats; bool m_enable_sound; - int m_spinup_time; };