mirror of
https://github.com/holub/mame
synced 2025-04-30 03:47:13 +03:00
Revert "floppy: Add an optional spinup delay to prevent unrealistic fast responses. Defaults to 0."
This reverts commit 3c144c5b48
.
Returning attotime::never from get_next_transition when there
eventually is going to be transitions without any externally imposed
state change is incorrect.
This commit is contained in:
parent
46cdb4b930
commit
49594f73b7
@ -13,16 +13,13 @@
|
|||||||
#include "formats/imageutl.h"
|
#include "formats/imageutl.h"
|
||||||
#include "zippath.h"
|
#include "zippath.h"
|
||||||
|
|
||||||
#define LOG_WARN (1U<<1) // Warnings
|
/*
|
||||||
#define LOG_STEP (1U<<2) // Step motor operation
|
Debugging flags. Set to 0 or 1.
|
||||||
#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
|
|
||||||
|
|
||||||
#define VERBOSE ( LOG_GENERAL | LOG_WARN )
|
// Show step operation
|
||||||
|
#define TRACE_STEP 0
|
||||||
#include "logmacro.h"
|
#define TRACE_AUDIO 0
|
||||||
|
|
||||||
#define PITCH_SEEK_SAMPLES 1
|
#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_t(mconfig, FLOPPY_CONNECTOR, tag, owner, clock),
|
||||||
device_slot_interface(mconfig, *this),
|
device_slot_interface(mconfig, *this),
|
||||||
formats(nullptr),
|
formats(nullptr),
|
||||||
m_enable_sound(false),
|
m_enable_sound(false)
|
||||||
m_spinup_time(0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +161,6 @@ void floppy_connector::device_config_complete()
|
|||||||
{
|
{
|
||||||
dev->set_formats(formats);
|
dev->set_formats(formats);
|
||||||
dev->enable_sound(m_enable_sound);
|
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),
|
image(nullptr),
|
||||||
fif_list(nullptr),
|
fif_list(nullptr),
|
||||||
index_timer(nullptr),
|
index_timer(nullptr),
|
||||||
spinup_timer(nullptr),
|
|
||||||
tracks(0),
|
tracks(0),
|
||||||
sides(0),
|
sides(0),
|
||||||
form_factor(0),
|
form_factor(0),
|
||||||
@ -204,9 +198,7 @@ floppy_image_device::floppy_image_device(const machine_config &mconfig, device_t
|
|||||||
image_dirty(false),
|
image_dirty(false),
|
||||||
ready_counter(0),
|
ready_counter(0),
|
||||||
m_make_sound(false),
|
m_make_sound(false),
|
||||||
m_sound_out(nullptr),
|
m_sound_out(nullptr)
|
||||||
m_spun_up(true),
|
|
||||||
m_spinup_time(0)
|
|
||||||
{
|
{
|
||||||
extension_list[0] = '\0';
|
extension_list[0] = '\0';
|
||||||
m_err = IMAGE_ERROR_INVALIDIMAGE;
|
m_err = IMAGE_ERROR_INVALIDIMAGE;
|
||||||
@ -346,7 +338,6 @@ void floppy_image_device::device_start()
|
|||||||
wpt = 0;
|
wpt = 0;
|
||||||
dskchg = exists() ? 1 : 0;
|
dskchg = exists() ? 1 : 0;
|
||||||
index_timer = timer_alloc(0);
|
index_timer = timer_alloc(0);
|
||||||
spinup_timer = timer_alloc(1);
|
|
||||||
image_dirty = false;
|
image_dirty = false;
|
||||||
ready = true;
|
ready = true;
|
||||||
ready_counter = 0;
|
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)
|
void floppy_image_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||||
{
|
{
|
||||||
switch (id)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
index_resync();
|
index_resync();
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
LOGMASKED(LOG_MOTOR, "Speed reached\n");
|
|
||||||
m_spun_up = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
floppy_image_format_t *floppy_image_device::identify(std::string filename)
|
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 */
|
/* off -> on */
|
||||||
if (!mon && image)
|
if (!mon && image)
|
||||||
{
|
{
|
||||||
LOGMASKED(LOG_MOTOR, "Motor on, spinup time %d\n", m_spinup_time);
|
|
||||||
revolution_start_time = machine().time();
|
revolution_start_time = machine().time();
|
||||||
if (motor_always_on) {
|
if (motor_always_on) {
|
||||||
// Drives with motor that is always spinning are immediately ready when a disk is loaded
|
// 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;
|
ready_counter = 2;
|
||||||
}
|
}
|
||||||
index_resync();
|
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 */
|
/* on -> off */
|
||||||
else {
|
else {
|
||||||
LOGMASKED(LOG_MOTOR, "Motor off\n");
|
|
||||||
if(image_dirty)
|
if(image_dirty)
|
||||||
commit_image();
|
commit_image();
|
||||||
revolution_start_time = attotime::never;
|
revolution_start_time = attotime::never;
|
||||||
index_timer->adjust(attotime::zero);
|
index_timer->adjust(attotime::zero);
|
||||||
set_ready(true);
|
set_ready(true);
|
||||||
m_spun_up = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a motor sound (loaded or empty)
|
// Create a motor sound (loaded or empty)
|
||||||
@ -635,7 +605,7 @@ void floppy_image_device::index_resync()
|
|||||||
if(idx && ready) {
|
if(idx && ready) {
|
||||||
ready_counter--;
|
ready_counter--;
|
||||||
if(!ready_counter) {
|
if(!ready_counter) {
|
||||||
LOGMASKED(LOG_READY, "Drive ready\n");
|
// logerror("Drive spun up\n");
|
||||||
set_ready(false);
|
set_ready(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -698,7 +668,7 @@ void floppy_image_device::stp_w(int state)
|
|||||||
}
|
}
|
||||||
if(ocyl != cyl)
|
if(ocyl != cyl)
|
||||||
{
|
{
|
||||||
LOGMASKED(LOG_STEP, "track %d\n", cyl);
|
if (TRACE_STEP) logerror("track %d\n", cyl);
|
||||||
// Do we want a stepper sound?
|
// Do we want a stepper sound?
|
||||||
// We plan for 5 zones with possibly specific sounds
|
// We plan for 5 zones with possibly specific sounds
|
||||||
if (m_make_sound) m_sound_out->step(cyl*5/tracks);
|
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;
|
cyl = next_pos >> 2;
|
||||||
subcyl = next_pos & 3;
|
subcyl = next_pos & 3;
|
||||||
|
|
||||||
if (next_pos != cur_pos)
|
if(TRACE_STEP && (next_pos != cur_pos))
|
||||||
LOGMASKED(LOG_STEP, "track %d.%d\n", cyl, subcyl);
|
logerror("track %d.%d\n", cyl, subcyl);
|
||||||
|
|
||||||
/* Update disk detection if applicable */
|
/* Update disk detection if applicable */
|
||||||
if (exists() && !dskchg_writable)
|
if (exists() && !dskchg_writable)
|
||||||
@ -819,18 +789,6 @@ attotime floppy_image_device::get_next_transition(const attotime &from_when)
|
|||||||
if(!image || mon)
|
if(!image || mon)
|
||||||
return attotime::never;
|
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<uint32_t> &buf = image->get_buffer(cyl, ss, subcyl);
|
std::vector<uint32_t> &buf = image->get_buffer(cyl, ss, subcyl);
|
||||||
uint32_t cells = buf.size();
|
uint32_t cells = buf.size();
|
||||||
if(cells <= 1)
|
if(cells <= 1)
|
||||||
@ -1265,7 +1223,7 @@ void floppy_sound_device::step(int zone)
|
|||||||
// Changing the pitch does not always sound convincing
|
// Changing the pitch does not always sound convincing
|
||||||
if (!PITCH_SEEK_SAMPLES) m_seek_pitch = 1;
|
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,
|
// Set the timeout for the seek sound. When it expires,
|
||||||
// we assume that the seek process is over, and we'll play the
|
// we assume that the seek process is over, and we'll play the
|
||||||
|
@ -38,11 +38,6 @@
|
|||||||
#define MCFG_FLOPPY_DRIVE_SOUND(_doit) \
|
#define MCFG_FLOPPY_DRIVE_SOUND(_doit) \
|
||||||
static_cast<floppy_connector *>(device)->enable_sound(_doit);
|
static_cast<floppy_connector *>(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<floppy_connector *>(device)->set_spinup_time(_time);
|
|
||||||
|
|
||||||
#define DECLARE_FLOPPY_FORMATS(_name) \
|
#define DECLARE_FLOPPY_FORMATS(_name) \
|
||||||
static const floppy_format_type _name []
|
static const floppy_format_type _name []
|
||||||
|
|
||||||
@ -154,7 +149,6 @@ public:
|
|||||||
|
|
||||||
// Enable sound
|
// Enable sound
|
||||||
void enable_sound(bool doit) { m_make_sound = doit; }
|
void enable_sound(bool doit) { m_make_sound = doit; }
|
||||||
void set_spinup_time(int ms) { m_spinup_time = ms; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
floppy_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
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];
|
char extension_list[256];
|
||||||
floppy_image_format_t *fif_list;
|
floppy_image_format_t *fif_list;
|
||||||
emu_timer *index_timer;
|
emu_timer *index_timer;
|
||||||
emu_timer *spinup_timer;
|
|
||||||
|
|
||||||
/* Physical characteristics, filled by setup_characteristics */
|
/* Physical characteristics, filled by setup_characteristics */
|
||||||
int tracks; /* addressable tracks */
|
int tracks; /* addressable tracks */
|
||||||
@ -231,10 +224,6 @@ protected:
|
|||||||
// Sound
|
// Sound
|
||||||
bool m_make_sound;
|
bool m_make_sound;
|
||||||
floppy_sound_device* m_sound_out;
|
floppy_sound_device* m_sound_out;
|
||||||
|
|
||||||
// Spinup
|
|
||||||
bool m_spun_up;
|
|
||||||
int m_spinup_time;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DECLARE_FLOPPY_IMAGE_DEVICE(Type, Name, Interface) \
|
#define DECLARE_FLOPPY_IMAGE_DEVICE(Type, Name, Interface) \
|
||||||
@ -333,7 +322,6 @@ public:
|
|||||||
void set_formats(const floppy_format_type *formats);
|
void set_formats(const floppy_format_type *formats);
|
||||||
floppy_image_device *get_device();
|
floppy_image_device *get_device();
|
||||||
void enable_sound(bool doit) { m_enable_sound = doit; }
|
void enable_sound(bool doit) { m_enable_sound = doit; }
|
||||||
void set_spinup_time(int ms) { m_spinup_time = ms; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
@ -342,7 +330,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
const floppy_format_type *formats;
|
const floppy_format_type *formats;
|
||||||
bool m_enable_sound;
|
bool m_enable_sound;
|
||||||
int m_spinup_time;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user