8086 disassembly application. Project done during computer architecture course.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vs/Disasm64/v15
DEBUG.COM
Introduction_to_x64_Assembly.pdf
README.md
T1.COM
T10-LOG.COM
T11-STRC.COM
T12-JMPS.COM
T13-FPU.COM
T2.COM
T3-ADD.COM
T4-ADC.COM
T5-CMP.COM
T5-SUB.COM
T6-SBB.COM
T8-MDIV.COM
T9-OAR.COM
build.bat
buildc.bat
cwsdpmi.exe
disasm64.asm
disasm64.exe
disasm64.lst
disasm64.obj
hello_64.exe
instr86.pdf
mingw-w64.bat
mnemonics.asm
nasmlibc.asm
nasmmac.inc
t1.dsm
t10-log.dsm
t11-strc.dsm
t12-jmps.dsm
t13-fpu.dsm
t2.dsm
t3-add.dsm
t4-adc.dsm
t5-cmp.dsm
t5-sub.dsm
t6-sbb.dsm
t8-mdiv.dsm
t9-oar.dsm
test-result.txt
test.bat
test.c
test.txt
test2.c
test3.c
test4.c
tests.asm
yasm.exe

README.md

Disasm64

8086 disassembly application. Project done during computer architecture course.

I feel that there might be more clever way to implement this, but this is how I did it.
Also, this code has a room for improvement: it could be much more optimized and I see many places for refactoring, but that is for the future. 

Project is done using nasm(yasm) 64 bit assembly and some c functions to handle input/output.

I have chosen such technologies because I was curious about few topics:

  • Learning about asm 64 bit programming
  • Compiling assembly executable for windows 64 platform. During the comp architecture course we were doing assembly programming for a ms dos using dosbox. I was interested in making some executable code on a windows 64 platform.
  • Linking assembly code to some higher lever programming language library. During the comp architecture course we were using dos api (int) to handle input, output and some other manipulations. For modern platform you could use windows api function calls or libraries from higher level programming languages. I have chosen to use c and use some basic c input output functions.
  • Understanding assembly procedure calls on 64 platform and differences between win 64 calls and unix/posix 64 calls.
  • Disassembling some simple c applications and exploring how assembly code is constructed using c compile. To understand how some c function calls are made I have used some super simple c programs that I decompiled using gdb.

To build this project on windows 64 you will need:

Build script is build.bat Some tests are in test.bat

Basicly, disasm64.exe take file name as argument and outputs 8086 assembly code.

disasm64.asm - main application that produces executable. - Here we read command line argument, get file size, allocate some memory and read file. - Then we call disassembly procedure.

nasmlibc.asm - some helper procedures, also external c function declarations I have used.

nasmmac.inc - few helper macros.

mnemonics.asm - main dissassembler code is here, probably should split in sepearate files as its too long.

procDisasambliuok - main procedure that itterates over memory buffer, takes byte by byte and passes it to dissassembly procedures.

    - Each procedure either return 0 if it does not identify code, or prints out operation and returns operation size in bytes.
    - If procedure was identified, in procDisasambliuok we skip returned number of bytes and start identification over again.