mirror of
https://github.com/holub/mame
synced 2025-06-25 05:44:23 +03:00
Merge pull request #1974 from shattered/_55d0495
minor floppy internals improvements
This commit is contained in:
commit
72cf75f937
@ -184,6 +184,8 @@ floppy_image_device::floppy_image_device(const machine_config &mconfig, device_t
|
|||||||
sides(0),
|
sides(0),
|
||||||
form_factor(0),
|
form_factor(0),
|
||||||
motor_always_on(false),
|
motor_always_on(false),
|
||||||
|
dskchg_writable(false),
|
||||||
|
has_trk00_sensor(true),
|
||||||
dir(0), stp(0), wtg(0), mon(0), ss(0), idx(0), wpt(0), rdy(0), dskchg(0),
|
dir(0), stp(0), wtg(0), mon(0), ss(0), idx(0), wpt(0), rdy(0), dskchg(0),
|
||||||
ready(false),
|
ready(false),
|
||||||
rpm(0),
|
rpm(0),
|
||||||
@ -318,6 +320,8 @@ void floppy_image_device::device_start()
|
|||||||
{
|
{
|
||||||
rpm = 0;
|
rpm = 0;
|
||||||
motor_always_on = false;
|
motor_always_on = false;
|
||||||
|
dskchg_writable = false;
|
||||||
|
has_trk00_sensor = true;
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
|
|
||||||
@ -454,6 +458,9 @@ image_init_result floppy_image_device::call_load()
|
|||||||
} else if(!mon)
|
} else if(!mon)
|
||||||
ready_counter = 2;
|
ready_counter = 2;
|
||||||
|
|
||||||
|
if (dskchg_writable)
|
||||||
|
dskchg = 1;
|
||||||
|
|
||||||
return image_init_result::PASS;
|
return image_init_result::PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -657,7 +664,7 @@ void floppy_image_device::stp_w(int state)
|
|||||||
if (m_make_sound) m_sound_out->step(cyl*5/tracks);
|
if (m_make_sound) m_sound_out->step(cyl*5/tracks);
|
||||||
}
|
}
|
||||||
/* Update disk detection if applicable */
|
/* Update disk detection if applicable */
|
||||||
if (exists())
|
if (exists() && !dskchg_writable)
|
||||||
{
|
{
|
||||||
if (dskchg==0) dskchg = 1;
|
if (dskchg==0) dskchg = 1;
|
||||||
}
|
}
|
||||||
@ -702,7 +709,7 @@ void floppy_image_device::seek_phase_w(int phases)
|
|||||||
logerror("%s: track %d.%d\n", tag(), cyl, subcyl);
|
logerror("%s: track %d.%d\n", tag(), cyl, subcyl);
|
||||||
|
|
||||||
/* Update disk detection if applicable */
|
/* Update disk detection if applicable */
|
||||||
if (exists())
|
if (exists() && !dskchg_writable)
|
||||||
if (dskchg==0)
|
if (dskchg==0)
|
||||||
dskchg = 1;
|
dskchg = 1;
|
||||||
}
|
}
|
||||||
@ -2052,6 +2059,7 @@ void sony_oa_d31v::setup_characteristics()
|
|||||||
form_factor = floppy_image::FF_35;
|
form_factor = floppy_image::FF_35;
|
||||||
tracks = 70;
|
tracks = 70;
|
||||||
sides = 1;
|
sides = 1;
|
||||||
|
dskchg_writable = true;
|
||||||
set_rpm(600);
|
set_rpm(600);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2087,6 +2095,7 @@ void sony_oa_d32w::setup_characteristics()
|
|||||||
form_factor = floppy_image::FF_35;
|
form_factor = floppy_image::FF_35;
|
||||||
tracks = 80;
|
tracks = 80;
|
||||||
sides = 2;
|
sides = 2;
|
||||||
|
dskchg_writable = true;
|
||||||
set_rpm(600);
|
set_rpm(600);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2123,6 +2132,7 @@ void sony_oa_d32v::setup_characteristics()
|
|||||||
form_factor = floppy_image::FF_35;
|
form_factor = floppy_image::FF_35;
|
||||||
tracks = 80;
|
tracks = 80;
|
||||||
sides = 1;
|
sides = 1;
|
||||||
|
dskchg_writable = true;
|
||||||
set_rpm(600);
|
set_rpm(600);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2287,14 +2297,13 @@ ibm_6360::~ibm_6360()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//ol ibm_6360::trk00_r() { return true; }
|
|
||||||
|
|
||||||
void ibm_6360::setup_characteristics()
|
void ibm_6360::setup_characteristics()
|
||||||
{
|
{
|
||||||
form_factor = floppy_image::FF_8;
|
form_factor = floppy_image::FF_8;
|
||||||
tracks = 77;
|
tracks = 77;
|
||||||
sides = 1;
|
sides = 1;
|
||||||
motor_always_on = true;
|
motor_always_on = true;
|
||||||
|
has_trk00_sensor = false;
|
||||||
set_rpm(360);
|
set_rpm(360);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ public:
|
|||||||
|
|
||||||
bool wpt_r() { return wpt; }
|
bool wpt_r() { return wpt; }
|
||||||
int dskchg_r() { return dskchg; }
|
int dskchg_r() { return dskchg; }
|
||||||
bool trk00_r() { return cyl != 0; }
|
bool trk00_r() { return (has_trk00_sensor ? (cyl != 0) : 1); }
|
||||||
int idx_r() { return idx; }
|
int idx_r() { return idx; }
|
||||||
int mon_r() { return mon; }
|
int mon_r() { return mon; }
|
||||||
bool ss_r() { return ss; }
|
bool ss_r() { return ss; }
|
||||||
@ -124,6 +124,7 @@ public:
|
|||||||
void dir_w(int state) { dir = state; }
|
void dir_w(int state) { dir = state; }
|
||||||
void ss_w(int state) { ss = state; }
|
void ss_w(int state) { ss = state; }
|
||||||
void inuse_w(int state) { }
|
void inuse_w(int state) { }
|
||||||
|
void dskchg_w(int state) { if (dskchg_writable) dskchg = state; }
|
||||||
|
|
||||||
void index_resync();
|
void index_resync();
|
||||||
attotime time_next_index();
|
attotime time_next_index();
|
||||||
@ -162,6 +163,8 @@ protected:
|
|||||||
int sides; /* number of heads */
|
int sides; /* number of heads */
|
||||||
uint32_t form_factor; /* 3"5, 5"25, etc */
|
uint32_t form_factor; /* 3"5, 5"25, etc */
|
||||||
bool motor_always_on;
|
bool motor_always_on;
|
||||||
|
bool dskchg_writable;
|
||||||
|
bool has_trk00_sensor;
|
||||||
|
|
||||||
/* state of input lines */
|
/* state of input lines */
|
||||||
int dir; /* direction */
|
int dir; /* direction */
|
||||||
|
@ -55,7 +55,7 @@ int wd177x_format::compute_track_size(const format &f) const
|
|||||||
return track_size;
|
return track_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wd177x_format::build_sector_description(const format &f, uint8_t *sectdata, desc_s *sectors) const
|
void wd177x_format::build_sector_description(const format &f, uint8_t *sectdata, desc_s *sectors, int track, int head) const
|
||||||
{
|
{
|
||||||
if(f.sector_base_id == -1) {
|
if(f.sector_base_id == -1) {
|
||||||
for(int i=0; i<f.sector_count; i++) {
|
for(int i=0; i<f.sector_count; i++) {
|
||||||
@ -200,7 +200,6 @@ bool wd177x_format::load(io_generic *io, uint32_t form_factor, floppy_image *ima
|
|||||||
|
|
||||||
uint8_t sectdata[40*512];
|
uint8_t sectdata[40*512];
|
||||||
desc_s sectors[40];
|
desc_s sectors[40];
|
||||||
build_sector_description(f, sectdata, sectors);
|
|
||||||
|
|
||||||
for(int track=0; track < f.track_count; track++)
|
for(int track=0; track < f.track_count; track++)
|
||||||
for(int head=0; head < f.head_count; head++) {
|
for(int head=0; head < f.head_count; head++) {
|
||||||
@ -209,6 +208,7 @@ bool wd177x_format::load(io_generic *io, uint32_t form_factor, floppy_image *ima
|
|||||||
else
|
else
|
||||||
desc[16].p1 = get_track_dam_mfm(f, head, track);
|
desc[16].p1 = get_track_dam_mfm(f, head, track);
|
||||||
|
|
||||||
|
build_sector_description(f, sectdata, sectors, track, head);
|
||||||
io_generic_read(io, sectdata, get_image_offset(f, head, track), track_size);
|
io_generic_read(io, sectdata, get_image_offset(f, head, track), track_size);
|
||||||
generate_track(desc, track, head, sectors, f.sector_count, total_size, image);
|
generate_track(desc, track, head, sectors, f.sector_count, total_size, image);
|
||||||
}
|
}
|
||||||
@ -330,10 +330,10 @@ bool wd177x_format::save(io_generic *io, floppy_image *image)
|
|||||||
|
|
||||||
uint8_t sectdata[40*512];
|
uint8_t sectdata[40*512];
|
||||||
desc_s sectors[40];
|
desc_s sectors[40];
|
||||||
build_sector_description(f, sectdata, sectors);
|
|
||||||
|
|
||||||
for(int track=0; track < f.track_count; track++)
|
for(int track=0; track < f.track_count; track++)
|
||||||
for(int head=0; head < f.head_count; head++) {
|
for(int head=0; head < f.head_count; head++) {
|
||||||
|
build_sector_description(f, sectdata, sectors, track, head);
|
||||||
extract_sectors(image, f, sectors, track, head);
|
extract_sectors(image, f, sectors, track, head);
|
||||||
io_generic_write(io, sectdata, get_image_offset(f, head, track), track_size);
|
io_generic_write(io, sectdata, get_image_offset(f, head, track), track_size);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ protected:
|
|||||||
virtual int get_track_dam_mfm(const format &f, int head, int track);
|
virtual int get_track_dam_mfm(const format &f, int head, int track);
|
||||||
|
|
||||||
int compute_track_size(const format &f) const;
|
int compute_track_size(const format &f) const;
|
||||||
void build_sector_description(const format &d, uint8_t *sectdata, desc_s *sectors) const;
|
virtual void build_sector_description(const format &d, uint8_t *sectdata, desc_s *sectors, int track, int head) const;
|
||||||
void check_compatibility(floppy_image *image, std::vector<int> &candidates);
|
void check_compatibility(floppy_image *image, std::vector<int> &candidates);
|
||||||
void extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head);
|
void extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user