Skip to content

BASIC POKE and DOKE Statements

Curtis F Kaylor edited this page Oct 29, 2023 · 1 revision

POKE

TYPE: BASIC System statement


FORMAT: POKE address , byte

Action: The POKE statement is used to write a one-byte (8-bits) binary value into a given memory location.

  • address is an expression which can be reduced to an integer in the range of -65535 to 65535.
  • byte is an expression which can be reduced to an integer in the range 0 to 255.
  • An Illegal Quantity error occurs if either argument is out of its respective range.

Examples of POKE Statement:

POKE 12329,65

Puts an "A" at position 1 on the screen. POKE 36879,8 Puts 8 into memory location 36879


plusBASIC enhancement

FORMAT: POKE address , string

Action: As above but writes string expression string to memory starting at address.


plusBASIC enhancement

FORMAT: POKE @ page , address, byte

Action: This syntax writes a one-byte (8-bits) binary value into a given memory location in a specified page .

  • The page specifies the RAM page to write to. It is an expression which can be reduced to an 8-bit integer. The allowed pages are:
    • 20 for Video RAM
    • 21 for Character RAM
    • 32 to 63 for main RAM
  • address is a numeric expression which must be in the range of 0 to 16383.
  • byte is an expression which can be reduced to an integer value of 0 to 255.
  • An Illegal Quantity error occurs if any argument is out of its respective range.

plusBASIC enhancement

FORMAT: POKE @ page , address , string

Action: As above but writes string expression string to memory starting at address.

DOKE

TYPE: BASIC System statement


FORMAT: DOKE address , word

Action: Same as above, but writes a two-byte (16-bits) binary value.

  • word is an expression which can be reduced to an integer in the range -65535 to 65535.
    • The low byte of value is written to the specified address and the high byte is written to the following address.
  • An Illegal Quantity error occurs if either argument is out of its respective range.

FORMAT: DOKE @ page , address, word

Action: Same as above, but writes a two-byte (16-bits) binary value.

  • word is an expression which can be reduced to an integer in the range -65535 to 65535.
    • The low byte of word is written to the specified address and the high byte is written to the following address.
    • If address is 16383 (the last byte of the page), the high byte is written to address 0 of the following page.
      • An Overflow error occurs on an attempt to write to the last byte of pages 20, 21, and 63.
  • An Illegal Quantity error occurs if any argument is out of its respective range.
Clone this wiki locally