ZBasic Language Reference
71
ZX Microcontroller Family
Register.CodeSize
Register.RamSize
Register.RamStart
Register.RamUsed
Register.PersistentSize
Register.PersistentStart
Register.PersistentUsed
These system values may be useful for diagnostic and other purposes. Register.CodeSize is a Long
constant that indicates the number of bytes of Program Memory consumed by your program together with
any Program Memory data items that it defines.
Register.RamSize is an UnsignedInteger constant that indicates the total number of bytes of User
RAM that is directly available to your program. Register.RamStart is an UnsignedInteger
constant that indicates address at which User RAM begins. Register.RamUsed is an
UnsignedInteger constant that indicates the total number of bytes of User RAM that your program
statically allocates. The difference between Register.RamSize and Register.RamUsed represents
the number of bytes that will be allocated automatically for the task stack for the Main() task.
Similarly, Register.PersistentSize is an UnsignedInteger value that indicates the size of
Persistent Memory, in bytes, that is available to your program. Register.PersistentStart is an
UnsignedInteger value that indicates address at which User Persistent Memory begins and
Register.PersistentUsed indicates the number of byte of Persistent Memory actually used by your
program. These values are all read-only.
Register.HeapEnd
This read-only UnsignedInteger value indicates the lower bound of the memory allocation heap. The
heap grows from the high end of RAM toward the beginning of RAM. As blocks of memory are allocated
from the heap (for String variables or to satisfy System.Alloc() requests), the value of
Register.HeapEnd will decrease. As blocks of memory are returned to the heap (as String variables
change or go out of scope, or due to calls to System.Free()), the value of Register.HeapEnd may
or may not increase. The value of Register.HeapEnd will not increase until the allocated block of
memory closest to its current value is freed. At that time, Register.HeapEnd will increase to be near
the lowest still-allocated block.
Register.ExtRamConfig
This UnsignedInteger value indicates the current external RAM configuration. Of course, it is only
meaningful on ZX models that support external RAM, e.g. the ZX-1281. Although you may change this
value during execution, the configuration of the external RAM interface will not be affected until the next
time the ZX resets (i.e. following power up, WatchDog reset, download, etc.).
Register.FirstTime
This read-only Boolean value is identical to that which would be returned by the FirstTime() function.
Note, however, that reading the value via Register.FirstTime does not reset the flag like invoking
the FirstTime() function does.
Register.UserSP
This UnsignedInteger register contains the value of the stack pointer for the current task at the
moment it is referenced. This value may be useful in estimating the stack usage for a task. For native
mode devices (e.g. the ZX-24n) the value of Register.UserSP is identical to Register.SP.