[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apple floppy adaptor. I'm stuck!



Tristan Mumford wrote:

> Judging by the function of the stepping routines and the breakdown of the
> method of stepping in UTA2, I would say I am properly decoding all normal
> states of the step phase lines. However if there is other software that
> forces it to activate other combinations it will just consider that an
> illegal combination, do nothing and happily aid in destroying the contents
> of the disk :)

Hmmm... maybe this stepping code from YAE could help with the odd stuff?
Note that the numbers given in the table and held in physical_track_no
are *quarter* tracks.

static int	stepper_movement_table[16][NO_OF_PHASES] = {
	{  0,  0,  0,  0,  0,  0,  0,  0 },	/* all electromagnets off */
	{  0, -1, -2, -3,  0,  3,  2,  1 },	/* EM 1 on */
	{  2,  1,  0, -1, -2, -3,  0,  3 },	/* EM 2 on */
	{  1,  0, -1, -2, -3,  0,  3,  2 },	/* EMs 1 & 2 on */
	{  0,  3,  2,  1,  0, -1, -2, -3 },	/* EM 3 on */
	{  0, -1,  0,  1,  0, -1,  0,  1 },	/* EMs 1 & 3 on */
	{  3,  2,  1,  0, -1, -2, -3,  0 },	/* EMs 2 & 3 on */
	{  2,  1,  0, -1, -2, -3,  0,  3 },	/* EMs 1, 2 & 3 on */
	{ -2, -3,  0,  3,  2,  1,  0, -1 },	/* EM 4 on */
	{ -1, -2, -3,  0,  3,  2,  1,  0 },	/* EMs 1 & 4 on */
	{  0,  1,  0, -1,  0,  1,  0, -1 },	/* EMs 2 & 4 */
	{  0, -1, -2, -3,  0,  3,  2,  1 },	/* EMs 1, 2 & 4 on */
	{ -3,  0,  3,  2,  1,  0, -1, -2 },	/* EMs 3 & 4 on */
	{ -2, -3,  0,  3,  2,  1,  0, -1 },	/* EMs 1, 3 & 4 on */
	{  0,  3,  2,  1,  0, -1, -2, -3 },	/* EMs 2, 3 & 4 on */
	{  0,  0,  0,  0,  0,  0,  0,  0 } };	/* all electromagnets on */
static void toggleStepper( ADDR address )
{
	int	magnet, on, old_track_no, new_status,phase;

	if ( track_buffer_valid )
	   save_track_buffer();
	magnet = (address & 0x0E) >> 1;
	on = address & 0x01;
	old_track_no = physical_track_no[current_slot][current_drive];
	if ( on )
	   stepper_status |= (1<<magnet);
	else
	   stepper_status &= ~(1<<magnet);
	if ( motor_on ) {
	   new_status = stepper_status;
	   phase = physical_track_no[current_slot][current_drive] & 0x07;
	   physical_track_no[current_slot][current_drive] +=
	       stepper_movement_table[new_status][phase];
	   if ( physical_track_no[current_slot][current_drive] < 0 ) {
#ifdef DEBUG
	      fprintf( stderr, "Grrrr....\n" );
#endif
	      physical_track_no[current_slot][current_drive] = 0;
	   }
	   else if ( physical_track_no[current_slot][current_drive] >=
MAX_PHYSICAL_TRACK_NO )
	      physical_track_no[current_slot][current_drive] =
MAX_PHYSICAL_TRACK_NO-1;
	   track_buffer_valid = 0;
	}

}









> 
> 
>>> Another possibility I guess is that I have some kind of weird error in
>>> the head movement causing it to move to the wrong tracks.
>>>
>>> Is there some kind of low level format that I can do on an apple floppy.
>>> I tried the ProDOS format, but it looks like it only does track 0,
>>> somewhere in the middle, and track35? I just got that from watching the
>>> head movements.
>> Then there is something wrong with the head movements, because both DOS
>> and ProDOS format all 35 tracks, starting with track 0.
> 
> Hmm... I'll have to give it another good looking over. I'm going to change
> the names of a couple of the "#define" directives in my code for
> readability as it is. Ie change my "UP" and "DOWN" to "IN" and "OUT" for
> head direction reference. I suspect that I have a case of double
> backwardsness, causing the head to step in the right direction but the
> filtering logic not to work right.
>   
>>> I'm hoping I can get this issue sorted, because it's nearly done! I hope
>>> I can get it working right, because I actually decided to use a
>>> calculator to figure out final storage capacity *Gasp!*. A 2HD disk
>>> should hold 640kb. In it's current form a normal 2HD disk appears as one
>>> big single-sided 160 track disk.
>> Several places in the Disk ][ driver/RWTS think that a disk has at most
>> 40 or so tracks--like recalibration.
> 
> D'oh! I wonder what I can do about that. Because I have ultimate control of
> the head I guess I could make a single floppy into 4 x semi-virtual 40
> track drives. The uC keeps track of the trackcount, direction, and side of
> disk so it shouldn't be too hard at all.
> 
> Tristan.
>