So, I'm working on a 16 bits CPU Emulator with these settings:
- Instructions are 4 Bytes long;
- 24 bits of an instruction are for data purposes, but only 16 bits are used for memory addressing.
- All registers are 4 Bytes in size, the CPU however can only read the lower 2 bytes;
An example of an instruction with as operands a Register and a Memory address:
mov A, [0x1234];
Anyway, I can only use 16 bits to read/write to memory. So, my problem is that I need to address more than 64K addresses.
Is there a way I can map a 32 bits address with only 16 bits at my disposal?
( I'm aware that I could just use my registers to store addresses, but this would take more clock cycles as the CPU can read/write 2 bytes at a time. This means you would need to shift bits etc... to use the higher 2 bytes).
Would virtual memory/paging solve the problem, or is it too high-level on CPU level?