Simplest Solution: Memory Mapped I/O
Connect up the memory so that accessing certain memory locations causes data to be transferred to or from the outside world.
______________ 0| | .| | .| Memory | | | |______________| a0000| | .| I/O | |______________| b0000| | .| | .| Memory | |______________|This diagram shows which parts of the memory are used for storage and which for I/O, it is called the memory map.
For example, the screen on a PC is mapped into memory between address 0xa0000 and 0xaffff. Writing to one of these memory locations causes a dot to appear on the screen.
______________ |012345... | | | | Screen | | | |______________|
For example: consider keyboard input. Using Memory Mapped I/O, there may be a memory location holding the ASCII value of the key currently being pressed. The CPU could keep looking at this memory location to see if an input has occurred (this is what my cpu in lecture 8 did).
Unfortunately, the CPU can now do nothing else because if it looked away from the keyboard I/O location, it may miss a key-press (in fact my cpu is so slow that it does sometimes miss key presses).
Better is if the CPU can be told when data is ready. The input device interrupts the CPU to tell it that data is ready.