ZX BASIC:PEEK

From BorielWiki

Jump to: navigation, search

Contents

[edit] PEEK

[edit] Syntax

PEEK <Address>

 or

PEEK(<Type>, <Address>)

Returns the memory content stored at Address position. If Address is not a 16 bit unsigned integer, it will be converted to such type before reading the memory.

When Type is specified, the given type is read from memory. For example, you can read a float from memory (5 bytes). The following example reads a 16 bit unsigned integer at position 23675 (this is the System Variable for UDG in Sinclair BASIC systems):

PRINT "Address of UDG is "; PEEK(UINTEGER, 23675)

In this case, reading an unsigned 16 bit integer from 23675 is the same as PEEK(23675) + 256 * PEEK(23676), but the above method is faster.

[edit] Remarks

  • If Type is omitted, it is supposed to be UBYTE (8 bit unsigned integer).
  • The type of the returning value is the Type specified.
  • This function is Sinclair BASIC compatible.
  • This function extends Sinclair BASIC version.

[edit] See also

Personal tools