[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dealing with disk 2 controller
In article <3259bb14.14511636@tomato.dussco.com> paulf@aphrodite.com writes:
>I have a need to read and write sectors to a 5.25" disk talking to the
>disk 2 controller directly (I don't have time to go into why) - that
>is, outside of DOS 3.3 or ProDOS. So far, I am able to READ and
>decode the sectors just fine, but for going the other way, I know what
>needs to be written to the disk, I'm just not sure how. What I do
>know is the byte to be written gets loaded into C0xD, and C0xC is
>read to actually do the write.
>
>Specifically:
>
>Do I need to exactly sit for a specific time between writes, or is
>there something I can read and wait on during the write (like read a
>location until it hits 0?)
Yes...the interval between writes must be exactly 32 cycles (at slow speed,
if you have a IIGS or an otherwise-accellerated machine). The hardware
won't tell you when 32 cycles have passed.
This means you need to get out your 6502 reference card, and count the cycles
in your write loop very carefully, remembering all the little quirks like
branches taking longer if you branch across a page boundary, and indexed
addressing taking longer if you index across a page boundary.
>Is there a specific book I can look for (but good luck finding it) on
>this? Anybody have some source code doing this?
The almost-definitive reference for this sort of stuff is _Beneath_Apple_
_DOS_ by Don Worth and Pieter Lechner. I think you can still order it from
Byteworks.
If you have WWW access, check out
http://cie-2.uoregon.edu/cgi-bin/zcat/~nparker/disk5.25. It tells all
about accessing the 5.25-inch drive I/O switches, and includes some sample
code for writing (admittedly, it's not very practical source code, but it
does illustrate how you have to count cycles).
- Neil Parker
--
Neil Parker | No cute quote, no cute ASCII art, no cute
nparker@cie-2.uoregon.edu | disclaimer, no deposit, no return....
nparker@cie.uoregon.edu | (This space intentionally left blank:
http://cie-2.uoregon.edu/~nparker | )