diff options
author | Ben Bridle <ben@derelict.engineering> | 2025-02-28 14:35:04 +1300 |
---|---|---|
committer | Ben Bridle <ben@derelict.engineering> | 2025-02-28 14:35:04 +1300 |
commit | da5c8173a56d5be7fa23d2b18eaba1542aa31dd6 (patch) | |
tree | 6ef7aa76568bfa2488b0d0d9a878016eabadcae0 /src/main.rs | |
parent | dba769e13ca5029643c6068e53fa34ae0fea8421 (diff) | |
download | torque-asm-da5c8173a56d5be7fa23d2b18eaba1542aa31dd6.zip |
Implement inhx format
inhx is the original Intel hex format.
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 9fb404c..f271bcd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,7 +47,7 @@ fn main() { let dry_run = args.named("dry-run").short('n').as_bool(); let Ok(format) = Format::from_str(format.as_str()) else { - fatal!("Unknown format '{format}', expected 'debug', 'inhx32', 'raw', or 'source'. "); + fatal!("Unknown format '{format}', expected 'debug', 'inhx', 'inhx32', 'raw', or 'source'. "); }; // ----------------------------------------------------------------------- @@ -127,6 +127,10 @@ fn main() { } write_bytes_and_exit(output.as_bytes(), destination_path.as_ref()); } + Format::Inhx => { + let output = format_inhx(&bytecode.words); + write_bytes_and_exit(output.as_bytes(), destination_path.as_ref()); + } Format::Inhx32 => { let output = format_inhx32(&bytecode.words); write_bytes_and_exit(output.as_bytes(), destination_path.as_ref()); @@ -162,6 +166,7 @@ fn write_bytes_and_exit<P: AsRef<Path>>(bytes: &[u8], path: Option<&P>) -> ! { #[derive(PartialEq)] enum Format { Debug, + Inhx, Inhx32, Raw, Source, @@ -172,6 +177,7 @@ impl FromStr for Format { fn from_str(string: &str) -> Result<Self, ()> { match string { "debug" => Ok(Self::Debug), + "inhx" => Ok(Self::Inhx), "inhx32" => Ok(Self::Inhx32), "raw" => Ok(Self::Raw), "source" => Ok(Self::Source), |