neodev wrote: ↑
04 Jul 2019, 17:26
Yes, I mean that the seek time is currently enabled just for a few games, instead of being an user accessible option. Seek time is calculated from the current sector to the destination sector.
The calculation should be a little more complicated than that, but if implemented properly you wouldn't need to try to recognize any games.
seek time = head movement time + settling time + rotation time to destination sector
For purpose of simplicity, the spiral of the CD can be considered as a number of tracks during movement. At the inner edge there are roughly 8 sectors per "track", and at the outer edge there are a lot more (should be in my public notes; I recall it was around 20).
For head movement time, you first need to calculate distance; you can use a lookup table with zones (i.e. "8 sector per track zone starts here and ends here"). This helps calculate how many tracks are traversed, based on sectors to travel and start/end disc position.
Next, the head movement is not linear, but I provided a bunch of measurements in my notes. Calculations don't need to be exact, but should at least be close; there are only a few games sensitive to minimum times, and the original hardware also had variances.
For short distances, head rotation is the biggest factor. Moving 2 sectors will definitely incur a penalty of at least one rotation which is minimum 106ms (minimum 8 sectors, at 75 sectors pre second regular playback rate), but depends on where the head is on the disc, since rotation becomes slower toward the outer edge.
The head settling time usually doesn't come into play, but is a random element which has a greater effect on shorter-distance seeks. My measurements randomly had additional 1-rotation penalties, as the head occasionally needed to refocus.
I did not try to calculate the rotational position of the disc at the arrival of the head (in order to identify how much of a rotation is required after the head settles). It's a very difficult calculation, and probably won't be correct anyway, as this would depend on the exact disc master. Instead, a full rotation should be used when the movement is close, and a partial rotation (>= 50%) should be used for distant movements. But there should be no harm in keeping it 100% of a rotation.