EasyManua.ls Logo

Commodore VIC-20 - Page 238

Commodore VIC-20
404 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
224
The
VIC
20
User
Guide
POKE. Like the border and background colors, they are combined into a
single location, 36869. Each half
of
this byte contains a number from 0 to
15,
which
is
the offset in Kbytes
(lK
=
1024)
into the window. The formula to
calculate the value to POKE
is
(Character memory location/
1024)
+
16
* (screen memory location /
1024)
The screen memory pointer has
an
additional bit stored in location
36866
that
indicates which half
of
the
lK
byte block
is
being used.
If
the
lower 506-byte block
is
being used, its value
is
o.
If
the upper half
is
being
used, its value
is
1.
This additional bit
is
the "128" bit in location 36866. Use
statements similar to the following to set it (SB
is
the start
of
screen
memory):
10e
POKE
36867,
(PEEK(36867)
AND
127)
OR
«SB/S)
AND
12S)
The other seven bits oflocation 36866 are the number of columns on the
screen. Unless you plan to change the screen size, you can simply
PO
KE in a
value
of
22
if you are using the lower half
of
the 1 K byte block, or
150
for the
upper half.
To determine the POKE value for altering the location of screen and
character memory, you must first translate the computer memory locations
to VIC chip window locations.
Use
Figure
6-6
to determine where your
screen and character memories will fall in the window. Then plug those
values into the formulas to calculate the POKE values.
For
example, to
move screen memory to location 6656 and use a set of
128
custom characters
starting
at
location 7168,
Character memory block = 7168 /
1024
= 7
Screen memory block
= 6656 /
1024
= 6
POKE value
= 7 +
16
* 6 =
103
Since the screen memory
is
in the upper half of the
lK
block, the POKE
value for location 36866
is
150
.
.
ProtectIng
Your
Custom
Character
Memory
In
our
examples
we
have shown the POKE statements
that
keep
BASIC from using your custom character memory.
If
you write programs
that use different areas in memory for custom characters, you will need to
understand the rules behind the statements.

Other manuals for Commodore VIC-20

Related product manuals