Commodore 128 Programmer's Reference Manual page 474

Hide thumbs Also See for 128:
Table of Contents

Advertisement

464
COMMODORE 128
PART 1
LDA #$0E
STA $D501
PART 2
STA$FF01
Load accumulator with 14
This selects
I/O ($D000-$DFFF)
RAM ($4000-$7FFF,$8000-$BFFF)
Kernal and Character ROM ($CO0O-$FFFF)
RAM Bank 0
Store in PCR A—no immediate results
Place interim part of the program here
Write to LCR A, selects above configuration
In this program segment, PART 1 initializes PCR A ($D501) with the value 14
($0E), which performs no immediate result. When PART 2 is encountered, the STA
instruction performs a write operation to location $FF01, which triggers the preconfiguration
mechanism and loads the value from PCR A into the Configuration Register. The store
instruction value is not significant; it must operate only on the address, and any store
instruction works. Once this instruction is executed, the memory management organiza
tion is immediately changed according to the value in the appropriate PCR, in this case
PCR A ($D501).
The value 14 ($0E) loaded into PCR A selects the following memory organization:
TYPE
I/O
RAM
RAM
Kernal, Char
RAM BANK 0
14
ADDRESS RANGE
$DO0O-$DFFF
$4000-$7FFF
$8000-$BFFF
$C000-$FFFF
= $0E = 0000 1110
BIT(S) AFFECTED IN CR
0
1
2,3
4,5
6,7
(binary)
u
u
0
Li
U
U
It is good practice to initialize the PCR's in the beginning of your program, as in
PART 1 of the above program segment. Then place the interim portion of your program
in memory. PART 2 marks the place in your program where you are actually going
to alter the memory management setup. For the utmost speed and processor efficiency,
use absolute addressing for the MMU registers, as in the above example.
As previously noted, when the Input/Output Registers are switched out, the registers
of the MMU that appear in memory range $D500-$D50B are unavailable to the micro
processor. When this occurs, a write operation to an LCR still loads the corresponding PCR
value (currently invisible to the 8502) into the CR, even though the PCR's are not acces
sible to the microprocessor when I/O is switched out. If you switch out I/O, make sure to
set up the PCR's first, which are present when bit 0 of the Configuration Register is equal
to 0. However, the Load Configuration Registers are available at all times since they
appear in the address range $FF00-$FF04. If I/O is switched out, the PCR's must be
u

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents