This gets to the other sense of your query: \"I want to make a disassembler\". The source for ndisasm is available, and it handles many of the descendants of 8086, not just 8086, itself (which seriously clutters it, if all you want is an 8086 or even 80386 disassembler), but it is not self-contained and has a heavy dependency on the rest of the distribution.
And then you've just disassembled a disassembler that also happens to do CPU emulation, like Fake86 does - but only for the 8086. You'll have to make the absolute addresses relative (using the original relocation table as a guide), to make is re-assemblable. Once you do that, you can work on the source. The opcode table is in clear view (if you display it as text) - both when seen in the packed and unpacked versions of debug.exe.
I might port the DAS disassembler to the x86, since items (a)-(f) are already incorporated into DAS's design. I've only ever ported it to the 8051, 6800, 6809 and 8080/8085 (and Z80) up to now; but the transition from 8085 to 8086 is relatively small. To that end, I might hack something out of Fake86. That's mostly abandonware, now, since the author replaced it by XTulator, as Fake86 was written when the programmer was relatively new to C. You might also be able to hack something directly out of DosDebug's opcode tables (their \"instr.*\" files).
DecompilersA decompiler tries to translate an object file into a compilablesource file. There are many decompilers for C# or Java,but only a few for C/C++. See in particular: Ghidra:An open-source decompiler developed by the U.S. National Security Agency,is an advanced interactive environment (seems inspired by IDA - below),for binary analysis and decompilation. It's written in Java, has a userinterface resembling the Eclipse IDE (in fact there's also a plug-in for Eclipse).I've analyzed its implementation (the decompiler is in C++) and it hasmany of the features I wanted to implement in my own decompiler (see REC, below).Users can write their own plug-in for target-specific analysis in eitherJava or python!Runs on Windows, Linux, MacOS, and supports many processors. New processorscan be added by writing text files to specify the processor architecture'sand its instruction set.Overall, an excellent work, which sets a new standard for decompilers. reko:Another open-source decompiler. Written in C#, it thus onlyrun on Windows, or on platforms supporting mono.It accepts binaries compiled for many processors. It has both a GUIwith all the standard views (disassembly, hexdump, C source, project),and can also be used from the command line. RetDec:Originally developed by the Brno University of Technology, Czech Republic,as an on-line service, and AVG Technologies, now part of Avast, it can be downloadedfrom a GitHub repository and run locally. I have not evaluated it, but at the time I had read the paper published by theBrno University team, and it seemed at the level of the other advanceddecompilers available at the time. C4Decompiler:(The original link seems to be dead. I'm leaving the description herein case it becomes available again - I think I have an old versiondownloaded on my hard-disk)A new decompiler under development. Windows only, has a slickuser interface inspired to Visual Studio 2010 with many usefulinteractions, that unfortunately are not always obvious. Onehas to right-click to discover them.The analysis seems very good, at least for the debug-compiledexample included in the installation. Trying it on random executablesfrom the Windows folder had mixed results, from completion of theanalysis to crashes to endless loops.Still it's very promising, as its authors haveclearly put a lot of thought and effort in its development. Boomerang:open source C decompiler. Very advanced set of analysesthat attempt to solve the most difficult problemsfacing decompilers. The generated code quality varies greatly:some functions are almost perfect in their representation of codestructure, local variables and types. Other functions look highlyobfuscated by the number of variables and their uses.It's also rather fragile, as it often crashes with big programs. REC:My own C decompiler for Linux, DOS and Windows.The first decompiler to work on multiple platforms and that supportsmultiple processors (x86 16 and 32-bits, MIPS, 680x0, PowerPC).It's very stable, as it's been tested with hundreds of programs.The quality of the output is not as good as Boomerang's,since its implementation is based on 20 years old coding style(read very difficult to extend). I've now published a new version,RecStudio 4, which supports 64-bit executables. It has not beentested on as many executables, so problems still remain. Also thedifferent analyses performed (SSA), generate totally differentcode that at times may seem of much worse quality (although it'sprobably more correct), than the code generated by the previousversion. Hex Rays:a decompiler plug-in for IDA Pro. The combinationwith IDA's advanced disassembly capabilities and run-time debuggermake it the ideal choice. However it's still very new, and requires IDA Pro.Unlike the others decopilers, it's not free.It also has to stand the test of time in terms of stability. Very promising. Dcc:DOS to C decompiler. One of the first decompilers. It shows its age,but it's still referenced by many other decompilers for itsstructuring abilities. Only supports 8086 (16 bits) programs. More on other decompilers at the Program Transformation Wiki on DecompilationHere's a comparison of the various decompilers: Decompiler Platform TargetsSupport Binary FormatSupport InteractiveBatch RecompilableOutput Structuring Variables Types Notes C4Decompiler Windows IA64 PE-COFF Interactive GUI No Very Good Good Fair Boomerang Windows/Linux IA32MIPSPPC ELFPE-COFFMac-OS Batch withGUI front-end No Very good Good Very good REC Windows/Linux IA32IA64MIPSPPCmc68k ELFPE-COFFAOUTRAWPS-X Batch / Interactive No Good Fair Partial dcc Windows 8086 DOS .com Batch No Good Fair Poor Hex Rays Windows ? ? Interactive ? ? ? ? Testing DecompilersThe quality of a decompiler is based on how good the code it generates is,and how well it performs in the presence of \"unexpected\" input.Particularly difficult problems are posed by the use of compiler optimizationswhich make the input code highly unstructured and difficult to understand, evenfor a human. Handling the following cases defines the quality of a decompiler:No information on symbol names in the binary file (stripped executable)Static vs. dynamically linked executable files (use pattern matching vs.dynamic linker information to identify access to library functions)
Emu8086 is an 8086 microprocessor emulator and disassembler.It permit to assemble, emulate and debug 8086 programs (16bit/DOS).Although this program was made for Windows, it works fine on GNU/Linux (with the help of Wine).
Free software, uploaded by the author. Index A B C D E F G H I J [K] L M N O P Q R S T U V W X Y Z KVL29EOSSummary:Hires graphics library for Eclipse (adv. GUI)License:FreewareAuthor:Grzegorz KowalEmail:email@example.comDownload:kvl29eos.zip(Apr 7 2000, 115.9K)Description:Kojak's VESA Library 2.9 is a set of functions useful for the simplecreation of 32-bit GUI DOS programs under the Eclipse Operating System(DOS Extender). It supports VESA 1.x or 2.x BIOS in 640x480x256,800x600x256 and 1024x768x256 modes. The library implements macros andfunctions providing support for block, line and pixel operations,pallette manipulation, GIF, Color-IX bitmaps, text, filtered input,advanced graphic user interface, and more. Index A B C D E F G H I J K [L] M N O P Q R S T U V W X Y Z LOADEMSSummary:ASM example of load & execute from EMS memoryDownload:loadems.zip(Feb 25 1990, 3.1K) LW 8086/80186Summary:Pop-up help for instruction setDownload:lw86.zip(Nov 20 1986, 14.3K) Index A B C D E F G H I J K L [M] N O P Q R S T U V W X Y Z M68DISVersion:2.0Summary:Intelligent MC6800/6802 disassembler,License:FreewareDownload:m68dis20.zip(Nov 26 2000, 11K)Description:The M68DIS program is a disassembler for MC6800/6802. It's operationis controlled by a command file, which tells it what binary code imagefile(s) to load, the addresses for code entry points such as RST, NMI,etc. (optional), and the addresses for any code or subroutines whichmay not be explicitly called within the MC6800/6802 code. The programthen processes the code, tracing execution paths and identifying jumplocations, subroutines and data tables. The program output is normallyin \"list\" format, with an address column at the start of each line,however, this address column is omitted if the specified output filename ends in \".ASM\". MAC 8080Summary:TASM macros to assemble codeDownload:mac8080.zip(Nov 24 1991, 9.9K) MASM_CN 6Summary:Converts v6.x .ASM to v5.x formatLicense:SharewareEmail:firstname.lastname@example.orgDownload:masm_cn3.zip(May 31 1997, 8K)Description:MASM converter converts the MASM v6.x Assembly Source Code (.ASM) to the format used by the older MASM v5.x assemblers. This allows you to assemble, after the conversion, the new source code with an older assembler (the author uses MASM v5.1). The new source code comes from such sources as a disk when you purchase an assembly related book, software distributors, etc. MASM32 V9.0Summary:32 bit MASM ass