This commit is contained in:
abbie 2022-07-23 20:00:25 +01:00
commit a06be093f1
No known key found for this signature in database
GPG key ID: A575D2415E5E5B6D
4 changed files with 293 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

7
Cargo.lock generated Normal file
View file

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "pkmngs_ace_hex2text"
version = "0.1.0"

8
Cargo.toml Normal file
View file

@ -0,0 +1,8 @@
[package]
name = "pkmngs_ace_hex2text"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

277
src/main.rs Normal file
View file

@ -0,0 +1,277 @@
fn hex2text(hex: &str) -> &str {
let hhex = hex.replace("\n","");
match hhex.as_str() {
"00" => "AA",
"01" => "AB",
"03" => "BC",
"04" => "CC",
"05" => "CD",
"06" => "DD",
"07" => "DE",
"08" => "EE",
"09" => "EF",
"0A" => "FF",
"0B" => "FG",
"0C" => "GG",
"0D" => "GH",
"0E" => "HH",
"0F" => "HI",
"10" => "II",
"11" => "IJ",
"12" => "JJ",
"13" => "JK",
"14" => "KK",
"15" => "KL",
"16" => "LL",
"17" => "LM",
"18" => "MM",
"19" => "MN",
"1A" => "NN",
"1B" => "NO",
"1C" => "OO",
"1D" => "OP",
"1E" => "PP",
"1F" => "PQ",
"20" => "QQ",
"21" => "QR",
"22" => "RR",
"23" => "RS",
"24" => "SS",
"25" => "ST",
"26" => "TT",
"27" => "TU",
"28" => "UU",
"29" => "UV",
"2A" => "VV",
"2B" => "VW",
"2C" => "WW",
"2D" => "WX",
"2E" => "XX",
"2F" => "XY",
"30" => "YY",
"31" => "YZ",
"32" => "ZZ",
"33" => "Z(",
"34" => "((",
"35" => "()",
"36" => "))",
"37" => "):",
"38" => "::",
"39" => ":;",
"3A" => ";;",
"3B" => ";[",
"3C" => "[[",
"3D" => "[]",
"3E" => "]]",
"3F" => "]a",
"40" => "aa",
"41" => "ab",
"42" => "bb",
"43" => "bc",
"44" => "cc",
"45" => "cd",
"46" => "dd",
"47" => "de",
"48" => "ee",
"49" => "ef",
"4A" => "ff",
"4B" => "fg",
"4C" => "gg",
"4D" => "gh",
"4E" => "hh",
"4F" => "hi",
"50" => "ii",
"51" => "ij",
"52" => "jj",
"53" => "jk",
"54" => "kk",
"55" => "kl",
"56" => "ll",
"57" => "lm",
"58" => "mm",
"59" => "mn",
"5A" => "nn",
"5B" => "no",
"5C" => "oo",
"5D" => "op",
"5E" => "pp",
"5F" => "pq",
"60" => "qq",
"61" => "qr",
"62" => "rr",
"63" => "rs",
"64" => "ss",
"65" => "st",
"66" => "tt",
"67" => "tu",
"68" => "uu",
"69" => "uv",
"6A" => "vv",
"6B" => "vw",
"6C" => "ww",
"6D" => "wx",
"6E" => "xx",
"6F" => "xy",
"70" => "yy",
"71" => "yz",
"72" => "zz",
"73" => "?N",
"74" => "?O",
"75" => "?P",
"76" => "?Q",
"77" => "?R",
"78" => "?S",
"79" => "?T",
"7A" => "?U",
"7B" => "?V",
"7C" => "?W",
"7D" => "?X",
"7E" => "?Y",
"7F" => "?Z",
"80" => "?(",
"81" => "?)",
"82" => "?:",
"83" => "?;",
"84" => "?[",
"85" => "?]",
"86" => "?a",
"87" => "?b",
"88" => "?c",
"89" => "?d",
"8A" => "?e",
"8B" => "?f",
"8C" => "?g",
"8D" => "?h",
"8E" => "?i",
"8F" => "?j",
"90" => "?k",
"91" => "?l",
"92" => "?m",
"93" => "?n",
"94" => "?o",
"95" => "?p",
"96" => "?q",
"97" => "?r",
"98" => "?s",
"99" => "?t",
"9A" => "?u",
"9B" => "?v",
"9C" => "?w",
"9D" => "?x",
"9E" => "?y",
"9F" => "?z",
"A0" => "9b",
"A1" => "9c",
"A2" => "9d",
"A3" => "9e",
"A4" => "9f",
"A5" => "9g",
"A6" => "9h",
"A7" => "9i",
"A8" => "9j",
"A9" => "9k",
"AA" => "9l",
"AB" => "9m",
"AC" => "9n",
"AD" => "9o",
"AE" => "9p",
"AF" => "9q",
"B0" => "9r",
"B1" => "9s",
"B2" => "9t",
"B3" => "9u",
"B4" => "9v",
"B5" => "9w",
"B6" => "9x",
"B7" => "9y",
"B8" => "9z",
"B9" => "'r?",
"BA" => "'s?",
"BB" => "'t?",
"BC" => "'v?",
"BD" => "'v!",
"BE" => "'v.",
"BF" => "'v&",
"C0" => "'vé",
"C1" => "'m♂",
"C2" => "PkPk",
"C3" => "PkMn",
"C4" => "MnMn",
"C5" => "Mn-",
"C6" => "--",
"C7" => "Pk?",
"C8" => "Mn?",
"C9" => "-?",
"CA" => "-!",
"CB" => "Mn&",
"CC" => "??",
"CD" => "?!",
"CE" => "!!",
"CF" => "!.",
"D0" => "..",
"D1" => ".&",
"D2" => "&&",
"D3" => "Mn×",
"D4" => "Pk/",
"D5" => "Pk,",
"D6" => "Pk♀",
"D7" => "Pk0",
"D8" => "Mn0",
"D9" => "?/",
"DA" => "?,",
"DB" => "?♀",
"DC" => "?0",
"DD" => "!0",
"DE" => ".0",
"DF" => ".1",
"E0" => ".2",
"E1" => ".3",
"E2" => ".4",
"E3" => ".5",
"E4" => ".6",
"E5" => ".7",
"E6" => ".8",
"E7" => ".9",
"E8" => "♂3",
"E9" => "♂4",
"EA" => "♂5",
"EB" => "♂6",
"EC" => "00",
"ED" => "01",
"EE" => "11",
"EF" => "12",
"F0" => "22",
"F1" => "23",
"F2" => "33",
"F3" => "34",
"F4" => "44",
"F5" => "45",
"F6" => "55",
"F7" => "56",
"F8" => "66",
"F9" => "67",
"FA" => "77",
"FB" => "78",
"FC" => "88",
"FD" => "89",
"FE" => "99",
_ => " A",
}
}
fn main() {
let mut line = String::new();
println!("Enter first address byte to write to:");
let _b1 = std::io::stdin().read_line(&mut line).unwrap();
let byte1 = hex2text(&line);
println!("Enter second address byte to write to:");
let mut line = String::new();
let _b2 = std::io::stdin().read_line(&mut line).unwrap();
let byte2 = hex2text(&line);
println!("Enter byte to write to address:");
let mut line = String::new();
let _b3 = std::io::stdin().read_line(&mut line).unwrap();
let byte3 = hex2text(&line);
println!("Blank character is space.");
println!("{} {} {}", byte1, byte2, byte3);
}