Skip to content

BASIC PEEK and DEEK Functions

Curtis F Kaylor edited this page Jan 20, 2025 · 20 revisions

PEEK

TYPE: BASIC System Function

FORMAT: PEEK ( address )

Action: The PEEK function is used to read a one-byte (8-bit) binary value from a given memory location.

  • address is a memory location which must be in the range -65535 to 65535.
  • The return value will be an integer in the range 0 - 255.
  • An Illegal Quantity error occurs if the argument is out of its respective range.

Example of PEEK Function:

10 PRINT PEEK(13312) AND 15 (Prints the value of screen border color)

plusBASIC enhancement

FORMAT: PEEK ( @ page , address )

Action: This syntax reads a one-byte (8-bit) binary value from a given memory location in a specified page.

  • page specifies the RAM page to read from. It is an expression which can be reduced to an 8-bit integer in the range 0 - 63.
  • address is a numeric expression which must be in the range of 0 to 16383.
  • The return value will be an integer in the range 0 - 255.
  • An Illegal Quantity error occurs if any argument is out of its respective range.

See Also : DEEK(), PEEK$() ⚠️ peekcolor, peekcolor$, peekscreen, peekscreen$, poke, doke


PEEK$

TYPE: plusBASIC System Function

FORMAT: PEEK$ ( address , length )

Action: As above, but reads a series of bytes and returns a string.

  • address is the starting address to read from.
  • length is the number of bytes to read.

Example of PEEK$ Function:

C$=PEEK$($16C,22)

Sets C$ to the text "1982 by Microsoft Inc."

plusBASIC enhancement

FORMAT: PEEK$ ( @ _page , address , length )

Action: As above, but reads a series of bytes from the specified page and returns a string.

See Also : DEEK(), PEEK() ⚠️ peekcolor, peekcolor$, peekscreen, peekscreen$, poke, doke


DEEK

TYPE: plusBASIC System Function

FORMAT: DEEK ( address )

Action: As above, but reads a two-byte (16-bit) value.

  • The low byte of the returned value is read from address and the high 8 byte is read from address + 1.
  • PEEKINT(_address_) is equivalent to 'PEEK(address)+256*PEEK(address+1)`.

Example of DEEK Function:

A=DEEK(14550)

Sets A to the address of BASIC variable table

FORMAT: DEEK ( @ page , address )

Action: Same as above, but reads a two-byte (16-bits) binary value from a given memory location in a specified page.

  • The low byte of value is read from the specified address and the high byte is read from the following address.
  • If address is 16383 (the last byte of the page), the high byte is read from address 0 of the following page.
  • An Overflow error occurs on an attempt to read from the last address of pages 20, 21, and 63.
  • An Illegal Quantity error occurs if any argument is out of its respective range.

PEEKSCREEN

TYPE: plusBASIC System Function

FORMAT: PEEKSCREEN ( offset )


PEEKSCREEN$

TYPE: plusBASIC System Function

FORMAT: PEEKSCREEN$ ( offset , _length )

PEEKCOLOR

TYPE: plusBASIC System Function

FORMAT: PEEKCOLOR ( offset )


PEEKCOLOR$

TYPE: plusBASIC System Function

FORMAT: PEEKCOLOR$ ( offset , _length )

Clone this wiki locally