Fix arithmetic instruction specs
Originally, arithmetic instructions were in the form of
REG2 = REG1 (OP) REG2
but then I started storing the result in REG1 (both in implementation,
and later defs of the arth instructions). So I'm updating it to match
what was actually in my head.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
21
vm.md
21
vm.md
@@ -43,32 +43,32 @@ CPU flags are addressed by bit index, going from right to left.
|
||||
|
||||
## Arithmetic
|
||||
|
||||
Arithmetic instructions store their result in the last register specified.
|
||||
Arithmetic instructions store their result in the first register specified.
|
||||
|
||||
* Add
|
||||
* **Params**: REG1, REG2
|
||||
* `REG2 = REG1 + REG2`
|
||||
* `REG1 = REG1 + REG2`
|
||||
* Mul
|
||||
* **Params**: REG1, REG2
|
||||
* `REG2 = REG1 * REG2`
|
||||
* `REG1 = REG1 * REG2`
|
||||
* Div
|
||||
* **Params**: REG1, REG2
|
||||
* `REG2 = REG1 / REG2`
|
||||
* `REG1 = REG1 / REG2`
|
||||
* Mod
|
||||
* **Params**: REG1, REG2
|
||||
* `REG2 = REG1 % REG2` (exact semantics TBD)
|
||||
* `REG1 = REG1 % REG2` (exact semantics TBD)
|
||||
* Neg
|
||||
* **Params**: REG1
|
||||
* `REG1 = REG1 * -1`
|
||||
* And
|
||||
* **Params**: REG1, REG2
|
||||
* `REG2 = REG1 & REG2`
|
||||
* `REG1 = REG1 & REG2`
|
||||
* Or
|
||||
* **Params**: REG1, REG2
|
||||
* `REG2 = REG1 | REG2`
|
||||
* `REG1 = REG1 | REG2`
|
||||
* Xor
|
||||
* **Params**: REG1, REG2
|
||||
* `REG2 = REG1 ^ REG2`
|
||||
* `REG1 = REG1 ^ REG2`
|
||||
* Shl
|
||||
* **Params**: REG1, REG2
|
||||
* `REG1 = REG1 << REG2`
|
||||
@@ -124,9 +124,8 @@ Arithmetic instructions store their result in the last register specified.
|
||||
MEM[REG2] = REG1;
|
||||
```
|
||||
* StoreImm32
|
||||
* (hw = half word)
|
||||
* **Params**: REG1, IMM_HW
|
||||
* `REG1 = IMM_HW`
|
||||
* **Params**: REG1, IMM_32
|
||||
* `REG1 = IMM_32`
|
||||
* MemCopy
|
||||
* **Params**: REG1, REG2
|
||||
* `MEM[REG1] = MEM[REG2]`
|
||||
|
||||
Reference in New Issue
Block a user