| 4708 | static int linecounter; |
| 4709 | |
| 4710 | void DISK_hsync (void) |
| 4711 | { |
| 4712 | int dr; |
| 4713 | |
| 4714 | for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { |
| 4715 | drive *drv = &floppy[dr]; |
| 4716 | if (drv->steplimit) |
| 4717 | drv->steplimit--; |
| 4718 | if (drv->revolution_check) |
| 4719 | drv->revolution_check--; |
| 4720 | |
| 4721 | if (drv->dskready_down_time > 0) |
| 4722 | drv->dskready_down_time--; |
| 4723 | /* emulate drive motor turn on time */ |
| 4724 | if (drv->dskready_up_time > 0 && !drive_empty (drv)) { |
| 4725 | drv->dskready_up_time--; |
| 4726 | if (drv->dskready_up_time == 0 && !drv->motoroff) |
| 4727 | drv->dskready = true; |
| 4728 | } |
| 4729 | if (drv->dskeject_time > 0) { |
| 4730 | drv->dskeject_time--; |
| 4731 | } |
| 4732 | /* delay until new disk image is inserted */ |
| 4733 | if (drv->dskchange_time > 0) { |
| 4734 | drv->dskchange_time--; |
| 4735 | if (drv->dskchange_time == 0) { |
| 4736 | drive_insert(drv, &currprefs, dr, drv->newname, false, drv->newnamewriteprotected); |
| 4737 | if (disk_debug_logging > 0) |
| 4738 | write_log(_T("delayed insert, drive %d, image '%s'\n"), dr, drv->newname); |
| 4739 | update_drive_gui(dr, false); |
| 4740 | } |
| 4741 | } |
| 4742 | |
| 4743 | #ifdef FLOPPYBRIDGE |
| 4744 | if (drv->bridge && drv->writepending) { |
| 4745 | // With bridge we wait for the disk to commit the data before firing the DMA |
| 4746 | if (drv->bridge->isWriteComplete()) { |
| 4747 | disk_dmafinished(); |
| 4748 | drv->writepending = false; |
| 4749 | } |
| 4750 | } |
| 4751 | #endif |
| 4752 | |
| 4753 | |
| 4754 | } |
| 4755 | if (indexdecay) { |
| 4756 | indexdecay--; |
| 4757 | } |
| 4758 | if (linecounter) { |
| 4759 | linecounter--; |
| 4760 | if (! linecounter) { |
| 4761 | disk_dmafinished(); |
| 4762 | } |
| 4763 | return; |
| 4764 | } |
| 4765 | DISK_update (maxhpos); |
| 4766 | DISK_update_predict(); |
| 4767 |
no test coverage detected