Authors
Publication
Pub Details
Date
Pages
Here’s a program written in Extended Basic to demonstrate the use of the new commands DRAW, FILL, and SCREEN. For those not familiar with Extended Basic, this program adds 22 new Basic commands to the existing TS1000 vocabulary. The three used in this program are from a large group of “display commands”. DRAW is used to draw a line between two points on the screen. The effect is similar to drawing a line using the Sinclair PLOT command, only draw is much much faster, and easier to use when making diagonal lines. SCREEN is a function, which returns the character of a given column/line position of the TV display.
It tells you, for example, what character is printed at column 6, line 4. The TS2068 has both of these commands and they work in almost exactly the same way. The third command demonstrated here, FILL, is unique to Extended Basic. You won’t find anything like it on anything less than the new QL computer. FILL lets you fill an area of the screen of whatever size you specify with any desired character or graphic. And its F-A-S-T. The area literally fills instantly. This makes the command particularly useful for explosions, flashing screens, window simulations, etc.
When you study the listing, you will see that it looks pretty much like any other Sinclair Basic except for lines 11-12, 20-21 and 2004-2005. These lines are the three places where the Extended Basic is invoked.
What this program does is draw a random path across the screen in a zig-zag fashion. Hidden from view is a box of explosives. If the line passes over the bomb, an explosion occurs. The drawing of the random path, the check to see if an explosion is needed, and the explosion itself are all accomplished with Extended Basic. Everything else is done in Sinclairese.
1 REM
2 LET A=10
3 LET M=23
4 LET B=10
5 LET S=0
6 LET C=6
7 PRINT AT 18,7;"HIDDEN EXPLOSIVES"
8 LET D=5
10 LET X=0
11 GOSUB 0
12 REM DRAW;A,B,C,D,
15 GOTO 1005
20 GOSUB 0
21 REM DRAW;A,C,B,D,:SCREEN;16,12,X,
30 IF X THEN GOTO 2000
1005 LET A=C
1010 LET B=D
1020 LET C=1+(INT (RND*63))
1030 LET D=1+(INT (RND*43))
1040 GOTO 20
2000 FOR X=1 TO 5
2004 GOSUB 0
2005 REM FILL;11,13,15,17,(M),11,13,15,17,(S),
2007 NEXT X
2010 GOTO 1005