--- title: "Survive" id: 71463 type: "computer_media" slug: "survive-2" url: "http://localhost/computer_media/survive-2/" markdown_url: "http://localhost/computer_media/survive-2.md" published_at: "2026-09-09T09:04:27+00:00" modified_at: "2026-09-09T09:04:28+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/09/survive.png" excerpt: "Guide your character across a dot-filled screen to safety while homing crushers zero in on your every move — can you survive?" category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "1983" slug: "year-1983" taxonomy: "post_tag" url: "http://localhost/tag/year-1983/" - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Robert Midura" slug: "robert-midura" taxonomy: "indiv" url: "http://localhost/indiv/robert-midura/" genre: - name: "Game" slug: "game" taxonomy: "genre" url: "http://localhost/type/game/" media_type: "Program" programmers: - name: "Robert Midura" slug: "robert-midura" taxonomy: "indiv" url: "http://localhost/indiv/robert-midura/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Survive%20(1983)(Midura%2C%20Robert)(TS2068)(US)(Program).zip" tsrun_member: "Survive (1983)(Midura, Robert)(TS2068)(US)(Program).tap" mediadate: "1983" images: - url: "http://localhost/wp-content/uploads/2026/09/survive.png" media_type_tags: "Game" --- # Survive Survive is a single-screen action game in which the player navigates a character (“U”) from the left side of the screen to the right edge while avoiding crushing X’s that spawn and home in on the player’s position. Movement is handled via keyboard keys 5–8 or a joystick read through the STICK command, with keyboard input checked first and joystick used as a fallback. The playing field is a 21-row by 30-column grid backed by a two-dimensional array `m(21,30)` that tracks cell states for scoring; cells are initialized by printing dots across each row. Scoring accumulates based on array values as the player moves, with a 100-point bonus awarded for successfully crossing to the right edge of the screen. *** ### Program Structure The program is organized into several distinct functional regions rather than strictly sequential flow: 1. **Lines 10–20:** REM header and entry-point jump to the welcome screen. 2. **Lines 30–170:** Main game loop — reads input, moves the player, updates score and grid state, and decrements the timer. 3. **Lines 180–250:** Projectile (“X”) targeting logic, computing the next spawn position based on player trajectory. 4. **Lines 260–280:** X animation, placement, and collision check. 5. **Lines 290–330:** Score display, key-release wait, and game restart. 6. **Lines 340–420:** Game initialization — sets player position, zeroes timer, dimensions the grid array, clears score, draws the dot field. 7. **Lines 430–480:** Welcome/instructions screen with key/joystick wait. 8. **Line 490:** SAVE statement. ### Input Handling Input is polled rather than waited on. Lines 30–40 check keyboard keys 5–8 for vertical and horizontal movement respectively, computing signed deltas (`l` for row, `c` for column) using Boolean arithmetic — subtracting one direction’s condition from the other yields −1, 0, or +1. Lines 60–70 check STICK only if no keyboard input was detected (the `IF l OR c THEN GO TO 80` guard at line 50), making keyboard the primary input method. STICK directions use bitmask values (1, 2, 4, 8). The key/joystick release-then-press idiom used at lines 310–320 and 460–470 ensures a fresh deliberate press is required to continue: the first loop waits for all inputs to be idle, and the second waits for a new press. ### Grid and Scoring A two-dimensional array `m(21,30)` represents the play field. At initialization (lines 370–410), all cells default to zero. As the player moves, line 130 adds `m(x,y)+2` to the score `s`; since cells start at 0, each new cell is worth 2 points. Line 140 sets the visited cell to −2, so revisiting it contributes 0 points (−2+2=0). When an X lands on a cell, line 270 marks it −3, meaning if the player subsequently steps on that cell it would subtract 1 from the score. A 100-point bonus is added at line 290 when the player reaches column > 30 (the right edge). ### X (Projectile) Behavior Lines 180–250 compute where an X will appear. The timer `t` starts at zero; each game loop decrements it (line 150). When `t` reaches zero (line 160 branches to 260 to animate), and when `t` is negative it resets to a random value 3–5 (line 180). The target position `h,i` leads the player by `t` steps in the current movement direction (`l`, `c`), clamped to the screen bounds (lines 200–240). The X is animated with two alternating block-graphic frames (▖ and ▘) before settling as an inverse “X”. Collision is checked at line 280: if the X lands on the player’s current cell, control falls through to the game-over display at line 290. ### Notable Techniques - **Boolean arithmetic for movement:**`LET l=(INKEY$="6" AND x<21)-(INKEY$="7" AND x>1)` computes a clamped ±1 delta in a single expression, a compact BASIC idiom. - **Dual-source input with fallback:** Keyboard is tried first; the joystick path is skipped entirely if a key is held, avoiding input conflicts cleanly. - **Predictive targeting:** The X spawns ahead of the player’s current trajectory rather than at the player’s current position, creating a leading challenge. - **Score encoded in the grid:** Using the array both for game state and score calculation avoids maintaining a separate per-cell point table. - **OVER 1 underline on title:** Line 430 uses `OVER 1` to XOR-draw underscores over the welcome text, creating an underline effect without overwriting characters. ### Bugs and Anomalies - The timer variable `t` is initialized to 0 at line 360 via `LET s=t` (which also sets `s` to 0). However, `t` itself is only set to 0 at line 360 because it was freshly DIMmed or carried from a previous game. On the very first pass through the main loop, `t` decrements to −1 immediately (line 150), causing the X-targeting code (lines 180–250) to fire on the very first move, which may be intentional for difficulty. - Line 300 uses `PRINT #1` (the lower information area) for the “Press a key…” prompt, while the score is displayed on the main screen at line 290 — a deliberate split-screen use of the display. - The `m` array is dimensioned as `m(21,30)` but the player’s column `y` is allowed to reach 31 (checked at line 120 to trigger game-over). Line 130 could in theory index `m(x,31)` before the check at line 120 executes — however, line 120 comes before line 130, so the out-of-bounds access is prevented correctly. ## Source Code ``` 10 REM \{20}\{1}>> SURVIVE <<\{20}\{0} \* Sync, Sept/Oct 1983 by Robert J. Midura 20 CLS :GO TO 430 30 LET l=(INKEY$="6" AND x<21)-(INKEY$="7" AND x>1) 40 LET c=(INKEY$="8" AND y<31)-(INKEY$="5" AND y>1) 50 IF l OR c THEN GO TO 80 60 LET l=(STICK (1,2)=2 AND x<21)-(STICK (1,2)=1 AND x>1) 70 LET c=(STICK (1,2)=8 AND y<31)-(STICK (1,2)=4 AND y>1) 80 PRINT AT x,y;" " 90 LET x=x+l 100 LET y=y+c 110 PRINT AT x,y;"U" 120 IF y>30 THEN GO TO 290 130 LET s=s+m(x,y)+2 140 LET m(x,y)=-2 150 LET t=t-1 160 IF NOT t THEN GO TO 260 170 IF t>0 THEN GO TO 30 180 LET t= INT (RND*3+3) 190 LET h=x+t*l 200 IF h>21 THEN LET h=21 210 IF h<1 THEN LET h=1 220 LET i=y+t*c 230 IF i<1 THEN LET i=1 240 IF i>31 THEN LET i=31 250 GO TO 30 260 FOR z=1 TO 2:PRINT AT h,i;"\.'":PAUSE 5:PRINT AT h,i;"\'.":PAUSE 5:NEXT z:PRINT AT h,i;"\{20}\{1}X\{20}\{0}" 270 LET m(x,y)=-3 280 IF h <>x OR i <>y THEN GO TO 30 290 PRINT AT 0,11;"\{20}\{1} SCORE \{20}\{0} ";s+(100 AND y>30) 300 PRINT #1; AT 0,9;"Press a key...":FOR L=1 TO 99:NEXT L 310 IF INKEY$ <>"" OR STICK (1,2) <>0 OR STICK (2,2) <>0 THEN GO TO 310 320 IF INKEY$="" AND STICK (1,2)=0 AND STICK (2,2)=0 THEN GO TO 320 330 GO TO 430 340 LET x=10 350 LET y=1 360 LET t=0 370 DIM m(21,30) 380 LET s=t 390 FOR l=1 TO 21 400 PRINT AT l,0;"................................" 410 NEXT l 420 GO TO 30 430 CLS :PRINT "WELCOME TO SURVIVE!"; AT 0,0; OVER 1;"___________________"'''" The object of the game is to travel to the right side of the screen using the arrow keys","(5-8) without getting squashed by the evil \{20}\{1}X\{20}\{0}'s." 440 PRINT ''" The right joystick can also be used." 450 PRINT '''"\{20}\{1}PRESS A KEY OR JOYSTICK BUTTON..\{20}\{0}" 460 IF INKEY$ <>"" OR STICK (1,2) <>0 OR STICK (2,2) <>0 THEN GO TO 460 470 IF INKEY$="" AND STICK (1,2)=0 AND STICK (2,2)=0 THEN GO TO 470 480 CLS :GO TO 340 490 SAVE "SURVIVE" LINE 10 ```