Information Technology Reference
In-Depth Information
4. The instruction decoding will gate the data available on the data bus into the
input of a particular register in the CPU, normally the accumulator.
Output operations can be performed in a way similar to the input operation
explained above. The only difference will be the direction of data transfer, which
will be from a specific CPU register to the output register in the specified output
device. I
O operations performed in this manner are called programmed I / O.
They are performed under the CPU control. A complete instruction fetch, decode,
and execute cycle will have to be executed for every input and every output oper-
ation. Programmed I
/
O is useful in cases whereby one character at a time is to be
transferred, for example, keyboard and character mode printers. Although simple,
programmed I
/
O is slow.
One point that was overlooked in the above description of the programmed I
/
Ois
/
how to handle the substantial speed difference between I
O devices and the pro-
cessor. A mechanism should be adopted in order to ensure that a character sent to
the output register of an output device, such as a screen, is not overwritten by the
processor (due to the processor's high speed) before it is displayed and that a char-
acter available in the input register of a keyboard is read only once by the processor.
This brings up the issue of the status of the input and output devices. A mechanism
that can be implemented requires the availability of a Status Bit (B in ) in the interface
of each input device and Status Bit (B in ) in the interface of each output device.
Whenever an input device such as a keyboard has a character available in its
input register, it indicates that by setting B in ¼
/
1. A program in the processor can
be used to continuously monitor B in . When the program sees that B in ¼
1, it will
interpret that to mean a character is available in the input register of that device.
Reading such character will require executing the protocol explained above. When-
ever the character is read, then the program can reset B in ¼
0, thus avoiding multiple
read of the same character. In a similar manner, the processor can deposit a character
in the output register of an output device such as a screen only when B out ¼
0. It is
only after the screen has displayed the character that it sets B out ¼
1, indicating to
the program that monitors B out that the screen is ready to receive the next character.
The process of checking the status of I
/
O devices in order to determine their readi-
ness for receiving and
or sending characters, is called software I / O polling.Ahard-
ware I / O polling scheme is shown in Figure 8.5.
/
Figure 8.5 Hardware polling scheme
Search WWH ::




Custom Search