MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / DISK_update_predict

Function DISK_update_predict

src/disk.cpp:4144–4264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4142}
4143
4144void DISK_update_predict(void)
4145{
4146 int finaleventcycle = maxhpos << 8;
4147 int finaleventflag = 0;
4148 bool noselected = true;
4149
4150 int startcycle = disk_hpos;
4151
4152 for (int dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
4153 drive *drv = &floppy[dr];
4154
4155 if (drv->motoroff)
4156 continue;
4157 if (!drv->trackspeed)
4158 continue;
4159 if ((selected | disabled) & (1 << dr))
4160 continue;
4161
4162 bool isempty = drive_empty(drv);
4163 bool isunformatted = unformatted(drv);
4164 int mfmpos = drv->mfmpos;
4165 bool tdsksync_on = dsksync_on;
4166 if (drv->tracktiming[0])
4167 updatetrackspeed (drv, mfmpos);
4168 int diskevent_flag = 0;
4169 uae_u32 tword = word;
4170 noselected = false;
4171 int countcycle = startcycle;
4172 int tdsklength = dsklength;
4173 int tbitoffset = bitoffset;
4174
4175 while (countcycle < (maxhpos << 8)) {
4176 int inc = nextbit(drv);
4177 if (drv->tracktiming[0])
4178 updatetrackspeed (drv, mfmpos);
4179 if (dskdmaen != DSKDMA_WRITE || (dskdmaen == DSKDMA_WRITE && !dma_enable)) {
4180 tword <<= 1;
4181 if (!isempty) {
4182 if (isunformatted)
4183 tword |= (uaerand () & 0x1000) ? 1 : 0;
4184 else
4185 tword |= getonebit(drv, drv->bigmfmbuf, mfmpos, &inc);
4186 }
4187 if ((tword & 0xffff) != dsksync) {
4188 tdsksync_on = false;
4189 }
4190 if ((tword & 0xffff) == dsksync && !tdsksync_on) {
4191 diskevent_flag |= DISK_WORDSYNC;
4192 tdsksync_on = true;
4193 }
4194 }
4195 int pmfmpos = mfmpos;
4196 mfmpos += inc;
4197 mfmpos %= drv->tracklen;
4198 if (!dskdmaen) {
4199 if (mfmpos == 0)
4200 diskevent_flag |= DISK_REVOLUTION << (drv - floppy);
4201 if (drive_at_index(drv, pmfmpos, mfmpos))

Callers 6

event_DISK_handlerFunction · 0.85
DSKBYTRFunction · 0.85
DISK_hsyncFunction · 0.85
DSKLENFunction · 0.85
DSKSYNCFunction · 0.85
ADKCONFunction · 0.85

Calls 11

drive_emptyFunction · 0.85
unformattedFunction · 0.85
updatetrackspeedFunction · 0.85
nextbitFunction · 0.85
getonebitFunction · 0.85
drive_at_indexFunction · 0.85
dmaenFunction · 0.85
disk_fifostatusFunction · 0.85
uaerandFunction · 0.70
write_logFunction · 0.70

Tested by

no test coverage detected