18 of 208
ZBasic Language Reference 10 ZX Microcontroller Family Port Configuration Designators Configuration Character Meaning T The corresponding bit should be a tri-state input (pull-up disabled). P The corresponding bit should be an input with the pull-up enabled. 0 The corresponding bit should be an output set to logic zero. 1 The corresponding bit should be an output set to logic one. Note that it is not necessary to configure your ports using this option directive. The configuration may also be done using the System Library subroutine PutPin() or built-in registers like Register.DDRA. Also, note that if you specify configuration directives for both the pins and the port containing them, the last occurring directive will prevail. Example Option PortA "TPTP0001" Option Base Option Base <value> Default: 0 Although zero-based arrays are common in many programming languages, some people find it easier to think about arrays being indexed beginning with 1. The Option Base directive is provided to allow you to specify that the default array base is either 0 or 1, the <value> element of the directive must be one of those values. Note that it is not necessary to use this directive to define 1-based arrays. The syntax for array definitions (see page 19) allows you to specify any base value that you wish for each array, including a negative base value if you wish. Some programmers believe that it is better to explicitly indicate the base of the array indices in each definition. That way, you never have to remember or go find out what the default base might be. This option does not affect Program Memory data items, they are always 1-based. Moreover, this option has local scope, i.e., it only affects arrays defined in the same module in which the option appears. Example Option Base 1 Option Explicit Option Explicit Default: Off Traditionally, the purpose of the Option Explicit directive has been to require that each variable in the program be explicitly defined. Historically, early Basic dialects allowed programs to be written so that when the compiler encountered a new variable name, it automatically created a definition for it. Although this may have been thought to be a nice feature, it turned out to be the source of many programming errors and bugs. If you accidentally misspelled a variable name, a new variable was created entirely unbeknownst to you. Because of this serious drawback implicit variable definition is not supported by ZBasic. The Option Explicit directive is accepted by the compiler for compatibility reasons but neither its presence nor its absence affects any aspect of the compiler’s operation.