Declaration:
void WaitMemoryAccess(unsigned long addr, int addr_space, int num_bytes, int flags);
Description
Suspends execution of the script file until the processor (the program being executed) accesses the specified memory area. Parameters:
addr - the memory area address.
addr_space - the address space. Constants with prefix AS_
are given in the system.h file.
num_bytes - the amount of bytes in the memory area.
flags - the flags that define the type of memory access:
MA_READ - reading, MA_WRITE - writing,
MA_READ | MA_WRITE - both reading and writing.
This function does not work in the emulators.
After return from the function, the built-in variables contain information on the latest traced memory access:
LastMemAccAddr the memory address
LastMemAccAddrSpace the type of address space
LastMemAccLen the amount of bytes
LastMemAccType the type of access (MA_READ, MA_WRITE).
Example:
while (1) // endless cycle
{
WaitMemoryAccess(0x80, AS_DATA, 1, MA_WRITE);
// to wait for write to the data memory cell with the address of 0x80 (bytes).
$P1 ^= 1; // to invert bit 0 in port P1
}
|