PARALLEL INPUT & OUTPUT
ALLOCATING I/O BITS
The TDS9092 has 35 parallel input-output bits, some of which you can choose to use for other purposes. The section PIN CONNECTIONS has details. This is a summary:
DRIVE CAPABILITY & INPUT LEVELS
See 6301 MICROPROCESSOR DATA for more electrical specifications.
Maximum input capacitance on parallel ports is 12.5pF plus PCB wiring.
DIRECTION OF PORTS A & B
At power-up (except for a few milliseconds when they are indeterminate) all Port A and B pins are inputs, you must set up any outputs needed. In the data direction registers a 1 means output and a 0 is input. For Port A and Port B use the write-only register at address hex 01F0. This has 3 bits:
A copy of the content of address 01F0 should always be written to the user variable CFIGM . You can then change direction on just Port A or Port B without affecting the direction of the other. Read CFIGM , then AND or OR to give the new value, and put it to both address 01F0 and CFIGM . This is necessary because of the write-only nature of 01F0. You can always get its value from CFIGM ; it is a mirror of the content of 01F0. Note that address 01F0 is a single byte, but CFIGM is a 16-bit word (as are all user variables). E.g.
To set A and B as outputs:
3 DUP CFIGM ! $01F0 C!
To change Port B to input:
CFIGM @ 5 AND DUP CFIGM ! $01F0 C!
ADDRESSING INPUT & OUTPUT
The ports are all memory-mapped and have these addresses in hex:
It is usually convenient to stay in the DECIMAL base and to define hex characters with the $ prefix. E.g. to output decimal 24 to Port 6:
24 $17 C!
Whenever you use a 16-bit input or output with @ or ! the top byte on the stack (which is the left two digits of the hex number) will be taken from, or put to, the lesser of the two adjacent addresses. The other byte corresponds to the greater of the two addresses.
Note that the addresses of Ports A and B are adjacent. You can input and output to these as if they were a single port at address hex 01DF. E.g. to output hex A39B to Ports A and B:
$A39B $01DF !
In this example A3 will be put to Port B and 9B will be put to Port A.
Parallel input and output can be almost indefinitely expanded, see the suggestions in PARALLEL INPUT & OUTPUT EXPANSION. This also has more software examples for using I/O.
USING ASSEMBLER FOR I/O
Fastest access to input and output is through assembly code. Simple primitive assembler I/O words can often result in the complete program running close to machine code speeds. Use STA, to output bytes and STX, for 16 bits at a time. For input use LDA, or LDX, or any of the test, add or compare instructions etc.
CODE !AB ( n - ) PULX, $01DF STX, END-CODE
!AB will write the top of the stack to Ports A and B. Use of the immediate with memory instructions can manipulate I/O bits directly and so are even faster:
CODE PULSE ( - ) $17 $80 ## OIM, $17 $7F ## AIM,
This does a logical OR of immediate data 80 with the output at address 17 and then a logical AND with immediate 7F. This will give a 5�s pulse on bit 7 of Port 6. You can not do this with Ports A and B since if they are set as outputs they can not be read back. Use Ports 6, 5 or 2 when manipulating I/O bits with this type of instruction.