Architecture: Program memory
The program memory is a contiguous block of byte-addressable read-write memory which holds the program bytecode.
Memory
The program memory is 65536 bytes in length. The initial value of each byte of program memory is zero.
Each byte of program memory is uniquely identified by a 16-bit memory address.
Systems with fewer than 65536 bytes of program memory are partially supported, but these systems will be unable to correctly evaluate any program which makes use of the full memory space. The program memory length will not change during runtime. The behaviour when an unavailable memory address is read from or written to is implementation defined.
Program counter
The program counter is a 16-bit register which contains the memory address of the next instruction to be evaluated.
The initial value of the program counter is zero. The behaviour when the program counter overflows is implementation defined.
Operations
The program memory supports two operations, read and write.
Read
Reading a byte from program memory will return the value stored at the given memory address.
Reading a double from program memory will read the high byte of the double from the given memory address, and the low byte of the double from the memory address directly following that address. The behaviour when a double is read from the highest memory address is implementation defined.
Write
Writing a byte to program memory will write the byte to the given memory address.
Writing a double to program memory will write the high byte of the double to the given memory address, and the low byte of the double to the memory address directly following that address. The behaviour when a double is written to the highest memory address is implementation defined.
Loading a program
Programs are loaded into program memory starting from address 0x0000
. If the length of the program bytecode exceeds the capacity of the program memory, the remaining bytecode not fitting into program memory will be discarded.