On 05/02/11 14:22, Steven Hirsch wrote:
Does the scripting language talk to a C/C++ library at
the low level, or
do you twiddle bits directly?
libdiscferret (the C API) relies on bit-twiddling. The Lua scripts are
used by the application software (specifically: discferret-read-disc) to
handle conversion between a drive 'name' (e.g. 'pc35a-80t') and the
lines which need to be made active in order to select the drive (e.g.
MOTEN, DS0, ...) and pick the correct head (SIDESEL, DS1, DS2, DS3 or
whatever the assignment is).
The pindefs generally vary depending on how the drive has been
connected. The Winchester adapter board wires HEAD_2^3 to DS3, for
instance. This is why there's a script to handle drive selection: I
don't want to end up recompiling loads of C code just to change a pindef!
Can you elaborate just a wee bit on how the
script talks to hardware?
The script doesn't talk to hardware directly. Libdiscferret provides the
hardware interface layer, in the form of bit-twiddling (actually
register POKEs and PEEKs). The Lua script takes a parameter set from the
application (current head, track and sector, etc.) and converts these
into a pin state.
The disc script tells the application what needs to be done to read the
disc. That is:
- Acquisition mode -- index-locked, MFM-locked, hard-sector mark, ...
- Min/max track number
- Min/max head number
- Disc class (must match the drive's Disc Class; mainly used to stop
Winchester profiles from being used with 80tk floppy drives).
Does this make it any clearer?
Thanks,
--
Phil.
classiccmp at philpem.me.uk
http://www.philpem.me.uk/