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
|
||||||
|
|
||||||
Arithmetic instructions store their result in the last register specified.
|
Arithmetic instructions store their result in the first register specified.
|
||||||
|
|
||||||
* Add
|
* Add
|
||||||
* **Params**: REG1, REG2
|
* **Params**: REG1, REG2
|
||||||
* `REG2 = REG1 + REG2`
|
* `REG1 = REG1 + REG2`
|
||||||
* Mul
|
* Mul
|
||||||
* **Params**: REG1, REG2
|
* **Params**: REG1, REG2
|
||||||
* `REG2 = REG1 * REG2`
|
* `REG1 = REG1 * REG2`
|
||||||
* Div
|
* Div
|
||||||
* **Params**: REG1, REG2
|
* **Params**: REG1, REG2
|
||||||
* `REG2 = REG1 / REG2`
|
* `REG1 = REG1 / REG2`
|
||||||
* Mod
|
* Mod
|
||||||
* **Params**: REG1, REG2
|
* **Params**: REG1, REG2
|
||||||
* `REG2 = REG1 % REG2` (exact semantics TBD)
|
* `REG1 = REG1 % REG2` (exact semantics TBD)
|
||||||
* Neg
|
* Neg
|
||||||
* **Params**: REG1
|
* **Params**: REG1
|
||||||
* `REG1 = REG1 * -1`
|
* `REG1 = REG1 * -1`
|
||||||
* And
|
* And
|
||||||
* **Params**: REG1, REG2
|
* **Params**: REG1, REG2
|
||||||
* `REG2 = REG1 & REG2`
|
* `REG1 = REG1 & REG2`
|
||||||
* Or
|
* Or
|
||||||
* **Params**: REG1, REG2
|
* **Params**: REG1, REG2
|
||||||
* `REG2 = REG1 | REG2`
|
* `REG1 = REG1 | REG2`
|
||||||
* Xor
|
* Xor
|
||||||
* **Params**: REG1, REG2
|
* **Params**: REG1, REG2
|
||||||
* `REG2 = REG1 ^ REG2`
|
* `REG1 = REG1 ^ REG2`
|
||||||
* Shl
|
* Shl
|
||||||
* **Params**: REG1, REG2
|
* **Params**: REG1, REG2
|
||||||
* `REG1 = REG1 << REG2`
|
* `REG1 = REG1 << REG2`
|
||||||
@@ -124,9 +124,8 @@ Arithmetic instructions store their result in the last register specified.
|
|||||||
MEM[REG2] = REG1;
|
MEM[REG2] = REG1;
|
||||||
```
|
```
|
||||||
* StoreImm32
|
* StoreImm32
|
||||||
* (hw = half word)
|
* **Params**: REG1, IMM_32
|
||||||
* **Params**: REG1, IMM_HW
|
* `REG1 = IMM_32`
|
||||||
* `REG1 = IMM_HW`
|
|
||||||
* MemCopy
|
* MemCopy
|
||||||
* **Params**: REG1, REG2
|
* **Params**: REG1, REG2
|
||||||
* `MEM[REG1] = MEM[REG2]`
|
* `MEM[REG1] = MEM[REG2]`
|
||||||
|
|||||||
Reference in New Issue
Block a user