Memory-mapped I/O gives device actions ordinary memory addresses. ivss's word-write helper routes a mapped address to a callback instead of storing into regular RAM:
if (Mem_IsMemoryMapped(addr)) { MPR_Callback(MPR_WRITE, addr, value, NULL); } else { Mem_WriteRawWord(addr, value); }
The mapped region spans 0xFFFFFF00 through 0xFFFFFFFF. Three addresses have defined device behavior:
| Address | Register |
|---|---|
0xFFFFFF00 | Terminal output |
0xFFFFFF04 | Terminal input |
0xFFFFFF10 | Timer configuration |
For example, storing a character at the output address prints it on the host terminal. Reading the input address returns the latest buffered input byte. The callback interprets the address and operation rather than treating the register as ordinary section data.
Raw memory helpers bypass this routing. The loader uses them to copy sections and apply relocation patches before execution. Terminal input and timer event generation need their corresponding emulator flags; output writes themselves do not require starting the input thread.
Source: emulator.c.