1 /** 2 * Application interface for disassembler command-line tool. 3 * 4 * Copyright © 2016, Eric Scrivner 5 * 6 * License: Subject to the terms of the MIT license, as written in the included 7 * LICENSE.txt file. 8 * Authors: Eric Scrivner 9 */ 10 module phlogiston.cli.disassembler; 11 12 import std.file; 13 import std.stdio; 14 15 import phlogiston.disassembler.disassembler; 16 17 /// Interface for the disassembler app. 18 class DisassemblerApp { 19 public void execute(string inputFile, string outputFile) { 20 string vmBytes = readText(inputFile); 21 22 Disassembler disassembler = new Disassembler; 23 auto assemblyCode = disassembler.disassemble(vmBytes); 24 25 File file = File(outputFile, "w"); 26 27 foreach (codeLine; assemblyCode) { 28 file.writeln(codeLine); 29 } 30 31 file.close(); 32 } 33 }