memacclib
Peek reads and Poke writes a value at a memory address, of the type
given by the suffix: .b a byte, .w a word, .l a long, .q a quick,
.f a float and .s or $ a string. Without a suffix, the default
type of the program is used. Peeks$ reads a string of a given length,
and Call jumps to machine code.
buf.l=AllocMem(100,65536)
Poke.w buf,1234
Poke$ buf+2,"Hello"
NPrint Peek.w(buf)," ",Peek$(buf+2)These commands do not check the address: writing to memory the program does not own can crash the system.
Library number 180.
Commands
Call
Jumps to the machine code at Address; the code returns to the program with RTS.
Statement. Help text: Address
Arguments: .l
Peek
The value at Address, as the type of the suffix; a string is read up to its first zero byte.
Function, takes a type suffix such as .w, result of the type of the suffix. Help text: [.Type](Address)
Arguments: .l
Peeks$
A string of the Length bytes from Address on, zero bytes included.
Function, result $. Help text: (Address,Length)
Arguments: .l, .l
A negative Length gives the empty string, as 0 does; with runtime
error checking, it is the error “Can’t Peeks$ a negative number of
Characters!”.
Poke
Writes Data at Address, as the type of the suffix; a string is written with a zero byte after it.
Statement, takes a type suffix such as .w. Help text: [.Type] Address,Data
Arguments: .l, .Type