diff options
| author | Melodi <62381002+Melodi17@users.noreply.github.com> | 2026-03-17 20:49:22 +1000 |
|---|---|---|
| committer | Melodi <62381002+Melodi17@users.noreply.github.com> | 2026-03-17 20:49:22 +1000 |
| commit | 18868128e18d38b706e7df14e8e683e1a9739c17 (patch) | |
| tree | 6f0e0e5eee646f10cbad9c0c89c24d330bc58cc6 /Assembler/Program.cs | |
| parent | d87ab8af4c86a3fc6ee237444e372d87e536e3ef (diff) | |
chore: Initial commit
Diffstat (limited to 'Assembler/Program.cs')
| -rw-r--r-- | Assembler/Program.cs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/Assembler/Program.cs b/Assembler/Program.cs deleted file mode 100644 index 0493057..0000000 --- a/Assembler/Program.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Q1.Assembler; - -using CommandLine; - -public class Program -{ - static void Main(string[] args) - { - Parser.Default.ParseArguments<AssemblerOptions>(args).WithParsed(Program.Main); - } - - public static void Main(AssemblerOptions assemblerOptions) - { - assemblerOptions.InputFile = assemblerOptions.InputFile; - - string[] input = File.ReadAllLines(assemblerOptions.InputFile); - - try - { - Assembler assembler = new(input); - byte[] bin = assembler.Assemble().ToArray(); - if (bin.Length > 8 * 1024) - throw new AssemblerException("Assembled binary exceeds maximum size of 8KB."); - - File.WriteAllBytes(assemblerOptions.OutputFile, bin); - - Console.WriteLine($"Assembled {assemblerOptions.InputFile} -> {assemblerOptions.OutputFile}. ({bin.Length} bytes)"); - } - catch (AssemblerException ex) - { - Console.ForegroundColor = ConsoleColor.Red; - Console.Error.WriteLine($"Error: {ex.Message}"); - Console.ResetColor(); - Environment.Exit(1); - } - } -}
\ No newline at end of file |
