The place values in a binary number are powers of two. Figure
With this labelling system, you fire the top element by sending LPRINT CHR$(128). To fire the bottom graphics element, you send LPRINT CHR$(1). If you want to fire only the top and bottom ele- ments, you simply add 128 and 1, then send LPRINT CHR$(129). By adding the appropriate label numbers together, you can fire any combination of elements you want.
Note: If your computer system cannot send ASCII codes above 127, you will not be able to fire the top element.
A Graphics Program
Now that we have discussed how Dot Graphics works, the following program gives you an example of what you can do. This program creates a series of space invaders. Type the program in exactly as you see it.
10 WIDTH LPRINT 255
20 INPUT "GRAPHICS CODE (K, L)";CODE$
30 INPUT "n1 and n2 PLEASE";N1,N2
40 INPUT "HOW | MANY GRAPHICS DATA";DCOUNT | ||||
50 DIM | D(DCOUNT) | ||||
60 FOR | J=1 TO DCOUNT | ||||
70 | INPUT | "DATA";D(J) | |||
80 NEXT J |
|
| |||
90 LPRINT CHR$(27);CODE$;CHR$(N1);CHR$(N2); | |||||
100 | FOR | L=1 | TO | (N1+N2*256)/DCOUNT | |
110 | FOR | K=1 | TO | DCOUNT | |
120 | LPRINT CHR$(D(K)); | ||||
1 3 0 | N E X T | K |
|
|
140 NEXT L
150END
When you RUN the program, it will first ask you to enter the control code that you want to use for dot graphics. Your choices are <ESC> K or <ESC> L. Enter K to run the program in
4 5