1 ' SPEED CHECKER
2 ' J Keneally
3 ' Jan 87 Amstrad Action
10 MEMORY 41999:GOSUB 1050
20 MODE 2:DEFINT i,k:DIM v(600),f(50)
30 WINDOW#1,1,80,5,24
40 CLS:LOCATE 30,1
50 PRINT"Tape speed checker."
60 CLS#1:WINDOW#2,30,50,11,14
70 PRINT#2,"1. Create test tape."
80 PRINT#2:PRINT#2,"2. Run a test."
90 GOSUB 1260:IF a$="2" THEN 160
100 IF a$<>"1" THEN 90 ELSE CLS#1
110 LOCATE 20,12:PRINT"Load test tape ";
120 PRINT"for recording.  Press any key."
130 GOSUB 1260:CALL &BC6E
140 FOR i=1 TO 2000:NEXT
150 CALL 42050,1200:CALL &BC71:GOTO 40
160 CLS#1:LOCATE 20,12
170 PRINT"Load test tape, press ";
180 PRINT"PLAY then any key"
190 GOSUB 1260
200 CALL &BC71:CALL &BC6E
210 FOR i=1 TO 200:NEXT
220 CLS#1:ORIGIN 0,0,0,639,399,0
230 DRAWR -604,0:DRAWR 0,304
240 i1=10:GOSUB 740
250 GOSUB 1020
260 LOCATE 30,3:PRINT"Running test"
270 av=0:FOR i=1 TO 20
280 i2=0:CALL 42000,@i2
290 IF i2>300 AND (i2<500) THEN av=av+i2:ELSE 280
300 NEXT
310 iav=av/20:var=0.05*iav
320 plus=-100:minus=100
330 FOR i=1 TO 600:i2=0
340 CALL 42000,@i2:PLOT i,0
350 change=(i2-iav)/var:v(i)=change
360 DRAWR 0,change*150
370 plus=MAX(plus,change)
380 minus=MIN(minus,change)
390 NEXT
400 CALL &BC71
410 LOCATE 1,23:PRINT"Test over.  ";
420 PRINT"Peak variation is:";
430 PRINT INT(50*plus)/10;" to ";
440 PRINT INT(50*minus)/10;" %"
450 LOCATE 30,25
460 PRINT"Press any key to continue."
470 GOSUB 1260
480 GOSUB 640
490 GOSUB 710:PRINT CHR$(23);CHR$(1);
500 ix=0:GOSUB 610
510 LOCATE 1,24:PRINT CHR$(20)
520 PRINT"Pinch-wheel grid.  Move ";
530 PRINT"using L/R arrow keys"
540 PRINT"Press E to continue."
550 GOSUB 1260
560 IF a$="E" THEN GOSUB 800:GOTO 490
570 GOSUB 610:i=ASC(a$)
580 IF i=242 OR (i=246) THEN ix=MAX(0,ix-i+241)
590 IF i=243 OR (i=247) THEN ix=MIN(ix+i-242,530)
600 GOSUB 610:GOTO 550
610 a=ix
620 FOR i1=0 TO 9:PLOT a,-50:DRAWR 0,100
630 a=a+6.68:NEXT:RETURN
640 LOCATE 1,24:PRINT CHR$(20);
650 PRINT"Filtered plot coming."
660 t=0:FOR i=1 TO 600
670 t=0.95*t+0.5*v(i):v(i)=v(i)-t:NEXT
680 t=(v(1)+v(2)+v(3))/3:FOR i=3 TO 599
690 v(i)=t:t=0.5*t+0.5*v(i+1):NEXT
700 RETURN
710 CLG:i1=10:GOSUB 740
720 FOR i=3 TO 599:PLOT i,0
730 DRAWR 0,v(i)*150:NEXT:RETURN
740 ORIGIN 20,200,20,620,350,50
750 PLOT 0,-150
760 DRAWR 0,300:PLOT 599,-150
770 DRAWR 0,300:PLOT 0,-150
780 FOR i=0 TO i1:DRAWR 600,0
790 MOVER -600,30:NEXT:RETURN
800 PRINT CHR$(23);CHR$(0);:k1=ix
810 LOCATE 1,24:PRINT CHR$(20)
820 PRINT"Calculating spectrum."
830 t=0:FOR i=k1 TO k1+49
840 t=t+v(i):NEXT:t=t/50
850 b=2*PI/50:RAD:fmx=0
860 FOR k=0 TO 24:f1=0:f2=0
870 b1=b*k:FOR i=0 TO 49
880 f3=v(i+k1)-t:f1=f1+f3*SIN(b1*i)
890 f2=f2+f3*COS(b1*i):NEXT
900 f(k)=SQR(f1*f1+f2*f2)
910 fmx=MAX(fmx,f(k)):NEXT
920 CLS#1:i1=-1:GOSUB 740
930 PLOT 0,-150:DRAWR 600,0
940 FOR i=0 TO 24:PLOT i*24,-150
950 i1=f(1)/fmx*300:DRAWR 0,i1
960 DRAWR 24,0:DRAWR 0,-i1
970 IF i>5 AND (i<9) THEN FOR i2=1 TO 24:MOVER -1,i1:DRAWR 0,-i1:NEXT
980 NEXT
990 LOCATE 1,24:PRINT CHR$(20);
1000 PRINT"Press any key to continue"
1010 WHILE INKEY$="":WEND:RETURN
1020 LOCATE 1,3:PRINT"+5%"
1030 LOCATE 1,23:PRINT"-5%"
1040 LOCATE 1,13:PRINT"0":RETURN
1050 RESTORE 1050
1060 GOSUB 1070
1070 READ a,a$
1080 WHILE a$<>""
1090 FOR i=1 TO 19 STEP 2
1100 i1=VAL("&"+MID$(a$,i,2)):POKE a,i1
1110 a=a+1:NEXT:READ a$:WEND
1120 RETURN
1130 DATA 42000
1140 DATA f30100f5110000216419
1150 DATA 0e00ed78e680b9280213
1160 DATA 4f2b7cb520f2dd6e00dd
1170 DATA 6601732372fbc9000000
1180 DATA ""
1190 DATA 42050
1200 DATA f30100f6dd5e00dd5601
1210 DATA 2ec92d20092ec81b7bb2
1220 DATA 2007fbc93e033d20fd3e
1230 DATA 10ed793e3d3d20fd3e30
1240 DATA ed793e393d20fd18db00
1250 DATA ""
1260 a$="":WHILE a$="":a$=INKEY$:WEND
1270 a$=UPPER$(a$):RETURN    
