POKE

From C64-Wiki

Jump to: navigation, search
BASIC keyword
Keyword:POKE
Abbreviation:P Shift+O
Type:Command
Token code:151/$97
Handling routine
in BASIC ROM:
47140–47148
$B824–B82C
List of all BASIC keywords


Remark: This article describes the BASIC-Command POKE in BASIC V2 at the Commodore 64.

Typ: Command
General Programming-Syntax: POKE <Memory adress>,<number>

The BASIC-Command POKE changes the content of any addres in the memory adress, ranging from 0 to 65535, to the given byte value in the range 0 thru 255. If either number is outside these limits, the 64 will display the error message ?ILLEGAL QUALITY  ERROR IN line.

Caution: A misplaced POKE may cause the C-64 to lock up, or garble or delete the program currently in memory. To restore a locked-up C-64 without a reset button fitted, one have to momentarily turn of the power, thereby loosing any program or data in RAM!

Examples

POKE 53280,1 The screenframe color will be changed into white
F1=53281: W=1: POKE F1,W The background color will be changed into white over variables
POKE 53281, PEEK (53280) The background color is setting into the same color as the screenframe color
POKE 788,52 Deactivated <RUN/STOP>
POKE 808,225 Deactivated the key combination <RUN/STOP>+<RESTORE>
POKE 775,119 LIST-Command will be blocked

ROM details

POKE is handled in BASIC ROM at 47140–47148/$B824–B82C: It uses another subroutine, GETPAR, to read the two parameters of the POKE command as a 16-bit unsigned integer and a byte, respectively. The 16-bit address comes out in a zeropage pointer, and so the short POKE handling routine (a mere 9 bytes long) simply sets the Y index register to zero and uses an indirect indexed STA to store the given byte in the designated address.

Also see the BASIC-Command PEEK.

BASIC V2.0-Commands of Commodore 64

ABS | AND | ASC | ATN | CHR$ | CLOSE | CLR | CMD | CONT | COS | DATA | DEF | DIM | END | EXP | FN | FOR | FRE | GET | GET# | GOSUB | GOTO | IF | INPUT | INPUT# | INT | LEFT$ | LEN | LET | LIST | LOAD | LOG | MID$ | NEW | NEXT | NOT | ON | OPEN | OR | PEEK | POKE | POS | PRINT | PRINT# | READ | REM | RESTORE | RETURN | RIGHT$ | RND | RUN | SAVE | SGN | SIN | SPC( | SQR | STATUS/ST | STEP | STOP | STR$ | SYS | TAB( | TAN | THEN | TIME/TI | TIME$/TI$ | TO | USR | VAL | VERIFY | WAIT

 
Personal tools
Help and Feedback
In other languages