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:

peek is not reliable when reading data from memory-mapped I/O ports.
For example, suppose that the user wants to wait until the programable timer on
the TI-89 (its value may be read from the address 0x600017) reaches the value 255. The
following construction seems quite good:

while (peek (0x600017) != 255);

However, it will cause an infinity loop. Namely, the compiler will notice that the
same value is read in the loop. As a normal memory location can not be changed without
explicitely writing to it, and there is nothing in the loop which changes the data at the address
0x600017, the optimizer will move memory reading out of the loop to
make the code more efficient. Such behaviour is correct for ordinary memory locations.
But the compiler does not know anything about the
fact that 0x600017 is not an ordinary memory location but an I/O port, which may be
changed unpredictably (purely by the hardware, without any program control). To prevent
such behaviour, use peekIO instead of peek, i.e. write

while (peekIO (0x600017) != 255);

Basically, peekIO works exactly like peek, but prevents any unwanted optimizations
generated by the compiler. Always use peekIO for reading memory-mapped I/O ports, else you may have
trouble (especially in short loops). For example, to read the keyboard column mask on TI-89, do

key_mask = peekIO (0x60001B);

peekIO may be used even for reading bytes in memory, but peek
will generate better code when working with memory. However, use peekIO to read any memory
location which may change in a way which is unpredictable from the aspect of a normal program
flow (for example, a memory location which is changed in the body of the interrupt handler).

This macro inverts bit bit at memory address addr.
It is useful if you do not want to store a whole byte at this address, but only
need to invert the state of a single bit.
As usual, the rightmost bit of a value is numbered 0, and the leftmost bit is
7 in this case.
For example, let's assume the address addr contains the value 0b10011010,
and you call this macro like this:

poke_bchg (addr, 3);

Then the value will be 0b10010010 afterwards. Making the same call again will
restore the previous value 0b10011010,

Note: Do not use poke_bchg for sending bits to I/O ports! Use pokeIO_bchg
instead.

This macro clears bit bit at memory address addr.
It is useful if you do not want to store a whole byte at this address, but only
need to set a single bit to 0.
As usual, the rightmost bit of a value is numbered 0, and the leftmost bit is
7 in this case.
For example, let's assume the address addr contains the value 0b10011010,
and you call this macro like this:

poke_bclr (addr, 3);

Then the value will be 0b10010010 afterwards.

Note: Do not use poke_bclr for sending bits to I/O ports! Use pokeIO_bclr
instead.

This macro sets bit bit at memory address addr, which can
be any which which may be cast to unsigned char *.
It is useful if you do not want to store a whole byte at this address, but only
need to set a single bit to 1.
As usual, the rightmost bit of a value is numbered 0, and the leftmost bit is
7 in this case.
For example, let's assume the address addr contains the value 0b10010010,
and you call this macro like this:

poke_bset (addr, 3);

Then the value will be 0b10011010 afterwards.

Note: Do not use poke_bset for sending bits to I/O ports! Use pokeIO_bset
instead.

poke is a macro which stores a byte val at 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 storing bytes in memory using the style which is common in most dialects
of the BASIC language. For example, to store a byte 255 at the first byte of the video memory, do this:

poke (0x4C00, 255);

Note: Do not use poke for sending bytes to I/O ports! Use pokeIO
instead.

poke is not reliable when sending data to memory-mapped I/O ports.
Suppose that you have a device mapped to the address port, and that this device
requests sending a sequence ot bytes 127,0,255,0 to this address to be reset. If you
simply try to do

poke (port, 127);
poke (port, 0);
poke (port, 255);
poke (port, 0);

the compiler will (incorrectly) conclude that sending a sequence of bytes to the same address is
nonsense, because new values will overwrite previous ones (assuming that the address
points to the memory), so the optimizer will
ignore all stores but the last one. Such behavior is correct if port is a
normal memory address, but it may be fatal if port is an address of a memory-mapped I/O
port. To prevent such behaviour, use pokeIO instead of poke, i.e. write

Basically, pokeIO works exactly like poke, but prevents any unwanted optimizations
generated by the compiler. It may be used even for storing bytes in memory, but poke
will generate better code when working with memory.