So far, I have established the groundwork of the CPU. I have made a basic cycle system, where each cycle moves the instruction counter to the next instruction and then runs the newly selected instruction. The instructions I have implemented are:
- 0000 | NOP - No OPeration - most complex instruction; does exactly nothing.
- 0001 | JMP - JuMP - moves the instruction pointer to a specific address in the program it is running.
- 0010 | RGS - ReGister - Set - sets the register defined in the first byte to hold the next 2 bytes as a value.
- 0011 | PSH - PuSH - pushes the register states to the stack, and then saves the address of the 2nd-to-next instruction in the 4th register for returning.
- 0100 | POP - POP - reads the most recent entry into the stack and writes those values into the 4 registers
Right now all instructions have to be written one after another with no newlines or spaces, but in the future when I add more instructions I will also make it more human-readable
0
Log in to leave a comment