Page 25 of 229 Start Back Next End ZBasic Language Reference 15 ZBasic Microcontrollers effect. For ZBasic devices that support external RAM (e.g. ZX-1281), the compiler must know the actual size of User RAM (including external RAM) in order to avoid generating meaningless warnings. That is the purpose of this directive, which may only be used on ZBasic devices that support external RAM. The example below shows the simplest way of specifying the augmented User RAM size. The example is for the case where the maximum amount of additional RAM was added. Example Option RamSize 65536 – Register.RamStart Option HeapSize Option HeapSize <constant-expression> Default: (see text) This directive controls the allocation of RAM between the string heap and the Main() task stack. The effect is to set a hard limit beyond which the heap will not grow, thereby preventing the heap from encroaching on the Main() task stack. If a size less than the minimum size (which varies by device) is specified, the minimum is used instead. Also, for devices with external RAM, the special value of 65535 (&HFFFF) can be used to specify that all external RAM should be used for the heap. See the section on setting heap and task stack sizes for more information including the default heap size. For VM mode devices the directive has an additional effect. When the compiler performs various checks regarding the use of RAM, it takes into account an amount of RAM reserved for the heap (from which memory for strings, for example, is allocated). The size specified for the heap will effect whether the compiler will issue a warning about excessive use of RAM in a particular circumstance. Example Option HeapSize 500 Option HeapReserve Option HeapReserve <constant-expression> Default: (see text) After compilation, the compiler analyzes the use of RAM and compares it to the amount of RAM available on the target device. If a specific task stack size is specified for the Main() task, the compiler adds the amount of statically allocated data, the Main() task stack size and the minimum heap size and compares this total to the amount of available RAM. If the aggregate total exceeds the available RAM an error message will be issued. This directive allows you to specify the minimum space you want to reserve for the heap. See the section on setting heap and task stack sizes for more information including the default heap size. Option HeapLimit Option HeapLimit <constant-expression> Default: n/a This directive provides a different way of allocating RAM between the string heap and the task stacks. The value provided is interpreted as a RAM address and specifies the limit beyond which the heap will not grow. This directive is perhaps more useful with target devices that support external RAM. See the section on setting heap and task stack sizes for more information.