-
Added most stack instructions
08/05/2018 at 23:22 • 2 commentsI needed to re-add the stack instructions to make the CPU work.
As some saw in the HDD crash project log on the #DEXT Meteor project, I lost the VHDL code for the latest version of the Plasma Cortex processor. That version had most of the instructions already implemented, and the old version I had a backup of did not have all those instructions. Today I added the four main stack instructions for my CPU:
CALL address PUSH register POP register ADD SP, 32 bit constant
You notice no RET instruction? The Plasma Cortex allows access of all registers the same way, so these are actually valid instructions:
MOV PC, 0xDEADBEEF ; alias of JMP 0xDEADBEEF POP PC ; alias of RET PUSH PC ; unique instruction MOV AX, PC ; another unique instruction
The programmer has full control over the program counter, so the assembler just converts RET instructions to POP PC.
There are no interrupts *yet*, so no IRET or anything like that. I actually do not plan on having a special return instruction for the Plasma Cortex because I feel it is unneeded.
[edit] Just realized I still need to add these instructions:
MOV [sp+16 bit offset], general purpose register MOV general purpose register, [sp+16 bit offset]
Those are for the C compiler's local variables. Those instructions greatly speed up C programs running on the Plasma Cortex.
That's all for now, thanks for reading!!