30 X=RND (100)
35 Y=RND (75)
40 C=RND (64)
45 PLOT X,Y,C
50 COLOR 63,0
55 LOCATE 15,1: PRINT “ Faces in the Crowd “;
60 PAUSE 100
65 IF X<>50 THEN GOTO 30
70 COLOR C,0
75 LOCATE RND (50),RND (37)
80 DISPLAY 33
85 GOTO 30
• Line 75 moves the cursor to a random text column
and row. We could have assigned the random
column/row values to variables first (A=RND ( 50): B=RND
( 37): LOCATE A,B), but we’re not reusing the values. So,
this way works just fine, and doesn’t tie up any of our
Color BASIC variables.
• Line 80 displays the character whose assigned ASCII
value is the number that follows. Since we redefined ASCII
character 33 from the exclamation point to a smiley in line
15, DISPLAY 33 prints a smiley in the current foreground
color at the cursor location (we could also achieve the
same thing here with PRINT “!”). Multiple characters can
be included in the same DISPLAY command, like DISPLAY
65, 66, 67.
Here’s what’s going on in this little program:
• Lines 5 and 10 provide a tiny bit of internal
• Line 15 redefines the exclamation point character
• Line 85 directs program flow back to line 30 to plot
another random square (and perhaps a smiley). Since the
program has no end, it will remain in this endless loop
until interrupted with the <Esc> key. Enjoy your Amigo
artwork (Figure 4)!
(ASCII 33) for artistic use in our program. Each of the
eight numbers following the 33 (and separated by
commas) is the decimal value of one binary row of on-or-off pixels in the 8x8 pixel map for that character. These
values (double-check when you enter them) will change
the exclamation point character to a smiley face to give
our artwork some punch. (A little REDEFINE.BAS program
is included on the SD card in the Amigo kit from the Nuts
& Volts webstore — check it out!)
• Lines 20 and 25 set a black background and clear
• The Color BASIC screen has 100 graphics columns
numbered 0 to 99, and 75 graphics rows numbered 0 to
74. The PLOT command has the syntax PLOT <column>,
<row>, <color>. Lines 30, 35, and 40 pick random integers
for column, row, and color, and assign those values to
variables X, Y, and Z.
• Line 45 plots a small square (one quarter of a text
cell) at the randomly chosen graphics column and row, in
the randomly chosen color.
• Lines 50 and 55 set the color to white on black, and
prints the title of our artwork. We reprint the title every
cycle of the program, just in case one of the random
squares lands on our title.
January 2016 49
FIGURE 4: Your Amigo does art?
• Line 60 pauses the program for 100 milliseconds to
slow things down a bit for a good visual effect. You can
adjust this value to your preference.
• Line 65 directs program flow back to line 30 to plot
another random square, unless the value for X on that
cycle is 50. In that case, program execution continues at
line 70. (The value of 50 here is arbitrary, and could have
been any permissible value for X.) You can set a different
condition after the IF to plot more (or fewer) smiley faces.
This program takes keystrokes from the keyboard and
uses them to drive the audio channel. You’ll need to
connect a small powered speaker to your Amigo audio
jack to hear the results. (Earbuds will do in a pinch.) Use
the editor (<F1>) to enter and run (<F1> again) this code:
• Line 70 sets the foreground color to the random
value previously chosen for C, keeping the background
10 REM SOUNDFX.BAS ***
15 REM ... Your Amigo Makes Music? ...
20 COLOR 63,22
40 PRINT “ SOUND FX”: PRINT “ “
50 PRINT “ Connect earbuds to your Amigo audio