| 4773 | } |
| 4774 | |
| 4775 | void DISK_update (int tohpos) |
| 4776 | { |
| 4777 | int dr; |
| 4778 | int cycles; |
| 4779 | |
| 4780 | if (disk_hpos < 0) { |
| 4781 | disk_hpos = -disk_hpos; |
| 4782 | return; |
| 4783 | } |
| 4784 | |
| 4785 | cycles = (tohpos << 8) - disk_hpos; |
| 4786 | if (cycles <= 0) { |
| 4787 | return; |
| 4788 | } |
| 4789 | |
| 4790 | disk_hpos += cycles; |
| 4791 | if (disk_hpos >= (maxhpos << 8)) { |
| 4792 | disk_hpos %= 1 << 8; |
| 4793 | } |
| 4794 | |
| 4795 | dskbytr_delay = false; |
| 4796 | |
| 4797 | for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { |
| 4798 | drive *drv = &floppy[dr]; |
| 4799 | |
| 4800 | if (drv->motoroff || !drv->tracklen || !drv->trackspeed) { |
| 4801 | continue; |
| 4802 | } |
| 4803 | drv->floppybitcounter += cycles; |
| 4804 | if ((selected | disabled) & (1 << dr)) { |
| 4805 | drv->mfmpos += drv->floppybitcounter / drv->trackspeed; |
| 4806 | drv->mfmpos %= drv->tracklen; |
| 4807 | drv->floppybitcounter %= drv->trackspeed; |
| 4808 | continue; |
| 4809 | } |
| 4810 | if (drv->diskfile) { |
| 4811 | drive_fill_bigbuf(drv, side, 0); |
| 4812 | } |
| 4813 | #ifdef FLOPPYBRIDGE |
| 4814 | if (drv->bridge) { |
| 4815 | drive_fill_bigbuf(drv, side, 0); |
| 4816 | } |
| 4817 | #endif |
| 4818 | drv->mfmpos %= drv->tracklen; |
| 4819 | } |
| 4820 | int didaccess = 0; |
| 4821 | bool done_jitter = false; |
| 4822 | for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { |
| 4823 | drive *drv = &floppy[dr]; |
| 4824 | if (drv->motoroff || !drv->trackspeed) |
| 4825 | continue; |
| 4826 | if ((selected | disabled) & (1 << dr)) |
| 4827 | continue; |
| 4828 | if (!done_jitter) { |
| 4829 | update_jitter(); |
| 4830 | done_jitter = true; |
| 4831 | } |
| 4832 | /* write dma and wordsync enabled: read until wordsync match found */ |
no test coverage detected