--- title: "Basic BASIC" id: 51861 type: "computer_media" slug: "basic-basic" url: "http://localhost/computer_media/basic-basic/" markdown_url: "http://localhost/computer_media/basic-basic.md" published_at: "2023-08-16T01:42:19+00:00" modified_at: "2026-04-03T07:59:12+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2019/02/20230809-041332.jpg" excerpt: "A hands-on introductory BASIC course teaches INPUT, loops, subroutines, and INKEY$ through a series of block-graphic figures and a simple juggling game." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "2-Bit Software" slug: "2-bit-software" taxonomy: "post_tag" url: "http://localhost/tag/2-bit-software/" - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Programming" slug: "programming" taxonomy: "genre" url: "http://localhost/type/programming/" media_type: "Cassette" download_url: "https://archive.org/download/timex-sinclair-software-archive/Basic BASIC (1983)(2-Bit Software)(US)(TS1000)(Cassette).zip" mediadate: "1983" producer_company: - id: 10607 title: "2-Bit Software" type: "company" url: "http://localhost/company/2-bit-software/" related_products: - id: 11875 title: "Basic Basic" type: "product" url: "http://localhost/product/basic-basic/" media_type_tags: "Programming" --- # Basic BASIC This collection of introductory BASIC programs teaches fundamental programming concepts through character graphics, covering INPUT/OUTPUT, PRINT AT positioning, FOR/NEXT loops, GOSUB/RETURN subroutines, INKEY$ polling, and simple collision detection. Each mini-program draws block-graphic figures — a stick person, a juggler, a penguin, a car, and a traffic officer — using the block graphic character set to create crude but recognizable shapes. The juggler program demonstrates a simple real-time game loop where the player presses “M” to move a ball upward to catch a falling star, with collision detection at a specific screen coordinate. Several programs use the PRINT AT statement to confine user prompts to line 21, keeping the play area clear while awaiting INPUT. Variable pairs D (down/row) and A (across/column) are used consistently across programs as a movable anchor point for multi-row sprite drawing. *** ## Program Analysis This listing is a compilation of several independent short programs, each demonstrating a specific BASIC concept. They appear to be teaching exercises from a structured course, progressing from simple INPUT/PRINT through subroutines and real-time INKEY$ polling. The programs are not linked to each other; each starts at line 10 (or nearby) and stands alone. ### Program Structure Overview | Segment | Topic | Key Features | | --- | --- | --- | | INPUT demo (lines 3–80 / 100–240) | INPUT and INKEY$ | Two independent sections: INPUT-based person drawing, then INKEY$ toggle display | | Juggler game (lines 10–340) | Real-time game loop | Moving star, ball control, collision detection, GOSUB sprite | | Sandy’s Cartoon Show (lines 10–340) | Subroutines and animation | Two alternating GOSUB sprites, erase routine, FOR/NEXT loop | | Movement demo (lines 10–350) | FOR/NEXT and INKEY$ motion | Right, left, down, up movement using separate line-number blocks | | Greeting/Box/Car (lines 5–270) | PRINT AT layout | Static drawings, car and officer positioned mid-screen, LET for movable anchor | | Penguin program (lines 10–290) | GOSUB and erase | Draw and erase penguin at user-specified D,A coordinates | ### Sprite Representation All figures are drawn as 3-row tall character sprites using block graphics and standard ASCII characters. The consistent convention uses variable `D` for the row and `A` for the column, with `PRINT AT D,A`, `PRINT AT D+1,A`, and `PRINT AT D+2,A` forming each sprite. This pattern appears in every program in the collection and is clearly the central pedagogical technique being taught. Erase routines (e.g., lines 250–290 in the Cartoon Show and Penguin programs) simply reprint three spaces at the same coordinates, overwriting the sprite — a straightforward but effective approach without needing CLS. ### Juggler Game The juggler game is the most technically complex segment. It maintains two moving objects: a star that increments column `A` across row 7, and a ball at column 22 whose row `D` decreases when the player holds “M”. Key logic: - Line 60 prints a star character at `AT 7,A`; line 70 erases the previous ball position with `"."` before redrawing at line 90 — a simple erase-before-draw animation technique. - Collision is checked at line 100: `IF D=7 AND A=21 THEN GOTO 300`, requiring precise positioning. - Line 110 resets the ball to row 18 if it reaches row 6, preventing it going off-screen. - Line 120 wraps the star back to column 0 when it reaches column 30. - The GOSUB at line 20 draws the juggler figure once at the start; the figure is not redrawn each loop, relying on the display not being cleared. ### INKEY$ Usage Two different INKEY$ patterns are demonstrated. In lines 220–240 of the first segment, a polling loop toggles display text based on whether any key is pressed, using two consecutive `IF INKEY$ = ""` and `IF INKEY$ <> ""` checks — note that between the two checks the key state could change, making these not truly atomic. In the juggler and movement demos, INKEY$ is polled inline within the game loop to steer objects, which is the more typical real-time usage. ### Movement Demo Structure The movement demo places four independent motion routines at different line-number bands (10–50, 90–130, 190–240, 290–350), each ending with `STOP` so only the currently RUN segment executes. The “move up” section at lines 290–350 uses a INKEY$-driven loop rather than FOR/NEXT, polling for “M” to decrement `D` and looping back with `GOTO 310`, which means the figure only moves when the key is held and stops otherwise — a non-trivial behavioral difference from the FOR/NEXT examples. ### Notable Idioms and Techniques - Prompts are printed using `PRINT AT 21,0` with trailing spaces to overwrite previous longer prompts, keeping the display area clean without CLS. - The cartoon show uses a `FOR J=1 TO 80` loop alternating two GOSUB sprite routines to create a simple two-frame animation cycle. - Quoted strings containing a literal double-quote use the doubled-quote escape, e.g., `"SANDY""S"` and `"DON""T TOUCH"`. - REM lines are used liberally as inline documentation, consistent with the teaching purpose of the listing. - The copyright notice embedded in a REM at line 270 uses inverse-video block characters to spell out a company name, which is invisible to the running program but visible in the listing. ### Potential Issues - In the juggler game, line 70 uses `PRINT AT D,22;"."` to erase the ball by printing a period rather than a space — this leaves a dot artifact at every previous ball position rather than truly erasing it. - The double INKEY$ check at lines 220–230 (first segment) reads the keyboard twice in sequence; rapid or borderline keypresses could produce inconsistent results since both branches might fire or neither might fire. - In the “move up” section (lines 300–350), the initial `LET D=20` at line 300 is outside the loop, so after `CLS` and `GOTO 300` at lines 340–350, `D` is correctly reset each cycle — this is intentional design. - Sandy’s Cartoon Show has a line 20 `REM GET VALUE FOR D` that immediately precedes a `PRINT AT 21,0` prompt, but line 100 calls `GOSUB 200` and line 110 calls `GOSUB 300` in the same loop iteration with no erase between them, so the two sprite variants are drawn on top of each other each frame rather than alternating cleanly. ## Source Code ``` 3 REM USING INPUT 5 REM GET VALUE FOR D 10 PRINT "HOW FAR DOWN?" 20 INPUT D 25 REM GET VALUE FOR A 30 PRINT "HOW FAR ACROSS?" 40 INPUT A 45 REM DRAW PERSON AT D,A 50 PRINT AT D,A;" O▗" 60 PRINT AT D+1,A;"▛[:]▀" 70 PRINT AT D+2,A;"▗█▖" 80 STOP 100 REM DOING IT OVER AND OVER 110 PRINT AT 21,0;"HOW FAR DOWN? " 120 INPUT D 130 PRINT AT 21,0;"HOW FAR ACROSS?" 140 INPUT A 150 PRINT AT D,A;" O▗" 160 PRINT AT D+1,A;"▛[:]▀" 170 PRINT AT D+2,A;"▗█▖" 180 GOTO 110 200 REM FUNNY LITTLE PROGRAM 210 REM USE INKEY$ 220 IF INKEY$ ="" THEN PRINT AT 10,10;" " 230 IF INKEY$ <>"" THEN PRINT AT 10,10;"DON""T TOUCH" 240 GOTO 220 10 PRINT "PRESS M TO CATCH STAR" 20 GOSUB 200 25 REM STAR STARTS AT 0 30 LET A=0 35 REM BALL STARTS AT 18 40 LET D=18 45 REM LOOP TO MOVE BOTH 50 LET A=A+1 55 REM MOVE STAR 60 PRINT AT 7,A;".*" 70 PRINT AT D,22;"." 80 IF INKEY$ ="M" THEN LET D=D-1 85 REM DRAW BALL 90 PRINT AT D,22;"O" 95 REM CHECK FOR COLLISION 100 IF D=7 AND A=21 THEN GOTO 300 110 IF D=6 THEN LET D=18 120 IF A=30 THEN LET A=0 130 GOTO 50 200 REM DRAW JUGGLER 210 PRINT AT 19,20;" O▐" 220 PRINT AT 20,20;"▛[:]▀" 230 PRINT AT 21,20;"▗█▖" 240 RETURN 300 REM GOT ONE,SO START OVER 310 PRINT AT 21,0;"[G][O][T]█[O][N][E]" 320 PAUSE 100 330 CLS 340 GOTO 10 10 PRINT "SANDY""S CARTOON SHOW" 20 REM GET VALUE FOR D 30 PRINT AT 21,0;"HOW FAR DOWN? " 40 INPUT D 50 REM GET VALUE FOR A 60 PRINT AT 21,0;"HOW FAR ACROSS?" 70 INPUT A 80 PRINT AT 21,0;"HI THERE " 90 FOR J=1 TO 80 100 GOSUB 200 110 GOSUB 300 120 NEXT J 130 PRINT AT 21,0;"ERASE IT?(Y/N)" 140 INPUT E$ 150 IF E$="Y" THEN GOSUB 250 160 GOTO 20 200 REM DRAW PERSON AT D,A 210 PRINT AT D,A;" 0" 220 PRINT AT D+1,A;"▀█▀" 230 PRINT AT D+2,A;"▀▜ " 240 RETURN 250 REM ERASE FIGURE AT D,A 260 PRINT AT D,A;" " 270 PRINT AT D+1,A;" " 280 PRINT AT D+2,A;" " 290 RETURN 300 REM DRAW PERSON 2 310 PRINT AT D,A;" 0" 320 PRINT AT D+1,A;"▀█▀" 330 PRINT AT D+2,A;" ▛▀" 340 RETURN 10 REM MOVE RIGHT 20 FOR A=0 TO 25 30 PRINT AT 10,A;" ▙" 40 NEXT A 50 STOP 90 REM MOVE LEFT 100 FOR A=25 TO 0 STEP -1 110 PRINT AT 10,A;"█ " 120 NEXT A 130 STOP 190 REM MOVE DOWN 200 FOR D=0 TO 20 210 PRINT AT D,15;" " 220 PRINT AT D+1,15;"[*]" 230 NEXT D 240 STOP 290 REM MOVE UP 300 LET D=20 310 IF INKEY$ ="M" THEN LET D=D-1 320 PRINT AT D,17;"█" 330 IF D<>0 THEN GOTO 310 340 CLS 350 GOTO 300 5 REM PRINT GREETING 10 PRINT "HELLO" 20 PRINT "FROM" 30 PRINT "SANDY" 40 STOP 42 REM 45 REM PRINT BOX 50 PRINT "▛▀▜" 60 PRINT "▌ ▐" 70 PRINT "▙▄▟" 80 STOP 90 REM 100 REM USE PRINT AT TO DRAW IN THE MIDDLE OF THE SCREEN 105 REM 110 REM DRAW CAR 120 PRINT AT 10,7;"▗▄ " 130 PRINT AT 11,7;"█[-]█" 140 PRINT AT 12,7;"O O" 145 REM 150 REM DRAW TRAFFIC OFFICER 160 PRINT AT 10,12;" O▐" 170 PRINT AT 11,12;"▀[:]▀" 180 PRINT AT 12,12;"▗█▖" 190 STOP 200 REM USE LET TO MAKE A DRAWING EASY TO MOVE 210 LET D=18 220 LET A=25 230 PRINT AT D,A;"▗▄ " 240 PRINT AT D+1,A;"█[-]█" 250 PRINT AT D+2,A;"O O" 260 STOP 270 REM [C][O][P][R]1983[2][-][B][I][T]█[S][O][F][T][W][A][R][E] 10 PRINT "I WILL DRAW A PENGUIN" 20 PRINT "WHERE YOU TELL ME TO" 30 REM USING INPUT 40 REM GET VALUE FOR D 50 PRINT AT 21,0;"HOW FAR DOWN? " 60 INPUT D 70 REM GET VALUE FOR A 80 PRINT AT 21,0;"HOW FAR ACROSS?" 90 INPUT A 100 REM DRAW PERSON AT D,A 110 GOSUB 200 140 PRINT AT 21,0;"ERASE IT? (Y/N)" 150 INPUT E$ 160 IF E$="Y" THEN GOSUB 250 170 GOTO 50 200 REM DRAW PENGUIN AT D,A 210 PRINT AT D,A;">[.]▌" 220 PRINT AT D+1,A;" ▌▌" 230 PRINT AT D+2,A;"▗▙▌" 240 RETURN 250 REM ERASE AT D,A 260 PRINT AT D,A;" " 270 PRINT AT D+1,A;" " 280 PRINT AT D+2,A;" " 290 RETURN ```