The Editors and
Readers of COMPUTE!
Custom Characters For
Plus/4 And 16
I was wondering how the Commodore Plus/4 can generate user-defined
characters and where I would POKE them into memory.
Sean Donovan
The following program redefines the @ character as the familiar Commodore logo symbol.
FX 10 FORA=828TO860:READB:POKE
A,B:NEXT:SYS828
AM 20 POKE65298,PEEK(65298)AND
251
HP 30 POKE65299,PEEK(65299)AND
3OR60
SR 40 FORA=15360TO15367:READB:
POKEA,B:NEXT
JA 50 DATA 169,60,133,3,169,0,
133,2,133,4,169,208,133
AC 60 DATA 5,162,3,160,0,177,4
,145,2,136,208,249,230
SK 70 DATA 3,230,5,202,16,242,
96
HD 80 DATA 98,146,130,130,144,
98,0,0:REM CUSTOM CHARAC
TER DATA
Two memory locations are important for custom characters on the Commodore Plus/4 and 16. Bit 2 of location 65298 controls whether character data is fetched from ROM or RAM. The POKE in line 20 switches from the normal ROM character definitions to a custom character set in RAM. The upper six bits of location 65299 tell the computer where the character set is located in memory. When POKEing to location 65299 it is important not to disturb its lower two bits. To determine the number to POKE into this location, divide the starting address of the custom character set by 256. Since the example program puts the character set at location 15360, we use the POKE in line 30.
The program uses a machine language routine to copy the character set from ROM to RAM beginning at location 15360. To copy the character set to some location other than 15360, replace the second number in line 50 (currently 60) with the number you POKEd into line 30. Line 40 reads the custom character data from line 80 and POKES it into the area reserved for the definition of the @ symbol.