mbstring extension must be loaded in order to run mPDF
sd:sd-8516_user_s_guide
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| sd:sd-8516_user_s_guide [2026/03/27 08:00] – appledog | sd:sd-8516_user_s_guide [2026/04/02 07:13] (current) – appledog | ||
|---|---|---|---|
| Line 116: | Line 116: | ||
| - | **Getting Started | + | **Getting Started |
| The easiest way to make your SD-8516 say hello is with **PRINT**. You can also use the ? key as shorthand. | The easiest way to make your SD-8516 say hello is with **PRINT**. You can also use the ? key as shorthand. | ||
| Line 139: | Line 139: | ||
| === GOTO | === GOTO | ||
| - | **Your First Program | + | **Your First Program |
| Let's write a real program. Type **NEW** and press ENTER to clear any old stuff. | Let's write a real program. Type **NEW** and press ENTER to clear any old stuff. | ||
| Line 596: | Line 596: | ||
| | 1986 | WYSE WY-60 | 10 (USER) | 12 | 4 | | | 1986 | WYSE WY-60 | 10 (USER) | 12 | 4 | | ||
| - | === Advanced Looping | + | === More Loops |
| Stellar BASIC V1 keeps things simple and fast; Originally there was not even a FOR-NEXT loop, and even now there is no WHILE or DO loop. But you can still create powerful repeating loops using just IF...THEN and GOTO. This section will demonstrate the kind of clever thinking you will need to write advanced programs in TinyBASIC. | Stellar BASIC V1 keeps things simple and fast; Originally there was not even a FOR-NEXT loop, and even now there is no WHILE or DO loop. But you can still create powerful repeating loops using just IF...THEN and GOTO. This section will demonstrate the kind of clever thinking you will need to write advanced programs in TinyBASIC. | ||
| Line 631: | Line 631: | ||
| 10 INPUT "ENTER A POSITIVE NUMBER ", N | 10 INPUT "ENTER A POSITIVE NUMBER ", N | ||
| 20 IF N > 0 THEN GOTO 40 | 20 IF N > 0 THEN GOTO 40 | ||
| - | 30 PRINT "TRY AGAIN – MUST BE POSITIVE!" | + | 30 PRINT "TRY AGAIN -- MUST BE POSITIVE!" |
| 40 IF N <= 0 THEN GOTO 10 | 40 IF N <= 0 THEN GOTO 10 | ||
| 50 PRINT " | 50 PRINT " | ||
| Line 827: | Line 827: | ||
| - | == CHAPTER 4: ADVANCED STELLAR | + | == CHAPTER 4: How to write games in Stellar |
| - | ** CHAPTER 4: ADVANCED BASIC PROGRAMMING** | + | In this chapter we will demonstrate some advanced programming techniques by writing a real game in Stellar BASIC. Today' |
| - | + | ||
| - | In this chapter we will demonstrate some advanced programming techniques by writing a real game in Stellar BASIC. Today' | + | |
| === robots or CHASE? | === robots or CHASE? | ||
| - | Robots is not an original game; it is a direct descendant of an earlier game called Chase, a turn-based pursuit game that likely originated in the early 1970s on the Dartmouth Time-Sharing System (DTSS) at Dartmouth College. The author of the original Chase remains unknown, but public versions appeared in Creative Computing magazine in 1976, with various modifications circulating afterward. Chase involved escaping from pursuing robots in a simple grid environment. | + | 'Robots' |
| === Development of the BSD Version | === Development of the BSD Version | ||
| Line 882: | Line 880: | ||
| Let's make it more exciting; let's draw the player, and a robot. | Let's make it more exciting; let's draw the player, and a robot. | ||
| - | <codify BASIC | + | <codify BASIC> |
| 10 LET PX = 19 | 10 LET PX = 19 | ||
| 20 LET PY = 11 | 20 LET PY = 11 | ||
| Line 944: | Line 942: | ||
| 240 RETURN | 240 RETURN | ||
| - | The above demo program checks for keys 10 times a second (WAIT 100). To check 50 times a second, try WAIT 20. Instead of WAIT, the program could be doing other things, like playing music or animating sprites! That's the power of a HASKEY loop -- but not every program needs to use that kind of input loop. | + | The above demo program checks for keys 5 times a second (WAIT 200). To check 10 times a second, try WAIT 100 (i.e. 100ms). Instead of WAIT, the program could be doing other things, like playing music or animating sprites! That's the power of a HASKEY loop -- but not every program needs to use that kind of input loop. |
| ==== Our ROBOTS input loop | ==== Our ROBOTS input loop | ||
| Line 1014: | Line 1012: | ||
| 120 REM GET PLAYER INPUT | 120 REM GET PLAYER INPUT | ||
| 130 GOSUB 2000 | 130 GOSUB 2000 | ||
| - | 150 REM LOOP UNTIL QUIT | + | |
| - | | + | |
| + | 180 REM LOOP UNTIL QUIT | ||
| + | | ||
| | | ||
| 1000 REM DRAW MAP | 1000 REM DRAW MAP | ||
| Line 1091: | Line 1091: | ||
| 4020 ? "OH NO! THE ROBOT CATCHES YOU." | 4020 ? "OH NO! THE ROBOT CATCHES YOU." | ||
| 4030 ? "GAME OVER." | 4030 ? "GAME OVER." | ||
| - | 4040 PRINT PX,PY,RX,RY | ||
| 4900 END | 4900 END | ||
| - | Finally, this would be a boring game if the robot didn't try and catch you! Here's how to make the robot move: | + | This would be a boring game if the robot didn't try and catch you! Here's how to make the robot move: |
| 140 REM MAKE ROBOTS MOVE | 140 REM MAKE ROBOTS MOVE | ||
| - | | + | |
| 7000 REM MAKE ROBOT MOVE TOWARDS PLAYER | 7000 REM MAKE ROBOT MOVE TOWARDS PLAYER | ||
| 7010 IF RX < PX THEN LET RX = RX + 1 | 7010 IF RX < PX THEN LET RX = RX + 1 | ||
| Line 1105: | Line 1104: | ||
| 7900 RETURN | 7900 RETURN | ||
| - | === ROBOTS.BAS Complete Program | + | And let's also add a beep every time the robots move, to add to their dread. You can read more about the PLAY command in [[SD-8516 Stellar Basic# |
| - | Here is the complete program: | + | |
| - | <codify BASIC> | + | 7100 PLAY "T120 W1 V5 O2 L24 B" |
| - | 10 LET PX = 19 | + | |
| - | 20 LET PY = 11 | + | |
| - | 30 LET RX = 1 | + | |
| - | 40 LET RY = 1 | + | |
| - | 100 REM DRAW MAP | + | If you play the game, you will notice the collision check doesn' |
| - | 110 GOSUB 1000 | + | |
| - | 120 REM GET PLAYER INPUT | + | |
| - | 130 GOSUB 2000 | + | |
| - | 140 REM MAKE ROBOTS MOVE | + | |
| - | 145 GOSUB 7000 | + | |
| - | 150 REM LOOP UNTIL QUIT | + | |
| - | 160 GOTO 100 | + | |
| - | 1000 REM DRAW MAP | + | 160 REM CHECK FOR COLLISION |
| - | 1005 VSTOP | + | 170 IF PX = RX THEN IF PY = RY THEN GOTO 4000 |
| - | 1010 CLS | + | |
| - | 1020 LET A = ASC(" | + | |
| - | 1030 FOR X = 0 TO 39 | + | |
| - | 1040 CHARXY X, 0, A | + | |
| - | 1050 CHARXY X, 24, A | + | |
| - | 1060 NEXT X | + | |
| - | 1070 FOR Y = 0 TO 24 | + | |
| - | 1080 CHARXY 0, Y, A | + | |
| - | 1090 CHARXY 39, Y, A | + | |
| - | 1100 NEXT Y | + | |
| - | 1110 LET PC = ASC(" | + | |
| - | 1120 LET RC = ASC(" | + | |
| - | 1200 CHARXY PX, PY, ASC(" | + | |
| - | 1300 CHARXY RX, RY, ASC(" | + | |
| - | 1800 VSTART | + | |
| - | 1900 RETURN | + | |
| - | 2000 REM *** SECTION B) INPUT LOOP | + | After this, you have the basis for a playable game. You could add: |
| - | 2010 LET K = GETKEY() | + | |
| - | 2015 IF K >= 97 THEN LET K = K - 32 | + | |
| - | 2020 LET L = ASC(" | + | |
| - | 2030 LET D = ASC(" | + | |
| - | 2040 LET U = ASC(" | + | |
| - | 2050 LET R = ASC(" | + | |
| - | 2060 LET Q = ASC(" | + | |
| - | 2200 IF K = L THEN GOSUB 5000 : REM MOVE LEFT | + | |
| - | 2210 IF K = D THEN GOSUB 5100 : REM MOVE DOWN | + | |
| - | 2220 IF K = U THEN GOSUB 5200 : REM MOVE UP | + | |
| - | 2230 IF K = R THEN GOSUB 5300 : REM MOVE RIGHT | + | |
| - | 2240 IF K = Q THEN GOSUB 5400 : REM QUIT | + | |
| - | 2300 IF PX = RX THEN IF PY = RY THEN GOTO 4000 | + | |
| - | 2500 IF PX = RX THEN IF PY = RY THEN GOTO 4000 | + | |
| - | 2900 RETURN | + | |
| - | 4000 REM ROBOT CATCHES YOU | + | * Levels with more robots |
| - | 4010 CLS | + | * A stone (junk pile) that kills robots when they touch it (they crash). |
| - | 4020 ? "OH NO! THE ROBOT CATCHES YOU." | + | * Robot collisions which create crash-piles |
| - | 4030 ? "GAME OVER." | + | * Scores, including a hi-score list |
| - | 4040 PRINT PX, | + | * A teleport function (max three times per level!) |
| - | 4900 END | + | * Anything you can think of! |
| - | + | ||
| - | 5000 REM MOVE PLAYER LEFT | + | |
| - | 5010 LET PX = PX - 1 | + | |
| - | 5020 IF PX < 1 THEN LET PX = 1 | + | |
| - | 5030 RETURN | + | |
| - | 5100 REM MOVE PLAYER DOWN | + | |
| - | 5110 LET PY = PY + 1 | + | |
| - | 5120 IF PY > 22 THEN LET PY = 22 | + | |
| - | 5130 RETURN | + | |
| - | 5200 REM MOVE PLAYER UP | + | |
| - | 5210 LET PY = PY - 1 | + | |
| - | 5220 IF PY < 1 THEN LET PY = 1 | + | |
| - | 5230 RETURN | + | |
| - | 5300 REM MOVE PLAYER RIGHT | + | |
| - | 5310 LET PX = PX + 1 | + | |
| - | 5320 IF PX > 38 THEN LET PX = 38 | + | |
| - | 5330 RETURN | + | |
| - | 5400 REM QUIT | + | |
| - | 5410 CLS | + | |
| - | 5420 PRINT "QUIT GAME" | + | |
| - | 5430 END | + | |
| - | + | ||
| - | 7000 REM MAKE ROBOT MOVE TOWARDS PLAYER | + | |
| - | 7010 IF RX < PX THEN LET RX = RX + 1 | + | |
| - | 7020 IF RX > PX THEN LET RX = RX - 1 | + | |
| - | 7030 IF RY < PY THEN LET RY = RY + 1 | + | |
| - | 7040 IF RY > PY THEN LET RY = RY - 1 | + | |
| - | 7050 PRINT RX,RY | + | |
| - | 7900 RETURN | + | |
| - | </ | + | |
| + | === ROBOTS.BAS Complete Program | ||
| + | The source code for ROBOTS.BAS is listed on the BASIC Programs page: | ||
| + | * [[Stellar BASIC Programs]] | ||
| + | * Direct link: [[https:// | ||
| == NEXT STEPS | == NEXT STEPS | ||
sd/sd-8516_user_s_guide.1774598434.txt.gz · Last modified: by appledog
