200 The VIC 20
User
Guide
Let's examine this program line by line. Line 1 changes two of BASIC's
internal pointers to make it appear as if less program memory
is
available.
(The method for choosing this POKE value will be explained later.) It also
includes a
CLR
statement, which forces BASIC to erase any variables
that
have been defined and to adjust its other internal pointers to the reduced
memory size. The POKEs and CLR must be done before any variables are
defined in the program
or
the values assigned to those variables will be lost.
It
is
best to make this statement the first one in any program
that
defines its
own characters.
Lines 2 and 3 set up
an
area in screen memory where
we
can
see
the
results of changing character memory by PRINTing the characters that will
use our custom character set.
Line 4 tells the VIC chip to start using this new area. When this
statement
is
executed, the characters on the screen will change to gibberish
because
we
have not yet filled in our character definitions.
Line 5 loads
our
new character memory with the first
192
characters
from the Commodore set. This includes all
128
nonreversed characters and
the first
64
reversed characters. This line will take a
few
seconds to execute.
When the program starts copying the reversed characters, you can
see
the
characters in the top lines change as their definitions are filled in.
We
chose to copy both the nonreversed and reversed characters be-
cause the VIC generates its cursor by turning bit 7 (the "reverse" bit) in the
character off and on.
If
we
had copied just the nonreversed characters, the
character under the cursor would be changing from nonreversed to nonre-
versed, which doesn't show up.
We
took only the first
64
reversed characters
because
our
character memory overlaps screen memory on a "small" VIC.
On a VIC with less
than
8K
of
added memory, screen memory starts
at
location 7680.
Our
new character memory runs from location
6144
to
location 8192,
but
if
we
had copied all
128
rev~rsed
characters, some of them
would have their definitions stored in screen memory.
If
we
had taken away
more memory to redefine all
256
characters, there would be little room left
for a program on a VIC with no added memory.
In the examples that follow,
we
will be making our changes in the
reversed characters, leaving the normal characters intact. This will make
program listings and immediate mode statements readable on the screen.
As
our first experiment, we'll replace the @ sign with our stick man
character. To change the character memory for
@,
enter the following
POKE statements. You should type the POKE statement once and keep