The Ember CPU — Initial Design Part 5: Load-Store and Memory Instructions
- Tom Gambill
- Feb 20
- 1 min read
Updated: Mar 7

We covered ALU instructions in Part 4, but with a Load-Store architecture CPU, separate instructions are required in order to move data from memory into registers or to write data back to main memory or external devices.
Load and Store Memory Instructions
We briefly mentioned LDI and LDIH instructions previously, which can be used to load a constant value into a register 16 bits at a time. This works by first loading the low 16 bits, then the high 16 bits, splitting the operation between two instructions. However, the immediate value is stored within the instruction word, and cannot be changed when the program runs. In order to interact with actual data from RAM, ROM, or external devices, we will need two new instructions, LD (Load) and ST (Store), as well as a new operand type and an address, or index, to a location in memory.
Σχόλια