trunk/src/emu/imagedev/floppy.h
| r20323 | r20324 | |
| 49 | 49 | typedef delegate<void (floppy_image_device *)> unload_cb; |
| 50 | 50 | typedef delegate<void (floppy_image_device *, int)> index_pulse_cb; |
| 51 | 51 | typedef delegate<void (floppy_image_device *, int)> ready_cb; |
| 52 | typedef delegate<void (floppy_image_device *, int)> wpt_cb; |
| 52 | 53 | |
| 53 | 54 | // construction/destruction |
| 54 | 55 | floppy_image_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); |
| r20323 | r20324 | |
| 84 | 85 | void setup_unload_cb(unload_cb cb); |
| 85 | 86 | void setup_index_pulse_cb(index_pulse_cb cb); |
| 86 | 87 | void setup_ready_cb(ready_cb cb); |
| 88 | void setup_wpt_cb(wpt_cb cb); |
| 87 | 89 | |
| 88 | 90 | UINT32* get_buffer() { return image->get_buffer(cyl, ss); } |
| 89 | 91 | UINT32 get_len() { return image->get_track_size(cyl, ss); } |
| r20323 | r20324 | |
| 92 | 94 | bool ready_r(); |
| 93 | 95 | double get_pos(); |
| 94 | 96 | |
| 95 | | bool wpt_r() { return output_format == 0; } |
| 97 | bool wpt_r() { return wpt; } |
| 96 | 98 | int dskchg_r() { return dskchg; } |
| 97 | 99 | bool trk00_r() { return cyl != 0; } |
| 98 | 100 | int idx_r() { return idx; } |
| r20323 | r20324 | |
| 166 | 168 | unload_cb cur_unload_cb; |
| 167 | 169 | index_pulse_cb cur_index_pulse_cb; |
| 168 | 170 | ready_cb cur_ready_cb; |
| 171 | wpt_cb cur_wpt_cb; |
| 169 | 172 | |
| 170 | 173 | UINT32 find_position(attotime &base, attotime when); |
| 171 | 174 | int find_index(UINT32 position, const UINT32 *buf, int buf_size); |
trunk/src/emu/imagedev/floppy.c
| r20323 | r20324 | |
| 114 | 114 | cur_ready_cb = cb; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | void floppy_image_device::setup_wpt_cb(wpt_cb cb) |
| 118 | { |
| 119 | cur_wpt_cb = cb; |
| 120 | } |
| 121 | |
| 117 | 122 | void floppy_image_device::set_formats(const floppy_format_type *formats) |
| 118 | 123 | { |
| 119 | 124 | image_device_format **formatptr; |
| r20323 | r20324 | |
| 287 | 292 | |
| 288 | 293 | image = global_alloc(floppy_image(tracks, sides, form_factor)); |
| 289 | 294 | best_format->load(&io, form_factor, image); |
| 295 | output_format = is_readonly() ? 0 : best_format; |
| 290 | 296 | |
| 291 | | if(!is_readonly()) |
| 292 | | output_format = best_format; |
| 293 | | |
| 294 | 297 | revolution_start_time = motor_always_on ? machine().time() : attotime::never; |
| 295 | 298 | revolution_count = 0; |
| 296 | 299 | |
| 297 | 300 | index_resync(); |
| 298 | 301 | image_dirty = false; |
| 299 | | output_format = 0; |
| 300 | 302 | |
| 303 | wpt = 1; // disk sleeve is covering the sensor |
| 304 | if (!cur_wpt_cb.isnull()) |
| 305 | cur_wpt_cb(this, wpt); |
| 306 | |
| 307 | wpt = is_readonly(); |
| 308 | if (!cur_wpt_cb.isnull()) |
| 309 | cur_wpt_cb(this, wpt); |
| 310 | |
| 301 | 311 | if (!cur_load_cb.isnull()) |
| 302 | 312 | return cur_load_cb(this); |
| 303 | 313 | |
| r20323 | r20324 | |
| 317 | 327 | global_free(image); |
| 318 | 328 | image = 0; |
| 319 | 329 | } |
| 330 | |
| 331 | wpt = 1; // disk sleeve is covering the sensor |
| 332 | if (!cur_wpt_cb.isnull()) |
| 333 | cur_wpt_cb(this, wpt); |
| 334 | |
| 335 | wpt = 0; // sensor is uncovered |
| 336 | if (!cur_wpt_cb.isnull()) |
| 337 | cur_wpt_cb(this, wpt); |
| 338 | |
| 320 | 339 | if (!cur_unload_cb.isnull()) |
| 321 | 340 | cur_unload_cb(this); |
| 322 | 341 | if(!ready) { |