RomeoT

Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Game

Drop a weight on a seesaw to fling a little man up the side of a castle tower and onto its balcony. Each round the balcony appears at a random height, and the player enters a weight from 1 to 14, which sets how many rows the figure flies. The weight falls onto the raised end of the seesaw, the board tips, and the man rises and then steps across toward the tower. If he lands level with the balcony, the game shows WELL DONE! with a rising run of beeps. If he falls short, he drops back to the ground and is shown as a heap. If he flies too high, a flattened figure appears beside the tower. Each outcome starts a new round. The tower, battlements and green garden are built from block graphics, the figures from five UDGs, and the seesaw from PLOT and DRAW.

The listing also includes a separate utility at lines 9900–9952 that the game never calls (start it with GO TO 9900). It reads the BASIC program from memory and draws it as a flowchart: each statement’s line number and keyword are printed on the left, with a matching flowchart symbol and connecting arrows drawn beside them. The program is saved as ROMEO T with LINE 0, so it autostarts into the game.

Program Analysis

Game

  • Lines 20–70 READ 40 bytes into UDGs a–e: a the man, b the balcony railing, c the weight, d the heap left after a fall and e the flattened figure.
  • Lines 80–110 print the yellow tower with battlements at the left and the green garden at the right. Line 120 puts the fulcrum O at row 21 and draws the seesaw with its low end under the man.
  • Line 140 picks the balcony row h from 8 to 18, and line 170 accepts a weight w greater than 0 and less than 15.
  • Line 180 drops the weight down column 12 with rising beeps. Line 190 erases the board with DRAW OVER 1 and redraws it tipped the other way. Lines 200–240 then move the man up w rows and two columns left, toward the tower.
  • Line 250 compares the man’s row x with h. Equal is a win (lines 280–310, ending in RUN). A lower position runs the fall animation (lines 320–370). A higher one shows e with a low BEEP (line 270).

Flowchart Utility

  • Line 9901 finds the program start from the system variable PROG (PEEK 23635+256*PEEK 23636). Line 9903 reads each big-endian line number and skips the length word, and the routine stops when it reaches line 9900.
  • The token of each statement selects a symbol. STOP, REM, PAUSE and RETURN get a rounded terminator, drawn with arc DRAWs (-PI). DATA, RESTORE, NEW, CONTINUE, FOR, LET, RUN, RANDOMIZE and CLEAR get a process rectangle, and every other keyword gets a parallelogram.
  • IF and NEXT get a decision diamond with an arrow to the right. For IF, the routine scans to the THEN token (203) and prints the keyword that follows it.
  • GO TO and GO SUB get a connector circle with a long arrow. The target line number is read from the hidden five-byte number that follows the CHR$ 14 marker. The same lookup labels an IF ... THEN GO TO.
  • Down arrows join the symbols except after STOP, GO TO, GO SUB and RETURN. String literals are skipped (lines 9951–9952), and so are embedded numbers. Statements separated by : are charted one after another.
  • Ten statements fill a screen. The prompt then offers V to view the next screen or P to COPY the screen to the printer and continue.

Notable Techniques

  • The UDG DATA uses the variable a as an item. READ evaluates it at read time, when a still holds the last value read, so each a repeats the previous byte. For example, line 30 yields 0,255,171,171,171,171,255,255 for the balcony railing.
  • The seesaw tips by redrawing its old diagonal with DRAW OVER 1, which erases it, and then drawing the new one.
  • The flowchart utility works directly on the tokenized program: keyword tokens, the CHR$ 14 number marker, the 13 end-of-line byte and the 58 statement separator.
  • SAVE ... LINE 0 autostarts at the first line, line 10.

Potential Issues

  • Line 170 accepts fractional weights. A value such as 2.5 makes the FOR loop at line 200 run only twice, so the man rises by the whole-number part.
  • The flowchart scanner skips quoted strings but not REM text, so a colon inside a REM would appear to be read as a statement separator. The game itself has no REM lines.

Appears On

Solve a virtual Rubik's Cube, guide Santa through five arcade stages, play Scrabble against the computer, or renumber your BASIC programs with machine code precision — ISTUG Library 8 rounds out the Indiana collection with polished games and essential dev tools.

Related Content

Image Gallery

Source Code

   10 PAPER 0: INK 7: BORDER 0: CLS 
   20 DATA 56,56,146,254,16,124,68,198
   30 DATA 0,255,171,a,a,a,255,a
   40 DATA 0,a,28,20,62,a,127,a
   50 DATA 0,a,a,a,24,126,255,a
   60 DATA 192,224,a,240,a,224,a,192
   70 FOR f=0 TO 39: READ a: POKE USR "\a"+f,a: NEXT f
   80 PRINT AT 4,0; INK 6;"\:: \:: \:: \::"'"\::\::\::\::\::\::\::"'"\::\::\::\::\::\::\::"
   90 FOR n=7 TO 21: PRINT AT n,1; INK 6;"\::\::\::\::\::": NEXT n
  100 PRINT AT 11,13; INK 4;"\':\::\::";AT 12,15;"\':";AT 13,15;"\ :";AT 14,15;"\ '";AT 18,15;"\ :";AT 19,15;"\ :";AT 20,15;"\ :";AT 21,15;"\.:"
  110 FOR n=11 TO 21: PRINT AT n,16; INK 4;"\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::": NEXT n
  120 LET x=21: LET y=8: PRINT AT 21,10;"O": PLOT 64,0: DRAW 37,16
  130 PRINT AT x,y; INK 5;"\a"
  140 LET h=INT (RND*11)+8
  150 PRINT AT h+1,6;"\b"
  160 PRINT AT 4,11;"ENTER WEIGHT";AT 5,13;"(max.14)"
  170 INPUT w: IF w<=0 OR w>=15 THEN GO TO 170
  180 FOR n=10 TO 20: PRINT AT n-1,12;" ";AT n,12;"\c": BEEP .1,n: NEXT n
  190 PLOT 64,0: DRAW OVER 1;37,16: PLOT 64,16: DRAW 37,-16
  200 FOR n=1 TO w
  210 LET x=x-1
  220 PRINT AT x,y;"\a";AT x+1,y;" "
  230 NEXT n
  240 FOR n=1 TO 2: LET y=y-1: PRINT AT x,y;"\a ": NEXT n
  250 IF x=h THEN GO TO 280
  260 IF x>h THEN GO TO 320
  270 IF x<=h THEN PRINT AT x,y; INK 5;"\e": BEEP 1,-10: PAUSE 30: CLS : GO TO 80
  280 PRINT AT x,y+1;"WELL DONE!"
  290 FOR n=0 TO 40 STEP 10: BEEP .1,n: NEXT n
  300 CLS 
  310 PAUSE 30: RUN 
  320 FOR n=x TO 21
  330 PRINT AT n,y; INK 5;"\e";AT n-1,y;" "
  340 BEEP .05,n: NEXT n
  350 PRINT AT 21,y; INK 5;"\d"
  360 BEEP 1,-10
  370 PAUSE 30: CLS : GO TO 80
 9900 OVER 0: INVERSE 0: BRIGHT 0: FLASH 0: BORDER 7: PAPER 7: INK 0: CLS 
 9901 LET a=PEEK 23635+256*PEEK 23636
 9902 LET c=0: LET y=175: LET x=130
 9903 LET l=PEEK (a+1)+256*PEEK a: LET a=a+4
 9904 IF l>9900 THEN GO TO 9942
 9905 PRINT l;TAB 5;CHR$ PEEK a: LET c=c+2: PRINT 
 9906 PLOT x,y: LET b=PEEK a
 9907 IF b=226 OR b=234 OR b=242 OR b=254 THEN GO TO 9923
 9908 IF b>227 AND b<231 OR b=232 OR b=235 OR b=241 OR b=247 OR b=249 OR b=253 THEN GO TO 9924
 9909 IF b=243 OR b=250 THEN GO TO 9925
 9910 IF b=236 OR b=237 THEN GO TO 9933
 9911 DRAW 16,0: DRAW -4,-8: DRAW -28,0: DRAW 4,8: DRAW 12,0
 9912 LET y=y-8
 9913 IF b=226 OR b=236 OR b=237 OR b=254 THEN GO TO 9915
 9914 PLOT x,y: DRAW 0,-7: DRAW 4,4: DRAW -4,-4: DRAW -4,4
 9915 LET y=y-8
 9916 LET b=PEEK a: IF b=34 THEN GO SUB 9951
 9917 IF b=14 THEN LET a=a+4
 9918 IF b=13 THEN GO TO 9921
 9919 IF b=58 THEN GO TO 9939
 9920 LET a=a+1: GO TO 9916
 9921 IF c=20 THEN GO TO 9942
 9922 LET a=a+1: GO TO 9903
 9923 DRAW 12,0: DRAW 4,-8,-PI: DRAW -24,0: DRAW -4,8,-PI: DRAW 12,0: GO TO 9912
 9924 DRAW 16,0: DRAW 0,-8: DRAW -32,0: DRAW 0,8: DRAW 16,0: GO TO 9912
 9925 DRAW 8,-4: DRAW 8,0: DRAW -4,4: DRAW 4,-4: DRAW -4,-4: DRAW 4,4: DRAW -8,0: DRAW -8,-4: DRAW -8,4: DRAW 8,4
 9926 IF b=243 THEN GO TO 9932
 9927 LET a=a+1: LET f=PEEK a
 9928 IF f=14 THEN LET a=a+4
 9929 IF NOT f=203 THEN GO TO 9927
 9930 LET a=a+1: LET f=PEEK a: PRINT AT c-2,19;CHR$ f: PRINT 
 9931 IF f=236 OR f=237 THEN GO TO 9934
 9932 GO TO 9912
 9933 CIRCLE x,y-4,4: PLOT x+4,y-4: DRAW 64,0: DRAW -4,4: DRAW 4,-4: DRAW -4,-4: PLOT x,y
 9934 LET a=a+1: LET f=PEEK a
 9935 IF NOT f=14 THEN GO TO 9934
 9936 LET a=a+3: LET g=PEEK a+256*PEEK (a+1)
 9937 PRINT AT c-2,26;g: PRINT 
 9938 GO TO 9912
 9939 IF c=20 THEN GO TO 9942
 9940 LET a=a+1: PRINT "   :";TAB 5;CHR$ PEEK a: PRINT : LET c=c+2
 9941 GO TO 9906
 9942 INVERSE 1: PRINT AT 21,0;" PRESS ""V"" TO VIEW:""P"" TO PRINT ": INVERSE 0
 9943 IF INKEY$="v" THEN GO TO 9946
 9944 IF INKEY$="p" THEN GO TO 9950
 9945 GO TO 9943
 9946 CLS : LET d=0: LET e=22: LET c=0: LET x=130: LET y=175
 9947 IF PEEK a=58 THEN GO TO 9940
 9948 IF l>9900 THEN PRINT AT 20,6;"End of Basic Program": STOP 
 9949 LET a=a+1: GO TO 9903
 9950 PRINT AT 21,0,,: COPY : GO TO 9946
 9951 LET a=a+1: LET b=PEEK a: IF b=34 THEN RETURN 
 9952 GO TO 9951
 9953 SAVE "ROMEO  T" LINE 0

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.