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
5 'OMMON EX$,PROG$
10 'LADRSOLV - Ladder Network Aanalyzer - 18 FEB 2002 - rev. 26 MAR 2009
20 CLS:KEY OFF
30 IF EX$=""THEN EX$="EXIT"
40 IF PROG$=""THEN GO$=EX$ ELSE GO$=PROG$
50 
60 'CLEAR,,2000  'deactivated - replaced by line 4200
70 PI=4*ATN(1):TP=2*PI
80 UL$=STRING$(80,205) 'double line
90 ER$=STRING$(80,32)  'erase
100 R$=STRING$(42,32)
110 '.....set new arrays
120 DIM V(20),A$(20),E$(20),N$(20),V$(20),SP$(20)
130 '
140 '.....title page
150 CLS
160 COLOR 15,2,1
170 PRINT " LADDER NETWORK ANALYZER";TAB(57);"by George Murphy VE3ERP ";
180 COLOR 1,0:PRINT STRING$(80,223);
190 COLOR 15,2:LOCATE CSRLIN-1,22
200 PRINT " Concept and algorithm by R.J.Dehoney "
210 COLOR 7,0
220 PRINT
230 '
240 '.....start
250 LOCATE 4:PRINT " Network"
260 LOCATE 5:PRINT " Elements ÄÄ¯"
270 K=9:Y=4
280 FOR Z=1 TO 6:K=K+8:ON Z GOSUB 1240,1320,1400,1480,1560,1640:NEXT Z
290 PRINT
300 PRINT " This program solves for Rin, Xin, and VSWR vs. Frequency. You ca";
310 PRINT "n check Zin   "
320 PRINT " and SWR at various points in the ladder network to see the effec";
330 PRINT "t of the      "
340 PRINT " circuit components. Values can be changed and elements can be ad";
350 PRINT "ded, deleted, "
360 PRINT " inserted or relocated anywhere at any time during the program.  "
370 PRINT
380 PRINT " To design a ladder network, simply draw a diagram of any compone";
390 PRINT "nt with any   "
400 PRINT " value and use the various options to build the network. If you w";
410 PRINT "ish, you can  "
420 PRINT " analyze each option as you proceed.                             "
430 PRINT
440 PRINT " To analyze or design a network you must first draw a ladder netw";
450 PRINT "ork, a very   "
460 PRINT " simple task, as follows:                                        "
470 PRINT
480 COLOR 0,7:LOCATE ,23:PRINT " Press 1 to continue or 0 to EXIT ";:COLOR 7,0
490 Z$=INKEY$:IF Z$=""THEN 490
500 IF Z$="0"THEN RUN GO$
510 IF Z$="1"THEN 540
520 GOTO 490
530 '
540 '.....start
550 CLS:COLOR 7,0,0
560 LOCATE 15
570 PRINT "If you make a mistake in any of the following entries, don't worr";
580 PRINT "ry about it.  "
590 PRINT "Just keep going. You can correct it later, when you have finished";
600 PRINT " the drawing. "
610 LOCATE 18:PRINT "Elements Ä¯"
620 Y=17:K=3:FIN=Y
630 FOR Z=1 TO 6
640 K=K+10:ON Z GOSUB 1240,1480,1320,1560,1400,1640
650 NEXT Z
660 K=3
670 FOR Z=1 TO 6
680 K=K+10:LOCATE ,K+2:PRINT "(";CHR$(Z+96);;")";
690 NEXT Z:PRINT ""
700 PRINT " TO DRAW LADDER:";
710 PRINT " (Press z if no more elements)"
720 '
730 '.....input data
740 N=0:K=-6
750 LOCATE 22:N=N+1
760 T1=TIMER
770 T2=TIMER:IF T2-T1<1 THEN 770
780 COLOR 0,7
790 PRINT " Press letter in ( ) to select diagram for element #";N:COLOR 7,0
800 E$=INKEY$:IF E$=""THEN 800
810 IF E$="z"AND N=1 THEN 10
820 E$(N)=E$
830 IF E$="z"THEN 890
840 IF E$="" OR E$>"f"THEN 880
850 IF N=1 AND E$=""THEN 880
860 IF VAL(E$)<>0 OR ASC(E$)<97 THEN 880
870 GOTO 940
880 BEEP:LOCATE CSRLIN-1:PRINT STRING$(80,32);:LOCATE CSRLIN-1:GOTO 780
890 N=N-1:M=N:LOCATE FIN:PRINT UL$;
900 LN=CSRLIN:COLOR 0,7
910   FOR Z=0 TO N-1:LOCATE 1,Z*7+7:PRINT "Ä";:NEXT Z
920   LOCATE 1,M*7:PRINT"*"
930 LOCATE LN:COLOR 7,0:GOTO 1940     'menu
940 GOSUB 1070  'select diagram and enter value
950 VIEW PRINT 22 TO 24:CLS:VIEW PRINT:LOCATE 22
960 GOSUB 980:GOTO 750
970 '
980 '.....table of values
990 LOCATE 4
1000   FOR Z=1 TO N:IF V(Z)=0 THEN PRINT STRING$(T-1,32):GOTO 1040
1010 PRINT USING "Element ##:";Z;:PRINT " ";A$(Z);N$(Z);
1020 PRINT USING "...... ######.### ";V$(Z);V(Z)
1030 FIN=CSRLIN
1040   NEXT Z
1050 RETURN
1060 '
1070 '.....select element
1080 Y=1:K=K+7:N$=STR$(N):N$(N)=RIGHT$(N$,LEN(N$)-1)
1090 IF E$="a"OR E$="b"THEN A$(N)="C":U$="pF"
1100 IF E$="c"OR E$="d"THEN A$(N)="L":U$="uH"
1110 IF E$="e"OR E$="f"THEN A$(N)="R":U$="ê "
1120 PRINT "ENTER: value in ";U$;:INPUT V$
1130 V=VAL(V$):IF V=0 THEN 1220
1140 V(N)=V:V$(N)=U$:V=0
1150 IF E$="a"THEN SP$(N)="s":GOSUB 1240
1160 IF E$="b"THEN SP$(N)="p":GOSUB 1480
1170 IF E$="c"THEN SP$(N)="s":GOSUB 1320
1180 IF E$="d"THEN SP$(N)="p":GOSUB 1560
1190 IF E$="e"THEN SP$(N)="s":GOSUB 1400
1200 IF E$="f"THEN SP$(N)="p":GOSUB 1640
1210 RETURN
1220 BEEP:LOCATE CSRLIN-1:PRINT ER$;:LOCATE CSRLIN-1:GOTO 1120
1230 '
1240 'a....Cshunt
1250 COLOR 0,7
1260 LOCATE Y,K:PRINT "ÄÄÄÂÄÄÄ"
1270 LOCATE  ,K:PRINT "   Cn  "
1280 IF N$<>""THEN LOCATE CSRLIN-1,K+3:PRINT "C";N$(N)
1290 LOCATE  ,K:PRINT "ÄÄÄÁÄÄÄ"
1300 COLOR 7,0:RETURN
1310 '
1320 'c....Lshunt
1330 COLOR 0,7
1340 LOCATE Y,K:PRINT "ÄÄÄÂÄÄÄ"
1350 LOCATE  ,K:PRINT "   Ln  "
1360 IF N$<>""THEN LOCATE CSRLIN-1,K+3:PRINT "L";N$(N)
1370 LOCATE  ,K:PRINT "ÄÄÄÁÄÄÄ"
1380 COLOR 7,0:RETURN
1390 '
1400 'e....Rshunt
1410 COLOR 0,7
1420 LOCATE Y,K:PRINT "ÄÄÄÂÄÄÄ"
1430 LOCATE  ,K:PRINT "   Rn  "
1440 IF N$<>""THEN LOCATE CSRLIN-1,K+3:PRINT "R";N$(N)
1450 LOCATE  ,K:PRINT "ÄÄÄÁÄÄÄ"
1460 COLOR 7,0:RETURN
1470 '
1480 'b....Cseries
1490 COLOR 0,7
1500 LOCATE Y,K:PRINT "ÄÄÄCnÄÄ"
1510 IF N$<>""THEN LOCATE CSRLIN-1,K+3:PRINT "C";N$(N)
1520 LOCATE  ,K:PRINT "       "
1530 LOCATE  ,K:PRINT "ÄÄÄÄÄÄÄ"
1540 COLOR 7,0:RETURN
1550 '
1560 'd....Lseries
1570 COLOR 0,7
1580 LOCATE Y,K:PRINT "ÄÄÄLnÄÄ"
1590 IF N$<>""THEN LOCATE CSRLIN-1,K+3:PRINT "L";N$(N)
1600 LOCATE  ,K:PRINT "       "
1610 LOCATE  ,K:PRINT "ÄÄÄÄÄÄÄ"
1620 COLOR 7,0:RETURN
1630 '
1640 'f....Rseries
1650 COLOR 0,7
1660 LOCATE Y,K:PRINT "ÄÄÄRnÄÄ"
1670 IF N$<>""THEN LOCATE CSRLIN-1,K+3:PRINT "R";N$(N)
1680 LOCATE  ,K:PRINT "       "
1690 LOCATE  ,K:PRINT "ÄÄÄÄÄÄÄ"
1700 COLOR 7,0:RETURN
1710 '
1720 '.....empty element
1730 COLOR 0,7
1740 LOCATE Y,K:PRINT "ÄÄÄÄÄÄÄ"
1750 LOCATE  ,K:PRINT "       "
1760 IF N$<>""THEN LOCATE CSRLIN-1,K+1:PRINT "El.";N$(N)
1770 LOCATE  ,K:PRINT "ÄÄÄÄÄÄÄ"
1780 COLOR 7,0:RETURN
1790 '
1800 '.....erase element
1810 LOCATE Y,K:PRINT "        "
1820 LOCATE  ,K:PRINT "        "
1830 LOCATE  ,K:PRINT "        "
1840 RETURN
1850 '
1860 '.....mini-diagrams
1870 K=T:COLOR 0,7
1880 LOCATE 16,K:PRINT " ÄÂÄ   ÄCÄ   ÄÂÄ   ÄLÄ   ÄÂÄ   ÄRÄ "
1890 LOCATE   ,K:PRINT "  C           L           R        "
1900 LOCATE   ,K:PRINT " ÄÁÄ   ÄÄÄ   ÄÁÄ   ÄÄÄ   ÄÁÄ   ÄÄÄ "
1910 LOCATE   ,K:PRINT " <a>   <b>   <c>   <d>   <e>   <f> "
1920 COLOR 7,0:RETURN
1930 '
1940 '.....menu
1950 VIEW PRINT LN TO 24:CLS:VIEW PRINT:LOCATE LN
1960 INPUT "ENTER: Network Zo (in ohms)...";ZO
1970 IF ZO=0 THEN 1960
1980 INPUT "ENTER: Low frequency (MHZ)....";FL
1990 IF FL=0 THEN 1980
2000 INPUT "ENTER: High frequency (MHZ)...";FH
2010 IF FH=0 THEN 2000
2020 IF FL>FH THEN SWAP FL,FH
2030 '
2040 VIEW PRINT LN-1 TO 24:CLS:VIEW PRINT:LOCATE LN-1
2050 PRINT USING "Network impedance.... #,###.### ê";ZO
2060 PRINT USING "Low frequency........ #,###.### MHz";FL
2070 PRINT USING "High frequency....... #,###.### MHz";FH
2080 PRINT
2090 GOSUB 3810
2100 '
2110 V=0:T=38:LOCATE 4
2120 LOCATE ,T:PRINT "³ * = Zin & SWR calculation point"
2130 LOCATE ,T:PRINT "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ";
2140 LOCATE ,T:PRINT "³Press number in < > to:"
2150 LOCATE ,T:PRINT "³<0> QUIT"
2160 LOCATE ,T:PRINT "³<1> Change a value"
2170 LOCATE ,T:PRINT "³<2> Change a component"
2180 LOCATE ,T:PRINT "³<3> Delete a component"
2190 LOCATE ,T:PRINT "³<4> Add or insert a component"
2200 LOCATE ,T:PRINT "³<5> Change Zo"
2210 LOCATE ,T:PRINT "³<6> Relocate *";:IF M=0 THEN M=N
2220 LOCATE ,T:PRINT "³<7> Change frequencies"
2230 G$=INKEY$:IF G$="" GOTO 2230
2240  FOR Z=6 TO 15:IF Z=VAL(G$)+7 THEN 2260
2250  LOCATE Z,T:PRINT R$
2260  NEXT Z
2270 IF G$="0"THEN 3770
2280 IF G$="1"THEN 2370
2290 IF G$="2"THEN 2450
2300 IF G$="3"THEN 2600
2310 IF G$="4"THEN 2900
2320 IF G$="5"THEN 3490
2330 IF G$="6"THEN 3550
2340 IF G$="7"THEN 3690
2350 GOTO 2230
2360 '
2370 '.....change element value
2380 LOCATE 22,T:COLOR 0,7:PRINT " Press element number ";:COLOR 7,0
2390 Z$=INKEY$:IF Z$=""THEN 2390
2400 Z=VAL(Z$)
2410 IF Z>N THEN BEEP:LOCATE 22,T+22:PRINT STRING$(10,32):GOTO 2380
2420 LOCATE   ,T:INPUT "ENTER: new value     ";V
2430 V(Z)=V:GOSUB 980:GOSUB 3810:GOTO 2040
2440 '
2450 '.....change diagram
2460 GOSUB 1860   'mini-diagrams
2470 LOCATE 21,T:COLOR 0,7:PRINT " Press element number ";:COLOR 7,0
2480 J$=INKEY$:IF J$=""THEN 2480
2490 J=VAL(J$)
2500 IF(J$>="A"AND J$<="z")OR J>N OR J<1 THEN 2580
2510 LOCATE 22,T:COLOR 0,7:PRINT " Press new diagram letter <?> ";:COLOR 7,0
2520 E$=INKEY$:IF E$=""THEN 2520
2530 IF E$>="a"AND E$<="f"THEN 2540 ELSE BEEP:LOCATE 22,T:PRINT R$;:GOTO 2510
2540 E$(J)=E$
2550 LOCATE 23,T:V=0:INPUT "ENTER: value";V
2560  FOR Z=6 TO 23:LOCATE Z,T:PRINT R$:NEXT Z
2570 GOTO 3150    'redraw ladder
2580 BEEP:LOCATE 21,T:PRINT R$;:GOTO 2470
2590 '
2600 '.....delete element
2610 LOCATE 21,T:COLOR 0,7:PRINT " Press element number ";: COLOR 7,0
2620 J$=INKEY$:IF J$=""THEN 2620
2630 J=VAL(J$)
2640 IF(J$>="A"AND J$<="z")OR J>N OR J<1 THEN 2650 ELSE 2660
2650 BEEP:LOCATE 21,T:PRINT R$;:GOTO 2610
2660 N=N-1:Y=1:K=-6:IF N=0 THEN 10
2670  FOR Z=J TO N
2680 V(Z)=V(Z+1):E$(Z)=E$(Z+1):V$(Z)=V$(Z+1):SP$(Z)=SP$(Z+1):A$(Z)=A$(Z+1)
2690 N$=STR$(Z):N$(Z)=RIGHT$(N$,LEN(N$)-1)
2700  NEXT Z
2710 Q=N     'diagrams require a value N
2720  FOR N=1 TO Q   'redraw ladder
2730 K=K+7
2740 N$=STR$(N):N$(N)=RIGHT$(N$,LEN(N$)-1)
2750 IF E$(N)="a"THEN GOSUB 1240
2760 IF E$(N)="b"THEN GOSUB 1480
2770 IF E$(N)="c"THEN GOSUB 1320
2780 IF E$(N)="d"THEN GOSUB 1560
2790 IF E$(N)="e"THEN GOSUB 1400
2800 IF E$(N)="f"THEN GOSUB 1640
2810  NEXT N
2820 N=Q      'reset value of N
2830 V(N+1)=0:E$(N+1)="":N$(N+1)="":V$(N+1)="":SP$(N+1)="":A$(N+1)=""
2840 Y=1:K=N*7+1:GOSUB 1800    'erase existing last element
2850 M=N:IF M=0 THEN 2880
2860 M=N:LOCATE 1,M*7:COLOR 0,7:PRINT"*"
2870 LOCATE 4+N:PRINT R$:COLOR 7,0
2880 GOTO 3380   'display table of values
2890 '
2900 '.....insert new element
2910 GOSUB 1860
2920 LOCATE 21,T:COLOR 0,7:PRINT " Press element number ( 1 to";N+1;")";:COLOR 7,0
2930 J$=INKEY$:IF J$=""THEN 2930
2940 J=VAL(J$)
2950 IF(J$>="A"AND J$<="z")OR J>N+1 OR J=0 THEN 2960 ELSE 2970
2960 BEEP:LOCATE 21,T:PRINT R$;:GOTO 2920
2970 N=N+1
2980 IF J>N THEN J=N
2990  FOR Z=N TO J STEP -1
3000 V(Z)=V(Z-1):E$(Z)=E$(Z-1):V$(Z)=V$(Z-1):SP$(Z)=SP$(Z-1):A$(Z)=A$(Z-1)
3010 N$=STR$(Z):N$(Z)=RIGHT$(N$,LEN(N$)-1)
3020  NEXT Z
3030 V(J)=0:A$(J)="":N$(J)="":V$(J)="":SP$(J)="":E$(J)="":A$(J)=""
3040 GOSUB 980
3050 N$(N)=STR$(J):Y=1:K=(J)*7-6:GOSUB 1720  'print empty element
3060  FOR Z=LN TO 24:LOCATE Z:PRINT STRING$(T-1,32);:IF Z<24 THEN PRINT ""
3070  NEXT Z
3080 LOCATE 22,T:COLOR 0,7:PRINT " Press new diagram letter <?> ";:COLOR 7,0
3090 E$=INKEY$:IF E$=""THEN 3090
3100 IF E$>="a"AND E$<="f"THEN 3110 ELSE BEEP:LOCATE 22,T:PRINT R$;:GOTO 3080
3110 N$=STR$(J):N$(J)=RIGHT$(N$,LEN(N$)-1)
3120 E$(J)=E$
3130 IF E$=""THEN BEEP:LOCATE CSRLIN-1:GOTO 3080
3140 '
3150 IF E$="a"OR E$="c"OR E$="e"THEN SP$(J)="s"
3160 IF E$="b"OR E$="d"OR E$="f"THEN SP$(J)="p"
3170 IF E$="a"OR E$="b"THEN A$(J)="C":V$(J)="pF"
3180 IF E$="c"OR E$="d"THEN A$(J)="L":V$(J)="uH"
3190 IF E$="e"OR E$="f"THEN A$(J)="R":V$(J)="ê "
3200 IF V THEN 3230
3210 LOCATE 23,T:INPUT "ENTER: value....................";V
3220 IF V=0 THEN BEEP:LOCATE CSRLIN-1:GOTO 3210
3230 V(J)=V:V=0
3240 LOCATE CSRLIN-1,T:PRINT STRING$(40,32)
3250 '
3260 '.....display ladder
3270 Y=1:K=-6
3280   FOR Z=1 TO N:K=K+7
3290 N$=STR$(Z):N$(Z)=RIGHT$(N$,LEN(N$)-1):N$(N)=N$(Z)
3300 IF E$(Z)="a"THEN GOSUB 1240
3310 IF E$(Z)="b"THEN GOSUB 1480
3320 IF E$(Z)="c"THEN GOSUB 1320
3330 IF E$(Z)="d"THEN GOSUB 1560
3340 IF E$(Z)="e"THEN GOSUB 1400
3350 IF E$(Z)="f"THEN GOSUB 1640
3360   NEXT Z
3370 COLOR 0,7:M=N:LOCATE 1,M*7:PRINT "*";:COLOR 7,0
3380 GOSUB 980  'table of initial values
3390 FOR Z=6 TO 23:LOCATE Z,T:PRINT STRING$(40,32):NEXT Z
3400 VIEW PRINT FIN TO 24:CLS:VIEW PRINT:LOCATE FIN
3410 '
3420 COLOR 0,7:PRINT " Want to change anything else? (y/n) ";:COLOR 7,0
3430 Z$=INKEY$:IF Z$=""THEN 3430
3440 IF Z$="n"THEN 3470
3450 IF Z$="y"THEN LOCATE CSRLIN-1:PRINT R$:GOTO 2110
3460 GOTO 3430
3470 GOSUB 3810:GOTO 2040
3480 '
3490 '.....change impedance
3500 LOCATE 21,T:COLOR 0,7:INPUT " ENTER: new Zo ";ZO$:COLOR 7,0:ZO=VAL(ZO$)
3510 IF(ZO$>="A"AND ZO$<="z")THEN 3530
3520 GOSUB 980:GOSUB 3810:GOTO 2040
3530 BEEP:LOCATE 21,T:PRINT R$;:GOTO 3500
3540 '
3550 '.....calculation point
3560 COLOR 0,7:LOCATE 1,M*7:PRINT" ";:COLOR 7,0
3570 LOCATE 21,T
3580 COLOR 0,7:PRINT " Press element number for new location ";:COLOR 7,0
3590 M$=INKEY$:IF M$=""THEN 3590
3600 M=VAL(M$)
3610 IF(M$>="A"AND M$<="z")OR M>N OR M<1 THEN 3670
3620 IF M>N OR M<1 THEN BEEP:LOCATE 18,T+36:PRINT "     ";:GOTO 3570
3630 COLOR 0,7:LOCATE 1,N*7:PRINT " "
3640   FOR Z=0 TO N-1:LOCATE 1,Z*7+7:PRINT "Ä";:NEXT Z
3650 COLOR 0,7:LOCATE 1,M*7:PRINT"*";:COLOR 7,0
3660 GOSUB 980:GOSUB 3810:GOTO 2040
3670 BEEP:LOCATE 21,T:PRINT R$;:GOTO 3570
3680 '
3690 '.....change frequencies
3700 LOCATE 21,T:COLOR 0,7:INPUT " ENTER: change low MHz to: ";FL:COLOR 7,0
3710 IF FL=0 THEN BEEP:LOCATE 21,T:PRINT R$;:GOTO 3700
3720 LOCATE 22,T:COLOR 0,7:INPUT " ENTER: change high MHz to:";FH:COLOR 7,0
3730 IF FH=0 THEN BEEP:LOCATE 22,T:PRINT R$;:GOTO 3720
3740 IF FL>FH THEN SWAP FL,FH
3750 GOSUB 980:GOSUB 3810:GOTO 2040
3760 '
3770 '.....quit
3780 FOR Z=4 TO 23:LOCATE Z,37:PRINT STRING$(42,32):NEXT Z
3790 GOTO 4190
3800 '
3810 '.....calculation subroutine
3820 VIEW PRINT FIN TO 24:CLS:VIEW PRINT:LOCATE FIN
3830 PRINT "    Zin & SWR at * for Zo=";ZO;"ê:"
3840 PRINT TAB(5);"MHz ³";TAB(11);"Rin(ê) ³";TAB(20);"Xin(ê) ³";TAB(30);"VSWR"
3850 START=FIN+2            'start line
3860 LINES=24-START+1       'no.of lines
3870 INC=(FH-FL)/(LINES-1)  'increment
3880 F=FL-INC
3890   FOR Z=START TO 24
3900 F=F+INC
3910 W=F*TP
3920 R=9.999999E+14 :X=9.999999E+14
3930     FOR P=1 TO M
3940 IF SP$(P)="p" THEN GOSUB 4050
3950 IF SP$(P)="s" THEN GOSUB 4110
3960     NEXT P
3970 RHO=SQR(((R-ZO)^2+X^2)/((R+ZO)^2+X^2)):IF RHO>9.990000E-01 THEN RHO=9.990000E-01
3980 SWR=(1+RHO)/(1-RHO)
3990 P$="####.###³ #####.#³ #####.#³###.##:1"
4000 PRINT USING P$;F,R,X,SWR;
4010 IF Z<24 THEN PRINT ""
4020   NEXT Z
4030 GOTO 2110
4040 '
4050 '.....subroutine to calc series element
4060 IF A$(P)="C" THEN X=X-10^6/W/V(P)
4070 IF A$(P)="L" THEN X=X+W*V(P)
4080 IF A$(P)="R" THEN R=R+V(P)
4090 RETURN
4100 '
4110 '.....subroutine to calc shunt element
4120 G=R/(R^2+X^2):B=-X/(R^2+X^2)
4130 IF A$(P)="C" THEN B=B+W*V(P)/10^6
4140 IF A$(P)="L" THEN B=B-1/W/V(P)
4150 IF A$(P)="R" THEN G=G+1/V(P)
4160 R=G/(G^2+B^2):X=-B/(G^2+B^2)
4170 RETURN
4180 '
4190 '.....end
4200 ERASE V,A$,E$,N$,V$,SP$
4210 GOSUB 4230:GOTO 110
4220 '
4230 '.....PRT
4240 KEY OFF:GOSUB 4310:LOCATE 25,5:COLOR 0,2
4250 PRINT " Send this page to:(1)Printer Queue? (2)Printout? ";
4260 PRINT "(3)Next page? (1/2/3)";:COLOR 7,0
4270 Z$=INKEY$:IF Z$<"1"OR Z$>"3"THEN 4270 ELSE GOSUB 4310
4280 IF Z$="3"THEN RETURN
4290 FOR I%=1 TO 24:FOR J%=1 TO 80:LPRINT CHR$(SCREEN(I%,J%));:NEXT J%:NEXT I%
4300 IF Z$="2"THEN LPRINT CHR$(12) ELSE 4240
4310 LOCATE 25,1:PRINT STRING$(80,32);:RETURN
