aboutsummaryrefslogtreecommitdiff
path: root/src/display.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2019-11-29 16:50:18 -0800
committeriximeow <me@iximeow.net>2020-01-12 16:10:13 -0800
commit5c86aaf06d0f638d3fc1d302ef4d401b0222bee1 (patch)
treecac7d1294fca70707ea6fac3ff472fe93796edca /src/display.rs
parent324c58fee142e0ea987d1d23a7e25142dde803d0 (diff)
support imul, >2 operands, and 4-bit register bank
Diffstat (limited to 'src/display.rs')
-rw-r--r--src/display.rs113
1 files changed, 58 insertions, 55 deletions
diff --git a/src/display.rs b/src/display.rs
index 0694265..1c5792e 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -706,75 +706,78 @@ impl <T: std::fmt::Write> ShowContextual<u64, [Option<String>], T> for Instructi
x.colorize(colors, out)?;
}
};
- match self.opcode {
- Opcode::MOVSX_b |
- Opcode::MOVZX_b => {
- match context.and_then(|xs| xs[1].as_ref()) {
- Some(s) => { write!(out, ", {}", s) }
- None => {
- match &self.operands[1] {
- &OperandSpec::Nothing => {
- unreachable!();
- },
- &OperandSpec::RegMMM => {
- write!(out, ", ")?;
- }
- x @ _ => {
- write!(out, ", byte ")?;
- if let Some(prefix) = self.segment_override_for_op(1) {
- write!(out, "{}:", prefix)?;
+ for i in 1..4 {
+ match self.opcode {
+ Opcode::MOVSX_b |
+ Opcode::MOVZX_b => {
+ match context.and_then(|xs| xs[i].as_ref()) {
+ Some(s) => { write!(out, ", {}", s)? }
+ None => {
+ match &self.operands[i] {
+ &OperandSpec::Nothing => {
+ return Ok(());
+ },
+ &OperandSpec::RegMMM => {
+ write!(out, ", ")?;
+ }
+ x @ _ => {
+ write!(out, ", byte ")?;
+ if let Some(prefix) = self.segment_override_for_op(1) {
+ write!(out, "{}:", prefix)?;
+ }
}
}
+ let x = Operand::from_spec(self, self.operands[i]);
+ x.colorize(colors, out)?
}
- let x = Operand::from_spec(self, self.operands[1]);
- x.colorize(colors, out)
}
- }
- },
- Opcode::MOVSX_w |
- Opcode::MOVZX_w => {
- match context.and_then(|xs| xs[1].as_ref()) {
- Some(s) => { write!(out, ", {}", s) }
- None => {
- match &self.operands[1] {
- &OperandSpec::Nothing => {
- unreachable!();
- },
- &OperandSpec::RegMMM => {
- write!(out, ", ")?;
- }
- _ => {
- write!(out, ", word ")?;
- if let Some(prefix) = self.segment_override_for_op(1) {
- write!(out, "{}:", prefix)?;
+ },
+ Opcode::MOVSX_w |
+ Opcode::MOVZX_w => {
+ match context.and_then(|xs| xs[i].as_ref()) {
+ Some(s) => { write!(out, ", {}", s)? }
+ None => {
+ match &self.operands[i] {
+ &OperandSpec::Nothing => {
+ return Ok(());
+ },
+ &OperandSpec::RegMMM => {
+ write!(out, ", ")?;
+ }
+ _ => {
+ write!(out, ", word ")?;
+ if let Some(prefix) = self.segment_override_for_op(1) {
+ write!(out, "{}:", prefix)?;
+ }
}
}
+ let x = Operand::from_spec(self, self.operands[i]);
+ x.colorize(colors, out)?
}
- let x = Operand::from_spec(self, self.operands[1]);
- x.colorize(colors, out)
}
- }
- },
- _ => {
- match context.and_then(|xs| xs[1].as_ref()) {
- Some(s) => { write!(out, ", {}", s) }
- None => {
- match &self.operands[1] {
- &OperandSpec::Nothing => {
- return Ok(());
- },
- _ => {
- write!(out, ", ")?;
- if let Some(prefix) = self.segment_override_for_op(1) {
- write!(out, "{}:", prefix)?;
+ },
+ _ => {
+ match context.and_then(|xs| xs[i].as_ref()) {
+ Some(s) => { write!(out, ", {}", s)? }
+ None => {
+ match &self.operands[i] {
+ &OperandSpec::Nothing => {
+ return Ok(());
+ },
+ _ => {
+ write!(out, ", ")?;
+ if let Some(prefix) = self.segment_override_for_op(1) {
+ write!(out, "{}:", prefix)?;
+ }
+ let x = Operand::from_spec(self, self.operands[i]);
+ x.colorize(colors, out)?
}
- let x = Operand::from_spec(self, self.operands[1]);
- x.colorize(colors, out)
}
}
}
}
}
}
+ Ok(())
}
}