LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-14-2003, 01:37 AM   #1
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Rep: Reputation: 45
assmbly. Oh my goodness


Hi there iam trying to start reading linux assembly but i am really confused. I am trying to see what i must follow, something like a standars.
For example so many programs nasm,yasm,*asm,*asm* with different syntax and different operations. I want to know what is the most popular of them and where i must turn my attention

moved to the Programming forum

Last edited by mcleodnine; 11-14-2003 at 03:51 AM.
 
Old 11-14-2003, 06:20 AM   #2
worldmagic
Member
 
Registered: Oct 2003
Location: Europe/Sweden
Distribution: RedHat
Posts: 78

Rep: Reputation: 15
The most used one has to be the "as" program. The GNU Compiler translates C into Asm and then hand it over to "as" to create the objectfiles that later can be linked with "ld". If you want to look at the syntax, the easyest way is actualy to compile a very simple C program, but tell the compiler to output the assembler data as files instead of objectfiles.

This command:
gcc -S mytest.c

Will result in the files mytest.s (This is the assembly file)

Happy Hacking =)
 
Old 11-14-2003, 10:36 AM   #3
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
by worldmagic
The most used one has to be the "as" program

is it? i thought it wasnt designed for human use and is a real pain in the ass to use? but i might be wrong. if you like intel syntax then i would reccomend nasm, if you prefer AT&T syntax then the only assembler i know of is as but im sure there are more, check out the linux assembly howto hosted on tldp.org somewhere.
 
Old 11-14-2003, 11:26 AM   #4
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Original Poster
Rep: Reputation: 45
xm...

I have just read it but still i can not define the most usable assembler
 
Old 11-14-2003, 01:25 PM   #5
LogicG8
Member
 
Registered: Jun 2003
Location: Long Island, NY
Distribution: Gentoo Unstable (what a misnomer)
Posts: 380

Rep: Reputation: 30
Definately go with nasm.
gas (gnu as) might be the most used,
but it's only b/c gcc uses it behind the
scenes. at&t syntax is a real pain.

Plus as a bonus if you ever need to code
a win32 platform you won't have to
struggle to remember which way operands
work.

Intel
mov dest, src

gas
mov src, dest

Most asm tutorials on the web use
intel and only a handful discuss
gas. Your life will be easier if you
use nasm.
 
Old 11-14-2003, 01:29 PM   #6
LogicG8
Member
 
Registered: Jun 2003
Location: Long Island, NY
Distribution: Gentoo Unstable (what a misnomer)
Posts: 380

Rep: Reputation: 30
Oh yeah, just remembered, while one of the biggest reasons
to learn at&t syntax has been that gcc can output the compilation
of C program in it so you can study the code it generates. Since
version 3.0 GCC also puts out assembly language in intel format
with the -mintel-syntax switch...
 
Old 11-14-2003, 02:34 PM   #7
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Original Poster
Rep: Reputation: 45
at&twhat

what is at&t syntax?
 
Old 11-14-2003, 02:57 PM   #8
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
att syntax is a pain? lmao, what makes more sense?

move eax into edx:

a) movl %eax, %edx ---ATT
b) mov %edx, [dword ptr] %eax ---intel

?
reading right to left and using a single letter prefix for operand size? or reading backwards and using a "cast" for operand size?
 
Old 11-14-2003, 05:07 PM   #9
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
depends what your used to i suppose

with intel you dont need the cast unless storing/load from memory location, AT&T has a cast with each instruction as it must be postfixed with with either b, w, or l also AT&T has $ and % everywhere wheras intel doesnt which makes it easier to read, as for src, dest or dest, src i think that should be left to usenet wars.
 
Old 11-15-2003, 02:06 PM   #10
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
i agree it is somewhat of a religious war, but COME ON we read from left to right! ok im just causing trouble i'll shut up
 
Old 11-15-2003, 02:44 PM   #11
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Original Poster
Rep: Reputation: 45
xm...

A conclusion? What to decide? Do u know any visual debugger like code view . I want to view the values of the registers.....
Info about debuggers?
Thx guys
 
Old 11-15-2003, 05:03 PM   #12
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
view the registers? gdb <exe>; set a breakpoint somewhere 'br <function/memaddr>'; run the program 'r'; view the regs 'info registers'
 
Old 11-16-2003, 01:36 AM   #13
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Original Poster
Rep: Reputation: 45
xm...

Something more visual?
 
Old 11-16-2003, 04:12 AM   #14
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
http://webster.cs.ucr.edu/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Samba goodness element Linux - Networking 1 11-10-2003 11:55 PM
qt 3.2.2 goodness nirvanix Linux - General 0 11-04-2003 04:27 PM
Creamy Kernel Goodness.... RaTBoX Linux - Newbie 2 02-22-2003 09:52 AM
Oh My Goodness I Love Xfce!! JoeLinux Linux - Software 7 09-07-2002 05:11 AM
MP3 Goodness! xion Linux - General 1 05-09-2001 05:03 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration