“a program that performs all functions needed to realise the desired action”
difference in speed between processor and I/O devices, need to synchronise transfer of data
solution — signalling protocol (wait for signal from device, a status flag)
polling — checking the device’s status flag
reads from keyboard, echoes back to display. end on newline
Point register R2 to address of first location in main memory where read characters will be stored
Load newline character (terminator) into R3
Start input loop
Move keyboard status into R4
R4 = R4 AND #2
...0X
or ...1X
If [R4] is 0 (KIN is false), jump to step 1 of loop
Load KBD_DATA
byte into R5 (clearing KIN to 0)
Store R5 into address in R2
Increment pointer in R2 (to store next character)
Start output loop
Load DISP_STATUS
byte into R4
R4 = R4 AND #2
If [R4] is 0, jump to step 1 of loop
Store byte in R5 into DISP_DATA
If the Terminator isn’t in R5 ([R5] ≠ [R3]), jump to step 3 (input loop)