Commodore 128 Programmer's Reference Manual page 319

Hide thumbs Also See for 128:
Table of Contents

Advertisement

PROGRAMMING THE 80-COLUMN (8563) CHIP
309
The first instruction (at $1800) loads the X register with the register number
18 ($12).
■"]
■ The next instruction loads the accumulator with the high byte of the value you
I i
are placing in register 18 ($20).
Instruction 3 calls the subroutine at location $18IE, which is essentially the
r*
same routine as in the read register example in the last section, with one
| !
exception. The instruction in the subroutine immediately before the RTS is a
store instruction to the 8563 data register at $D601. The two instructions before
it form a loop that continually checks the Update Ready status bit pending the
I j
write operation, just as the read program did. The write operation (STA
■ I
$D601) is not performed until the status bit 7 in the address register becomes
high (1). Once the status bit becomes equal to a 1, the high byte of the address
n
in register 18 is written to the data register ($D601). The subroutine returns
j i
control to the main body of the program with the RTS instruction.
The program resumes with the fourth instruction INX. This increments the
fm^
register number.
! |
The fifth instruction (LDA #00) loads the value of the low byte of the address
1
to be written to register 19 ($13) into the accumulator.
The subroutine at $18 IE is called again, and the same process is repeated.
n"
Upon return of the subroutine, the same read routine example from the last
section is performed (the subroutine between $182C-$1837) to ensure that the
values that were written to registers 18 and 19 are valid. These values are
^
printed by the BASIC routine. To see those values, use the memory command
j
within the monitor as follows:
MFB
ft
The first two bytes displayed are:
M
20 00
^
This shows that the address in the update location register pair (R18, R19) has
j I
been written to successfully and is valid.
WRITING TO 8563 RAM
Now take the example from the last section one step farther. The last example illustrated
how to write to an 8563 register. It just so happens that the register chosen for the
example is the update location register pair (R18, R19). This is the register pair that
enables you to write to and read from the 16K of independent 8563 RAM. This section
expands on the previous example and shows you how to write to the 16K of 8563 RAM.
The program given below fills display memory in 8563 RAM with characters, in
the process displaying the characters on the screen. The program fills display RAM
located in the default range $0000 through $07CF, with screen code character 102
($66). See Appendix D for a complete list of screen code characters.
Here's the listing:

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents