Hexidecimal values may now be denoted in expressions using the &H prefix.
The INP() function and OUT command has been added to the DOS Edition. It makes sense to allow DOS programmers the ability to access ports. This only works on the DOS .Edition and not DPMI, Win32, or Linux. While this allows for incompatible software to exist, the trade-off is worth it. Express BASIC for DOS is a whole new animal now. Especially with the addition of hex notation.
I tried adding Peek/Poke/Def Seg and had some luck, but still can't get it right. When I get that down I will try Varseg and Varptr. Maybe even Call Absolute.. That one looks difficult. For now, we have INP() and OUT for tinkering.
For example, INP(96) is now valid in Express BASIC. You may read keyboard input in real time.
I have updated the documentation. As always, please check it before using to avoid confusion. Please let me know if anyone has questions or wants to suggest something that is missing or incorrect.
More example programs have been added. There's a total of 18 playable games now that are cross platform between Linux, Windows, and DOS.
Here's a few of the new examples:
Code: 1 REM Percentages Quiz
2 REM by Beronica Smothers
5 PRECISION 2
10 CLS: PRINT "*** Percentages Quiz ***": PRINT
20 INPUT "How many questions"; Q
25 LET C = 0
30 FOR I = 0 TO Q - 1
40 CLS
50 LET T = INT(RND * 9) + 1
60 GOSUB T * 1000
70 PRINT: PRINT: INPUT "Enter 0 to continue or 1 to exit. ", Z
80 IF Z = 1 THEN 100
90 NEXT I
100 LET P = C / Q * 100
110 CLS: PRINT: PRINT "You got "; P; "%% of the questions correct!": PRINT
120 IF P >= 90 THEN PRINT "You got an A! Amazing!"
130 IF P >= 80 AND P < 90 THEN PRINT "You got a B! Not bad!"
140 IF P >= 70 AND P < 80 THEN PRINT "You got a C! Could have done better."
150 IF P >= 60 AND P < 70 THEN PRINT "You got a D! Needs improvement!"
160 IF P < 60 THEN PRINT "You got an F! What a catastrophe!"
170 PRINT: PRINT: INPUT "Try again? Yes(1) No(2) ", Z
180 IF Z = 1 THEN 10
190 PRINT: PRINT "Hmm...alright. You better come back!"
200 END
999 REM *** Discount
1000 LET OP = (RND * 100) + ABS(RND - 1)
1010 LET PD = INT(RND * 99) + 1
1020 LET D = OP * (PD * .01)
1030 PRINT "A video game originally costs $"; OP
1040 PRINT "It now has a "; PD;"%% discount."
1050 PRINT: INPUT "What is the discount? $", A: PRINT
1060 IF A = D THEN PRINT "Correct!": LET C = C + 1: RETURN
1070 PRINT "Incorrect! The discount is $"; D: RETURN
1999 REM *** Final price after discount
2000 LET OP = (RND * 100) + ABS(RND - 1)
2010 LET PD = INT(RND * 99) + 1
2020 LET FP = OP - (OP * (PD * .01))
2030 PRINT "A video game originally costs $"; OP
2040 PRINT "It now has a "; PD;"%% discount."
2050 PRINT: INPUT "What is the final price? $", A: PRINT
2060 IF A = FP THEN PRINT "Correct!": LET C = C + 1: RETURN
2070 PRINT "Incorrect! The final price is $"; FP: RETURN
2999 REM *** Percent discount
3000 LET FP = (RND * 100) + ABS(RND - 1)
3010 LET OP = (RND * 100) + ABS(RND - 1): IF OP <= FP THEN 3010
3020 LET PD = (1 - (FP / OP)) * 100
3030 PRINT "A video game now costs $"; FP
3040 PRINT "The original price was $"; OP
3050 PRINT: INPUT "What is the percent discount"; A: PRINT
3060 IF A = PD THEN PRINT "Correct!": LET C = C + 1: RETURN
3070 PRINT "Incorrect! The percent discount is "; PD; "%%": RETURN
3999 REM *** Original price before discount
4000 LET FP = (RND * 100) + ABS(RND - 1)
4010 LET PD = INT(RND * 99) + 1
4020 LET OP = FP / ((100 - PD) * .01)
4030 PRINT "A video game is on sale for "; PD; "%% off."
4040 PRINT "The final price is $"; FP
4050 PRINT: INPUT "What was the original price? $", A: PRINT
4060 IF A = OP THEN PRINT "Correct!": LET C = C + 1: RETURN
4070 PRINT "Incorrect! The original price is $"; OP: RETURN
4999 REM *** Final price after markup
5000 LET OP = (RND * 100) + ABS(RND - 1)
5010 LET PD = INT(RND * 99) + 1
5020 LET FP = OP + (OP * (PD * .01))
5030 PRINT "A game console costs $"; OP; " to make."
5040 PRINT "The store marks it up "; PD; "%% to make profit."
5050 PRINT: INPUT "What is the final price of the game console? $", A: PRINT
5060 IF A = FP THEN PRINT "Correct!": LET C = C + 1: RETURN
5070 PRINT "Incorrect! The final price is $"; FP: RETURN
5999 REM *** Taxes
6000 LET BT = (RND * 100) + ABS(RND - 1)
6010 LET ST = 8
6020 LET TA = BT * (ST * .01)
6030 PRINT "Your total before taxes comes out to $"; BT
6040 PRINT "Your state's sales tax is "; ST; "%%"
6050 PRINT: INPUT "How much will you be paying in taxes? $", A: PRINT
6060 IF A = TA THEN PRINT "Correct!": LET C = C + 1: RETURN
6070 PRINT "Incorrect! The tax amount is $"; TA: RETURN
6999 REM *** Total after taxes
7000 LET BT = (RND * 100) + ABS(RND - 1)
7010 LET ST = 8
7020 LET AT = BT + (BT * (ST * .01))
7030 PRINT "Your total before taxes comes out to $"; BT
7040 PRINT "Your state's sales tax is "; ST; "%%"
7050 PRINT: INPUT "What is your total after taxes? $", A: PRINT
7060 IF A = AT THEN PRINT "Correct!": LET C = C + 1: RETURN
7070 PRINT "Incorrect! Your total after taxes is $"; AT: RETURN
7999 REM *** Total after taxes
8000 LET AT = (RND * 100) + ABS(RND - 1)
8010 LET ST = 8
8020 LET BT = AT / ((100 + ST) * .01)
8030 PRINT "Your total after taxes comes out to $"; AT
8040 PRINT "Your state's sales tax is "; ST; "%%"
8050 PRINT: INPUT "What was your total before taxes? $", A: PRINT
8060 IF A = BT THEN PRINT "Correct!": LET C = C + 1: RETURN
8070 PRINT "Incorrect! Your total before taxes is $"; BT: RETURN
8999 REM *** Percent from ratio
9000 LET R1 = INT(RND * 99) + 1
9010 LET R2 = INT(RND * 100) + 1: IF R2 <= R1 THEN 9010
9020 LET P = R1 / R2 * 100
9030 PRINT "You buy a new video game and take it for a spin!"
9040 PRINT "You shot down "; R1; " out of "; R2; " enemy space ships!"
9050 PRINT: INPUT "What is your percent accuracy"; A: PRINT
9060 IF A = P THEN PRINT "Correct!": LET C = C + 1: RETURN
9070 PRINT "Incorrect! Your percent accuracy is "; P; "%%": RETURN
Code: 10 PRINT TAB(33); "SPLAT"
20 PRINT TAB(15); "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
40 PRINT: PRINT: PRINT
95 PRINT "WELCOME TO 'SPLAT' -- THE GAME THAT SIMULATES A PARACHUTE"
96 PRINT "JUMP. TRY TO OPEN YOUR CHUTE AT THE LAST POSSIBLE"
97 PRINT "MOMEMT WITHOUT GOING SPLAT."
118 PRINT: PRINT: LET D1 = 0: LET V = 0: LET A = 0: LET N = 0: LET M = 0: LET D1 = INT(9001 * RND + 1000)
119 PRINT " SELECT YOUR OWN TERMINAL VELOCITY (YES(1) NO(2))";: INPUT Z
120 IF Z = 2 THEN GOTO 128
121 IF Z <> 1 THEN PRINT "YES(1) OR NO(2)";: INPUT Z: GOTO 120
123 PRINT "WHAT TERMINAL VELOCITY (MI/HR)";:INPUT V1
125 LET V1 = V1 * (52800 / 3600): LET V = V1 + ((V1 * RND) / 20) - ((V1 * RND) / 20): GOTO 135
128 LET V1 = INT(1000 * RND)
130 PRINT "OK. TERMINAL VELOCITY = "; V1; " MI/HR"
131 LET V1 = V1 * (52800 / 3600): LET V = V1 + ((V1 * RND) / 20) - ((V1 * RND) / 20)
135 PRINT "WANT TO SELECT ACCERLERATION DUE TO GRAVITY (YES(1) OR NO(2))";
136 INPUT Z
140 IF Z = 2 THEN 150
141 IF Z <> 1 THEN PRINT "YES(1) OR NO(2)";: INPUT Z: GOTO 140
143 PRINT "WHAT ACCELERATION (FT/SEC/SEC)";: INPUT A2
145 LET A = A2 + ((A2 * RND) / 20) - ((A2 * RND) / 20): GOTO 205
150 LET Z = INT(1 + (10 * RND))
151 IF Z = 1 THEN PRINT "FINE. YOU'RE ON MERCURY. ACCELERATION=12.2FT/SEC/SEC":GOTO 161
152 IF Z = 2 THEN PRINT "ALRIGHT. YOU'RE ON VENUS. ACCELERATION=28.3FT/SEC/SEC":GOTO 162
153 IF Z = 3 THEN PRINT "THEN YOU'RE ON EARTH. ACCELERATION=32.16FT/SEC/SEC":GOTO 163
154 IF Z = 4 THEN PRINT "FINE. YOU'RE ON THE MOON. ACCELERATION=5.15FT/SEC/SEC":GOTO 164
155 IF Z = 5 THEN PRINT "ALRIGHT. YOU'RE ON MARS. ACCELERATION=12.5FT/SEC/SEC":GOTO 165
156 IF Z = 6 THEN PRINT "THEN YOU'RE ON JUPITER. ACCELERATION=85.2FT/SEC/SEC":GOTO 166
157 IF Z = 7 THEN PRINT "FINE. YOU'RE ON SATURN. ACCELERATION=37.6FT/SEC/SEC":GOTO 167
158 IF Z = 8 THEN PRINT "ALRIGHT. YOU'RE ON URANUS. ACCELERATION=33.8FT/SEC/SEC":GOTO 168
159 IF Z = 9 THEN PRINT "THEN YOU'RE ON NEPTUNE. ACCELERATION=39.6FT/SEC/SEC":GOTO 169
160 IF Z = 10 THEN PRINT "FINE. YOU'RE ON THE SUN. ACCELERATION=896FT/SEC/SEC":GOTO 170
161 LET A2 = 12.2: GOTO 145
162 LET A2 = 28.3: GOTO 145
163 LET A2 = 32.16: GOTO 145
164 LET A2 = 5.15: GOTO 145
165 LET A2 = 12.5: GOTO 145
166 LET A2 = 85.2: GOTO 145
167 LET A2 = 37.6: GOTO 145
168 LET A2 = 33.8: GOTO 145
169 LET A2 = 39.6: GOTO 145
170 LET A2 = 896: GOTO 145
205 PRINT
206 PRINT " ALTITUDE = "; D1; " FT"
207 PRINT " TERM.VELOCITY = "; V1; " FT/SEC = +-5 %"
208 PRINT " ACCELERATION = "; A2; " FT/SEC/SEC = -5 %"
210 PRINT "SET THE TIMER FOR YOUR FREEFALL."
211 PRINT "HOW MANY SECONDS";: INPUT T
215 PRINT "HERE WE GO."
217 PRINT
218 PRINT "TIME (SEC)", "DIST TO FALL (FT)"
219 PRINT "==========", "================="
300 FOR I = 0 TO T STEP (T/8)
310 IF I > V / A THEN GOTO 400
320 LET D = D1 - ((A / 2) * I ^ 2)
330 IF D <= 0 THEN GOTO 900
240 PRINT I, TAB(8), D
350 NEXT I
360 GOTO 500
400 PRINT "TERMINAL VELOCITY REACHED AT T PLUS "; V / A; " SECONDS"
405 FOR I = I TO T STEP (T / 8)
410 LET D = D1 - ((V ^ 2 / (2 * A)) + (V * (I - (V / A))))
420 IF D <= 0 THEN GOTO 1010
430 PRINT I, TAB(8), D
440 NEXT I
500 PRINT "CHUTE OPEN"
510 LET K = 0: LET K1 = 0
550 FOR J = 0 TO 42
555 IF @(J) = 0 THEN GOTO 620
560 LET K = K + 1
570 IF D >= @(J) THEN GOTO 600
580 LET K1 = K1 + 1
600 NEXT J
610 GOTO 540
620 LET @(J) = D
630 IF J > 2 THEN 650
635 PRINT "AMAZING!!! NOT BAD FOR YOUR ";
636 IF J = 0 THEN PRINT "1ST ";
637 IF J = 1 THEN PRINT "2ND ";
638 IF J = 2 THEN PRINT "3RD ";
639 PRINT "SUCCESSFUL JUMP!!!": GOTO 2000
650 IF K - K1 <= .1 * K THEN GOTO 700
660 IF K - K1 <= .25 * K THEN GOTO 710
670 IF K - K1 <= .5 * K HEN GOTO 720
680 IF K - K1 <= .75 * K THEN GOTO 730
690 IF K - K1 <= .9 * K THEN GOTO 740
695 GOTO 750
700 PRINT "WOW! THAT'S SOME JUMPING. OF THE "; K; " SUCCESFUL JUMPS"
701 PRINT "BEFORE YOURS, ONLY "; K - K1; " OPENED THEIR CHUTE LOWER THAN"
702 PRINT "YOU DID."
703 GOTO 2000
710 PRINT "PRETTY GOOD! "; K; " SUCCESSFUL JUMPS PRECEDED YOURS AND ONLY"
711 PRINT K - K1; " OF THEM GOT LOWER THAN YOU DID BEFORE THEIR CHUTES"
712 PRINT "OPENED.": GOTO 2000
720 PRINT "NOT BAD. THERE HAVE BEEN "; K; " SUCCESSFUL JUMPS BEFORE YOURS."
721 PRINT "YOU WERE BEATEN OUT BY "; K - K1; " OF THEM.": GOTO 2000
730 PRINT "CONSERVATIVE AREN'T YOU? YOU RANKED ONLY "; K - K1; " IN THE"
731 PRINT K; " SUCCESSFUL JUMPS BEFORE YOURS.": GOTO 2000
740 PRINT "HUMPH! DON'T YOU HAVE ANY SPORTING BLOOD? THERE WERE"
741 PRINT K; " SUCCESSFUL JUMPS BEFORE YOURS AND YOU CAME IN "; K1; " JUMPS"
742 PRINT "BETTER THAN THE WORST. SHAPE UP!!!": GOTO 2000
750 PRINT "HEY! YOU PULLED THE RIP CORD MUCH TOO SOON. "; K; " SUCCESSFUL"
751 PRINT "JUMPS BEFORE YOURS AND YOU CAME IN NUMBER "; K- K1; "! GET WITH IT!"
752 GOTO 2000
800 PRINT "REQUIESCAT IN PEACE.": GOTO 1950
801 PRINT "MAY THE ANGEL OF HEAVEN LEAD YOU INTO PARADISE": GOTO 1950
802 PRINT "REST IN PEACE": GOTO 1950
803 PRINT "SON-OF-A-GUN": GOTO 1950
804 PRINT "#$%&&%!$": GOTO 1950
805 PRINT "A KICK IN THE PANTS IS A BOOST IF YOU'RE HEADED RIGHT": GOTO 1950
806 PRINT "HMMM. SHOULD HAVE PICKED A SHORTER TIME.": GOTO 1950
807 PRINT "MUTTER. MUTTER. MUTTER": GOTO 1950
808 PRINT "PUSHING UP DAISIES.": GOTO 1950
809 PRINT "EASY COME, EASY GO.": GOTO 1950
900 PRINT SQR(2 * D1 / A), "SPLAT"
1000 LET Z = INT(1 + (10 * RND)): IF Z = 1 THEN 800
1001 IF Z = 2 THEN 801
1002 IF Z = 3 THEN 802
1003 IF Z = 4 THEN 803
1004 IF Z = 5 THEN 804
1005 IF Z = 6 THEN 805
1006 IF Z = 7 THEN 806
1007 IF Z = 8 THEN 807
1008 IF Z = 9 THEN 808
1009 IF Z = 10 THEN 809
1010 PRINT (V / A) + ((D1 - (V ^ 2 / (2 * A))) / V), "SPLAT"
1020 GOTO 1000
1950 PRINT "I'LL GIVE YOU ANOTHER CHANCE." GOTO 2000
2000 PRINT "DO YOU WANT TO PLAY AGAIN YES(1) OR NO(2)";: INPUT Z
2001 IF Z = 1 THEN GOTO 118
2002 IF Z = 2 THEN GOTO 2005
2003 PRINT "YES(1) OR NO(2)": GOTO 2000
2005 PRINT "PLEASE";: INPUT Z: IF Z = 1 THEN 118
2006 IF Z <> 2 THEN PRINT "YES(1) OR NO(2)";: GOTO 2005
2007 PRINT "SSSSSSSSSS.": GOTO 2046
2046 END
Code: 10 PRINT TAB(32); "REVERSE"
20 PRINT TAB(15); "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
30 PRINT: PRINT: PRINT
100 PRINT "REVERSE -- A GAME OF SKILL": PRINT
140 REM *** N = NUMBER OF NUMBERS
150 LET N = 9
160 PRINT "DO YOU WANT THE RULES YES(1) NO(2)";
170 INPUT A
180 IF A = 2 THEN 210
190 GOSUB 710
200 REM *** MAKE A RANDOM LIST A(1) TO A(N)
210 LET @(1) = INT((N - 1) * RND + 2)
220 FOR K = 2 TO N
230 LET @(K) = INT(N * RND + 1)
240 FOR J = 1 TO K - 1
250 IF @(K) = @(J) THEN 230
260 NEXT J
261 NEXT K
280 REM *** PRINT ORIGINAL LIST AND START GAME
290 PRINT: PRINT "HERE WE GO ... THE LIST IS:"
310 LET T = 0
320 GOSUB 610
330 PRINT "HOW MANY SHALL I REVERSE";
340 INPUT R
350 IF R = 0 THEN 520
360 IF R <= N THEN 390
370 PRINT "OOPS! TOO MANY! I CAN REVERSE AT MOST"; N: GOTO 330
390 LET T = T + 1
400 REM *** REVERSE R NUMBERS AND PRINT NEW LIST
410 FOR K = 1 TO INT(R / 2)
420 LET Z = @(K)
430 LET @(K) = @(R - K + 1)
440 LET @(R - K + 1) = Z
450 NEXT K
460 GOSUB 610
470 REM *** CHECK FOR A WIN
480 FOR K = 1 TO N
490 IF @(K) <> K THEN 330
500 NEXT K
510 PRINT "YOU WON IT IN "; T; " MOVES!!!": PRINT
520 PRINT
530 PRINT "TRY AGAIN (YES(1) NO(2))";
540 INPUT A
550 IF A = 1 THEN 210
560 PRINT: PRINT "O.K. HOPE YOU HAD FUN!!": GOTO 999
600 REM *** SUBROUTINE TO PRINT LIST
610 PRINT
611 FOR K = 1 TO N
612 PRINT @(K);
613 NEXT K
650 PRINT: PRINT: RETURN
700 REM *** SUBROUTINE TO PRINT THE RULES
710 PRINT: PRINT "THIS IS THE GAME OF 'REVERSE'. TO WIN, ALL YOU HAVE"
720 PRINT "TO DO IS ARRANGE A LIST OF NUMBERS (1 THROUGH ";N; ")"
730 PRINT "IN NUMERICAL ORDER FROM LEFT TO RIGHT. TO MOVE, YOU"
740 PRINT "TELL ME HOW MANY NUMBERS (COUNTING FROM THE LEFT) TO"
750 PRINT "REVERSE. FOR EXAMPLE, IF THE CURRENT LIST IS:"
760 PRINT: PRINT "2 3 4 5 1 6 7 8 9"
770 PRINT: PRINT "NOW IF YOU REVERSE 5, YOU WIN!"
800 PRINT: PRINT "1 2 3 4 5 6 7 8 9": PRINT
810 PRINT "NO DOUBT YOU WILL LIKE THIS GAME, BUT"
820 PRINT "IF YOU WANT TO QUIT, REVERSE 0 (ZERO).": PRINT: RETURN
999 END