| peek | Function (Macro)

peekpoke.h

#define peek(addr) (*((unsigned char*)(long)(addr)))

Fetches a byte from the memory.

peek is a macro which fetches a byte from the memory address addr, where addr does not necessarily need to be a pointer. Instead, it can be of any type (usually an integer) which may represent a memory address in a way which makes sense. This way it allows for fetching bytes from memory using the style which is common in most dialects of the BASIC language. For example, to read a first byte from the video memory, do this:

    byte = peek (0x4C00);

Note that it is better to use LCD_MEM in this case.
Note: Do not use peek for reading I/O ports! Use peekIO instead.