[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Whole track writing code?
sicklittlemonkey wrote:
Well, there's sample write track code in Beneath Apple Prodos:
ftp://ftp.a2central.com/pub/documents/beneathprodos.pdf
Look at the "Format" utility in Appendix A. Note that if you want to
write a track which you've read in yourself, you'll have to detect
auto-sync nibbles. The Format utility uses #$80 to represent these.
Since you are writing out a track image that was read from a
disk, you may also want to preserve the actual values of the
sync nibbles.
A good representation of sync nibbles is the actual read value
with the high bit turned off (since it is always on). If you
need to represent both 36-cycle and 40-cycle sync nibbles, you
can turn off the high bit for 36-cycle nibbles and turn off both
the high bit and the low bit for 40-cycle nibbles.
Stephen Thomas suggested this representation to me, since the
low bit of any 40-cycle nibble must be 1 to avoid violating the
"no more than two consecutive zeroes" rule for the disk controller.
The track write routine is pretty simple, since its just a matter
of preserving 32-, 36-, or 40-cycle timing while looping through
the stored nibble image. Of course, the writing of the actual
image must be preceded by writing a sufficiently large number
of sync nibbles to ensure overlap.
If you know that only one timing of sync nibbles is used, then
it's even simpler.
-michael
Music synthesis for 8-bit Apple II's!
Home page: http://members.aol.com/MJMahon/
"The wastebasket is our most important design
tool--and it is seriously underused."