What if the processor does not have special instructions for input and output
Solution 1:
The in
and the out
instructions of an x86 are more or less special cases of the mov
instruction:
You might say that the M//IO
pin of an 8088 CPU running in "min" mode is actually the pin /A20
. In this case, the instruction mov al, [si]
is used to read a byte from the address range 0-0FFFFFh and in al, dx
is used to read a byte from the address range 100000h-10FFFFh.
The same is true for mov [si], al
and out dx, al
.
So an 8088 can access the address range 0-10FFFFh. And an 80386 can access and address range 0-10000FFFFh.
However, in reality, you would not talk about "address range 100000h-10FFFFh" but about the "I/O address range". But the principle is the same.
CPUs not having an in
or out
instruction (ARM, PowerPC, MIPS, TriCore, V850, m68k, 680x, 6502 ...) only have one address range.
All devices (keyboard, UART, mouse ...) connected to such a CPU have an address in this single address range.
For this case, these devices are accessed using the instruction that equals the x86 instruction mov al, [si]
instead of the instruction in al, dx
(which does not exist on such CPUs).