Classic Computer Magazine Archive COMPUTE! ISSUE 32 / JANUARY 1983 / PAGE 198

VIC Super Expander Graphics

Tim Parker, Kanata, Ontario

Want to see some stunning graphics on your VIC? Type in these short programs and you might be surprised to see what's possible with the Super Expander cartridge.

The VIC-1211A Super Expander is a plug-in cartridge for the VIC-20 that provides several extra features to the graphics and sound abilities. It also adds an extra three kilobytes of memory, giving a power-up of 6519 bytes free. (The missing bytes are used by the expander.)

Program 1 is a short routine that draws a grid on the screen, then selectively erases parts. This is done by drawing vertical and horizontal lines in a character color, then redrawing at a random interval with the screen's color. When RUN for several cycles, the patterns produced can be quite complex. Changing the color of the character in line 20 and the STEP interval in lines 100, 200, 300 and 400 can alter the complexity and appearance.

A variation on this program is to draw the lines on the graphics display diagonally, as Program 2 does. Here, lines 100-220 draw a circular pattern, skipping dots at intervals set by the STEP command. Then, lines 300-420 redraw at intervals in the screen color. The effects are produced as a consequence of the 1024×1024 graphics screen being shortened to 160×160. As the coordinates are altered, some dots will lie on either side of the line. As a result, some dots that are on are turned off, and vice versa.

A long routine to accomplish the above could be arranged using the RDOT(x,y) command, to see if a dot is on, then reverse it. Needless to say, this is an extremely time-consuming task, even in machine language.

Program 3 provides a pattern familiar to most people, although here it is generated in four corners. To see the pattern by itself, leave out lines 110-130. The simple routine here can be enhanced by adding circles concentrically in the center, or by repeating sections in the screen color, as above.

Program 4 draws rectangles on the screen concentrically and is then repeated to color in some areas. Again, when this is elaborated, it can have the effect of a moire pattern, almost achieving movement of its own.

An alternate method of obtaining the concentric rectangles of Program 4 requires drawing squares with multiple TO's in the DRAW statement (Program 5). Repeating the pattern without a screen-clear command (SCNCLR) produces overlapping bands in the pattern. The pattern can be inverted (i.e., have the rectangles drawn from the outside in) by rewriting lines 100-140 to step down, instead of up. Naturally, concentric circles can be done the same way, by changing line 120 to read:

120 CIRCLE1,511,511,X,X

This actually produces ellipses, as the axes are not of equal length. This can be changed to produce true circles by adding a constant parameter to the X-axis value.

These programs are by no means as sophisticated as can be achieved with the Super Expander, but they do fill the need for a basic subroutine library on which to base future graphics displays. Combining these with PAINT commands can produce some interesting effects. The Super Expander cartridge's graphics abilities are limited only by the resolution of the graphics screen.

Possible future work for examination of the commands available includes drawing Archimedes' spiral, a herringbone-grid of diagonals, and changing to multicolor graphics to build up a quilt-like display.

Program 1.

10 GRAPHIC 2
20 REGION 5
50 DEFFNA(X) = INT(RND(1)*X)+1
100 FOR X = 1 TO 1023 STEP FNA(40)+10
110 DRAW1,X,0 TO X,1023
120 NEXT
200 FOR Y = 1 TO 1023 STEP FNA(40)+10
210 DRAW1,0,YTO1023,Y
220 NEXT
300 FOR X = 1 TO 1023 STEP FNA(40)+20
310 DRAW0,X,0TOX,1023
320 NEXT
400 FOR Y = 1 TO 0123 STEP FNA(40)+20
410 DRAW0,0YTO1023,Y
420 NEXT
500 GOTO 100

Program 2.

10 GRAPHIC 2
20 REGION 5
50 DEFFNA (X) = INT (RND (1) * X) + 1
100 FOR X = 1 TO 1023 STEP FNA (10) + 10
110 DRAW 1, X, 0 TO 1023 - X, 1023
120 NEXT
200 FOR X = 1 TO 1023 STEP FNA (10) + 10
210 DRAW 1, 1023, X TO 0, 1023 - X
220 NEXT
300 FOR X = 1 TO 1023 STEP FNA (10) + 20
310 DRAW 0, X, 0 TO 1023 - X, 1023
320 NEXT
400 FOR X = 1 TO 1023 STEP FNA (10) + 20
410 DRAW 0, 1023, X TO 0, 1023 - X
420 NEXT
500 GOTO 100

Program 3.

10 GRAPHIC 2
20 REGION 5
50 DEFFNA (X) = INT (RND (1) * X) + 1
100 FOR X = 1 TO 1023 STEP FNA (70) + 10
110 DRAW 1, X, 0 TO 1023, X
120 DRAW 1, 0, X TO X, 1023
130 DRAW 1, X, 0 TO 0, 1023 - X
140 DRAW 1, 1023, X TO 1023 - X, 1023
150 NEXT

Program 4.

10 GRAPHIC 2
20 REGION 5
50 DEFFNA (X) = INT (RND (1) * X) + 1
100 FOR A = 1 TO 2
110 FOR X = 1 TO 1023 STEP FNA (10) + 10
120 DRAW 1, 1023 - X, X TO X, 0 + X
130 DRAW 1, X, 1023 - X TO 0 + X, X
150 NEXT X, A

Program 5.

10 GRAPHIC 2
20 REGION 5
50 DEFFNA (X) = INT (RND (1) * X) + 1
100 X = FNA (20) : X1 = X 120 DRAW 1, 511 - X, 511 - X TO 511 + X, 511 - X TO 511 + X, 511 + X TO 511
        - X, 511 + X TO 511 - X, 511 - X
130 X = X + X1
140 IF X < 511 THEN 120