Anderson Green
Anderson Green

Reputation: 31800

Convert assembly language macros to plain assembly language

In MASM, is it possible to convert macro instructions to the corresponding assembly language instructions? I want to convert MASM's macro instructions to plain assembly language instructions, so that I can see how the macros actually work.

For example, I'd like to convert these macro instructions to the corresponding assembly language instructions (without macros):

.if(x > 5)
    mov eax, x
.else
    mov ebx, x
.endif

Upvotes: 1

Views: 412

Answers (1)

Igor Skochinsky
Igor Skochinsky

Reputation: 25268

I was going to suggest "generate a listing" like 500-InternalServerError proposed, but after verifying it, that won't work - the listing contains only your instructions, not MASM-generated ones. What does work is the following:

1) Assemble with debug info:

ml /c /Zi file.asm

2) disassemble with dumpbin (or another disassembler):

dumpbin /disasm file.obj

For the example above, it produces:

$$000000:
  00000000: 83 3D 00 00 00 00  cmp         dword ptr [x],5
            05
  00000007: 76 04              jbe         @C0001
  00000009: 8B C2              mov         eax,edx
  0000000B: EB 02              jmp         @C0003
@C0001:
  0000000D: 8B DA              mov         ebx,edx

Upvotes: 2

Related Questions