8-Bit Software Online Conversion

Resistor Codes in Basic - Listing

2 REM RESISTOR CODES 10 MODE7 20 *KEY10"OLD|M" 30 PROCinit 40 50 REPEAT 60 PROCdraw 70 PROCprefvals 80 PROCpcode 90 PROCbands 100 PRINT'col1$"Another one?" 110 go=GET 120 UNTIL go=78 OR go=110 130 VDU23,1,1;0;0;0; 140 END 150 160 DEFPROCinit 170 VDU23,1,0;0;0;0; 180 col1$=CHR$(132)+CHR$(157)+CHR$(129 ) 190 col2$=CHR$(132)+CHR$(157)+CHR$(131 ) 200 ENDPROC 210 220 DEFPROCdraw 230 PROCcls 240 PRINTTAB(33,6)CHR$(151)CHR$(255) 250 PRINTTAB(33,7)CHR$(151)CHR$(255) 260 270 FOR n=8 TO 20 280 PRINTTAB(30,n); 290 PROCcolcod(12) 300 NEXT 310 320 PRINTTAB(33,21)CHR$(151)CHR$(255) 330 PRINTTAB(33,22)CHR$(151)CHR$(255) 340 ENDPROC 350 360 DEFPROCprefvals 370 VDU26 380 PRINTcol1$" Standard Values 5% (10 %) [20%]" 390 PRINTcol2$ 400 PRINTcol2$" [10] 11 (12) 13 [15] 1 6 (18) 20" 410 PRINTcol2$" [22] 24 (27) 30 [33] 3 6 (39) 43" 420 PRINTcol2$" [47] 51 (56) 62 [68] 7 5 (82) 91" 430 PRINTcol2$ 440 ENDPROC 450 460 DEFPROCcolcod(a) 470 IF a = 0 THEN PRINT" BLACK " 480 IF a = 1 THEN PRINT" BROWN " 490 IF a = 2 THEN PRINT" RED " 500 IF a = 3 THEN PRINT" ORANGE " 510 IF a = 4 THEN PRINT" YELLOW " 520 IF a = 5 THEN PRINT" GREEN " 530 IF a = 6 THEN PRINT" BLUE " 540 IF a = 7 THEN PRINT" VIOLET " 550 IF a = 8 THEN PRINT" GREY " 560 IF a = 9 THEN PRINT" WHITE " 570 IF a = 10 THEN PRINT" GOLD " 580 IF a = 11 THEN PRINT" SILVER " 590 IF a = 12 THEN VDU149,255,255,255, 255,255,255,255 600 ENDPROC 610 620 DEFPROCpcode 630 PRINTcol2$ 640 PRINTcol1$"Band colours" 650 PRINTcol2$ 660 FOR n=0 TO 12 670 c=n+48-(n>9)*7 680 PRINTcol2$CHR$(c)":"; 690 PROCcolcod(n) 700 NEXT 710 PRINT 720 PRINTcol2$ 730 PRINTcol2$ 740 ENDPROC 750 760 DEFFNindata 770 c=GET 780 IF c>58 THEN c=c AND &5F 790 IF c=32 OR c=13 THEN c=67 800 =c-48+(c>58)*7 810 820 DEFFNgetband(tb,tx,ty,nmin,nmax) 830 tn=13 840 REPEAT 850 PRINTTAB(tx,ty); 860 PRINT"Band";STR$(tb);" ? ";CHR$(8) 870 tn=FNindata 880 UNTIL tn >= nmin AND tn <= nmax 890 =tn 900 910 DEFPROCbands 920 b1=FNgetband(1,25,9,1,9) 930 PRINT TAB(30,9); 940 PROCcolcod(b1) 950 b2=FNgetband(2,25,11,0,9) 960 PRINT TAB(30,11); 970 PROCcolcod(b2) 980 b3=FNgetband(3,25,13,0,11) 990 PRINT TAB(30,13); 1000 PROCcolcod(b3) 1010 b4=FNgetband(4,25,15,1,12) 1020 IF b4>2 AND b4<10 THEN b4=12 1030 PRINT TAB(30,15); 1040 PROCcolcod(b4) 1050 PROCptol 1060 PROCans 1070 ENDPROC 1080 1090 DEFPROCptol 1100 PROCcls 1110 PRINTTAB(0,6) 1120 PRINTcol1$"Tolerence codes " 1130 PRINTcol2$ 1140 PRINTcol2$" F == 1%" 1150 PRINTcol2$" G == 2%" 1160 PRINTcol2$" J == 5%" 1170 PRINTcol2$" K == 10%" 1180 PRINTcol2$" M == 20%" 1190 ENDPROC 1200 1210 DEFPROCcls 1220 FOR n=6 TO 21 1230 PRINTTAB(0,n)col2$;STRING$(27," ") 1240 NEXT 1250 ENDPROC 1260 1270 DEFPROCans 1280 PRINT''col1$"RESISTOR IS =="col2$; 1290 e=(b3+5) DIV 3:emod=(b3+5) MOD 3 1300 IF e=5 THEN e=1:emod=emod EOR 1 1310 IF emod=0 THEN PROCpmult(e) 1320 PRINT STR$(b1); 1330 IF emod=1 THEN PROCpmult(e) 1340 PRINT STR$(b2); 1350 IF emod=2 THEN PROCpmult(e) 1360 PRINT" "; 1370 PROCptolcod(b4) 1380 ENDPROC 1390 1400 DEFPROCpmult(e) 1410 IF e = 1 THEN PRINT"#"; 1420 IF e = 2 THEN PRINT"K"; 1430 IF e = 3 THEN PRINT"M"; 1440 IF e = 4 THEN PRINT"G"; 1450 ENDPROC 1460 1470 DEFPROCptolcod(b4) 1480 IF b4 = 1 THEN PRINT"F"; 1490 IF b4 = 2 THEN PRINT"G"; 1500 IF b4 = 10 THEN PRINT"J"; 1510 IF b4 = 11 THEN PRINT"K"; 1520 IF b4 = 12 THEN PRINT"M"; 1530 ENDPROC