mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
floppy: Fixed write protected signal and added a callback for it. [Curt Coder]
This commit is contained in:
parent
e606fe6131
commit
e649b84050
@ -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) {
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
typedef delegate<void (floppy_image_device *)> unload_cb;
|
||||
typedef delegate<void (floppy_image_device *, int)> index_pulse_cb;
|
||||
typedef delegate<void (floppy_image_device *, int)> ready_cb;
|
||||
typedef delegate<void (floppy_image_device *, int)> 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);
|
||||
|
Loading…
Reference in New Issue
Block a user