implement a more readable bit mask syntax, add (ldXX Wr Rd Rd) with separate dest and both sources
This commit is contained in:
+16
-2
@@ -34,6 +34,8 @@ struct Config {
|
||||
program_file: String,
|
||||
#[serde(skip)]
|
||||
assemble_only: bool,
|
||||
#[serde(skip)]
|
||||
assemble_debug: bool,
|
||||
#[serde(with = "serde_duration_millis")]
|
||||
cycle_time: Duration,
|
||||
}
|
||||
@@ -47,6 +49,7 @@ impl Default for Config {
|
||||
},
|
||||
program_file: "".to_string(),
|
||||
assemble_only: false,
|
||||
assemble_debug: false,
|
||||
cycle_time: Duration::default(),
|
||||
}
|
||||
}
|
||||
@@ -88,6 +91,12 @@ impl AppConfig for Config {
|
||||
.long("asm")
|
||||
.help("Only assemble, do not run."),
|
||||
)
|
||||
.arg(
|
||||
clap::Arg::with_name("asm-debug")
|
||||
.short("D")
|
||||
.long("asm-debug")
|
||||
.help("Only assemble, do not run. Print the result in debug format."),
|
||||
)
|
||||
.arg(
|
||||
clap::Arg::with_name("cycle")
|
||||
.long("cycle")
|
||||
@@ -100,7 +109,8 @@ impl AppConfig for Config {
|
||||
|
||||
fn configure(mut self, clap: &ArgMatches) -> anyhow::Result<Self> {
|
||||
self.program_file = clap.value_of("input").unwrap().to_string();
|
||||
self.assemble_only = clap.is_present("asm-only");
|
||||
self.assemble_debug = clap.is_present("asm-debug");
|
||||
self.assemble_only = self.assemble_debug || clap.is_present("asm-only");
|
||||
if let Some(t) = clap.value_of("cycle") {
|
||||
let (t, mul) = if t.ends_with("us") {
|
||||
(&t[..(t.len()-2)], 1)
|
||||
@@ -142,7 +152,11 @@ fn main() -> anyhow::Result<()> {
|
||||
|
||||
if config.assemble_only {
|
||||
for (n, op) in parsed.ops.iter().enumerate() {
|
||||
println!("{:04} : {}", n, op.to_sexp());
|
||||
if config.assemble_debug {
|
||||
println!("{:04} : {:?}", n, op);
|
||||
} else {
|
||||
println!("{:04} : {}", n, op.to_sexp());
|
||||
}
|
||||
}
|
||||
return Ok(());
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user