[glug-t] Hope its Useful.

Hi deepak!
Finally some signs of Life on our mailing list, [I mean no harm guys
just joking...;-)]

Well the GNU seems exceedingly powerful when it comes to the black magic
of assembly level programming.

First the documentation parts are well covered in the site

http://linuxassembly.org. They also have a mailing list that 
speaks a hell a lot about assembly for kiddies like me & deepak.

Quoting Deepak Barua <db_barua@xxxxxxxxxxx>:
> how do you program x86 assembly in linux ?

Well you go to the "NASM" assembler or "GAS" assembler,
read the info pages, [and bang your head against the wall
 ..well not really] and mail some more time to idiots like 
me [well really yes]. 

Assuming you know the x86 architecture and wanna really try hard enough
to progam in the assembly try using the NASM or GAS assemblers,
depending on your tastes.

After you write your first assembly program for NASM or GAS
and save it as a .asm file do the following.


Invoke NASM to convert the assemly code into object code.
Do this by the command:

nasm -f elf hello.asm

This command creates the hello.o file.
Now link this program using the linker 'LD', by

ld -s -o hello hello.o


Then bingo , type  $./hello 
and see whatever junk/mess that happens out there.

Some example code for practice with NASM.

This chunk of code prints hello world and exits.Thats all. In case you want to
assemble the code and see it work use the following stuff. 1->save the file as
"hello.asm" without the quotes. 2->execute the command "nasm -f elf hello.asm"
without quotes. 3->run the linker with "ld -s -o hello hello.o" without quotes.
4->execute the program with "./hello". Enjoy.

section data
        hellostr db "Hello World",0xa;
section text
        mov eax,4;
        mov ebx,1;
        mov ecx,hellostr;
        mov edx,1;
        int 0x80;
        
        mov eax,1;
        mov ebx,0;
        int 0x80;
end;


Cheers
Muthu.

Its more certainly GNU.
http://cybernetics.freewebspace.com

-------------------------------------------------
This mail sent through IMP(http://www.nitt.edu)
---------------------------------------------------------------
To unsubscribe send a mail to glug_t-request@xxxxxxxxxxxxx with 
'unsubscribe' as subject.

Website: http://glugt.linuxisle.com

Other related posts: