42 lines
831 B
Rust
42 lines
831 B
Rust
use clap::{Parser, Subcommand};
|
|
|
|
mod aout;
|
|
mod decode;
|
|
mod disasm;
|
|
mod instructions;
|
|
|
|
#[derive(Subcommand, Debug)]
|
|
enum Command {
|
|
/// Disassemble the binary into 8086 instructions
|
|
Disasm,
|
|
|
|
/// Interpret the binary as 8086 Minix
|
|
Interpret,
|
|
}
|
|
|
|
/// Simple prgram to diasm and interpret Minix binaries
|
|
#[derive(Parser, Debug)]
|
|
#[command(version, about, long_about = None)]
|
|
struct Args {
|
|
#[command(subcommand)]
|
|
command: Command,
|
|
|
|
/// Path of the binary
|
|
#[arg(short, long, global = true)]
|
|
path: Option<String>,
|
|
}
|
|
|
|
fn main() {
|
|
env_logger::init();
|
|
|
|
let args = Args::parse();
|
|
log::debug!("{:?}", args);
|
|
|
|
match args.command {
|
|
Command::Disasm => {
|
|
let _instructions = disasm::disasm(&args).unwrap();
|
|
}
|
|
_ => panic!("Command not yet implemented"),
|
|
}
|
|
}
|