ROM Computer Magazine Archive ROM MAGAZINE ISSUE 5 — APRIL/MAY 1984 / PAGE 58

DISK SPEED CHECKER
By BOB COCKROFT

    If your disks get many format errors, or your programs cannot be read by someone elses drive, your drive could be rotating at the wrong speed. Some disk drives, particularly ones manufactured before 1982, have been known to get out of speed adjustment. The drive was intended to spin disks at 288 revolutions per minute(RPM). However, because of a poor data separator, the rotation speed may vary from its correct setting. Although not perfect, the disk should still be able to function correctly when the speed ranges anywhere from 285-290 RPM.
    When a drive rotates too slowly, data is stored so close together that it becomes diffi cult to read. The drive that wrote the data, because it is already running at a slow speed,may be able to read it, but a faster drive would not. Because the inner tracks on a disk have a smaller circumference,the rotation is slower, and therefore the data here is stored closer together. These inner tracks are represented as the higher sector. As a result, higher sectors are more susceptible to error on slow disk drives than lower sectors.
    When a drive rotates too quickly, it may not write to all 18 sectors on each rotation. The drive could skip a sector,resulting in destruction of the item being saved.
    The following program is a utility that will determine whether or not your disk drive is operating at the correct speed. The BASIC section of the program only sets up the environment for the machine code that does all the work. To determine how the machine code operated refer to the assembler listing and read on.
    The first part of the program is self explanatory; lines 15-24 defines the variable used in the assembler program and line 10 clears the stack.
    DUNIT(hex 301) (dec 769) is the location that indicates the drive that is to be used. The user must POKE the value (1-4) representing the wanted disk drive.
    DBUFLO/HI (hex 304,305) (dec 772,773) is the data buffer address of the destination of the data to be transfered.
    DCOMND(hex 302)(dec 770) is the location that indicates the disk operation to be performed. The options are:

Command
 
hex
 
dec
 
Read 52
82
Write 57
87
Status 83
83
Put 50
80
Format 21
33
Download 22
32
Read address 54
84
Read spin 81
81
Motor on 55
85
Verify sector 56
86

    DAUX 1/2 (hex 30A ,30B) (dec 778,779). This location indicates the disk sector number which will be read or written to. This program sets this value to one.

Basic Listing

5 DIM YN$(3)
10 GRAPHICS 0:SETCOLOR 2,16,1
20 POSITION 10,8:? "Loading Machine Code"
30 FOR X=0 TO 62:READ D:POKE 1536+X,D:NEXT X
40 GRAPHICS 0:SETCOLOR 2,16,1
50 POSITION 12,5:? "DRIVE SPEED TEST"
60 ? :? :? "Test Which Drive?"
70 INPUT N
80 POKE 1616,1
90 ? :? "The test will take 18 sec"
100 X=USR(1536)
110 MIN=(PEEK(1618)+256*PEEK(1619))/3600
120 RPM=INT(85/MIN+0.5)
130 ? :? ,"     ";:? RPM;:? "  RPM":?
140 IF RPM=288 THEN ? "Drive speed is perfect":GOTO 200
150 IF RPM<280 THEN ? "Drive speed is too slow":GOTO 200
160 IF RPM>290 THEN ? "Drive speed is too fast":GOTO 200
180 ? "Drive speed is o.k."
200 ? :? "Would you like a retest.?"
210 INPUT YN$
240 IF YN$="Y" THEN 40
500 DATA 104,173,80,6,141,1,3,169,5,141,5,3,169,82,141,2,3,169,1,141,10,3,160,0
510 DATA 140,11,3,140,4,3,169,85,141,81,6,32,83,228,160,0,132,19,132,20,32,83,228,206
520 DATA 81,6,208,248,166,20,165,19,141,83,6,142,82,6,96

Assembler Listing

00010  .LI OFF
00011  .OR $600
00012  .TA $4000
00014  .TF "D:RPM.OBJ"
00015 DAUX1 .EQ $30A    ;DISK SECTOR NO. (LO)
00016 DAUX2 .EQ $30B    ;(HI)
00017 DBUFLO .EQ $304   ;DATA BUFFER ADDRESS (LO)
00018 DBUFHI .EQ $305   ;(HI)
00019 DUNIT .EQ $301    ;DISK UNIT NUMBER
00020 DCOMND .EQ $302   ;DISK COMMAND
00022 RTCLOK1 .EQ $13   ;CLOCK
00024 RTCLOK2 .EQ $14   ;CLOCK
00100 BEGIN PLA    ;CLEAR STACK
00110  LDA $650
00120  STA DUNIT   ;DRIVE NUMBER
00130  LDA #5
00140  STA DBUFHI  ;RESERVE BUFFER AREA
00150  LDA #82     ;SET DISK OPERATION
00160  STA DCOMND
00170  LDA #1      ;SECTOR NO. 1
00180  STA DAUX1
00190  LDY #0
00200  STY DAUX2
00210  STY DBUFLO
00220  LDA #85     ;NO. OF DISK SPINS
00230  STA $651
00240  JSR $E453   ;GET DISK UP TO SPEED
00250  LDY #0      ;START CLOCK
00260  STY RTCLOK1
00270  STY RTCLOK2
00280 L2 JSR $E453 ;DISK HANDLER ENTRY
00290  DEC $651
00300  BNE L2
00310  LDX RTCLOK2 ;RECORD TIME
00320  LDA RTCLOK1
00330  STA $653    ;STORE TIME
00340  STX $652    ;BASIC PROGRAM
00350  RTS