How do Input Output devices work with Computer (Non interrupt edition)

Photo by Sofya on Unsplash

How do Input Output devices work with Computer (Non interrupt edition)

·

2 min read

Basically there are two ways of using Input Output devices , first is by using non interrupt programming and other one is by using interrupts, in this we will use non interrupt way->

Let us take following example

Write RISC style program for performing typing by keyboard and displaying it on screen

1.Initialize the pointer register R2 so that characters pressed by keyboards are placed in that address in main memory

Move R2,#LOC

2.Load the end character in register which suggests that typing is over

MoveByte R3,#CR

3.Wait for character to be entered

LoadByte R4,KBD_STATUS

4.Check the status of flag

And R4,R4,#2

5.If flag is not set or keyboard is not ready then again read the status flag

Branch_if_[R4] = 0 READ

6.Load all data from keyboard register to microprocessor register

LoadByte R5,KBD_DATA

7.Store the character read from keyboard in main memory

StoreByte  R5,[R2]

8.Increment the address pointer in main memory

Add R2,R2,#1

9. Wait for display to be ready

LoadByte R4,DISP_STATUS

10.Check the output status flag

And R4,R4,#4

11.If it is not ready then repeat the checking process

Branch_if_[R4] = 0 ECHO

12.Store the value in register in address at keyboard device

StoreByte R5,DISP_DATA

13.Check for ending condition , if not ended then repeat read & write process

Branch_if_[R5]!=[R3] READ