From 47995c9580e3d643fad5c3bda21dd986781cbe53 Mon Sep 17 00:00:00 2001 From: Hayden Kroepfl Date: Sun, 7 Jan 2018 11:44:42 -0700 Subject: [PATCH] Added INC and DEC instructions --- Instruction-Set.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Instruction-Set.md b/Instruction-Set.md index f083a61..c6be5e7 100644 --- a/Instruction-Set.md +++ b/Instruction-Set.md @@ -8,9 +8,11 @@ | [**BRK**](#brk) | *None* | 0x00 |`- - - - 1` | | [**CALL**](#call) *target* | *mem/reg/imm* | 0x15 |`- - - - -` | | [**CMP**](#cmp) *destination*, *source* | *mem/reg*, *mem/reg/imm* | 0x0C |`X X X X -` | +| [**DEC**](#dec) *destination* | *mem/reg* | 0x2B | `- X X X -` | | [**DIV**](#div) *source* | *mem/reg/imm* | 0x18 |`- - - - -` | | [**HWI**](#hwi) *source* | *mem/reg/imm* | 0x09 |`- - - - -` | | [**HWQ**](#hwq) *source* | *mem/reg/imm* | 0x1C |`- - - - -` | +| [**INC**](#inc) *destination* | *mem/reg* | 0x2A | `- X X X -` | | [**JC**](#jc) *target* | *mem/reg/imm* | 0x21 |`- - - - -` | | [**JG**](#jg) *target* | *mem/reg/imm* | 0x0F |`- - - - -` | | [**JGE**](#jge) *target* | *mem/reg/imm* | 0x10 |`- - - - -` | @@ -857,6 +859,32 @@ if count == 1: OVERFLOW_FLAG = (old_sign_bit != new_sign_bit) ``` +### INC +#### Details +| mnemonic | opcode | operands | carry | zero | sign | overflow | break | +| -------- | ------ | -------- | ----- | ---- | ---- | -------- | ----- | +| `INC destination` | `0x2A` | `destination` : `mem` / `reg` | `-` | `X` | `X` | `X` | `-` | +#### Description +`INC` adds one to the value of destination, replacing the previous value. Unlike [**ADD**](#add) the carry flag is not modified. If you wish the carry flag to be modified then use `add dest, 1` instead + +### Pseudo code +```py +destination = destination + 1 +``` +### DEC +#### Details +| mnemonic | opcode | operands | carry | zero | sign | overflow | break | +| -------- | ------ | -------- | ----- | ---- | ---- | -------- | ----- | +| `DEC destination` | `0x2B` | `destination` : `mem` / `reg` | `-` | `X` | `X` | `X` | `-` | +#### Description +`DEC` adds one to the value of destination, replacing the previous value. Unlike [**SUB**](#sub) the carry flag is not modified. If you wish the carry flag to be modified then use `sub dest, 1` instead + +### Pseudo code +```py +destination = destination - 1 +``` + + ### NOP #### Details | mnemonic | opcode | operands | carry | zero | sign | overflow | break |