Timecode Calculator

This is a SMTPE calculator program for the CASIO FX-850P/FX-880P.

This Program is written in CASIO BASIC. Use it on you own risk.

SMPTE Timecode Calculator - Basic Listing

1 ' SMPTE Timecode Calculator for CASIO FX-850P/880P

2 ' BY THOMAS ILG

5 FCC=0:IF FPS=0 THEN FPS=25

10 CLS:GOSUB100 ' Main Menu

20 IF DISP=0 THEN GOSUB1500 ELSE GOSUB 1700

25 LOCATE0,OSY+1

27 IFFCC>0THENTX$="6C>A 7C>B "ELSETX$=""

30 PRINT "3T/F 4+ 5- "+TX$+"8BA 9-"+MID$(STR$(FPS),2);

40 IF VAL(A$)=0 THEN GOSUB2000

45 A=VAL(A$):CLS

55 IF DISP=0 THEN ON A GOSUB400,430,500,600,700,730,760,900,800 ELSE ON A GOSUB200,240,510,600,700,730,760,900,800

60 A$="":GOTO10

70 END

100 FPM=FPS*60:FPH=FPM*60:RETURN ' Procedure basic value calculation

150 T$=TC$:GOSUB3000 ' Procedure calculate values from TC text and check validity

152 GOSUB4000:FRF=NUM

155 GOSUB4000:SEC=NUM

160 GOSUB4000:MIN=NUM

161 GOSUB4000:HOR=NUM

167 ERT=0

168 IFSEC>59 THEN SEC=59:ERT=1

169 IFMIN>59 THEN MIN=59:ERT=1

170 IFHOR>23 THEN HOR=23:ERT=1

171 IF FRF>=FPS THEN FRF=0:ERT=1

172 IF ERT=1 THEN PRINT"TC ENTRY ERROR!"

173 RETURN

200 INPUT "FAMES A: ",FCA ' Menu Point 1 FC: Enter A

205 FCC=0:RETURN

240 INPUT "FAMES B: ",FCB ' Menu Point 2 FC: Enter B

245 FCC=0:RETURN

400 INPUT "TIMECODE A: ",TCA$ ' Menu Point 1 TC: Enter A

405 TC$=TCA$

410 GOSUB1100

415 FCA=FRA

416 FCC=0:RETURN

430 INPUT "TIMECODE B: ",TCB$ ' Menu Point 2 TC: Enter B

435 TC$=TCB$

440 GOSUB 1100

445 FCB=FRA

446 FCC=0:RETURN

500 DISP=1:RETURN ' Menu Point 3: Change display TC/Framecount

510 DISP=0:RETURN

600 FCC=FCA+FCB ' Menu Point 4: Calculate A+B

605 IF FCC=>24*FPH THEN FCC=FCC-24*FPH

610 OPT$="[C=A+B]"

655 RETURN

700 FCC=FCA-FCB ' Menu Point 5: Calculate A-B

705 IF FCC<0 THEN FCC=FCC+24*FPH

710 OPT$="[C=A-B]"

720 RETURN

730 IF FCC>0 THEN FCA=FCC:FCC=0 ' Menu point 6: Move C TO A

740 RETURN

760 IF FCC>0 THEN FCB=FCC:FCC=0 ' Menu point 7: Move C to B

770 RETURN

800 INPUT "NEW BASE FPS: ",FPS ' Menu Point 9: Frames per second

805 RETURN

900 NUM=FCB ' Menu Point 8: B-A

910 FCB=FCA

920 FCA=NUM

930 RETURN

1000 TCH=INT(FRA/FPH) ' Procedure calculate TC values from framecount

1005 FRAM=FRA-TCH*FPH

1010 TCM=INT(FRAM/FPM)

1015 FRAS=FRAM-(TCM*FPM)

1020 TCS=INT(FRAS/FPS)

1025 TCF=FRAS-(TCS*FPS)

1090 RETURN

1100 GOSUB 150 ' Procedrue calculate framecount from TC

1110 FRA=HOR*FPH+MIN*FPM+SEC*FPS+FRF

1120 RETURN

1500 PRINT "1A : : : 2B : : : "; ' Procedure display als TC

1510 FRA=FCA:GOSUB1000

1530 OS=3:OSY=0:GOSUB1800

1550 FRA=FCB:GOSUB1000

1570 OS=19:GOSUB1800

1590 IF FCC=0 THEN RETURN

1595 LOCATE 0,1

1600 PRINT " C= : : :";

1610 FRA=FCC:GOSUB1000

1630 OS=3:OSY=1:GOSUB1800

1655 PRINT " "+OPT$;

1656 GOSUB2000:RETURN

1700 PRINT "1A"+STR$(FCA); ' Procedure display as framecount

1705 LOCATE 16,0

1710 PRINT "2B"+STR$(FCB);

1715 OSY=0

1720 IF FCC=0 THEN RETURN

1730 LOCATE 0,1

1735 OSY=1

1740 PRINT " C="+STR$(FCC)+" "+OPT$;

1741 GOSUB2000:RETURN

1800 IF TCH<10 THEN TEXT$="0" ELSE TEXT$="" ' Display a timecode

1805 TEXT$=TEXT$+MID$(STR$(TCH),2)

1810 IF TCM<10 THEN INS$=":0" ELSE INS$=":"

1815 TEXT$=TEXT$+INS$+MID$(STR$(TCM),2)

1820 IF TCS<10 THEN INS$=":0" ELSE INS$=":"

1825 TEXT$=TEXT$+INS$+MID$(STR$(TCS),2)

1830 IF TCF<10 THEN INS$=":0" ELSE INS$=":"

1835 TEXT$=TEXT$+INS$+MID$(STR$(ROUND(TCF,-1),2)

1840 LOCATE OS,OSY

1850 PRINT TEXT$;

1860 RETURN

2000 A$=INKEY$ ' Procedure wait for key

2010 IF A$="" THEN GOTO2000

2020 RETURN

3000 PRINT "PARSING... "; ' Procedure search non numerics

3005 FOR I=1 TO LEN(T$)

3010 FOR X=0 TO 9

3015 IF MID$(T$,I,1)=MID$(STR$(X),2) THEN GOTO 3030

3020 NEXT X

3030 IF X>9 THEN T$=LEFT$(T$,I-1)+":"+MID$(T$,I+1)

3040 NEXT I

3060 T$="0000000000"+T$

3070 RETURN

4000 IF RIGHT$(T$,1)=":" THEN T$=LEFT$(T$,LEN(T$)-1) ' Return 2 digit value

4010 NUM=VAL(RIGHT$(T$,2))

4020 T$=LEFT$(T$,LEN(T$)-2)

4040 RETURN

Linetris

This is a Tetris inspired game for the CASIO FX-850P/FX-880P.

This Program is written in CASIO BASIC. Use it on you own risk.

Linetris - Basic Listing

1 ' LINETRIS FOR CASIO FX-850P/880P V2.0

2 ' BY THOMAS ILG

10 GOSUB5000:CLS ' Call Initialisation

13 GOSUB1800:CLS ' Call Main Menu

14 POINT=0:LEVEL=SRTLEV-1

15 GOSUB4400

16 CLS:GOSUB6000:GOSUB6030 ' Call for a first Object

20 LOC=25:POS=1:CLRLEV=0

30 ERASE LCHECK:DIM LCHECK(1)

35 ERASE PCHECK:DIM PCHECK(1)

40 ERASE ROW$:DIM ROW$(2)

50 ERASE HIG:DIM HIG(2)

200 ROW$(0)=CHR$(134):ROW$(1)=ROW$(0)

240 GOSUB 6000 ' outher GAMELOOP START

250 HIG(0)=LEN(ROW$(0))

255 HIG(1)=LEN(ROW$(1))

260 GOSUB 1600

270 IF HIG(0)>LOC OR HIG(1)>LOC THEN GOTO 1400

275 TURN=1:POS=1

280 GOSUB 1550

300 FOR I=LOC TO 1 STEP -1 ' inner GAMELOOP START

350 K$=INKEY$:IF K$="0" THEN GOTO 1400

360 IF (TURN=0) OR (K$="") THEN GOTO 380

365 IF K$="8" THEN POS=POS+1:IF POS=5 THEN POS=1

370 IF K$="2" THEN POS=POS-1:IF POS=0 THEN POS=4

380 LOCATE I,0:PRINT OB$(POS,0);

390 LOCATE I,1:PRINT OB$(POS,1);

400 IF K$="5" THEN GOSUB 2400:I=0

450 FOR T=0 TO 1

460 IF I>HIG(T) OR OB$(POS,T)="" THEN GOTO 492

470 FOR X=1 TO 2

480 ADD$=MID$(OB$(POS,T),X,1)

485 IF ADD$<>" " THEN ROW$(T)=ROW$(T)+ADD$:LCHECK(T)=LCHECK(T)+1:HIG(T)=HIG(T)+1

490 NEXT X

491 OB$(POS,T)="":TURN=0

492 NEXT T

493 IF K$="5" THEN GOSUB 1600

495 FOR T=0 TO 1

510 IF LCHECK(T)=0 THEN GOTO 550

512 FOR CPO=HIG(T)-LCHECK(T)-1 TO HIG(T)

513 IF CPO<=1 THEN GOTO 535

515 ME=T:GOSUB7000

520 IF DIF>1 OR CPO<HIG(T)-LCHECK(T) THEN GOTO 535

525 IF T=0 THEN ME=1 ELSE ME=0

530 GOSUB 7000

535 NEXT CPO

540 LCHECK(T)=0

550 NEXT T

600 IF OB$(POS,0)="" AND OB$(POS,1)="" THEN I=0

700 IF PCHECK(0)>0 THEN ME=0:OP=1:GOSUB2000:LOCATE 0,0:PRINT ROW$(0)+" ";

710 IF PCHECK(1)>0 THEN ME=1:OP=0:GOSUB2000:LOCATE 0,1:PRINT ROW$(1)+" ";

720 IF CLRLEV=2 THEN GOTO 15

730 ' END OF CHECK

1340 NEXT I ' Inner GAMELOOP END

1355 GOSUB 6030

1360 GOTO 240 ' Outher GAMELOOP END

1400 BEEP:GOSUB1900:GOTO13 ' Procedure Calculate Row Highs

1500 HIG(0)=LEN(ROW$(0)):HIG(1)=LEN(ROW$(1)):RETURN

1550 LOCATE 28,0:PRINT C$;A$;B$; ' Procedure display points and next object

1555 IF POINT<100 THEN LOCATE 29,1 ELSE IF POINT<1000 THEN LOCATE 28,1 ELSE THEN LOCATE 27,1

1560 PRINT MID$(STR$(POINT),2);:RETURN

1600 LOCATE 0,0:PRINT ROW$(0)+" "; ' Procedure dispaly rows

1610 LOCATE 0,1:PRINT ROW$(1)+" ";

1620 RETURN

1700 LOCATE I,0:PRINT OB$(POS,0); ' Procedure display opject

1710 LOCATE I,1:PRINT OB$(POS,1);

1750 RETURN

1800 CLS:PRINT " *** LINETRIS FOR CASIO ***"; ' Procedure main menu

1810 GOSUB 4000

1820 GOSUB 8000

1830 MEN=VAL(K$)

1840 IF MEN=3 THEN END

1845 IF MEN=1 THEN RETURN

1850 IF MEN=2 THEN SRTLEV=SRTLEV+1:IF SRTLEV>14 THEN SRTLEV=1

1890 GOTO1810

1900 CLS:PRINT" *** GAME OVER ***"; ' Procedure game over and highscore

1910 LOCATE 0,1:PRINT "POINTS:";POINT;"HS:";SCORE;"BY ";NAME$;

1915 GOSUB 8000

1920 IF POINT<=SCORE THEN RETURN

1925 SCORE=POINT

1930 CLS:PRINT"NEW HIGHSCORE!";

1935 LOCATE 0,1

1940 INPUT "ENTER YOUR NAME: ",NAME$

1950 RETURN

2000 HIG(ME)=LEN(ROW$(ME)) ' Procedure check for spaces and matches

2010 FOR P=PCHECK(ME) TO HIG(ME)

2015 IF MID$(ROW$(ME),P,1)=" " THEN GOTO 2030

2020 NEXT P

2025 PCHECK(ME)=0:RETURN

2030 ROW$(ME)=LEFT$(ROW$(ME),P-1)+MID$(ROW$(ME),P+1):HIG(ME)=HIG(ME)-1

2090 ROWME$=ROW$(ME)+" "

2095 IF DIF=1 THEN ROWOP$=ROW$(OP)+" "

2100 NOW$=MID$(ROWME$,P-1,1)

2105 IF P>2 THEN LAS$=MID$(ROWME$,P-2,1) ELSE LAS$="X"

2110 FOR P=P-1 TO HIG(ME)

2115 IF NOW$=" " THEN PCHECK(ME)=P:RETURN

2120 NEX$=MID$(ROWME$,P+1,1)

2130 CONT=0

2135 IF NOW$=LAS$ THEN CONT=1

2140 IF DIF>1 THEN GOTO 2150

2145 OPO$=MID$(ROWOP$,P,1)

2146 IF NOW$=OPO$ THEN CONT=CONT+1:GOSUB2500

2150 IF NOW$=NEX$ THEN CONT=CONT+1

2160 IF CONT>1 THEN GOTO 2300

2170 LAS$=NOW$:NOW$=NEX$

2180 NEXT P

2220 PCHECK(ME)=0:RETURN

2300 PCHECK(ME)=2

2310 KILL$=NOW$:GOSUB3000

2390 RETURN

2400 O1$=OB$(POS,0):O2$=OB$(POS,1) ' Procedure Element Fall

2410 FOR A=I-1 TO 1 STEP -1

2420 LOCATE A,0:PRINT O1$;

2430 LOCATE A,1:PRINT O2$;

2440 IF A<=HIG(0) THEN O1$=""

2450 IF A<=HIG(1) THEN O2$=""

2460 IF O1$="" AND O2$="" THEN RETURN

2470 NEXT A

2480 RETURN

2500 IF NOW$=MID$(ROWOP$,P+1,1) THEN CONT=3:RETURN ' Procedure oposite row check

2510 IF P<2 THEN RETURN

2520 IF NOW$=MID$(ROWOP$,P-1,1) THEN CONT=3

2530 RETURN

3000 LPOINT=0:GOSUB 1600:GOSUB1700 ' Procedure find and kill a symbol

3005 IF DIF=3 THEN Y=ME ELSE Y=0

3010 FOR X=2 TO HIG(Y)

3015 IF " "=MID$(ROW$(Y),X,1) THEN GOTO 3050

3020 IF KILL$=MID$(ROW$(Y),X,1) THEN ROW$(Y)=LEFT$(ROW$(Y),X-1)+" "+MID$(ROW$(Y),X+1):LPOINT=LPOINT+1:LOCATE X-1,Y:PRINT "*";:IF PCHECK(Y)=0 OR PCHECK(Y)>X THEN PCHECK(Y)=X

3040 NEXT X

3050 IF DIF<3 AND Y=0 THEN Y=1:GOTO 3010

3055 POINT=POINT+LPOINT*DIF:LOCATE HIG(0),0:PRINT LPOINT*DIF;:BEEP 1:BEEP

3060 GOSUB 1600:GOSUB 1700:GOSUB 1550

3070 IF DIF=3 THEN Y=ME ELSE Y=0

3080 IF RIGHT$(ROW$(Y),1)=" " THEN ROW$(Y)=LEFT$(ROW$(Y),LEN(ROW$(Y)-1):GOTO3080

3090 IF DIF<3 AND Y=0 THEN Y=1:GOTO 3080

3095 GOSUB1500:CLRLEV=HIG(0)+HIG(1)

3100 RETURN

4000 LOCATE 0,1:PRINT"1-PLAY 2-STARTLEVEL 3-EXIT"; ' Procedure menu line display

4010 LOCATE 20,1:PRINT SRTLEV;

4030 RETURN

4400 LEVEL=LEVEL+1 ' Procedure Next Level

4410 CLS:IF LEVEL=SRTLEV THEN PRINT "START GAME LEVEL"+STR$(LEVEL); ELSE PRINT "LEVEL CLEAR - NEXT LEVEL"+STR$(LEVEL);:BEEP 1:BEEP 0

4420 GOSUB 4600

4430 LOCATE 0,1:PRINT"MODE - SYMBOLS - ";

4440 LOCATE 7,1:PRINT MXD$(DIF);

4450 LOCATE 24,1:PRINT LEFT$(SYMBTEXT$,ELE);

4460 GOSUB 8000:RETURN

4600 IF LEVEL<=9 THEN LL=LEVEL ELSE LL=9

4610 DIF=LEVDIF(LL):ELE=LEVELE(LL)

4650 RETURN

5000 ERASE SYMB$:DIM SYMB$(6):SYMBTEXT$="" ' Procedure basic data preperation

5005 RESTORE 10000

5010 FOR I=1 TO 6

5012 READ A:SYMB$(I)=CHR$(A):SYMBTEXT$=SYMBTEXT$+SYMB$(I)

5015 NEXT I

5020 ERASE MXD$:DIM MXD$(3)

5025 RESTORE 10100

5030 FOR I=1 TO 3

5035 READ MXD$(I):NEXT I

5040 ERASE LEVDIF:DIM LEVDIF(14):ERASE LEVELE:DIM LEVELE(14)

5045 RESTORE 10110

5050 FOR I=1 TO 14

5055 READ LEVDIF(I),LEVELE(I):NEXT I

5060 IF DIF=0 THEN DIF=1

5070 IF ELE=0 THEN ELE=5

5075 IF SRTLEV=0 THEN SRTLEV=1

5080 ERASE OB$:DIM OB$(4,1)

5090 RETURN

6000 OB1=INT((RAN#*ELE)+1) ' Procedure next element generator

6005 OB2=INT((RAN#*ELE)+1)

6010 OB3=INT((RAN#*(ELE*2)+1)

6015 IF OB3>ELE OR (OB3=OB1 AND OB3=OB2) THEN C$=" " ELSE C$=SYMB$(OB3)

6020 A$=SYMB$(OB1):B$=SYMB$(OB2)

6025 RETURN

6030 OB$(1,0)=A$+C$+" ":OB$(1,1)=B$+" " ' Procedure generate all element rotations

6040 OB$(2,0)=B$+A$+" ":OB$(2,1)=" "+C$+" "

6050 IF C$=" " THEN OB$(3,0)=B$+" ":OB$(3,1)=A$+" " ELSE OB$(3,0)=" "+B$+" ":OB$(3,1)=C$+A$+" "

6060 OB$(4,0)=C$+" ":OB$(4,1)=A$+B$+" "

6100 RETURN

7000 KILL$=MID$(ROW$(ME),CPO,1) ' Procedure check for a match at single position

7005 IF KILL$=" " THEN RETURN

7010 CONT=0

7020 IF KILL$=MID$(ROW$(ME),CPO-1,1) THEN CONT=1

7030 IF LEN(ROW$(ME))>CPO THEN IF KILL$=MID$(ROW$(ME),CPO+1,1) THEN CONT=CONT+1

7040 IF DIF>1 OR CONT> 1 THEN GOTO7100

7050 IF ME=0 THEN OP=1 ELSE OP=0

7060 IF LEN(ROW$(OP))>=CPO THEN IF KILL$=MID$(ROW$(OP),CPO,1) THEN CONT=CONT+1:IF CONT<=1 THEN GOSUB7300

7100 IF CONT>1 THEN GOSUB 3000:PCHECK(ME)=2

7110 IF DIF=1 AND CONT>1 THEN PCHECK(OP)=2

7120 IF CONT<=1 THEN LOCATE 0,ME:PRINT ROW$(ME)+" ";

7200 RETURN

7300 IF LEN(ROW$(OP))>=CPO+1 THEN IF KILL$=MID$(ROW$(OP),CPO+1,1) THEN CONT=3:RETURN ' Procedure oposite row check

7310 IF CPO<2 THEN RETURN

7320 IF KILL$=MID$(ROW$(OP),CPO-1,1) THEN CONT=3

7330 RETURN

8000 K$=INKEY$:IF K$<>"" THEN GOTO 8000 ' Procedure Wait Keypress

8010 K$=INKEY$:IF K$="" THEN GOTO 8010

8020 RETURN

10000 DATA 232,233,234,235,236,237

10100 DATA EASY,MEDIUM,HARD

10110 DATA 1,2

10120 DATA 1,3

10130 DATA 1,4

10140 DATA 1,5

10150 DATA 2,2

10160 DATA 2,3

10170 DATA 2,4

10180 DATA 2,5

10190 DATA 2,6

10200 DATA 3,2

10210 DATA 3,3

10220 DATA 3,4

10230 DATA 3,5

10240 DATA 3,6

Calculator Game

This is a simple game for the CASIO FX-850P/FX-880P.

This Program is written in CASIO BASIC. Use it on you own risk.

Calculator Game - Basic Listing

1 ' CALCULATOR GAME FOR CASIO FX-850P/880P

2 ' BY THOMAS ILG

20 SOUND=1:STARTLEV=1

50 GOSUB 5000:CLS

60 WAVEL=18+STARTLEV*2:GUN=0

70 DISL=18-STARTLEV:IF DISL<8 THEN DISL=8

80 SPEED=16-STARTLEV

90 POINTS=0

100 GOSUB 4000

110 GOSUB 3700

200 T=T+1 'GAMELOOP

250 K$=INKEY$

260 IF K$="1" THEN GOSUB 2000:GOTO 280

265 IF K$="2" THEN T=SPEED:GOTO 280

270 IF K$="3" THEN GOSUB 3000:IF POS>WAVEL AND DIST$=RESULT$ THEN GOSUB3500:GOTO200 ELSE GOTO 280

275 IF K$="0" THEN GOTO 400

280 IF T<SPEED THEN GOTO 200

290 T=0:GOSUB 2500

300 IF LEFT$(DIST$,1)=" " THEN GOTO 200

400 CLS:PRINT" *** GAME OVER ***"; ' Procedure game over and highscore

405 IF SOUND=1 THEN BEEP 1:BEEP 0

410 LOCATE 0,1:PRINT "POINTS:";POINTS;"HS:";CSCORE;"BY ";CNAME$;

420 K$=INKEY$:IF K$<>"" THEN GOTO 420

430 K$=INKEY$:IF K$="" THEN GOTO 430

440 IF POINTS<=CSCORE THEN GOTO 50

450 CSCORE=POINTS

460 CLS:PRINT"NEW HIGHSCORE!";

470 LOCATE 0,1

480 INPUT "ENTER YOUR NAME: ",CNAME$

500 GOTO 50

600 END

2000 IF SOUND=1 THEN BEEP 0

2005 GUN=GUN+1

2010 IF GUN>9 THEN GUN=0

2020 LOCATE 1,0:PRINT GUN;

2100 RETURN

2500 DIST$=MID$(DIST$,2)+MID$(WAVET$,POS,1):POS=POS+1

2510 GOSUB 2600:RETURN

2600 LOCATE 5,0:PRINT DIST$;

2650 RETURN

3000 IF SOUND=1 THEN BEEP 1

3002 LOCATE 5,1:PRINT "FIRE";

3005 S$=MID$(STR$(GUN),2,1):LP=0

3010 I=DISL:TRIG=0

3015 C$=MID$(DIST$,I,1)

3020 IF C$=" " AND TRIG=1 THEN GOTO 3060

3025 IF C$<>" " AND TRIG=0 THEN TRIG=1

3030 IF C$=S$ THEN DIST$=" "+LEFT$(DIST$,I-1)+MID$(DIST$,I+1):LP=LP+1 ELSE I=I-1

3050 IF I>0 THEN GOTO 3015

3060 LOCATE 5,1:PRINT " ";

3070 IF LP=0 THEN GOTO 3100

3080 POINTS=POINTS+LP*LP*(16-SPEED)

3090 LOCATE 23,0:PRINT POINTS;

3100 GOSUB 2600:RETURN

3500 CLS:PRINT "*** STAGE CLEAR - NEXT STAGE ***";:IF SOUND=1 THEN BEEP 0:BEEP 1:BEEP 0

3505 IF SPEED>1 THEN SPEED=SPEED-1

3510 WAVEL=WAVEL+2

3520 IF DISL>8 THEN DISL=DISL-1

3550 GOSUB 4000:GOSUB 3700

3700 CLS

3704 LOCATE 0,0:PRINT CHR$(134);

3705 LOCATE 4,0:PRINT CHR$(134);

3710 FOR X=5+DISL TO 22

3712 LOCATE X,0:PRINT CHR$(134);

3715 NEXT X

3720 GOSUB 2600

3730 LOCATE 1,0:PRINT GUN;

3735 LOCATE 4,1:PRINT "> <";

3740 LOCATE 13,1:PRINT "LENGTH"+STR$(WAVEL)+" SPEED"+STR$(15-SPEED);

3750 LOCATE 23,0:PRINT POINTS;

3800 RETURN

4000 LOCATE 0,1:PRINT "CREATING WAVE...";

4003 WAVET$="":DIST$="":POS=1

4005 FOR I=1 TO WAVEL

4010 L$=STR$(INT(RAN#*10))

4020 WAVET$=WAVET$+MID$(L$,2,1)

4050 NEXT I

4060 FOR I=1 TO DISL

4070 DIST$=DIST$+" ":WAVET$=WAVET$+" "

4080 NEXT I

4090 T=SPEED:RESULT$=DIST$

4100 RETURN

5000 CLS

5010 PRINT " *** CALCULATOR GAME ***";

5020 IF SOUND=1 THEN SOUND$=" 3-BEEP ON " ELSE SOUND$=" 3-BEEP OFF"

5030 LOCATE 0,1:PRINT "1-START 2-LEVEL"+STR$(STARTLEV)+SOUND$;

5050 K$=INKEY$:IF K$="" THEN GOTO 5050

5060 IF K$="1" THEN RETURN

5070 IF K$="2" THEN GOSUB 5200:GOTO 5030

5080 IF K$="3" THEN GOSUB 5400:GOTO 5020

5090 GOTO 5050

5200 STARTLEV=STARTLEV+1:IF STARTLEV>15 THEN STARTLEV=1

5210 RETURN

5400 IF SOUND=0 THEN SOUND=1:BEEP 0 ELSE SOUND=0

5410 RETURN