180
The
VIC
20
User
Guide
of
rows and columns in screen memory is fixed, its starting point
is
not: The
VIC chip has a pointer to the start
of
screen memory, and this pointer can be
changed by your program. Commodore makes use
of
this ability to move
screen memory. On a small VIC with no added memory
or
with one of the
cartridges
that
adds 3 K
of
memory, the screen
is
kept
at
the top
of
program
memory, starting
at
location 7680. On a VIC with 8K
or
more of added
memory, the screen
is
moved
to
the bottom
of
program memory, starting
at
location 4096. Figure 6-4 illustrates this relative placement
of
screen
memory.
The method
of
moving the screen around allows you to expand
memory without breaking it in the middle with the screen, but requires that
programs that
PEEK
and POKE directly into screen memory be aware of
where the screen is. This
is
easily done. VIC BASIC keeps a byte in low
memory
that
tells it where the screen begins.
If
you
PEEK
this byte (location
648) and mUltiply it by 256, you will get the starting address of screen
memory.
10
SBa256*PEEK(648)
Techniques for moving screen memory are discussed in the section on
"Advanced VIC Chip Topics"
at
the end
of
this chapter.
o
1024
4096
7680
8192
VIC System
Area
Not
Present
BASIC
Program
and
Variables
Screen Memory
No Added Memory
o
1024
7680
8192
VIC System
Area
BASIC
Program
and
Variables
Screen Memory
3K Added Memory
FIGURE
6-4. Relative placement
of
screen memory
o
1024
4096
4608
VIC System
Area
Not Used
by
BASIC
Screen Memory
BASIC
Program
and
Variables
~-
-
8K + Added Memory