1 COMMON A, AL, B, BASEONLY, C, C$, C1, CAT$, CC, CKT$, D, D$, DD, DIA, DIMN$, DMS, E, EO, EX$, F, F$, FD, FF, FQ, FRQ, G$, GO$, I, I$, L, LATLONG, LD, LL, LN, LS, LW, LX, MAX, MENU, MIN, MX, N, NN, NT, OV, P, PI, PROG$, Q, QQ, QU, R, RA, RC, T, T$, U, U$, UH, UL$, V$, VC, W, WHIP, WIRD, WW, X, X$, X1, XS, Z$, ZP, ZS
10 'SURVEY - Surveying and Mapping - 09 JAN 2002
20 CLS:KEY OFF
30 IF EX$=""THEN EX$="EXIT"
40 COLOR 7,0,1
50 PI=4*ATN(1)  '3.141593
60 UL$=STRING$(80,205)
70 '
80 '.....title page
90 CLS
100 COLOR 15,2,1
110 PRINT " SURVEYOR'S CALCULATOR";TAB(57);"by George Murphy VE3ERP ";
120 COLOR 1,0:PRINT STRING$(80,223);
130 COLOR 7,0
140 '
150 '.....start
160 PRINT " Ref. Thomas L. Glover, Pocket Ref, 2nd edition, Sequoia Publishi";
170 PRINT "ng, pp.373-382"
180 PRINT UL$;
190 PRINT " Press number in < > for"
200 PRINT UL$;
210 PRINT "   <1> Slope/Gradient/Grade Calculator"
220 PRINT "   <2> Stadia Calculator"
230 PRINT "   <3> Apparent Dip Calculator"
240 PRINT
250 PRINT "   <0) EXIT"
260 Z$=INKEY$:IF Z$=""THEN 260
270 IF Z$="0"THEN CHAIN EX$
280 IF Z$="1"THEN 330
290 IF Z$="2"THEN 910
300 IF Z$="3"THEN 1470
310 GOTO 260
320 '
330 '.....GRADE
340 H=0:D=0:V=0:G=0:X=0
350 CLS:COLOR 7,0,0
360 PRINT " GRADE/SLOPE/GRADIENT CALCULATOR"
370 PRINT UL$;
380 J$="must be"
390 GOSUB 840
400 PRINT UL$;
410 GOTO 460
420 '
430 PRINT " If unknown press <ENTER> otherwise"
440 RETURN
450 '
460 '.....data input
470 IF H THEN 490 ELSE GOSUB 430
480 INPUT " ENTER: Horizontal distance.........";H:GOSUB 640
490 IF V THEN 510 ELSE GOSUB 430
500 INPUT " ENTER: Vertical rise...............";V:GOSUB 640
510 IF D THEN 530 ELSE GOSUB 430
520 INPUT " ENTER: Slope in degrees............";D:GOSUB 640
530 IF G THEN 550 ELSE GOSUB 430
540 INPUT " ENTER: Grade in % .................";G:GOSUB 640
550 IF X OR D OR G THEN 620 ELSE GOSUB 430
560 INPUT " ENTER: Gradient..................1:";X
570 IF X=0 THEN 610
580 IF H=0 THEN INPUT " ENTER: Horizontal distance.........";H:V=H/X
590 IF V=0 THEN INPUT " ENTER: Vertical rise...............";V:H=X*V
600 IF H*V THEN 610 ELSE 580
610 GOSUB 640
620 GOTO 460
630 '
640 '.....calculate
650 IF D=0 AND V*H<>0 THEN D=ATN(V/H)*180/PI:GOTO 640
660 IF V=0 AND D*H<>0 THEN V=TAN(D*PI/180)*H:GOTO 640
670 IF H=0 AND D*V<>0 THEN H=V/TAN(D*PI/180):GOTO 640
680 IF G=0 AND D<>0 THEN G=100*TAN(D*PI/180):GOTO 640
690 IF D=0 AND G<>0 THEN D=ATN(G/100)*180/PI:GOTO 640
700 IF X=0 AND H*V<>0 THEN X=H/V:GOTO 640
710 IF H=0 AND X*V<>0 THEN H=X*V:GOTO 640
720 IF V=0 AND H*X<>0 THEN V=H/X:GOTO 640
730 '
740 '.....display
750 VIEW PRINT 5 TO 24:CLS:VIEW PRINT:LOCATE 5
760 IF H THEN PRINT USING " Horizontal distance......... #####.###";H
770 IF V THEN PRINT USING " Vertical rise............... #####.###";V
780 IF D THEN PRINT USING " Slope....................... #####.###ø";D
790 IF G THEN PRINT USING " Grade ...................... #####.###%";G
800 IF X THEN PRINT USING " Gradient................. 1: #####.###";X
810 IF D*H*V*G*X THEN LN=CSRLIN:GOTO 870
820 RETURN
830 '
840 PRINT " Distance and rise ";J$;;" in same unit of measure         "
850 RETURN
860 '
870 J$="are":LOCATE 3:GOSUB 840:LOCATE LN
880 PRINT UL$;
890 GOTO 1910
900 '
910 '.......STADIA
920 A=0:S=0:V=0:H=0:R=0:X=0
930 CLS:KEY OFF
940 COLOR 7,0,0
950 PRINT" STADIA CALCULATOR"
960 PRINT UL$;
970 J$="must be"
980 GOSUB 1400
990 PRINT UL$;
1000 GOTO 1100
1010 '
1020 PRINT " If unknown press <ENTER> otherwise"
1030 RETURN
1040 '
1050 '.....inverse sin and cos
1060 ASN=ATN(X/SQR(-X^2+1))       'arcsin
1070 ACS=-ASN+PI/2                'arcsin
1080 RETURN
1090 '
1100 '.....data input
1110 IF A THEN 1130 ELSE GOSUB 1020
1120 INPUT " ENTER: Slope angle (degrees)..........";A:GOSUB 1210
1130 IF S THEN 1150 ELSE GOSUB 1020
1140 INPUT " ENTER: Slope distance.................";S:GOSUB 1210
1150 IF V THEN 1170 ELSE GOSUB 1020
1160 INPUT " ENTER: Vertical distance..............";V:GOSUB 1210
1170 IF H THEN 1190 ELSE GOSUB 1020
1180 INPUT " ENTER: Horizontal distance............";H:GOSUB 1210
1190 GOTO 1100
1200 '
1210 '.....calculate
1220 IF R=0 AND A<>0 THEN R=A*PI/180    'R = angle in radians
1230 IF R*S THEN V=SIN(R)*S:H=SQR(S^2-V^2):GOTO 1300
1240 IF R*V THEN S=V/SIN(R):H=SQR(S^2-V^2):GOTO 1300
1250 IF R*H THEN S=H/COS(R):V=SQR(S^2-H^2):GOTO 1300
1260 IF S*V THEN X=V/S:GOSUB 1050:R=ASN:A=R*180/PI:H=SQR(S^2-V^2):GOTO 1300
1270 IF S*H THEN X=H/S:GOSUB 1050:R=ACS:A=R*180/PI:V=SQR(S^2-H^2):GOTO 1300
1280 IF V*H THEN R=ATN(V/H):A=R*180/PI:S=SQR(V^2+H^2):GOTO 1300
1290 '
1300 '.....display
1310 VIEW PRINT 5 TO 24:CLS:VIEW PRINT:LOCATE 5
1320 IF R THEN PRINT USING " Slope angle (radians).. ####.###";R
1330 IF A THEN PRINT USING " Slope angle (degrees).. ####.###";A
1340 IF S THEN PRINT USING " Slope distance......... ####.###";S
1350 IF V THEN PRINT USING " Vertical distance...... ####.###";V
1360 IF H THEN PRINT USING " Horizontal distance.... ####.###";H
1370 IF A*S*V*H*R THEN LN=CSRLIN:GOTO 1430
1380 RETURN
1390 '
1400 PRINT " Distances ";J$;;" in the same unit of measure        "
1410 RETURN
1420 '
1430 J$="are":LOCATE 3:GOSUB 1400:LOCATE LN
1440 PRINT UL$;
1450 GOTO 1910
1460 '
1470 '.....DIP
1480 AD=0:TD=0:AB=0:X=0
1490 CLS:KEY OFF
1500 COLOR 7,0,0
1510 'DEF FNASN=ATN(X/SQR(-X^2+1))  'arcsine
1520 PRINT " APPARENT DIP CALCULATOR"
1530 PRINT UL$;
1540 PRINT " ";CHR$(34);;"Angle between";CHR$(34);
1550 PRINT " refers to angle between Strike and direction of Cross Section"
1560 PRINT UL$;
1570 GOTO 1620
1580 '
1590 PRINT " If unknown press <ENTER> otherwise"
1600 RETURN
1610 '
1620 '.....data input
1630 IF AD THEN 1660 ELSE GOSUB 1590
1640 INPUT " ENTER: Apparent Dip (degrees)......";Z
1650 AD=Z*PI/180:GOSUB 1750
1660 IF TD THEN 1690 ELSE GOSUB 1590
1670 INPUT " ENTER: True dip (degrees)..........";Z
1680 TD=Z*PI/180:GOSUB 1750
1690 IF AB THEN 1730 ELSE GOSUB 1590
1700 INPUT " ENTER: Angle between...............";Z
1710 AB=Z*PI/180:GOSUB 1750
1720 GOSUB 1750
1730 GOTO 1620
1740 '
1750 '.....calculate
1760 IF AD*TD THEN X=TAN(AD)/TAN(TD):AB=ARCSINE(X):GOTO 1800
1770 IF AD*AB THEN TD=ATN(TAN(AD)/SIN(AB)):GOTO 1800
1780 IF TD*AB THEN AD=ATN(TAN(TD)*SIN(AB)):GOTO 1800
1790 '
1800 '.....display
1810 VIEW PRINT 5 TO 24:CLS:VIEW PRINT:LOCATE 5
1820 IF AD THEN PRINT USING " Apparent Dip.... ####.##ø";AD*180/PI
1830 IF TD THEN PRINT USING " True dip........ ####.##ø";TD*180/PI
1840 IF AB THEN PRINT USING " Angle between... ####.##ø";AB*180/PI
1850 IF AB*TD*AD THEN 1880
1860 RETURN
1870 '
1880 PRINT UL$;
1890 GOTO 1910
1900 '
1910 '.....end
1920 GOSUB 1950:GOTO 80
1930 '
1940 '.....PRT
1950 KEY OFF:GOSUB 2020:LOCATE 25,5:COLOR 0,2
1960 PRINT " Send this page to:(1)Printer Queue? (2)Printout? ";
1970 PRINT "(3)Next page? (1/2/3)";:COLOR 7,0
1980 Z$=INKEY$:IF Z$<"1"OR Z$>"3"THEN 1980 ELSE GOSUB 2020
1990 IF Z$="3"THEN RETURN
2000 FOR I%=1 TO 24:FOR J%=1 TO 80:LPRINT CHR$(SCREEN(I%,J%));:NEXT J%:NEXT I%
2010 IF Z$="2"THEN LPRINT CHR$(12) ELSE 1950
2020 LOCATE 25,1:PRINT STRING$(80,32);:RETURN
2100 FUNCTION ARCSINE(x)
2110 ARCSINE = ATN(X/SQR(-X^2+1))  'arcsine
2120 END FUNCTION
