Commodore VIC-20 User Manual page 72

Hide thumbs Also See for VIC-20:
Table of Contents

Advertisement

Now let's say that we are controlling a ball bouncing on the
(
screen. The ball is in the middle of the screen, column ten and
row ten. (The upper left corner is column zero, row zeroj The
formula for calculating the memory location on the screen is:
P = 7680 + X + 22*Y
*
where X is the row and Y is the column. Therefore, the memory
position of the ball is 7680 + 10 + 220, or 7910. Clear the screen
and type;
POKE 36879,8
(
This changes the color of the screen to all black. Now type:
POKE 7910,81
{
A ball appears in the middle of the screen! You have placed the
character directly into screen memory without using the PRINT
statement.
<
The ball that appeared was white. However, there is a way to
change the color of an object at any location on the screen,
also using POKEs. Type;
.
POKE 38630,3
(
The ball's color changes to cyan. For every spot on the VIC's
screen there are two memory locations, one for the character
code and the other for the color code. The color memory map
begins at location 38400 (top left-hand corner), and continues
on for 506 locations. The color codes from 0 to 7 will give you
the 8 colors numbered 1 to 8 on the keyboard. (Other numbers
will give strange looking results. See the VIC Programmers
/
Reference Guide for a complete explanation.)
C
I
I
c
I
I
f
c

Advertisement

Table of Contents
loading

Table of Contents