EasyManua.ls Logo

Commodore CBM - POKE to the Screen; Calculating the Screen Address

Commodore CBM
447 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...
POKE TO THE SCREEN
The programming of individual characters anywhere
on
the screen
is
most
effectively done
with
the
POKE
statement.
POKE
allows a eharacter to be
placed anywhere
on
the sereen by POKEing its eharaeter value into a sereen
location
in
memory, whieh
POKEs
it
onto the sereen.
Memory
Screen
Poke a
'1'
in Location X
xl+
1
'1'
...
on
the Screen
\
location X
The PET sereen
is
Iike a
gr
id
of
1000
squares;
40
columns by 25 rows: .
columns
rows
961
1000
One character may
be
displayed in each square. Ali
1000
sereen locations are
assigned
an
address and spaee
in
memory. Memory sereen spaee begins
at
address
32768
for square 1 (row
1,
eolumn 1)
and
ends
at
address
33767
for
square
1000
(row
25,
eolumn
40).
Memory
address 32768
is
screen location
(1.1). address 32769
is
screen location (1.2). etc. Figu
re
5-12 shows the correla-
tion between
PET
screen locations and their corresponding memory space and
addresses.
CALCULATING THE SCREEN ADDRESS
To find the screen address in memory for each screen location. manual
counting of each square
is
unnecessary. The
following
equation
is
a simpler and
more efficient method to calculate the memory address:
Memory Address of Screen Location =
32768+(column-l)+(40
(row-))
Enter the column and row numbers of any screen position into the equation to
find its memory address. To demonstrate. enter the values 5 and 3 to find the
288

Table of Contents

Other manuals for Commodore CBM

Related product manuals