I am working on designing and implementing a simple 8-bit computer. I intend to have an 8-bit data bus, 8-bit address bus, and 8-bit instructions. I intend to have a RISC style load-store architecture. I am working on designing the instruction set, and am trying to determine if it is possible to have exclusively 8-bit instructions (meaning no multi-byte instructions).
If an instruction is 8-bits, some of those bit fields will be occupied by the opcode, and the remaining may be occupied by a representation of data to work on. For example, consider a load immediate
instruction that takes an address and loads the contents of memory at that address into a specific register in the CPU. As the opcode for the load immediate instruction will occupy a couple bits, there is not room for a full 8-bit address in the instruction. For example, if the opcode for this instruction is '11' in binary, only 6 bits remain for the address to load from.
It seems to me the only option is to extend immediate
type instructions to two bytes, where the first contains the opcode and the second contains the immediate value. Is there another way to do this? Perhaps there are other techniques?
disp16(reg)
with 16 immediate bits. For small absolute addresses, you can use the zero register as the "base". – Peter Cordes