summaryrefslogtreecommitdiff
path: root/instructions.h
diff options
context:
space:
mode:
authoronelin <oscar@nelin.dk>2026-11-19 22:55:33 +0000
committeronelin <oscar@nelin.dk>2026-11-19 22:55:33 +0000
commit3ff27e78b6d7cd5ea82a8f34cfbb4308bd2378ea (patch)
tree45bd42e6b5ba144d0c5da3a57235a452528f6dd1 /instructions.h
parent692c1521ced0f113e85f0d67cead896893852093 (diff)
Add inc/dec instructions
Diffstat (limited to 'instructions.h')
-rw-r--r--instructions.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/instructions.h b/instructions.h
index d6c512b..c94c04b 100644
--- a/instructions.h
+++ b/instructions.h
@@ -153,8 +153,7 @@
(0x81), MODRM(3, 0, reg), (imm & 0xff), ((imm >> 8) & 0xff), \
((imm >> 16) & 0xff), ((imm >> 24) & 0xff)
// The immediate value will get truncated to 32bit anyways.
-#define ADDQI(reg, imm) \
- REX(REX_W), ADDDI(reg, imm)
+#define ADDQI(reg, imm) REX(REX_W), ADDDI(reg, imm)
// Add register
#define ADDB(src, dst) (0x00), MODRM(3, src, dst)
@@ -168,15 +167,23 @@
#define ADDDC(src, dst) (0x11), MODRM(3, src, dst)
#define ADDQC(src, dst) REX(REX_W), ADDDC(src, dst)
-#define ADD
#define CALL
#define CMP
-#define DEC
#define DIV
#define HLT
#define IDIV
#define IMUL
-#define INC
+
+#define INCB(reg) (0xFE), MODRM(3, 0x0, reg)
+#define INCW(reg) PREFIX_OVERRIDE_OPSIZE, (0xFF), MODRM(3, 0x0, reg)
+#define INCD(reg) (0xFF), MODRM(3, 0x0, reg)
+#define INCQ(reg) REX(REX_W), (0xFF), MODRM(3, 0x0, reg)
+
+#define DECB(reg) (0xFE), MODRM(3, 0x1, reg)
+#define DECW(reg) PREFIX_OVERRIDE_OPSIZE, (0xFF), MODRM(3, 0x1, reg)
+#define DECD(reg) (0xFF), MODRM(3, 0x1, reg)
+#define DECQ(reg) REX(REX_W), (0xFF), MODRM(3, 0x1, reg)
+
#define INT
#define INTO
#define IRET