tonioni / WinUAE

WinUAE Amiga emulator
http://www.winuae.net/
528 stars 86 forks source link

DSKBYTR WORDEQUAL can be set before DATA visible #249

Open mras0 opened 1 year ago

mras0 commented 1 year ago

Minor detail, and I doubt any software depends on it, but I don't think this is currently implemented in WinUAE.

The data visible in the DSKBYTR register seems to be delayed compared to the value used for WORDSYNC. Here's data captured on an A1000 (with real floppy drive):

image

The highlighted sequence shows that $5044 and $D089 was read from DSKBYTR (i.e. WORDEQUAL was set before the $89 byte was ready).

I know you prefer smaller test cases, so I made a simpler one that reads a track 41 times and counts how often $5044 is read from DSKBYTR. On my A1200 w/ gotek it's ~70-80 times (the count is displayed in hex), while in WinUAE it seems to never happen.

dskbytr.zip (apologies in advance for the stupid code)

tonioni commented 1 year ago

Yeah, there is something unexplained and my plan was always been to examine disk details before 5.0.

I thought DSKBYTR 8-bits of data are directly from internal buffer that is also used for DSKSYNC comparison but that isn't true.

Easy test: load something, then deselect drives, check all possible DSKSYNC values and exit loop if WORDSYNC bit gets set after writing to DSKSYNC. Value can be totally different than DSKBYTR 8-bit data.

EDIT: It looks like WORDSYNC bit is set 1 CCK before DSKBYTR data is loaded. Probable reason is DSKBYTR data part needing 1 CCK to load the latch but WORDSYNC bit is "live" data direct from DSKSYNC comparator.