Make state print when just running dependent on a flag
This commit is contained in:
parent
ec14039a40
commit
849f3c7dd2
@ -65,6 +65,9 @@ struct Args {
|
|||||||
/// Just run the CPU instad of starting a REPL
|
/// Just run the CPU instad of starting a REPL
|
||||||
#[clap(short, long)]
|
#[clap(short, long)]
|
||||||
run: bool,
|
run: bool,
|
||||||
|
/// If not using a REPL, print the state of the CPU on halt
|
||||||
|
#[clap(short, long, requires("run"))]
|
||||||
|
print_state: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<(), anyhow::Error> {
|
fn main() -> Result<(), anyhow::Error> {
|
||||||
@ -91,7 +94,9 @@ fn main() -> Result<(), anyhow::Error> {
|
|||||||
while !state.cpu.stopped {
|
while !state.cpu.stopped {
|
||||||
state.cpu.step();
|
state.cpu.step();
|
||||||
}
|
}
|
||||||
println!("CPU stopped at PC {:#x}\n{}", state.cpu.pc(), state.cpu);
|
if args.print_state {
|
||||||
|
println!("CPU stopped at PC {:#x}\n{}", state.cpu.pc(), state.cpu);
|
||||||
|
}
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
Repl::<_, anyhow::Error>::new(state)
|
Repl::<_, anyhow::Error>::new(state)
|
||||||
|
Loading…
Reference in New Issue
Block a user