Frequently Asked Question

How do I use PEEK and POKE commands?
Last Updated about a month ago

PEEK and POKE: Direct Memory Access

PEEK and POKE let you read and write directly to memory - the key to unlocking your Commodore's full power!

Syntax

POKE address, value    : REM Write value (0-255) to address
X = PEEK(address)      : REM Read value from address into X

Useful Memory Locations

Address Purpose Example
53280 Border color (0-15) POKE 53280,0 = Black border
53281 Background color POKE 53281,6 = Blue background
646 Cursor color POKE 646,1 = White text
198 Keyboard buffer count POKE 198,0 = Clear buffer
657 Shift key flag IF PEEK(657)=1 THEN...
53272 Character set select POKE 53272,23 = Lowercase

Fun Examples

10 REM FLASH THE BORDER!
20 FOR I = 0 TO 15
30 POKE 53280, I
40 FOR D = 1 TO 100: NEXT D
50 NEXT I
60 GOTO 20
10 REM DISPLAY MEMORY CONTENTS
20 FOR A = 0 TO 255
30 PRINT PEEK(A);
40 NEXT A
Warning: POKEing to wrong memory locations can crash your computer! Always save your work first. When in doubt, turn off and on to reset.

Please Wait!

Please wait... it will take a second!