Commodore 128 Programmer's Reference Manual page 315

Hide thumbs Also See for 128:
Table of Contents

Advertisement

n
i
i
PROGRAMMING THE 80-COLUMN (8563) CHIP
305
D600 and $D601. These are the 8563 address and data registers, respectively. In order
^
to read or write to 8563 RAM or registers, you must pass data through the address and
data registers. This section explains how to read the 8563 registers. The next section
illustrates how to write to the 8563 registers and RAM.
H
READING AN 8563 REGISTER
V
\
Reading an 8563 register requires five distinct programming steps. Although this may be
accomplished in BASIC, it is strongly recommended that you program the 8563 in
| j
machine language. Briefly, here are the five machine language programming steps, the
algorithm, to read an 8563 register. A more detailed explanation and a program to read
an 8563 register follows.
H
< i
1.
Load (immediate) the X register with the register number that you want to
read.
.1—j
2.
Store the contents of the X register (the 8563 register number) into the 8563
j |
address register ($D600).
3.
Check the status bit, bit 7 of address register $D600, until it is high (1).
4.
If the status bit is low (0), go back and check it again.
I
5.
Otherwise, load the accumulator with the contents of the 8563 data register
1
$D601. Store the contents of the data register into a C128 RAM location (a
variable) for future use and print the variable value.
i j
Since many of the 8563 registers are pointers to a 16-bit address, a register pair is
required, one register for the high byte and one for the low byte. In this case, simply
^
increment the X register and repeat the five-step process to read the register contents of
| j
the low byte. The high-byte register comes first in the register order, therefore the first
read is the high byte of a register pair, increment the X register and repeat the
process for the low byte. When the 8502 uses a register pair to point to a 16-bit
r"j
address, the high byte is the low byte plus 1.
i
Here's a program that reads the high- (R20) and low- (R21) byte register pair that
acts as a pointer to the start of the attribute storage in the 8563 RAM. The value stored
n
in locations $FB and $FC return the default start (high/low byte) of the attribute storage.
|
This pointer can be relocated to point to a section of 8563 RAM in which you define, as
is the case for display RAM and the character patterns.
~*
EXAMPLE:
Reading a register (attribute base address)

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents