Input Output Programming in Computer Architecture YASH PAL, March 1, 2026March 1, 2026 Input Output Programming in Computer Architecture – Input Output programs are needed for writing symbols to the computer’s memory and printing symbols from the memory. Input-output programs are employed for writing programs for the computer. The symbols are strings of characters, and each character is assigned an 8-bit code so that it can be stored in computer memory. A binary-coded character enters the computer when an INP (input) instruction is executed. A binary-coded character is transferred to the output device when an OUT (output) instruction is executed. The output device detects the binary code and types the corresponding character. Let’s take example programs for the Basic Computer to input and output one character without any interruption. (a) Input a character program CIF,SKIBUN CIFINPOUTSTA CHRHLT/Check input flag/Flag = 0, branch to check again/Flag = 1, input character/Print character/Store characterCHR,—/Store character here (b) Output one character LDA CHR/Load character into ACCOF,SKOBUN COFOUTHLT/Check-output flag/Flag = 0, branch to check again/Flag = 1, output characterCHR,HEX 0057/Character is “W” Character Manipulation – The binary-coded characters that represent symbols can be manipulated by computer instructions to achieve various data-processing tasks. One such task may be to pack two characters in one word. This is convenient because each character occupies 8 bits, and a memory word contains 16 bits. The program in the table below lists a subroutine named IN2 that inputs two characters and packs them into one 16-bit word. The packed word remains in the accumulator. Let’s take a Subroutine program to input and pack two characters. IN2—/Subroutine entryFST,SKIBUN FSTINPOUTBSA SH4BSA SH4/Input first character/Shift left four times/Shift left four more timesSCD,SKIBUN SCDINPOUTBUN IN2 I/Input second character/Return Program Interrupt – The running time of input and output programs is made up primarily of the time spent by the computer in waiting for the external device to set its flag. The wait loop that checks the flags wastes a large amount of time. This waiting time can be eliminated if the interrupt facility is used to notify the computer when a flag is set. The advantage of using the interrupt is that the information transfer is initiated upon request from the external device. In the meantime, the computer can be busy performing other useful tasks. Obviously, if no other program resides in memory, there is nothing for the computer to do, so it might as well check for the flag. The interrupt facility is useful in a multiprogram environment when two or more programs reside in memory at the same time. Only one program can be executed at any given time, even though two or more programs may reside in memory. The program currently being executed is referred to as the running program. The other programs are usually waiting for input or output data. The function of the interrupt facility is to take care of the data transfer of one (or more) programs while another program is currently being executed. The running program must include an ION instruction to turn the interrupt on. If the interrupt facility is not used, the program must include an IOF instruction to turn it off. Service Routine – Service routine must have instructions to perform the following tasks: Save contents of processor registers. Check which flag is set. Service the device whose flag is set. Restore contents of processor registers. Turn the interrupt facility on. Return to the running program. Computer System Architecture engineering subjects Computer System Architecture