Add call/ret/push/pop instructions
* Call/ret/push/pop are implemented and appear to be working * Call/ret/push/pop is specified in the 0x2000 block, replacing the mov instruction * Mov instruction is now specified in the 0x3000 block Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
25
vm.md
25
vm.md
@@ -181,10 +181,33 @@ wrapping around to 0.
|
||||
* Opcode: 0x1004
|
||||
* Params: Source
|
||||
|
||||
## Functions
|
||||
|
||||
* Call
|
||||
* Opcode: 0x2000
|
||||
* Params: Source
|
||||
* When this instruction is executed, these actions occur:
|
||||
* Push the current stack frame pointer
|
||||
* Push the IP of the next instruction
|
||||
* Update the IP (i.e., jump) to the value at the given source.
|
||||
* Ret
|
||||
* Opcode: 0x2001
|
||||
* When this instruction is executed, these actions occur:
|
||||
* Update the stack pointer to the current frame pointer + 16.
|
||||
* Pop the IP of the next instruction.
|
||||
* Pop the old stack frame.
|
||||
* Restore the last three values in an undefined order
|
||||
* Push
|
||||
* Opcode: 0x2002
|
||||
* Params: Source
|
||||
* Pop
|
||||
* Opcode: 0x2003
|
||||
* Params: Dest
|
||||
|
||||
## Data movement
|
||||
|
||||
* Mov
|
||||
* Opcode: 0x2000
|
||||
* Opcode: 0x3000
|
||||
|
||||
## Miscellaneous
|
||||
|
||||
|
||||
Reference in New Issue
Block a user