80-Bus News

  

January–February 1983, Volume 2, Issue 1











Page 10 of 56











modification involving one gate, detailed in INMC no 2. This mod. has been implemented on Nascom 2, Gemini GM811 and 813, and both the Nascom and Gemini I/O boards. When in a reset state, the PIO remains that way until instructed otherwise.

We instruct it otherwise by sending it a Control Word, and in some cases the necessary further commands, all of which we write to the Control Port. First, we load the Interrupt vector, which is indicated by having the LSB zero, i.e., it must start on an even boundary. You will remember that this is the least byte of the address of the interrupt service table. The high byte is supplied by the I register of the CPU. Now, we select an operating mode. This is built up of two parts:

M1 M0 x x 1 1 1 1

The 1111 indicates that this is the mode word. The M1 M0 values differ according to the Mode, and the x x are don’t care values. The mode is easy:

Output= 0{ in binary 0 0 }Modeword 0 = 0FH
Input = 1{ in binary 0 1 }Modeword 1 = 4FH
Bidir = 2{ in binary 1 0 }Modeword 2 = 8FH
Bit = 3{ in binary 1 1 }Modeword 3 = 0CFH

When Mode 0 is selected, the data byte written to the port is enabled onto the output lines, and the Ready handshake line goes high to let the peripheral know that the data is available. This signal remains until the peripheral handshakes. On the handshake, the PIO will cause an interrupt, if that has been enabled, to indicate that the next byte of output data is required.

Mode 1 is the Input mode. To start the handshake operation, the CPU has to perform a Read from the PIO. This empties the Input buffer, and sets the Ready line to let the peripheral know that the CPU is listening out for it. The peripheral loads the data onto the input register, and strobes the handshake line. This causes an interrupt, if enabled, and turns off the Ready signal. Note that if your peripheral is smart enough, the Ready line can be ignored, provided that you are careful not to load data too quickly.

Mode 2 is the bidirectional mode. This uses all four handshake lines, so that it is only possible on Port A. Port A handshake lines are used for Output control and Port B for input control.​There is a difference from Mode 0. In Mode 0, the data is on the Port output lines, and the Ready line (A RDY) is high. In Mode 2, A RDY goes high, but doesn’t put the data on the lines until the strobe line goes active.

Mode 3 is the mode we use most often. It uses no handshake signals, and hence can be of use to control a number of unrelated events, such as switching sections of a machine on and off, and reading status of input lines. When we have selected Mode 3, we must then send a control word to the Control Port to signal which lines are input and which output. This is easy to remember, as 1s are In and 0s are Out. During mode 3 operation, data can be read from or written to the port at any stage, with restrictions only when Port A is in mode 2 and Port Bin mode 3. When reading a mode 3 port, the data returned is the values of the lines defined as inputs plus the values currently being output on the output lines.

To enable the interrupts, we must write an Interrupt Control Word to each port. This has the following format:

EI &/. H/L M 0 1 1 1

This is an OCR’d version of the scanned page and likely contains recognition errors.











Page 10 of 56