1 REM v0.2
10 " "LOCK :CLEAR :USING "###.###^":WAIT 90:ON ERROR GOTO 900
20 PRINT "   SOLUBILITY PRODUCTS":PRINT "  Copr. 1982 Tandy Corp.":WAIT 
100 CLS :A$="":INPUT "(S)olubility or (K)sp? ";A$:GOTO 120
110 UNLOCK :END
120 IF A$<>"S"AND A$<>"K"THEN 100
130 PAUSE "Assuming salt type <MX>,"
140 M=0:INPUT "M ions per formula? ";M
150 IF M<1OR M<>INT MTHEN 140
160 X=0:INPUT "X ions per formula? ";X
170 IF X<0OR X<>INT XTHEN 160
180 A=10*M+X
190 IF A=11OR A=12OR A=13OR A=14OR A=21OR A=23OR A=31OR A=32THEN 200+100*(A$="S")
195 PRINT "BAD INPUT":GOTO 100
200 V=0:INPUT "Solubility? (M/l) ";V
210 IF V<=0THEN 200
220 GOSUB 400:PRINT "Ksp =";Y:GOSUB 500
230 IF P$="P"LPRINT "Sol";V;" M/l";:LPRINT "Ksp =";Y:LF 3
240 GOTO 100
300 INPUT "Ksp value? ";K
310 IF K<=0THEN 300
320 GOSUB 400:PRINT "Solubility";Z;" M/l":GOSUB 500
330 IF P$="P"LPRINT "Ksp =";K:LPRINT "Sol";Z;" M/l":LF 3
340 GOTO 100
400 IF A=11LET Y=V*V:Z=SQR K:RETURN 
410 IF A=12LET Y=4*V^3:Z=(K/4)^(1/3):RETURN 
420 IF A=13LET Y=27*V^4:Z=(K/27)^.25:RETURN 
430 IF A=14LET Y=256*V^5:Z=(K/256)^.2:RETURN 
440 IF A=21LET Y=4*V^3:Z=(K/4)^(1/3):RETURN 
450 IF A=23LET Y=108*V^5:Z=(K/108)^.2:RETURN 
460 IF A=31LET Y=27*V^4:Z=(K/27)^.25:RETURN 
470 Y=108*V^5:Z=(K/108)^.2:RETURN 
500 P$="":WAIT 0:PRINT CHR$ 34;"P";CHR$ 34;:WAIT :INPUT " to print, ENTER ";P$
510 IF P$<>"P"RETURN 
520 TEXT :CSIZE 2:USING :LPRINT "M =";M;", X =";X:USING "###.###^":RETURN 
900 USING :PRINT "*** ERROR";PEEK &789B;" in";STATUS 4;" ***":GOTO 100
999 END
