[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

Here is an example of a program using multi-color programmable characters:

 10 REM * EXAMPLE 2 *
 20 REM CREATING MULTI COLOR PROGRAMMABLE CHARACTERS
 31 POKE 56334,PEEK(56334)AND254:POKE1,PEEK(1)AND251
 35 FORI=0TO63:REM CHARACTER RANGE TO BE COPIED FROM ROM
 36 FORJ=0TO7:REM COPY ALL 8 BYTES PER CHARACTER
 37 POKE 12288+I*8+J,PEEK(53248+I*8+J):REM COPY A BYTE
 38 NEXT J,I:REM GOTO NEXT BYTE OR CHARACTER
 39 POKE 1,PEEK(1)OR4:POKE 56334,PEEK(56334)OR1:REM TURN ON I/O AND KB
 40 POKE 53272,(PEEK(53272)AND240)+12:REM SET CHAR POINTER TO MEM. 12288
 50 POKE 53270,PEEK(53270)OR16
 51 POKE 53281,0:REM SET BACKGROUND COLOR #0 TO BLACK
 52 POKE 53282,2:REM SET BACKGROUND COLOR #1 TO RED
 53 POKE 53283,7:REM SET BACKGROUND COLOR #2 TO YELLOW
 60 FOR CHAR=60TO63:REM PROGRAM CHARACTERS 60 THRU 63
 80 FOR BYTE=0TO7:REM DO ALL 8 BYTES OF A CHARACTER
 100 READ NUMBER:REM READ 1/8TH OF THE CHARACTER DATA
 120 POKE 12288+(8*CHAR)+BYTE,NUMBER:REM STORE THE DATA IN MEMORY
 140 NEXT BYTE,CHAR
 150 PRINT"{CLEAR}"TAB(255)CHR$(60)CHR$(61)TAB(55)CHR$(62)CHR$(63)
 160 REM LINE 150 PUTS THE NEWLY DEFINED CHARACTERS ON THE SCREEN
 170 GET A$:REM WAIT FOR USER TO PRESS A KEY
 180 IF A$=""THEN170:REM IF NO KEYS WERE PRESSED, TRY AGAIN
 190 POKE53272,21:POKE53270,PEEK(53270)AND239:REM RETURN TO NORMAL CHARS
 200 DATA129,37,21,29,93,85,85,85: REM DATA FOR CHARACTER 60
 210 DATA66,72,84,116,117,85,85,85: REM DATA FOR CHARACTER 61
 220 DATA87,87,85,21,8,8,40,0: REM DATA FOR CHARACTER 62
 230 DATA213,213,85,84,32,32,40,0: REM DATA FOR CHARACTER 63
 240 END

[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated May 12, 2002.