BUN LOOP // Branch back if no input
INP // Read character into AC
STA CHR // Store in memory location CHR
HLT // Stop program
CHR, HEX 0000 // Memory location for character
LOOP, COF // Check if output is ready
SKO // Skip if output flag = 1
BUN LOOP // Branch back if output busy
OUT // Send character to output
HLT // Stop program
CHR, HEX 0057 // ASCII code for 'W' (87 decimal)
41
57
30
39
ASCII values shown in hexadecimal
🎮 Interactive I/O Simulation
Experience how assembly I/O operations work!
Input Flag: Indicates when a character is ready to be read from input device.
Output Flag: Indicates when the output device is ready to accept a new character.
Polling: The process of repeatedly checking flags until they indicate readiness.
SKI (Skip on Input): Efficiently checks if input is ready without complex branching.
SKO (Skip on Output): Efficiently checks if output is ready without complex branching.
Efficiency: Skip instructions make polling loops more compact and faster.
Polling Loop: Program waits in a loop until I/O device is ready.
Synchronization: Ensures data integrity between CPU and I/O devices.