Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly x86 > Re: Question ab...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 6 Topic 4553 of 4860
Post > Topic >>

Re: Question about NASM

by Jack Klein <jackklein@[EMAIL PROTECTED] > Mar 1, 2008 at 11:29 PM

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
 




 6 Posts in Topic:
Question about NASM
fetag <spamtrap@[EMAI  2008-03-01 20:08:25 
Re: Question about NASM
Jack Klein <jackklein@  2008-03-01 23:29:00 
Re: [Clax86list] Question about NASM
Charles Crayne <spamt  2008-03-01 21:38:08 
Re: Question about NASM
Frank Kotler <spamtra  2008-03-02 09:56:08 
Re: Question about NASM
"H. Peter Anvin"  2008-03-03 11:05:20 
Re: Question about NASM
fetag <spamtrap@[EMAI  2008-03-03 16:40:55 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Nov 20 20:40:50 CST 2008.