Commodore 128 Programmer's Reference Manual page 242

Hide thumbs Also See for 128:
Table of Contents

Advertisement

232
COMMODORE 128
U
U
10 PRINT CHR$(142)
:REM SELECT UPPER CASE
20
POKE54,48:POKE58,48:CLR:REM PROTECT CHAR SET
30 BANK
14
:REM SWITCH TO BANK
14
FOR CHARACTER ROM
40 FORI=1
TO 511:POKEI+12288,PEEK(1+53248):NEXT:REM ROM TO RAM TRANSFER
50 BANK
15:REM SWITCH TO DEFAULT BANK
60 POKE 2604,(PEEK(2604)
AND 240)+12:REM START CHAR BASE AT
12288
70 FORJ=12288TO12288+71
:REM PLACE CHARACTER DATA IN RAM
80 READ A
90
POKEJ,A
100 NEXT J
110
SCNCLR
120 DATA 0,0f0,0,0,0,0,0:REM @
130 DATA 14,17,32,66,130,132,138,123:REM A
140 DATA 124,66,66,124,66,81,225,126:REM B
.
,
150
DATA 62,67,130,128,128,128,131,126:REM C
160 DATA 125,98,125,65,65,193,161,254:REM D
170 DATA 225,66,64,56,120,65,66,124:REM E
^
180 DATA 127,129,2,4,14,228,68,56:REM F
190
DATA 193,163,253,33,249,65,99,190:REM G
200 DATA 227,165,36,36,126,36,37,231:REM H
I
You can leave yourself more BASIC text area, but to do this you must enter a video
bank higher than zero. This sample program operates in Bank 0. If you place your
i ,
character set in a higher video bank, remember to add an offset of 16384 ($4000) to the
start of RAM character memory for each bank above video Bank 0.
The CLR in line 20 clears out memory starting at 12288 because, prior to the
placement of the character set there, the memory locations are filled with random bytes.
I I
The random bytes must be cleared before new character information can be stored.
U
- Line 30 selects BANK configuration 14. This configuration makes the character
ROM visible with a PEEK command or within the machine language monitor, and
i i
temporarily switches out the I/O registers. Both the I/O functions and the 4K character
[J
ROM share the same locations ($D000-$DFFF). Depending on whether bit 0 in the
configuration register (location $FF00) is on or off, the C128 addresses the I/O registers
or the character ROM. Normally the C128 powers up with bit 1 turned off; therefore,
I
the I/O registers in locations $D000-$DFFF are addressed. The BANK command in line
^
30 sets bit 0 in location $FF00; therefore, the character ROM in locations 53248-57343
($D000-$DFFF) is addressed. The character ROM is accessed in order to make the
I I
transfer of characters to RAM.
[J
Line 40 makes the actual transfer from ROM to RAM. Since the character ROM is
accessed in line 30, it now begins at location 53248. The first 512 bytes (the uppercase
i
character set) from the character ROM are POKEd into the 512 bytes of RAM beginning
at location 12288 and ending at 12800. At this point the character set is ready to be
redefined to custom characters.
Line 50 switches the I/O registers back in, meaning the character ROM is no
| 1
longer available.
(J
Line 60 specifies the start of the character set base at location 12288. The character
set base can be stored in locations other than 12288. (See the Character Memory section
i i
earlier in this chapter for more information on moving character memory.) Location
M
2604 is the intermediate memory location that the interrupt-driven C128 screen editor
uses to point to screen and character memory in character mode. You must use this
indirect location to change the value of the actual register that points to the screen and
character memory 53272. If you try to POKE directly to location 53272, the interrupt will
LJ

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents