'
' ***********************************
' *  Disk Drive Speed Checker V1.2  *
' *  By Gary Player  Nov 1987       *
' ***********************************
'
Buffer$=Space$(512)
Drive%=0
'
' Save old palette and set new palette
'
For I%=&HFFFF8240 To &HFFFF825E Step 2
  Oldcolour$=Oldcolour$+Mki$(Dpeek(I%))
  Sdpoke I%,5
Next I%
Sdpoke &HFFFF8240,0
Sdpoke &HFFFF8242,&H700
Sdpoke &HFFFF8244,&H70
'
Deftext 1,8,0,13
X=50
Y=20
T$="Disk Drive Speed Checker"
Gosub Showtext
X=90
Y=40
T$="by Gary Player"
Gosub Showtext
Deftext 1,0,0,13
X=57
Y=135
T$="A or B to select drive"
Gosub Showtext
Y=155
T$=" Space to recalculate"
Gosub Showtext
Y=175
T$="     ESC to exit"
Gosub Showtext
Deftext 1,4,0,4
X=10
Y=195
T$="Written in compiled GFA BASIC - Public Domain."
Gosub Showtext
'
Do
  Deftext 2,0,0,32
  X=1
  Y=100
  T$="Speed =        RPM"
  Gosub Showtext
  Deftext 3,0,0,32
  '
  ' Start up drive and get first sector
  '
  Void Xbios(8,L:Varptr(Buffer$),L:0,Drive%,1,0,0,1)
  Tries%=0
  T1%=Timer
  '
  ' Read sector and show average speed
  '
  Repeat
    Inc Tries%
    Void Xbios(8,L:Varptr(Buffer$),L:0,Drive%,1,0,0,1)
    T2%=Timer
    Rpm=Int(Tries%*1200000/(T2%-T1%))/100
    Text 125,100,Rpm
    A$=Upper$(Inkey$)
  Until A$<>""
  If A$="A" Then
    Drive%=0
  Endif
  If A$="B" Then
    Drive%=1
  Endif
  Exit If Asc(A$)=27
Loop
'
Cls
Void Xbios(6,L:Varptr(Oldcolour$))
End
'
Procedure Showtext
  Text X,Y,T$
Return
