aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2023-02-27 22:55:44 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2023-02-27 22:55:44 +0100
commitfdc967fb7a4c8417e846a7c2b1656e3d482967cd (patch)
treea43d3478bbc9233fe09bea6de7eb890ca1c306f1 /src
parent431dca3b8a128d24dc8c80d50e778e82c7e7fe9b (diff)
downloadjuicebox-asm-fdc967fb7a4c8417e846a7c2b1656e3d482967cd.tar.gz
juicebox-asm-fdc967fb7a4c8417e846a7c2b1656e3d482967cd.zip
Add doc comments to instructions
Diffstat (limited to 'src')
-rw-r--r--src/insn.rs9
1 files changed, 9 insertions, 0 deletions
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<T, U> {
+ /// Emit an add instruction.
fn add(&mut self, op1: T, op2: U);
}
pub trait Dec<T> {
+ /// Emit a decrement instruction.
fn dec(&mut self, op1: T);
}
pub trait Jmp<T> {
+ /// Emit an unconditional jump instruction.
fn jmp(&mut self, op1: T);
}
pub trait Jz<T> {
+ /// Emit a conditional jump if zero instruction (`ZF = 1`).
fn jz(&mut self, op1: T);
}
pub trait Mov<T, U> {
+ /// Emit an move instruction.
fn mov(&mut self, op1: T, op2: U);
}
pub trait Test<T, U> {
+ /// 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);
}