@@ 101,7 101,7 @@ fn main() {
arguments.insert("u8",
Argument {
tp: ArgumentType::Literal(0xFF + 1),
- prefix: "#imm",
+ prefix: "imm",
prefix_alt: None,
suffix: "",
multiplier: 0,
@@ 351,7 351,7 @@ fn main() {
const FAKE_ARGUMENTS: &[&str] = &["", "@(R0", "FPUL", "PC)", "R0", "FR0", "DBR", "GBR", "SGR", "SPC", "SR", "SSR", "VBR", "FPSCR", "MACH", "MACL",
"PR"];
for (mut disp_arg, arg_tp) in instr.disp.split(|c| c == ' ' || c == ',').skip(1).filter(|d| !FAKE_ARGUMENTS.contains(d)).zip(instr.args.iter()) {
- while disp_arg.starts_with(|ref c| ['(', '@', '-'].contains(c)) {
+ while disp_arg.starts_with(|ref c| ['(', '@', '-', '#'].contains(c)) {
disp_arg = &disp_arg[1..];
}
for &sfx in &[')', '+'] {
@@ 382,6 382,7 @@ fn main() {
display_format.push_str(&instr.disp[last_disp_idx..this_disp_idx]);
display_format.push_str("{}");
last_disp_idx = this_disp_idx + disp_arg.len();
+
}
display_format.push_str(&instr.disp[last_disp_idx..]);
@@ 1,6 1,6 @@
extern crate yaxpeax_superh;
-use yaxpeax_superh::SuperHInstruction;
+use yaxpeax_superh::{SuperHInstruction, SuperHRegister};
#[test]
@@ 15,6 15,11 @@ fn round_trip() {
}
}
+#[test]
+fn display() {
+ assert_eq!(format!("{}", SuperHInstruction::MovImm(0x69, SuperHRegister::R4)), "MOV #105,R4"); // Agrees with objdump
+}
+
mod generated_f64 {
use yaxpeax_superh::{SuperHInstruction, SuperHRegister, SuperHRegisterBank, SuperHFloatRegister, SuperHVectorFloatRegister, SuperHDoubleRegister,