6

How do I specify to radare2 that what I'm disassembling when I know it is a DOS MZ executable?

As it does not auto-detect this for me.

6

You can disassemble a DOS 16-bit executable using radare2 as follows:

Example using TEXTINST.EXE from the FreeDOS 1.1 CDROM image:

bash$ radare2 TEXTINST.EXE
SS : 214f
SP : 4c00
IP : 0
CS : 0
NRELOCS: 1
RELOC  : 1c
CHKSUM : 0
[0000:0020]> aa
[0000:0020]> pd 10
   ;      [0] va=0x00000020 pa=0x00000020 sz=67272 vsz=67272 rwx=-rwx .text
            ;-- section..text:
            0000:0020    b93b03       mov cx, 0x33b
            0000:0023    be7406       mov si, 0x674
            0000:0026    89f7         mov di, si
            0000:0028    1e           push ds
            0000:0029    a9b580       test ax, 0x80b5
        |   0000:002c    8cc8         mov ax, cs
        |   0000:002e    050510       add ax, 0x1005
        |   0000:0031    8ed8         mov ds, ax
        |   0000:0033    05f010       add ax, 0x10f0
        |   0000:0036    8ec0         mov es, ax
(etc)

If required, you can force the disassembler, etc. to assume DOS as follows:

e asm.arch=x86
e asm.os=dos

If you think you have a DOS executable and the above doesn't work, there may be something more subtle going on, and you should post a question showing specifically what you tried, what you expect and what is not working.

Note: showing what you tried, etc. is more likely to elicit answers on the SE sites...

  • Looks like a bug. Which version you've tried? – Anton Kochkov Jun 4 '14 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.