diasm - simple x86 16-bit real mode instruction subset disassembler, for MS-DOS operating system
diasm is a simple x86 16-bit real mode instruction subset disassembler, for MS-DOS operating system. Written in assembly with tasm compiler, basically proof of concept of writing disassembler in assembly.
- mov all 6 scenarios
- out 2 scenarios
- not 4 scenarios
- rcr 4 scenarios
- xlat 1 scenarios
Actually most interesting aspect of this program is code itself, for example
process_not:
@PRINT_STR(offset not_str)
mov w_val, al
@MASK_VALUE(w_val, 00000001b)
@RETRIEVE_NEXT_BYTE
mov rm_val, al
@MASK_VALUE(rm_val, 00000111b)
mov mod_val, al
@MASK_VALUE(mod_val, 11000000b)
shr mod_val, 3
@JMP_EQL(mod_val, 00000000b, not_scenario_mod_00)
@JMP_EQL(mod_val, 00001000b, not_scenario_mod_01)
@JMP_EQL(mod_val, 00010000b, not_scenario_mod_10)
@JMP_EQL(mod_val, 00011000b, not_scenario_mod_11)
not_scenario_mod_00:
call process_mod_xxx_rm_scenario_00
jmp not_continue
// process scenarios 01 - 11, same as 00
not_continue:
@PRINT_STR(offset endl_str)
jmp inst_loop
Note that for an assembly code is pretty readable, now it is very easy to even add support for new instructions.
Main benefit comes from @JMP_EQL(), @MASK_VALUE() and other macros. Tasm itself does not support such macros, these macros are resolved by my own preprocessor link.
Probably no one will build this project, so I will not include or release this preprocessor, if you really need it, just open an issue in this repository.
Sadly this time diasm is a asm framework ?
- Build manually
First of all requirements:- Dosbox (an x86 emulator with Dos)
- tasm (Should be installed in Dosbox)
- tlink (Should be installed in Dosbox)
diasm is free and open source thing. All code in this repository is licensed under
- MIT License (LICENSE.md or https://opensource.org/license/mit/)