15 of 158
9 the port with a period separating them, e.g. C.0. The advantage of the second method is that it is largely independent of the ZX processor that you’re using. The <pin-state> element may be one of the entries in the table below: Pin Configuration Values Pin State Meaning zxInputTriState The pin should be a tri-state input (pull-up disabled). zxInputPullUp The pin should be an input with the pull-up enabled. zxOutputLow The pin should be an output set to logic zero. zxOutputHigh The pin should be an output set to logic one. Alternatively, for compatibility with the Option Port directive, the <pin-state> element may be a quoted string containing a single character T, P, 0 or ¹ corresponding to the entries in the table above. For convenience when using the 24-pin ZX devices, RedLED and GreenLED are allowed as synonyms for Pin25 and Pin26 respectively. When using these synonyms the <pin-state> must be specified as On or Off. By default, all pins are configured to be inputs with the pullup disabled. Examples Option Pin5 zxOutputLow ' make pin 5 an output at logic zero Option Pin20 "T" ' make pin 20 a tri-state input Option C.0 zxOutputHigh ' make bit 0 of Port C an output at logic one Option RedLED On ' turn on the red LED Option <port> <config-string> This option directive provides a way to configure an entire I/O port at once instead of doing so pin by pin. For each bit of the port being configured to be an input, you can further specify that whether or not the pull-up resistor is enabled. For each bit of the port being configured to be an output, you can further specify the logic level that you want to be output. This option directive may only appear in the first module compiled - usually the one containing the Main() subroutine. The allowable values for the <port> element are PortA, PortB, PortC, etc. Note, however, that PortB and PortD will rarely be used with the 24 pin ZX devices since the many of the pins of those ports are not directly available. The <config-string> element must be a series of characters, enclosed in quote marks, which specify for each bit one of four configuration states. The allowable configuration characters are described in the table below. The <config-string> must contain exactly 8 configuration characters, the leftmost of which corresponds to the most significant bit of the port and the rightmost of which corresponds to the least significant bit of the port. Certain bits of PortB and PortD have dedicated uses on some ZX devices that require a specific configuration. Due to this requirement, those bits are protected from being changed by user-specified configuration. By default, all bits are configured to be inputs with the pullup disabled except for the special purpose bits. 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.