aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/insn
diff options
context:
space:
mode:
Diffstat (limited to 'src/insn')
-rw-r--r--src/insn/add.rs8
-rw-r--r--src/insn/sub.rs14
2 files changed, 21 insertions, 1 deletions
diff --git a/src/insn/add.rs b/src/insn/add.rs
index d5312be..1f5294e 100644
--- a/src/insn/add.rs
+++ b/src/insn/add.rs
@@ -1,5 +1,5 @@
use super::Add;
-use crate::{Asm, Imm16, MemOp, Reg16, Reg32, Reg64};
+use crate::{Asm, Imm16, Imm8, MemOp, Reg16, Reg32, Reg64};
impl Add<Reg64, Reg64> for Asm {
fn add(&mut self, op1: Reg64, op2: Reg64) {
@@ -25,6 +25,12 @@ impl Add<MemOp, Reg16> for Asm {
}
}
+impl Add<MemOp, Imm8> for Asm {
+ fn add(&mut self, op1: MemOp, op2: Imm8) {
+ self.encode_mi(0x83, 0, op1, op2);
+ }
+}
+
impl Add<MemOp, Imm16> for Asm {
fn add(&mut self, op1: MemOp, op2: Imm16) {
self.encode_mi(0x81, 0, op1, op2);
diff --git a/src/insn/sub.rs b/src/insn/sub.rs
new file mode 100644
index 0000000..814744c
--- /dev/null
+++ b/src/insn/sub.rs
@@ -0,0 +1,14 @@
+use super::Sub;
+use crate::{Asm, Imm8, MemOp, Reg64};
+
+impl Sub<Reg64, Reg64> for Asm {
+ fn sub(&mut self, op1: Reg64, op2: Reg64) {
+ self.encode_rr(&[0x29], op1, op2);
+ }
+}
+
+impl Sub<MemOp, Imm8> for Asm {
+ fn sub(&mut self, op1: MemOp, op2: Imm8) {
+ self.encode_mi(0x83, 5, op1, op2);
+ }
+}