Introduction To SmartBASIC
Lesson Two
by Charles A. Smith


You may have noticed that everything shown on the monitor screen is composed of little dots. These are called pixels and we can use these to tell ADAM how to make pictures. Here's how that is done-

 ] NEW
 ] 10 GR
 ] 20 COLOR = 15
 ] 30 PLOT 0,0
 ] 40 PLOT 10,10
 ] 50 PLOT 20,20
 ] RUN

GR in line 10 tells ADAM to expect some commands in Low Resolution GRaphics and Line 20 tells him what color to use (15 = white). The rest of the commands tells him what to draw. The three rectangles you see are PLOTted at horizontal and vertical locations on the screen. Your screen has 40 X 40 spaces for these rectangles. Computer designers like to use zero as a number so the spaces are numbered 0 thru 39.

The bottom portion of the screen is reserved for text so you can type in more program steps. Lets type over some of the old ones to get rid of them-

 ] 30 HLIN 0,39 AT 0
 ] 40 VLIN 0,39 AT 39
 ] 50 HLIN 39,0 AT 39
 ] 60 VLIN 39,0 AT 0
 ] RUN

In plain English - Line 30 says 'draw a horizontal line from the far left side (0) to the far right side (39) at the top of the screen (vertical 0)'. Line 40 says 'draw a vertical line from the top (0) to the bottom (39) at the far right side (horizontal 39)' and so on. Try adding these steps -

 ] 70 HLIN 10,29 AT 10
 ] 80 VLIN 10,29 AT 29
 ] 90 HLIN 29,10 AT 29
 ] 100 VLIN 29,10 AT 10
 ] RUN

By using a combination of the commands PLOT, HLIN, and VLIN you can construct anything you want. I have drawn up a 40 X 40 rectangular grid which can be Xeroxed and used to advantage in GRaphics planning.

You know how to SAVE any program you want to keep.


Whenever you want to get out of the GRaphics Mode just type the word - TEXT. I'm sure by now you know to type RETURN.

CHARLES.

EDITOR'S NOTE.
The foregoing is the second in Charles Smith's seties of instructional articles on SmartBASIC programming. An example of a SmartBASIC program provided for our use by Charles follows. We appreciate his taking the time and trouble to make this material available for our use and education. Thanks Charles, BDC.WC
SMARTBASIC PROGRAM LISTING.

COMPUTER VALENTINE.wA
10 TEXT
20 HOME
30 ? TAB(7); "-Computer Valentine-"
40 ?
50 ? "Press <RETURN> after"
60 ? "each reply."
70 ?
80 ? "Who is this"
90 ? "valentine for?":INPUT n$
100 ?
110 INPUT "Who is it from?"; f$
120 HOME
130 ? "Press any key then go"
140 ? "get"; n$; "."
150 GET r$
160 HOME
170 GR
180 COLOR =15
190 FOR ro=0 TO 39
200 HLIN 0, 39 AT ro
210 NEXT ro
220 COLOR =9
230 FOR co=7 TO 20
240 READ a, b
250 VLIN a, b AT co
260 VLIN a, b AT 40-co
270 NEXT co
280 COLOR =0
290 FOR x=1 TO 6
300 READ a, b, ro
310 FOR co=b TO a STEP -1
320 PLOT co, ro
330 NEXT co, x
340 FOR x=1 TO 4
350 READ ro, y
360 FOR co=y TO y+2
370 COLOR =co-y+7
380 PLOT co, ro
390 NEXT co, x
400 d$="*"
410 FOR x=1 TO 15
420 d$=d$+"-*"
430 NEXT x
440 m$=",you turn my heart upside down! Will you be my valentine? Love,"
450 m$=d$+" "+n$+m$+f$+" "+d$
460 HOME
470 FOR x=1 TO LEN(m$)-31
480 VTAB 22
490 ? MID$(m$, x, 31)
500 FOR d=1 TO 100:NEXT d
510 NEXT x
520 GOTO 470L
1000 DATA 19,27,17,29,15,31,13,32,12,33,11
1010 DATA 34,10,35,9,35,8,35,7,34,6,33,5
1020 DATA 32,4,31,3,30,32,36,16,2,17,16,4,4
1030 DATA 14,3,4,15,3,4,17,4,4,18,14,35,15
1040 DATA 34,17,34,18,35
 

Back to Top