Reverse Engineering 8086 Programs with Online Disassemblers
If you're just looking to use a disassembler, then objdump is one choice. The disassembler that comes with the nasm assembler is ndisasm. You can also run "debug.exe" in DOS Box on Linux, provided you get a hold of a copy of the program. It also does disassembly, as well as controlled execution; i.e. simulation of the CPU, itself - which is also important, even when doing disassembly, for reasons I'm about to describe.
8086 disassembler download in pc
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.
Its main talking point is that it uses octal digits for the opcodes - which better fits the 80x86 - as I pointed out on the USENET in 1995 in comp.lang.asm ... and (in fact) nasm's creation was a direct response to that. So, it's potentially more transparent and you may want to keep the source handy as a check and comparison, if you're making your own disassembler.
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.
There's also DosDebug up on GitHub. It handles everything up to "80586" (or Pentium") and "80686": it flags a generation "6" for some instructions.; e.g. the conditional "cmov" operations are handled by it, as well as their "fcmov" floating point versions. DosDebug is in 8086 assembly and is best-suited to compile with jwasm. You might be able to run nasm on it, I don't know. I never tried.
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).
Pass target specific information to the disassembler. Only supported onsome targets. If it is necessary to specify more than onedisassembler option then multiple -M options can be used orcan be placed together into a comma separated list.
cpu=... allows one to enforce a particular ISA when disassemblinginstructions, overriding the -m value or whatever is in the ELF file.This might be useful to select ARC EM or HS ISA, because architecture is samefor those and disassembler relies on private ELF header data to decide if codeis for EM or HS. This option might be specified multiple times - only thelatest value will be used. Valid values are same as for the assembler-mcpu=... option.
This option can also be used for ARM architectures to force thedisassembler to interpret all instructions as Thumb instructions byusing the switch --disassembler-options=force-thumb. This can beuseful when attempting to disassemble thumb code produced by othercompilers.
Visual Studio includes both 32-bit and 64-bit hosted versions of MASM (the Microsoft Macro Assembler) to target x64 code. Named ml64.exe, it's the assembler that accepts x64 assembler language. The MASM command-line tools are installed when you choose a C++ workload during Visual Studio installation. The MASM tools aren't available as a separate download. For instructions on how to download and install a copy of Visual Studio, see Install Visual Studio. If you only want the command-line tools, not the full IDE, download the Build Tools for Visual Studio.
As Jester correctly pointed out in a comment, you just need to use set architecture i8086 when using gdb so that it knows to assume 16-bit 8086 instruction format. You can learn about the gdb targets here.
Normally when you debug an ELF, PE or any other object file gdb can infer the architecture from the file headers. When you debug a bootloader there is no object file to read so you can tell gdb the architecture yourself (In the case of a bootloader arch will be i8086):
Currently there seem to be an issue in gdb that causes it to choose the most "featureful compatible architecture" between the target's architecture (i386) and the user provided architecture (i8086). Because gdb sees i386 as a proper super set of i8086 it uses it instead. Choosing i386 causes all operands to default to 32 bits (instead of 16), this what causes the disassembler errors.
Ever encountered a situation where you needed to view, disassemble or decompile a binary file, such as a data file, an object file,a library archive, a shared library (or DLL in Windows) or an executable image? Assembled on this page are severalhex viewers (hexadecimal viewers), hex editors, disassemblers and decompilers that will allow youto do precisely that.
RetDec is a decompiler that supports Intel x86, ARM, MIPS, PIC32 and PowerPC executables using formats such asELF, PE, Mach-O, COFF, AR, Intel HEX and raw machine code. It detects compilers and packers used on the executables,can remove statically-linked library code, extract and use embedded debugging information (DWARF and PDB), reconstructinstruction idioms and C++ class hierarchies (RTTI, vtables), demangle C++ symbols, reconstruct functions and otherhigh level constructs, etc. It has an integrated disassembler, and can output files in C and a Python-like language.It is also able to generate call graphs, control-flow graphs and a variety of statistics. This is a Windows and Linuxprogram. You can also build it on Mac OS, although that platform is not officially supported. The software is opensource; RetDec itself is released under the MIT licence, but it also includes other third-party libraries and resources,released under a variety of other licences.
This is a multiplatform binary viewer with "a built-in editor for binary, hexadecimal and disassembler modes".It supports disassembly of Pentium III, AMD K7 Athlon, and Cyrix M2 as well, and the ability to handle the followingexecutable formats: MZ, NE, PE, LE, LX, DOS, SYS, NLM, arch, ELF, a.out, coff32, PharLap, and rdoff.
and parameters are passed to these calls on the stack.The comments instruct us to assemble into an object formatof "win32" (not "coff"!) then link with the linker ld.Of course you can use any linker you want, but ld comeswith gcc and you can download a whole Win32 portof gcc for free. We pass thestarting address to the linker, and specify the static librarylibkernel32.a to link with. This static libraryis part of the Win32 gcc distribution, and itcontains the right calls into the system DLLs.
MICRO-C is a low cost PC based C language compiler optimisedfor the restricted and specialised environment of embeddedmicrocontrollers. It is produced by Dunfield Development Systems(DDS) in Canada. MICRO-C is portable: currently, there areversions for the 68HC08, 6809, 68HC11, 68HC12, 68HC16, 8051/52,8080/85, 8086, 8096 families. MICRO-C is supplied as aDeveloper's Kit with everything you need to develop C andAssembly Language software for a particular CPU.
A: Emily, with its hardware emulation option, permitsaccess to the timers and I/O ports of the hardware, howeverexternal memory on the target system cannot be accessed (EMILYprovides its own code and data areas using the PC’s memory).This is usually only important if you have hardware which isaccessed through the external memory address space.At present, EMILY does not act on interrupts from the targetsystem, but allows you to simulate them from the PC keyboard.When an interrupt is simulated, EMILY sets any hardware bitswhich would normally be set by that interrupt, and then vectorsto the interrupt handler. Although this prevents using “realtime” interrupts, I have found it to be a very effectiveapproach when debugging interrupt handlers. You can stop thesimulation at any point, inject an interrupt, and then stepthrough the interrupt handler etc. EMILY has a 4095 instructiontraceback buffer, which operates in all execution modes, howeverit only records the instructions executed. In other words, youcan scroll/search through the last 4095 instructions which wereexecuted in order to see “how it got here”. Moreexpensive ICE’s often have traceback buffers which recordboth the address and data bus activity.EMILY now includes MONICA, a PC hosted debugger, that debugsON-CHIP, by downloading your code, and controlling it through atiny on-board kernel program. MONICA’s user interface isvirtually identical to EMILY’s, and the kernel is upwardcompatible with EMILY.This means that you can easily switch back and forth betweenEMILY and MONICA, and use whichever is best suited to thedebugging at hand. MONICA can use the on-chip memory of a DALLASDS5000 processor, making it a true single-chip in-circuitemulator when used with this device.EMILY/MONICA is much less expensive than any ICE!