From 3ff27e78b6d7cd5ea82a8f34cfbb4308bd2378ea Mon Sep 17 00:00:00 2001 From: onelin Date: Thu, 19 Nov 2026 23:55:33 +0100 Subject: Add inc/dec instructions --- instructions.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'instructions.h') 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 -- cgit v1.3