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;
}
}