[comp.sys.amiga.hardware] Floppy Disk Controller

clp@altos86.Altos.COM (Chuck L. Peterson) (08/25/90)

I'm working on some stuff which will read the raw data from the disk
and do the MFM encoding.  I want to completely control the floppy drive
from my program, so I don't want to call DoIO to read the entire track.
I seem to be stuck selecting the drive (of all things).
The confusing 1.3 Hardware Reference Manual states on page 238:

DSKMOTOR*
	Disk motor control (active low). This signal is nonstandard on
	the amiga system.  Each drive will latch the motor signal at
	the time its select signal turns on.  The disk drive motor will
	stay in this state until the next time select turns on.
	DSKMOTOR* also controls the activity light on the front of the
	disk drive.  [What ?!?]

	All software that selects drives must set up the motor signal before
	selecting any drives.  This drive will "remember" the state of
	its motor when it is not selected.  All drive motors turn
	off after system reset.

	After turning on the motor, software must further wait for one half
	second (500ms) or for the DSKRDY* line to go low.

The drive select bits are: DSKSEL3* DSKSEL2* DSKSEL1* and DSKSEL0*.

So okay, great; you should be able to spin up the drive with
on of these:

	unsigned short x = 0xff;
	x &= ~(CIAF_DSKMOTOR|CIAF_DSKSEL0);

	ciab.ciaprb = x;

	while (t=(ciaa.ciapra & CIAF_DSKRDY))
		printf("ciapra=0x%x\n, t);

OR THIS:
	unsigned short x = 0xff;
	x &= ~CIAF_DSKMOTOR;
	ciab.ciaprb = x;

	x |= CIAF_DSKMOTOR;
	x &= ~CIAF_DSKSEL0;
	ciab.ciaprb = x;

	while (t=(ciaa.ciapra & CIAF_DSKRDY))
		printf("ciapra=0x%x\n, t);

This code flashes the floppy light, then spews out 0xfc forever.
Any help would be greatly appreciated.

Is the trackdisk.library floppy driver source available anywhere?
It would be smart for Commodore/Amiga to publish their source
since you have to buy their multi-thousand dollar machines to run it.

Chuck L. Peterson
clp@altos.com