From fdc967fb7a4c8417e846a7c2b1656e3d482967cd Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Mon, 27 Feb 2023 22:55:44 +0100 Subject: Add doc comments to instructions --- src/insn.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/insn.rs') diff --git a/src/insn.rs b/src/insn.rs index be2e689..8351c54 100644 --- a/src/insn.rs +++ b/src/insn.rs @@ -7,25 +7,34 @@ mod ret; mod test; pub trait Add { + /// Emit an add instruction. fn add(&mut self, op1: T, op2: U); } pub trait Dec { + /// Emit a decrement instruction. fn dec(&mut self, op1: T); } pub trait Jmp { + /// Emit an unconditional jump instruction. fn jmp(&mut self, op1: T); } pub trait Jz { + /// Emit a conditional jump if zero instruction (`ZF = 1`). fn jz(&mut self, op1: T); } pub trait Mov { + /// Emit an move instruction. fn mov(&mut self, op1: T, op2: U); } pub trait Test { + /// Emit a logical compare instruction. + /// + /// Computes the bit-wise logical AND of first operand and the second operand and sets the + /// `SF`, `ZF`, and `PF` status flags, the result is discarded. fn test(&mut self, op1: T, op2: U); } -- cgit v1.2.3