Spice86 - A PC emulator for real mode reverse engineering Spice86 is a tool to execute, reverse engineer and rewrite real mode DOS programs for which source code is not available. Release are available on Nuget. Pre-releases are also available on the Release page NOTE: This is a port, and a continuation from the original Java Spice86. It requires .NET 8 and runs on Windows, macOS, and Linux. Approach Rewriting a program from only the binary is a hard task. Spice86 is a tool that helps you do so with a methodic divide and conquer approach. General process: You start by emulating the program in the Spice86 emulator. At the end of each run, the emulator dumps some runtime data (memory dump and execution flow) You load those data into ghidra via the spice86-ghidra-plugin The plugin converts the assembly instructions in the memory dump to C# that can be loaded into spice86 and used either partially or completely instead of the assembly code. This allows you to gradually reimplement the assembly code with your C# methods This is helpful because: Small sequences of assembly can be statically analyzed and are generally easy to translate to a higher level language. You work all the time with a fully working version of the program so it is relatively easy to catch mistakes early. Rewriting code function by function allows you to discover the intent of the author. Running your exe This is a .NET program, you run it with the regular command line or dotnet run. Example with running a program called file.exe: Spice86 -e file.exe COM files and BIOS files are also supported. Dumping data It is recommended to set SPICE86_DUMPS_FOLDER environment variable pointing to where the emulator should dump the runtime data. If the variable is set or if --RecordedDataDirectory parameter is passed, the emulator will dump a bunch of information about the run there. If nothing is set, data will be dumped in the current directory. If there is already data there the emulator will load it first and complete it, you don't need to start from zero each time! More command line options --Debug (Default: false) Starts the program paused. --Ems (Default: false) Enables EMS memory. EMS adds 8 MB of memory accessible to DOS programs through the EMM Page Frame. --A20Gate (Default: false) Disables the 20th address line to support programs relying on the rollover of memory addresses above the HMA (slightly above 1 MB). -m, --Mt32RomsPath Zip file or directory containing the MT-32 ROM files -c, --CDrive Path to C drive, default is exe parent -r, --RecordedDataDirectory Directory to dump data to when not specified otherwise. Working directory if blank -e, --Exe Required. Path to executable -a, --ExeArgs List of parameters to give to the emulated program -x, --ExpectedChecksum Hexadecimal string representing the expected SHA256 checksum of the emulated program -f, --FailOnUnhandledPort (Default: false) If true, will fail when encountering an unhandled IO port. Useful to check for unimplemented hardware. false by default. -g, --GdbPort gdb port, if empty gdb server will not be created. If not empty, application will pause until gdb connects -o, --OverrideSupplierClassName Name of a class that will generate the initial function information. See documentation for more information. -p, --ProgramEntryPointSegment (Default: 4096) Segment where to load the program. DOS PSP and MCB will be created before it. -u, --UseCodeOverride (Default: true) if false it will use the names provided by overrideSupplierClassName but not the code -i, --InstructionsPerSecond if blank will use time based timer. -t, --TimeMultiplier (Default: 1)