76 of 172
ZBasic Language Reference 69 ZX Microcontroller Family below that begin with Option typically derive their value from the corresponding Option directives, the corresponding compiler command line options or their respective default values. Name Type Description Module.Name String The name of the module being compiled. Option.Strict Boolean Indicates if Strict mode is in effect. Option.AllocStr Boolean Indicates if dynamic string allocation is in effect. Option.StringSize Integer Gives the default string size for static string allocation. Option.Base Integer Gives the array base value for the current module. Option.CodeLimit UnsignedLong Specifies the code size limit (zero if none is specified). Option.CPUType String Specifies the CPU used on the target device. Option.ExtRamEnabled Boolean Indicates if external RAM use is enabled. Option.HeapLimit UnsignedInteger Indicates the specified heap limit. Option.HeapSize UnsignedInteger Indicates the specified or default heap size. Option.HeapReserve UnsignedInteger Indicates the default or specified minimum heap size. Option.Language String Specifies the language mode that is in effect. Option.MainTaskStackSize UnsignedInteger Indicates the specified size for the main task stack. Option.TargetCode String Specifies the type of code being generated (“ZVM” or “Native”). Option.TargetDevice String Specifies the ZX device for which the code is being compiled, e.g. “ZX24a”. Pin.GreenLED Byte Gives the pin designator for the green LED (if available). Pin.RedLED Byte Gives the pin designator for the red LED (if available). System.JumpBufSize Integer Gives the size required for a buffer used for SetJmp(). System.MinQueueSize Integer Gives the minimum size for an array to be used for a queue. Version.Major Integer Gives the major portion of the compiler version number. Version.Minor Integer Gives the minor portion of the compiler version number. Version.Variant Integer Gives the variant portion of the compiler version number. Version.Value UnsignedLong Gives the composite value of the compiler version number. The value corresponding to v1.2.3 is &H010203. Version.String String Gives the compiler version number as a string, e.g. “1.2.3”. With regard to the built-in constants referring to the version number, consider the version number v1.2.3. In this version number, the major value is 1, the minor value is 2 and the variant is 3. Additionally, for each target device there exists a set of built-in pin name constants of the form <port>.<bit> where <port> is a letter (case insignificant) referring to an I/O port and <bit> is a digit in the range 0-7 referring to a bit of the port. The value of the pin name is of type Byte and may be the pin number for the target device corresponding to that port bit or it may be an encoded port/pin designator (as controlled by Option PortPinEncoding). For example, when the target device is ZX24, the pin name C.7 has the value 5 if Option PortPinEncoding is off. 3.10 Exception Handling ZBasic implements a simple but effective form of exception handling using a concept borrowed from the C language. In the normal execution of a program, the call-return process is orderly and rigid. A routine can only return directly to the routine that called it. This forms a natural hierarchy that works well in most cases. However, it is sometimes the case that your program will detect a set of circumstances that preclude normal operation. In such cases, it is useful to be able to discard the normal call-return hierarchy and return directly to some distant caller, sending back a value to indicate the nature of the conditions that required the exceptional action. The simple example below shows how to utilize the exception handling mechanism. Dim jmpBuf1(1 to System.JumpBufSize) as Byte