6-2 PROGRAMMED I/O

Programmed I/O consists of continually examining the status of an interface and performing an I/O operation with the interface when its status indicates that it has data to be input or its data-out buffer register is ready to receive data from the CPU.

As a more complete example, suppose a line of characters is to be input from a terminal to an 82-byte array beginning at BUFFER until a carriage return is encountered or more then 80 characters are input. If a carriage return is not found in the first 81 characters then the message "BUFFER OVERFLOW" is to be output to the terminal; otherwise, a line feed is to be automatically appended to the carriage return.

Because the ASCII code is a 7-bit code, the eighth bit, bit 7, is often used as parity bit during the transmission from the terminal. Let us assume that bit 7 is set according to even parity and if an odd parity byte is detected, a branch is to be made to ERROR. If there is no parity error, bit 7 is to be cleared before the byte is transferred to the memory buffer.

PRETHODNA FOLIJA SADRZAJ SLEDECA FOLIJA