On Sat, 1 Mar 2008 20:08:25 -0800 (PST), fetag <spamtrap@[EMAIL PROTECTED]
>
wrote in comp.lang.asm.x86:
> hello, All:
> I have a little puzzle on NASM, I write a very simple case:
> [bits 32]
> segment .text
> global _start
> _start:
> mov eax, 4
> mov ebx, 2
> ret
> then, compiled it as:
> C:\ASM>nasm first.asm -o first.exe -l first.lst
> but, When I disassembling the first.exe, I get the code like this:
> C:\ASM>ndisasm -b 32 first.exe
> 00000000 B8 db 0xB8
> 00000001 0400 add al,0x0
> 00000003 0000 add [eax],al
> 00000005 BB02000000 mov ebx,0x2
> 0000000A C3 ret
> My question is: where the mov eax,0x4 in disassembly code? and where
> the two add statements come from? where the "00000000
> B8 db 0xB8" come from?
> Thank you all!
It has something to do with the display. The first 5 bytes are the
instruction you are looking for. BB04000000 is "mov eax, 4".
The disassembler might be confused by the fact that this is not a
valid executable .exe file. It does not have an EXE header starting
at 0. You are probably using incorrect settings for building an .exe
executable.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.para****ft.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html


|