Re: Model 4 Disk Drive Issue
- From: Frank Durda IV <uhclemLOSE.aug08@xxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 3 Aug 2008 00:11:38 GMT
Ira <youknow@xxxxxxxxxxxxxx> wrote:
: Frank, do you have any other ideas?
:
: 1) He had already successfully started up into Model III Cass-mode so
: the contrast was not an issue.
: 2) I had personally prepared the disks for him so I know they were
: single sided.
3. In ROM BASIC (or Model III disk basic for those who can do it)
enter this program:
10 DEFINT A-Z
20 F=240
30 S=244
40 OUT S,129
50 OUT F,208
60 FOR D=1 TO 100
70 NEXT D
80 PRINT "R";INP(F)
100 OUT F,15
110 L=INP(F)
120 PRINT "S";0;L
130 FOR X=1 TO 500
140 N=INP(F)
150 IF L<>N THEN PRINT "N";X;N, : L=N
160 OUT S,129
200 NEXT X
210 PRINT "F";X;N
220 STOP
500 DEFINT A-Z
510 F=240
520 S=244
530 OUT S,129
540 OUT F,208
550 FOR D=1 TO 100
560 NEXT D
570 PRINT "R";INP(F)
580 OUT F+3,34
590 OUT F,31
600 GOTO 110
CAUTION: Although as coded this program will only read diskettes,
if there are any typos changing any value even slightly, a disk
controller command could be changed to one that does write. I strongly
suggest write-protecting media in drive 0 used with this program and
remove media from all other drives.
This program has two parts. When just executed with the "RUN" command,
it will select drive 0 and force it to cylinder/track 0. It also uses
the slowest step rate possible so as to make as much noise as possible.
(If you have Tandon drives you will need to change the step rate*. If
the step rate is anything other than 6msec, Tandon drives frequently step
in unexpected ways, possibly changing direction several times in one
command, so you will have no idea where you end up.) Finally, once
the drive is reached where track 0 should be, it will also see if it
can read a media ID off the diskette in the drive to confirm its location.
The second half of the program forces the drive to step out to track 34
(not 40 in case you have ancient drives). It also uses a low step
rate. This part is invoked with the command "RUN 500".
Now, what happens when you do just plain "RUN"? Well it outputs a bunch
of numbers, and you will need to do some decimal to hexadecimal
conversions to determine what you are looking at.
Let's start with valid Model III/Model IV double-density media in drive 0,
and the door closed. a "RUN" will display something like:
R 96
N 31 99 N 32 97 N 67 101 N 7 100
N 82 102 N 83 100 N 122 102 N 123 100
N 147 102 N 148 100 N 173 102 N 174 100
N 198 102 N 199 100 N 267 68 N 294 70
....
F 501 70
Okay, what did all of that tell you? Quite a lot. The second number of
each group is content of the floppy disk controller status register.
The first number is when in the FOR/NEXT loop that value was reported.
The code is written so that it only shows you values when they changed
from the last time a value was displayed.
The values are in decimal, so you have to convert them to hex/binary to
be much use. The values that appeared above (roughly in order) are:
Decimal Hexadecimal Binary 7 6 5 4 3 2 1 0
99 0x63 0 1 1 0 0 0 1 1
97 0x61 0 1 1 0 0 0 0 1
101 0x65 0 1 1 0 0 1 0 1
Beyond here, the controller is no longer busy and has finished the command
100 0x64 0 1 1 0 0 1 0 0
102 0x66 0 1 1 0 0 1 1 0
68 0x44 0 1 0 0 0 1 0 0
70 0x46 0 1 0 0 0 1 1 0
Now, if you will all turn to Table 4 STATUS REGISTER SUMMARY in your
Western Digital June 1984 Storage Management Products manual...
Yeah, I thought so. Okay, here are what those bits mean for the
commands this program uses:
7 NOT READY
6 WRITE PROTECT
5 HEAD LOADED
4 SEEK ERROR
3 CRC ERROR
2 TRACK 0
1 INDEX PULSE
0 BUSY
Okay, what do we know? When the status register is an odd value (BIT 0
BUSY is set), a command is being performed, so for the time when we
were getting 99, 97 and 101 values, the disk controller was still performing
the command at hand, and so the results are not fully determined.
You should not pay attention to the SEEK ERROR and CRC ERROR bits
while BUSY is still set. The other values can be observed while
a command is in progress and get reasonable information.
When Bit 1 comes on (99, 102, and 70), it means the the drive is reporting
that the index sensor sees light, presumably because the index hole just
passed between light and sensor. If this bit stays on all the time when
we know the motor is on (and we do because of how the program is written),
seeing bit 1 stay on continuously likely indicates that the drive is
empty. Similarly, if bit 1 stays off all the time and we know the motor
is running, it could indicate the drive has a diskette in it but the door
isn't closed, the media is the wrong type or is inserted incorrectly
(like upside down), or could indicate that the drive has a fault, such as
a frozen spindle. There is no tachometer on the motor itself (or at
least one that we view), so we have to infer motor operation by watching
the index hole or seeing other signs of proper operation.
So, for the drive you want to test, seeing bit 1 blinking on and off is a
good indication that the media is moving and the drive wiring is good
enough to report this status.
Now for Bit 2. When it is a "1", it means the track 0 switch (or
opto-interruptor) on the drive believes that the head carriage is
positioned at track 0. So when we started getting values like 101, 100,
102, 68 and 70, but didn't get those initially, it means the drive was not
on track 0 when the command was issued, but it did move to that position.
Because of the options given to the RESTORE command, the disk controller
will make a further step of looking at the side 0 media in MFM mode and
search for a sector ID, looking to see if the sector ID also shows that
the head is reading track 0. For this part to work, the drive termination
usually has to be correct, and the heads aligned reasonably well (but
don't have to be perfect) so that the controller can read an entire sector
ID field and get a valid checksum on it. This is all handled by the
controller. It reads each sector ID (at the start of each data sector)
for the expected track number and a valid checksum on the sector ID
field. If it gets both the search ends and Bit 4 is set.
If the controller can't find what it wants, it will set SEEK ERROR
(Bit 4) and may also set CRC ERROR (Bit 3) if that was an issue
encountered.
In the above example, there were no media errors, so neither of these bits
are set. If you get a good TRACK 0 indication on media you know isn't
formatted "strange" (See Kim Watt products and other things with
non-standard format patterns), but you get a SEEK ERROR and no CRC ERROR,
then your track 0 switch is out of alignment on this drive, and the head
is positioned over some other track that it can read clearly.
If you get SEEK ERROR AND CRC ERROR, then you may have termination issues
with the cabling, problems with the disk controller, drive head
alignment or speed adjutemt issues. You need other tools to determine
which of these you have.
Next is HEAD LOAD (Bit 5). On the Model III/4 systems that do not
mechanically load and unload the heads, this bit pretty much indicates that
a command has been issued recently and the hardware head load timer
hasn't expired. It deliberately lags after a command ends in case the
controller is given a second command right away that might need the heads
loaded again, so as to reduce the time it takes to get them moved back
against the media. It is largely ignored in the Model I/III/4/4D/4P world.
Bit 0 (BUSY) should be used to determine if the disk controller is still
doing something.
Bit 6 indicates if the drive is reporting the presence of the Write-Protect
tab or not. If set, the media is considered to be write-protected.
Whether this is set will depend on your particular media. Note that
seeing WRITE PROTECT but not seeing any INDEX can indicate the media is
inserted improperly, but could also indicate a write-protected diskette
in a drive with spindle rotation problems. This, like most of the other
status bits, are only valid when a given drive is selected and
its motor is running.
Bit 7 NOT READY is set when the drive/media is not ready. However, the
commands being issued in this program can be performed regardless of the
ready/not-ready state of the drive, so the value is not material here.
One final bit of trivia about the status register: If after issuing a
Force Interrupt command (which the program also does), if the status
register value is 0xff (255), the controller isn't there or it isn't
working (doesn't have power, etc). This is basically the test the boot
ROM does to figure out if you have a disk controller or not.
- - - - - - - - - - - - - - - -
Okay, now to the second half of the program. Assuming you have done a
"RUN" already, doing a "RUN 500" will cause the drive to seek out to
track 34, doing so in the slowest rate possible, hopefully nice and noisy.
RUN 500
S 0 97
N 22 99 N 23 97 N 62 99 N 63 97
N 67 96 N 100 98 N 101 96 N 126 98
N 127 96 N 151 98 N 152 96 N 191 98
N 192 96 N 216 98 N 217 96 N 242 98
N 243 96 N 253 64 N 294 66 N 295 64
F 501 64
Okay, that's different.
Decimal Hexadecimal Binary 7 6 5 4 3 2 1 0
99 0x63 0 1 1 0 0 0 1 1
97 0x61 0 1 1 0 0 0 0 1
Beyond here, the actual command has finished.
96 0x60 0 1 1 0 0 0 0 0
98 0x62 0 1 1 0 0 0 1 0
64 0x40 0 1 0 0 0 0 0 0
66 0x42 0 1 0 0 0 0 1 0
As you can see, by the time the controller was first asked for status, we
were already not over track 0 any more, moving towards track 34.
When the value 96 comes up (0x60), the command is finished, there were no
errors and we aren't at track 0 anymore. The Track register can be read
to ask the controller where it thinks the drive is, but this only what
the controller thinks and not where the drive really is. If you
physically pushed the head carriage from one position to another, the only
way the disk controller will know is when the next command malfunctions,
and that will only happen if the next read or write command doesn't ask
the location to be verified before reading or writing.
As you will no doubt play with this program some, here are
results for a few other conditions:
No media in drive: RUN
R 2
S 0 35
N 69 39 F 501 39
No media in drive: RUN 500
R 3 8
S 0 35
F 501 35
Note that in both cases, when the "F" report (final) is displayed, the disk
controler is still busy (Bit 0 set, aka an odd number). Increasing the
loop value to a higher value won't change, this is a normal failure
condition on this controller. The controller has to be reset to abandon
this command and accept the next one.
Despite failing, 39==27 shows we did reach track 0, even though we had
trouble reading the media. The actual reason the controller hangs is
because it doesn't see index pulses.
Now, with write-protected media in the drive but the door open: RUN
R 96
S 0 97
S 69 101 F 501 101
With write-protected media in the drive but the door open: RUN 500
R 100
S 0 97
F 501 97
Hopefully this will help you do some basic troubleshooting of the floppy
disk controller subsystem.
* If you have drives that can't handle the seek rate (Tandon and other poor
drives) or you just prefer less noise, change these lines:
100 OUT F,12
590 OUT F,16
Frank Durda IV - send mail to this address and remove the "LOSE":
<uhclemLOSE.aug08%nemesis.lonestar.org> http://nemesis.lonestar.org
"Dear Mr Icahn, the reason I and others use Yahoo is because it
isn't controlled by Microsoft. Quit trying to mess this up."
Copyright 2008, ask before reprinting.
.
- Prev by Date: ASM Cassette Images in TRS-80 Emulator
- Next by Date: Re: ASM Cassette Images in TRS-80 Emulator
- Previous by thread: Re: Model 4 Disk Drive Issue
- Next by thread: ASM Cassette Images in TRS-80 Emulator
- Index(es):
Relevant Pages
|