Many of the games
designed for the Atari computers use GRAPHICS 1 and 2 as the basis
for the screen display. These are multi-coloured text modes and the
normal method of placing characters on the screen is by using the '?
#6;' instruction. To obtain the full range of colours available you
have to use lower-case and inverse video versions of the character
required. Try typing
in the following and then press RETURN.
|
|
|
The top portion of the screen should
contain the letter A in the four default colours - orange, blue,
purple and yellow. You will find that all of the letters of the
alphabet will give the full range of colours by this method but
what about the remaining characters? Well - unfortunately not! The
problem is that the operating system does not support lower case
versions of the other characters and consequently you can only print
directly in two colours - orange (upper case) and blue (inverse
video upper case). In order to print in the remaining colours, you
have to use the CHR$ statement. Try running Program 1.
|
|
|
The normal GRAPHICS 1 and 2 character
set is available in the full range of colours although Program 1
only displays the first half of the character set. The second half
can be seen by adding the following line to Program 1.
|
|
|
The order of characters and colours
is a bit jumbled but Table 1 should help a little.
Printing using CHR$ can become
a little cumbersome but there are other alternatives. The first
is by POKEing values directly to the screen memory locations as
outlined in my earlier article 'Memory Mapped Screens' in issues
4 and 5 of PAGE 6. This is, unfortunately, a little complicated
but can be extremely useful, especially in screens containing mixed
graphics modes. There is, however, a much easier solution which
is also very versatile.
You may not be aware of it but
you can actually PLOT and DRAWTO in GRAPHICS modes 1 and 2. You
still need to specify a COLOR before you PLOT and DRAWTO but this
does much more than just select a colour as all values from O to
255 are valid. Make the following changes to Program 1 and then
re-run it.
|
|
|
You will see that by specifying
a COLOR value you can PLOT a specific character in the assigned
colour. The figures shown in Table 1 are also the values required
when using this method of producing characters. The DRAWTO instruction
is just as easy to use. Try typing in Program 2.
|
|
|
Redefined character sets will work
in exactly the same way and it should be easy to build up quite
complex playfields by this method. Once you have designed your playfield,
there is no reason why you should not move a character around the
screen in a similar way. Program 3 is a GRAPHICS 1 version of the
'Spider' demonstration program from my earlier article.
|
|
|
I hope that this outline of 'character
plotting' has given you some ideas and set you thinking. Give yourself
a break from playing those expensive bought games and write your
own, just think of the money you will save! When you have finished
it send it in to PAGE 6 for other enthusiasts to share and enjoy
seeing your own name in print. Happy computing!
_____________________
Table 1
ATASCII CHARACTER DECIMAL CODE
|
VALUES REQUIRED TO OBTAIN THE
ATASCII CHARACTERS IN THE COLOURS SHOWN
|
DEFAULT
|
POKE 756,226
|
YELLOW
|
ORANGE
|
PURPLE
|
BLUE
|
32-63
|
0-31
|
0-31
|
32-63
|
128-159
|
160-191
|
64-95
|
96-128
|
96-127
|
64-95
|
224-255
|
192-223
|
NOTES:
a) The table should be used in
conjunction with a list showing the ATASCII character set (normally
included as an index in most books).
b) The figures above show the range of
values for each character set and colour.
c) Inverse-video versions of the characters
are not available in Modes 1 and 2.
top