src/mess/devices/flopdrv.c
| r6637 | r6638 | |
| 339 | 339 | /*************************************************************************/ |
| 340 | 340 | /* IO_FLOPPY device functions */ |
| 341 | 341 | |
| 342 | | /* return and set current status |
| 343 | | use for setting:- |
| 344 | | 1) write protect/enable |
| 345 | | 2) drive present/missing |
| 346 | | */ |
| 347 | | |
| 348 | | int floppy_status(const device_config *img, int new_status) |
| 349 | | { |
| 350 | | /* return current status only? */ |
| 351 | | if (new_status!=-1) |
| 352 | | { |
| 353 | | /* we don't set the flags directly. |
| 354 | | The flags are "cooked" when we do a floppy_drive_get_flag_state depending on |
| 355 | | if drive is connected etc. So if we wrote the flags back it would |
| 356 | | corrupt this information. Therefore we update the flags depending on new_status */ |
| 357 | | |
| 358 | | floppy_drive_set_flag_state(img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED, (new_status & FLOPPY_DRIVE_DISK_WRITE_PROTECTED)); |
| 359 | | } |
| 360 | | |
| 361 | | /* return current status */ |
| 362 | | return floppy_drive_get_flag_state(img,0x0ff); |
| 363 | | } |
| 364 | | |
| 365 | 342 | /* set flag state */ |
| 366 | 343 | void floppy_drive_set_flag_state(const device_config *img, int flag, int state) |
| 367 | 344 | { |
src/mess/machine/smc92x4.c
| r6637 | r6638 | |
| 255 | 255 | static UINT8 floppy_get_disk_status(running_machine *machine,int which, int disk_unit) |
| 256 | 256 | { |
| 257 | 257 | const device_config *disk_img = floppy_get_device(machine, disk_unit); |
| 258 | | int status = floppy_status(disk_img, -1); |
| 259 | | int reply; |
| 258 | int reply = 0; |
| 260 | 259 | |
| 261 | | reply = 0; |
| 262 | | if (status & FLOPPY_DRIVE_INDEX) |
| 260 | if (floppy_drive_get_flag_state(disk_img, FLOPPY_DRIVE_INDEX) == FLOPPY_DRIVE_INDEX) |
| 263 | 261 | reply |= DS_INDEX; |
| 264 | | reply |= DS_SKCOM; |
| 265 | | if (status & FLOPPY_DRIVE_HEAD_AT_TRACK_0) |
| 262 | if (floppy_drive_get_flag_state(disk_img, FLOPPY_DRIVE_HEAD_AT_TRACK_0) == FLOPPY_DRIVE_HEAD_AT_TRACK_0) |
| 266 | 263 | reply |= DS_TRK00; |
| 267 | | if (status & FLOPPY_DRIVE_DISK_WRITE_PROTECTED) |
| 264 | if (floppy_drive_get_flag_state(disk_img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED) == FLOPPY_DRIVE_DISK_WRITE_PROTECTED) |
| 268 | 265 | reply |= DS_WRPROT; |
| 269 | | if /*(status & FLOPPY_DRIVE_READY)*/(image_exists(disk_img)) |
| 266 | if (image_exists(disk_img)) |
| 270 | 267 | reply |= DS_READY; |
| 271 | 268 | |
| 269 | reply |= DS_SKCOM; |
| 270 | |
| 272 | 271 | return reply; |
| 273 | 272 | } |
| 274 | 273 | |