From a06be093f1a7c8ed62f01cf33a2bc141366c1114 Mon Sep 17 00:00:00 2001 From: Celeste Date: Sat, 23 Jul 2022 20:00:25 +0100 Subject: [PATCH] add --- .gitignore | 1 + Cargo.lock | 7 ++ Cargo.toml | 8 ++ src/main.rs | 277 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 293 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..1ca21c4 --- /dev/null +++ b/Cargo.lock @@ -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" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..1a7f813 --- /dev/null +++ b/Cargo.toml @@ -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] diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..163fffb --- /dev/null +++ b/src/main.rs @@ -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); +}