Before having a discussion regarding the merits of I/O mapped I/O and demerits of memorymapped I/O, let us have a generic discussion regarding the difference between I/O mapped I/O and memory mapped I/O.
In Memory Mapped Input Output −
We allocate a memory address to an Input Output device.
Any instructions related to memory can be accessed by this Input Output device.
The Input Output device data are also given to the Arithmetic Logical Unit.
Input Output Mapped Input Output −
We give an Input Output address to an Input Output device.
Only IN and OUT instructions are accessed by such devices.
The ALU operations are not directly applicable to such Input Output data.
So as a summary we can mention that −
I/O is any general-purpose port used by processor/controller to handle peripherals connected to it.
I/O mapped I/Os have a separate address space from the memory. So, total addressed capacity is the number of I/Os connected and memory connected. Separate I/O-related instructions are used to access I/Os. A separate signal is used for addressing an I/O device.
Memory-mapped I/Os share the memory space with external memory. So, total addressed capacity is memory connected only. This is underutilisation of resources if your processor supports I/O-mapped I/O. In this case instructions used to access I/Os are same as that used for memory.
Let's take an example of the 8085 processor. It has 16 address lines i.e. addressing capacity of 64 KB memory. It supports I/O-mapped I/Os. It can address up to 256 I/Os.
If we connect I/Os to it an I/O-mapped I/O then, it can address 256 I/Os + 64 KB memory. And special instructions IN and OUT are used to access the peripherals. Here we fully utilize the addressing capacity of processor.
If the peripherals are connected in memory mapped fashion, then total devices it can address is only 64K. This is underutilisation of the resource. And only memory-accessing instructions like MVI, MOV, LOAD, SAVE are used to access the I/O devices.
Now we shall discuss about merits of I/O mapped I/O and demerits of memory-mapped I/O −
We use the instructions IN and OUT for the addressing of input output mapped input output ports. The mnemonics of these instructions indicates that the processor is in the process of communication with the Input Output port. For loading the accumulator from memory-mapped input port with address FFF0H we execute the instructions LDA FFF0H.
There are some microprocessors which consists of a control pin for the selection of memory location or an Input Output port. As an example to be cited as in 8085 processor, the pin IO/M* is used for the selection of an Input Output port or a memory location.
256 locations are allocated for the address space of the Input Output port since they are only of size of 8 bits. The address space of memory consists of 64K locations as the addresses of the memory are of length 16 bits.
If we address the Input Output ports as the memory mapped Input Output ports with the addresses ranging from FF00H-FFF0H then these address ranges should not be allotted for any memory chip.