8-Bit Software Online Conversion
Chemistry Database/Test Prog - Listing
10REM"
20REM " ****************************
30REM " * *
40REM " * MINI CHEMISTRY DATABASE *
50REM " * *
60REM " * BY PETER SMITH *
70REM " * *
80REM " * USER M8M *
90REM " * *
100REM " ****************************
110REM"
120REM"
130 SD=0
140 MODE7
150 PROCDB(0,4,7,"Do you want sound?(Y
/N)")
160 A$=GET$
170 IF A$="Y" OR A$="N" THEN GOTO 180
ELSE GOTO 160
180 IF A$="N" THEN *FX210,1
190 IF A$="Y" THEN *FX210,0
200 VDU23;8202;0;0;0;
210 PROCINIT
220 PROCMAINMENU
230 GOTO 220
240 DEFPROCSCREEN
250 CLS
260 PROCDB(0,4,2,"Search for"+ST$)
270 PROCDB(5,1,0,"Chemical Symbol -
")
280 PROCDB(7,2,0,"Chemical Name -
")
290 PROCDB(9,3,0,"Atomic number -
")
300 PROCDB(11,4,0,"R'tive A' Mass -
")
310 PROCSYMB
320 ENDPROC
330 DEFPROCSEARCH
340 CLS
350 PROCDB(0,2,4,"Search")
360 PROCDB(3,2,1," What to you want t
o search for?")
370 PRINTTAB(6,8);" 1. Chemical Symbo
l"
380 PRINTTAB(6,9);" 2. Chemical Name"
390 PRINTTAB(6,10);" 3. Relative Atom
ic mass"
400 PRINTTAB(6,11);" 4. Atomic Number
"
410 REM
420 A=GET-48:K=A
430 IF A=1 OR A=2 OR A=3 OR A=4 THEN G
OTO 440 ELSE GOTO 420
440 IF A=1 THEN ST$=" Chemical Symbol"
:S=1:N=0:R=0:A=0
450 IF A=2 THEN ST$=" Chemical Name":S
=0:N=1:R=0:A=0
460 IF A=3 THEN ST$=" Relative Atomic
mass":S=0:N=0:R=1:A=0
470 IF A=4 THEN ST$=" Atomic Number":S
=0:N=0:R=0:A=1
480 REM
490 PRINTTAB(0,15);
500 ENDPROC
510 END
520 DEFPROCoscli($&700)
530 LOCAL X%,Y%
540 X%=&700 MOD 256
550 Y%=&700 DIV 256
560 CALL &FFF7
570 ENDPROC
580 DEFPROCSYMB
590 PRINTTAB(0,15)" Enter the ";ST$;
600 INPUTLINE FG$
610 PRINTTAB(0,15)"
";
620 FORI=1 TO 103
630 SOUND 1,-10,I,1
640 SD=1
650 PRINTTAB(19,5);SM$(I);ER$
660 PRINTTAB(19,6);SM$(I);ER$
670 PRINTTAB(19,7);NA$(I);ER$
680 PRINTTAB(19,8);NA$(I);ER$
690 PRINTTAB(19,09);AN(I);ER$
700 PRINTTAB(19,10);AN(I);ER$
710 PRINTTAB(19,11);RM(I);ER$
720 PRINTTAB(19,12);RM(I);ER$
730 SD=0
740 IF S=1 THEN PROCNO1
750 IF N=1 THEN PROCNO2
760 IF R=1 THEN PROCNO3
770 IF A=1 THEN PROCNO4
780 IF W=1 THEN GOTO 850
790 NEXT
800 CLS
810 PROCDB(0,1,7,"There is no such"+ST
$)
820 PROCDB(15,4,7,"Press any key")
830 A$=GET$
840 ENDPROC
850 PROCDB(15,4,7,"Press any key")
860 SOUND &10,-1,1,1
870 A$=GET$
880 ENDPROC
890 DEFPROCINIT
900 ER$=" "
910 DIM SM$(103),NA$(103),AN(103),RM(1
03),SP$(103),N$(257),LE$(26),Q(103),d%&2
0
920 FORI=1 TO 103:READ NA$(I),SM$(I),A
N(I),RM(I):NEXT
930 ENDPROC
940 DEFPROCNO1
950 IF FG$=SM$(I) THEN VDU7:W=1 ELSE W
=0
960 ENDPROC
970 DEFPROCNO2
980 IF FG$=NA$(I) THEN VDU7:W=1 ELSE W
=0
990 ENDPROC
1000 DEFPROCNO4
1010 IF EVAL(FG$)=AN(I) THEN VDU7:W=1 E
LSE W=0
1020 ENDPROC
1030 DEFPROCNO3
1040 IF EVAL(FG$)=RM(I) THEN VDU7:W=1 E
LSE W=0
1050 ENDPROC
1060 DEFPROCMAINMENU
1070 CLS
1080 PROCDB(0,4,2,"Main Menu")
1090 PRINTTAB(6,7);" 1. Search for dat
a"
1100 PRINTTAB(6,8);" 2. Take the test"
1110 A=GET-48
1120 IF A=1 OR A=2 THEN GOTO 1130 ELSE
GOTO 1110
1130 REM
1140 IF A=1 THEN PROCSEARCH:PROCSCREEN:
ENDPROC
1150 IF A=2 THEN PROCTEST:ENDPROC
1160 DEFPROCTEST
1170 WR=0:IC=0:C=0
1180 CLS
1190 NA=0:SY=0
1200 PROCDB(0,2,4,"Test")
1210 PROCDB(4,7,0,"What do you want to
be tested on?")
1220 PRINTTAB(6,7);" 1. Symbols"
1230 PRINTTAB(6,8);" 2. Names"
1240 A=GET-48
1250 IF A=1 OR A=2 THEN GOTO 1260 ELSE
GOTO 1250
1260 REM
1270 PRINT'''
1280 IF A=1 THEN SY=1 ELSE NA=1
1290 PRINT" How many questions do you
want?(2-50)"
1300 PRINTTAB(19,15);:INPUT NQS
1310 IF NQS<2 OR NQS>50 THEN GOTO 1300
1320 FOR G=1 TO NQS
1330 A=RND(103):B=RND(103):D=RND(103)
1340 Q(G)=RND((A+B+D)/3):NEXT
1350 CLS
1360 PROCDB(0,2,4,"Test")
1370 FOR G=1 TO NQS
1380 IF WR=3 AND SY=1 THEN IC=IC+1:WR=0
:PROCDB(3,7,4,"The symbol for "+NA$(Q(G)
)+" was "+SM$(Q(G))):FORI=1 TO 3000:NEXT
:PRINTTAB(0,3);STRING$(80," "):GOTO1460
1390 IF WR=3 AND NA=1 THEN IC=IC+1:WR=0
:PROCDB(3,7,4,"The name for "+SM$(Q(G))+
" was "+NA$(Q(G))):FORI=1 TO 3000:NEXT:P
RINTTAB(0,3);STRING$(80," "):GOTO1460
1400 IF SY=1 THEN WE$=SM$(Q(G))
1410 IF NA=1 THEN WE$=NA$(Q(G))
1420 IF SY=1 THEN PRINTTAB(0,12);"
";:PRI
NTTAB(0,12);" What symbol is ";NA$(Q(G))
;:INPUT AN$
1430 IF NA=1 THEN PRINTTAB(0,12);"
";:PRI
NTTAB(0,12);" What element is ";SM$(Q(G)
);:INPUT AN$
1440 IF WE$=AN$ THEN C=C+1:WR=0:FORV=0
TO 100 STEP 10:SOUND 1,-15,V,1:NEXT V:PR
OCDB(3,4,7,"Correct"):FORI=1 TO 3000:NEX
T:PRINTTAB(0,3);STRING$(80," ")
1450 IF WE$<>AN$ THEN WR=WR+1:FORV=20 T
O 10 STEP -10:SOUND 1,-15,V,15:NEXT V:PR
OCDB(3,4,7,"Wrong,try again"):FORI=1 TO
3000:NEXT:PRINTTAB(0,3);STRING$(80," "):
GOTO1380
1460 PROCDB(20,0,7," Correct Wrong")
1470 PROCDB(22,0,7," "+STR$(C)+"
"+STR$(IC)+" ")
1480 NEXT
1490 CLS
1500 PROCDB(0,4,2,"Test")
1510 PROCDB(3,2,4,"In that test,you had
")
1520 IF IC=0 THEN PROCDB(5,2,4," All "+
STR$(NQS)+" of the questions correct"):G
OTO1540
1530 PROCDB(5,2,4,"All but "+STR$(IC)+"
correct")
1540 PROCDB(10,4,7,"Press any key")
1550 A$=GET$
1560 ENDPROC
1570DATA ACTINIUM,Ac,89,227
1580DATA ALUMINIUM,Al,13,27
1590DATA AMERICUM,Am,95,243
1600DATA ANTIMONY,Sb,51,122
1610DATA ARGON,Ar,18,40
1620DATA ARSENIC,As,33,75
1630DATA ASTATINE,At,85,210
1640DATA BARIUM,Ba,56,137
1650DATA BERKELIUM,Bk,97,249
1660DATA BERYLLIUM,Be,4,9
1670DATA BISMUTH,Bi,83,209
1680DATA BORON,B,5,11
1690DATA BROMINE,Br,35,80
1700DATA CADMIUM,Cd,48,112
1710DATA CAESIUM,Cs,55,133
1720DATA CALCIUM,Ca,20,40
1730DATA CALIFORNIUM,Cf,98,251
1740DATA CARBON,C,6,12
1750DATA CERIUM,Ce,58,140
1760DATA CHLORINE,Cl,17,35.5
1770DATA CHROMIUM,Cr,24,52
1780DATA COBALT,Co,27,59
1790DATA COPPER,Cu,29,63.5
1800DATA CURIUM,Cm,96,247
1810DATA DYSPROSIUM,Dy,66,162.5
1820DATA EINSTEINIUM,Es,99,254
1830DATA ERBIUM,Er,68,167
1840DATA EUROPIUM,Eu,63,152
1850DATA FERMIUM,Fm,100,253
1860DATA FLOURINE,F,9,19
1870DATA FRANCIUM,Fr,87,223
1880DATA GADOLINIUM,Gd,64,157
1890DATA GALLIUM,Ga,31,70
1900DATA GERMANIUM,Ge,32,73
1910DATA GOLD,Au,79,197
1920DATA HAFNIUM,Hf,72,178.5
1930DATA HELIUM,He,2,4
1940DATA HOLMIUM,Ho,67,165
1950DATA HYDROGEN,H,1,1
1960DATA INDIUM,In,49,115
1970DATA IODINE,I,53,127
1980DATA IRIDIUM,Ir,77,192
1990DATA IRON,Fe,26,56
2000DATA KRYPTON,Kr,36,84
2010DATA LANTHANUM,La,57,139
2020DATA LAWRENCIUM,Lr,103,257
2030DATA LEAD,Pb,82,207
2040DATA LITHIUM,Li,3,7
2050DATA LUTETIUM,Lu,71,175
2060DATA MAGNESIUM,Mg,12,24
2070DATA MANGANESE,Mn,25,55
2080DATA MENDELEVIUM,Md,101,256
2090DATA MERCURY,Hg,80,201
2100DATA MOLYBDENUM,Mo,42,96
2110DATA NEODYMIUM,Nd,60,144
2120DATA NEON,Ne,10,20
2130DATA NEPTUNIUM,Np,93,237
2140DATA NICKEL,Ni,28,59
2150DATA NIOBUM,Nb,41,93
2160DATA NITROGEN,N,7,14
2170DATA NOBELIUM,No,102,254
2180DATA OSMIUM,Os,76,190
2190DATA OXYGEN,O,8,16
2200DATA PALLADIUM,Pd,46,106
2210DATA PHOSPHORUS,P,15,31
2220DATA PLATINUM,Pt,78,195
2230DATA PLUTONIUM,Pu,94,242
2240DATA POLONIUM,Po,84,210
2250DATA POTASSIUM,K,19,39
2260DATA PRASEODYMIUM,Pr,59,141
2270DATA PROMETHIUM,Pm,61,147
2280DATA PROTACTINIUM,Pa,91,231
2290DATA RADIUM,Ra,88,226
2300DATA RADON,Rn,86,222
2310DATA RHENIUM,Re,75,186
2320DATA RHODIUM,Rh,45,103
2330DATA RUBIDIUM,Rb,37,85.5
2340DATA RUTHENIUM,Ru,44,101
2350DATA SAMARIUM,Sm,62,150
2360DATA SCANDIUM,Sc,21,45
2370DATA SELENIUM,Se,34,79
2380DATA SILICON,Si,14,28
2390DATA SILVER,Ag,47,108
2400DATA SODIUM,Na,11,23
2410DATA STRONTIUM,Sr,38,88
2420DATA SULPHUR,S,16,32
2430DATA TANTALUM,Ta,73,181
2440DATA TECHNETIUM,Tc,43,99
2450DATA TELLURIUM,Te,52,128
2460DATA TERBIUM,Tb,65,159
2470DATA THALLIUM,Tl,81,204
2480DATA THORIUM,Th,90,232
2490DATA THULIUM,Tm,69,169
2500DATA TIN,Sn,50,119
2510DATA TITANIUM,Ti,22,48
2520DATA TUNGSTEN,W,74,184
2530DATA URANIUM,U,92,238
2540DATA VANADIUM,V,23,51
2550DATA XENON,Xe,54,131
2560DATA YTTERBIUM,Yb,70,173
2570DATA YTTRIUM,Y,39,89
2580DATA ZINC,Zn,30,65
2590DATA ZIRCONIUM,Zr,40,91
2600 DEFPROCDB(Y%,FC,BC,M$)
2610 IF BC=-1 THEN BC=0
2620 IF FC=0 THEN FC=4
2630 CE=40-LEN(M$):CE=CE/2
2640 CE=CE-2
2650 A$=CHR$(FC+128)+CHR$(141)+M$
2660 FOR OP=0 TO 1
2670 IF BC<>0 THEN PRINTTAB(0,OP+Y%);CH
R$(BC+128)+CHR$(157);
2680 PRINTTAB(CE,OP+Y%);A$
2690 NEXT
2700 ENDPROC