News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Generated code and assembly listing

Started by bf2, July 29, 2011, 04:52:13 PM

Previous topic - Next topic

bf2

Is the debugger the only place where I can see the code generated by MASM?

For example, the code

.CODE
MyProc PROC
LOCAL temp: DWORD
MOV temp, 10


generates the listing (using the /Fl switch)

00000000 .CODE
00000000 MyProc PROC
LOCAL temp: DWORD

00000006  C7 45 FC MOV temp, 10
0000000A


It's only in the debugger that I can see

00401030  /$ 55                      PUSH EBP
00401031  |. 8BEC                   MOV EBP,ESP
00401033  |. 83C4 FC               ADD ESP,-4
00401036  |. C745 FC 0A0000> MOV DWORD PTR SS:[EBP-4],0A



Thanks in advance.

dedndave

there are a number of switches that affect the listing
it depends on which version of masm you are using
i use 6.15, and there is a "Sa" switch that maximizes the listing - it may help

beyond that, there are a number of disassemblers available
i haven't played with the one that is in the masm32 package - have a look at the dasm and dasmd batch files
i sometimes use a simple one by Sang Cho
http://hcilab.cju.ac.kr/
it does not attempt to disassemble data - and sometimes fails on the code - lol
but, it is fast and simple and usually does well

bf2

Thanks. I have been using OllyDbg so far.

clive

Listing file with -Fl and -Sa, and -Zi for debug symbols

Microsoft (R) Macro Assembler Version 6.15.8803     07/29/11 13:27:02
test83.asm      Page 1 - 1


        .386
        .MODEL  FLAT,C
00000000         .CODE
00000000 MyProc PROC
LOCAL temp: DWORD
00000000  55    *     push   ebp
00000001  8B EC    *     mov    ebp, esp
00000003  83 C4 FC    *     add    esp, 0FFFFFFFCh
00000006  C7 45 FC         MOV temp, 10
   0000000A
        RET
0000000D  C9    *     leave
0000000E  C3    *     ret    00000h
0000000F MyProc ENDP
        END MyProc


Disassembly


00401000 CCCCCCCCCC             db      5 dup (0CCh) ; * Linker *

00401005                    start:
00401005 E906000000             jmp     _MyProc

0040100A CCCCCCCCCCCC           db      6 dup (0CCh)

00401010                    _MyProc:                    ; Xref 00401005
00401010 55                     push    ebp ; test83.obj
00401011 8BEC                   mov     ebp,esp
00401013 83C4FC                 add     esp,0FFFFFFFCh
00401016 C745FC0A000000         mov     dword ptr [ebp-4],0Ah
0040101D C9                     leave
0040101E C3                     ret

0040101F CCCCCCCCCCCCCCCCCCCC.. db      4097 dup (0CCh)
It could be a random act of randomness. Those happen a lot as well.

bf2

Yes, the /Sa switch did the trick. Thank you.