linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Nasm v/s Gas
@ 2002-12-03 12:06 Anticipating a Reply
  2002-12-03 18:57 ` h-peter recktenwald
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Anticipating a Reply @ 2002-12-03 12:06 UTC (permalink / raw)
  To: Assembly Linux

Hi All ,

   I'am a Assembly learner , working 
on Linux Platform .

   I was not able to decide whether I should
learn assembly programming using NASM or 
GNU-As  .

   As Linux Inline assembly accepts 'gas'
syntax , I would like to know which of 
the two to use .

   So I would like to know what are the 
advantages and disadvantages involved in 
using NASM v/s GNU-As ?

   Thanks in Advance .

Bye,
Sarvesh

________________________________________________________________________
Missed your favourite TV serial last night? Try the new, Yahoo! TV.
       visit http://in.tv.yahoo.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Nasm v/s Gas
  2002-12-03 12:06 Nasm v/s Gas Anticipating a Reply
@ 2002-12-03 18:57 ` h-peter recktenwald
  2002-12-03 20:21 ` Jack Dennon
  2002-12-03 21:33 ` Robert G. Plantz
  2 siblings, 0 replies; 7+ messages in thread
From: h-peter recktenwald @ 2002-12-03 18:57 UTC (permalink / raw)
  To: ruxyz, Assembly Linux

On Tuesday 03 December 2002 12:06, Anticipating a Reply wrote:
>
>    So I would like to know what are the
> advantages and disadvantages involved in
> using NASM v/s GNU-As ?

AS, despite it's funny 'syntax`, is reliable(!) and fast and present in 
(almost) any Linux system.


> ________________________________________________________________________
> Missed your favourite TV serial last night? Try the new, Yahoo! TV.
>        visit http://in.tv.yahoo.com

(you might get filtered w. that sort of 'footers'...)



best
	hp

-- 
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Nasm v/s Gas
  2002-12-03 12:06 Nasm v/s Gas Anticipating a Reply
  2002-12-03 18:57 ` h-peter recktenwald
@ 2002-12-03 20:21 ` Jack Dennon
  2002-12-03 21:33 ` Robert G. Plantz
  2 siblings, 0 replies; 7+ messages in thread
From: Jack Dennon @ 2002-12-03 20:21 UTC (permalink / raw)
  To: ruxyz; +Cc: Assembly Linux

I like gas, but I will listen, rather than
answer. Are you trying to start a fight?


Anticipating a Reply wrote:

> Hi All ,
>
>    I'am a Assembly learner , working
> on Linux Platform .
>
>    I was not able to decide whether I should
> learn assembly programming using NASM or
> GNU-As  .
>
>    As Linux Inline assembly accepts 'gas'
> syntax , I would like to know which of
> the two to use .
>
>    So I would like to know what are the
> advantages and disadvantages involved in
> using NASM v/s GNU-As ?
>
>    Thanks in Advance .
>
> Bye,
> Sarvesh
>
> ________________________________________________________________________
> Missed your favourite TV serial last night? Try the new, Yahoo! TV.
>        visit http://in.tv.yahoo.com
> -
> To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Nasm v/s Gas
  2002-12-03 12:06 Nasm v/s Gas Anticipating a Reply
  2002-12-03 18:57 ` h-peter recktenwald
  2002-12-03 20:21 ` Jack Dennon
@ 2002-12-03 21:33 ` Robert G. Plantz
  2002-12-04  3:35   ` Randall Hyde
  2 siblings, 1 reply; 7+ messages in thread
From: Robert G. Plantz @ 2002-12-03 21:33 UTC (permalink / raw)
  To: ruxyz; +Cc: Assembly Linux

I thought about this issue a lot when we moved to a linux
platform for teaching assembly language. I chose gas because:

1. It already exists on almost all linux systems.
2. The interface between gas and C/C++ is very good in the gnu
    environment. (The whole point of our class is to teach
    what is going on at the asm level when programming in C/C++.)
2a. One can easily generate assembly language from a C/C++
     source with gcc, which provides a valuable learning tool.
3. Students need to learn the concepts, and the minor syntax
    differences actually reinforce this.

I have not taken the time to learn NASM to see if any of
my arguments also apply to NASM. After using gas for four
years, though, I do not regret my decision. It is working
very well for us.

Please note that my comments apply to a teaching environment.
I can easily imagine that other assemblers would be preferable
in a productions environment.

Bob

On Tuesday, December 3, 2002, at 04:06 AM, Anticipating a Reply wrote:

>    As Linux Inline assembly accepts 'gas'
> syntax , I would like to know which of
> the two to use .
>
>    So I would like to know what are the
> advantages and disadvantages involved in
> using NASM v/s GNU-As ?
>
------------------------------------------------------------------------ 
---------------
Robert G. Plantz, PhD		| http://www.cs.sonoma.edu/~bob
Sonoma State University		| ph: (707) 664-2806
CS Department				| fax: (707) 664-3012
1801 E. Cotati Avenue		| email: plantz@sonoma.edu
Rohnert Park, CA 94928


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Nasm v/s Gas
  2002-12-03 21:33 ` Robert G. Plantz
@ 2002-12-04  3:35   ` Randall Hyde
  0 siblings, 0 replies; 7+ messages in thread
From: Randall Hyde @ 2002-12-04  3:35 UTC (permalink / raw)
  To: Robert G. Plantz, ruxyz; +Cc: Assembly Linux

Interesting.
In my experience Gas is probably the worst assembly to use
in an educational environment (no pedagogy).  I'm surprised you're
as happy with it as you are.  
(comments follow below).

----- Original Message ----- 
From: "Robert G. Plantz" <plantz@SONOMA.EDU>
To: <ruxyz@yahoo.com>
Cc: "Assembly Linux" <linux-assembly@vger.kernel.org>
Sent: Tuesday, December 03, 2002 1:33 PM
Subject: Re: Nasm v/s Gas


> I thought about this issue a lot when we moved to a linux
> platform for teaching assembly language. I chose gas because:
> 
> 1. It already exists on almost all linux systems.

Yes, in particular it exists on all non-x86 platforms as well (though
I don't know if this was your main consideration).
Most distributions also ship NASM (and have been for the past
year or so, so this is hardly a consideration).  Since almost everyone
has internet access, I seriously doubt this is an important consideration
today since anyone can download NASM, HLA, or just about any other
Linux-compatible assembler today.

> 2. The interface between gas and C/C++ is very good in the gnu
>     environment. (The whole point of our class is to teach
>     what is going on at the asm level when programming in C/C++.)

About the only advantage that Gas has over NASM or HLA in this
environment is that GCC's in-line assembly syntax is based on Gas (definitely
not the same, but similar).  NASM produces ELF files that link with
C/C++ just fine.  HLA is actually a compiler that emits Gas code (much like
GCC emits Gas code), so clearly HLA shares any advantages that Gas
has in this area.


> 2a. One can easily generate assembly language from a C/C++
>      source with gcc, which provides a valuable learning tool.

Depends, I guess, on what kind of assembly you want your students
writing.  While I have employed this very trick in the past (using
Windows compilers, which tend to generate much more readable
assembly code), the truth is that compilers don't produce the kind
of code a normal human being would write.  And if you're teaching
students to write code that way (that is, in the same style that a compiler
produces), there really is no need to learn assembly language programming
at all since a compiler would produce that kind of code for them (with a
whole lot less work).


> 3. Students need to learn the concepts, and the minor syntax
>     differences actually reinforce this.

Although I am not a big fan of Intel syntax, and, in fact, most people
would believe that HLA's syntax is closer to Gas than, say, to NASM,
I really don't agree with the second part of your statement.  The "minor"
syntax differences always raise the question of "why are we learning this
rather than the 'standard' way?"  For Gas, the reason for the "minor"
syntax differences was because Gas' authors wanted a single assembly
syntax for all the processors;  the mere fact that Gas now supports the
".intel_syntax" directive should suggest the ultimate popularity of that
approach.  Now there are good reasons for going with a different syntax
for your assembler (which I've done with HLA), but Gas' syntax is
not justified by any of those good reasons.  Gas' syntax was chosen
to fit the syntax of an existing assembler;  not a good design decision IMHO.

I do agree, though, that learning the concepts is the most important thing.
Whether a student learns NASM, Gas, HLA, MASM, TASM, SpASM,
or whatever, if they really learn the assembly paradigm, they can master the
syntax of some other assembler within a week or two, if the need arises.


> I have not taken the time to learn NASM to see if any of
> my arguments also apply to NASM. After using gas for four
> years, though, I do not regret my decision. It is working
> very well for us.

Again, I find this amazing.  Every class I've seen that uses an AT&T syntax
assembler has been a disaster in terms of teaching, really teaching, assembly
language programming.

> Please note that my comments apply to a teaching environment.
> I can easily imagine that other assemblers would be preferable
> in a productions environment.

I would find just the reverse to be true.  Gas may be okay in certain
production environments, but for educational environments the lack of
good documentation and pedagogy is a real issue.
It doesn't help that Gas isn't very robust (that is, it assumes that the code
you feed it is perfect and doesn't have very helpful diagnostics when fed
code containing the types of errors that students seem to produce).
Randy Hyde


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Nasm v/s Gas
       [not found] <A8FBDFE1-0748-11D7-91BF-003065A88832@sonoma.edu>
@ 2002-12-04  6:07 ` Randall Hyde
  2002-12-04  6:36   ` Anticipating a Reply
  0 siblings, 1 reply; 7+ messages in thread
From: Randall Hyde @ 2002-12-04  6:07 UTC (permalink / raw)
  To: Robert Plantz; +Cc: linux-assembly


----- Original Message ----- 
From: "Robert Plantz" <plantz@SONOMA.EDU>
To: "Randall Hyde" <aoax86@earthlink.net>
Sent: Tuesday, December 03, 2002 9:24 PM
Subject: Re: Nasm v/s Gas


> Randy,
> 
> Thank you for your very thoughtful comments. I have consulted your
> online book often and appreciate your expertise in this area.
> 
> I really should take the time to learn NASM
> so I can make a better informed decision. (We have a 12 unit
> teaching load every semester (no TAs), so it's a struggle just
> to keep up.)
> 
> One thing to note is my parenthetical comment:
> 
> >> (The whole point of our class is to teach
> >>     what is going on at the asm level when programming in C/C++.)
> 
> which I should have placed at the beginning.
> 
> We decided many years ago that it was not important for our
> students to learn assembly language programming. Our course
> was renamed "Computer Organization: Software". We really do
> try to show approximately what the compiler is generating.
> We are trying to demystify the machine operations going on
> behind C. Within this context, the course serves as sort of
> an introduction to computer architecture.

Well, that makes sense, then.  A machine organization course
could easily get by with Gas since the purpose of teaching assembly
in such a course is not to teach students how to write programs in
assembly code, but to teaching them how to write HLL code that
generates decent assembly.

> 
> It's also important to note that I am at a CSU campus, not
> a UC. Our courses are probably not quite as ambitious.

Actually, when I taught at CSU (Cal Poly Pomona), we actually
got *farther* along in assembly than at UC.  The reason was simple:
the students took a "digital electronics" course prior to the assembly
course.  It wasn't really an electronics course (though they did wire
up a few simple projects).  It really was a machine organization
course where the students learned about numbering systems, digital
logic, and a ton of other things that wind up consuming half the term
in an assembly course without such a prerequisite.  It was great because
I could get much farther in the assembly course.  At UCR, the
"Machine Organization and Assembly Language Programming" course
spent about 3-4 weeks covering all that prerequisite material prior to
getting into the actual assembly programming.  With just six or seven
weeks to teach assembly, you can't get very far, which is why I've always
worked at figuring out how to make the process more efficient.


> I fully understand that many people (including some of my
> best friends  :-) ) do not agree with this philosophy.

Actually, if you'd just said that it was a Computer Organization course,
I probably would have agreed with the approach right from the start.
Indeed, I'm currently working on a new book that attempts to teach
Machine Organization using HLLs as much as possible (and the last chapter,
which I'm currently working on, covers HLL->machine code translation by
a compiler).  Although it's obvious that a programmer who knows assembly
language really well makes a good HLL programmer, I've never been convinced
that you have to become an accomplished assembly programmer in order to
write good HLL code.  I believe that by studying machine organization really
well, it's quite possible to write the same quality HLL code that someone who
know assembly would be capable of writing.  We'll see if this text I'm working
on takes people a little bit closer to that goal.
Randy Hyde



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Nasm v/s Gas
  2002-12-04  6:07 ` Randall Hyde
@ 2002-12-04  6:36   ` Anticipating a Reply
  0 siblings, 0 replies; 7+ messages in thread
From: Anticipating a Reply @ 2002-12-04  6:36 UTC (permalink / raw)
  To: Randall Hyde, Robert Plantz; +Cc: linux-assembly

Hello Everybody,

   Thank you for all the responses provided 
by all you learned people out there .

    As pointed out in the mails , I too 
was interested in learning Assembly to know
what is going on at the assembly level when
programming in C , so that I can write
HLL code that generates decent assembly.

    I would look forward to Mr.Randall Hyde's
new book which takes this aspect into 
consideration and thank him for his efforts .

    Thank you once again for all your inputs .

Best Regards !   
 


 --- Randall Hyde <aoax86@earthlink.net> wrote: > 
> ----- Original Message ----- 
> From: "Robert Plantz" <plantz@SONOMA.EDU>
> To: "Randall Hyde" <aoax86@earthlink.net>
> Sent: Tuesday, December 03, 2002 9:24 PM
> Subject: Re: Nasm v/s Gas
> 
> 
> > Randy,
> > 
> > Thank you for your very thoughtful comments. I
> have consulted your
> > online book often and appreciate your expertise in
> this area.
> > 
> > I really should take the time to learn NASM
> > so I can make a better informed decision. (We have
> a 12 unit
> > teaching load every semester (no TAs), so it's a
> struggle just
> > to keep up.)
> > 
> > One thing to note is my parenthetical comment:
> > 
> > >> (The whole point of our class is to teach
> > >>     what is going on at the asm level when
> programming in C/C++.)
> > 
> > which I should have placed at the beginning.
> > 
> > We decided many years ago that it was not
> important for our
> > students to learn assembly language programming.
> Our course
> > was renamed "Computer Organization: Software". We
> really do
> > try to show approximately what the compiler is
> generating.
> > We are trying to demystify the machine operations
> going on
> > behind C. Within this context, the course serves
> as sort of
> > an introduction to computer architecture.
> 
> Well, that makes sense, then.  A machine
> organization course
> could easily get by with Gas since the purpose of
> teaching assembly
> in such a course is not to teach students how to
> write programs in
> assembly code, but to teaching them how to write HLL
> code that
> generates decent assembly.
> 
> > 
> > It's also important to note that I am at a CSU
> campus, not
> > a UC. Our courses are probably not quite as
> ambitious.
> 
> Actually, when I taught at CSU (Cal Poly Pomona), we
> actually
> got *farther* along in assembly than at UC.  The
> reason was simple:
> the students took a "digital electronics" course
> prior to the assembly
> course.  It wasn't really an electronics course
> (though they did wire
> up a few simple projects).  It really was a machine
> organization
> course where the students learned about numbering
> systems, digital
> logic, and a ton of other things that wind up
> consuming half the term
> in an assembly course without such a prerequisite. 
> It was great because
> I could get much farther in the assembly course.  At
> UCR, the
> "Machine Organization and Assembly Language
> Programming" course
> spent about 3-4 weeks covering all that prerequisite
> material prior to
> getting into the actual assembly programming.  With
> just six or seven
> weeks to teach assembly, you can't get very far,
> which is why I've always
> worked at figuring out how to make the process more
> efficient.
> 
> 
> > I fully understand that many people (including
> some of my
> > best friends  :-) ) do not agree with this
> philosophy.
> 
> Actually, if you'd just said that it was a Computer
> Organization course,
> I probably would have agreed with the approach right
> from the start.
> Indeed, I'm currently working on a new book that
> attempts to teach
> Machine Organization using HLLs as much as possible
> (and the last chapter,
> which I'm currently working on, covers HLL->machine
> code translation by
> a compiler).  Although it's obvious that a
> programmer who knows assembly
> language really well makes a good HLL programmer,
> I've never been convinced
> that you have to become an accomplished assembly
> programmer in order to
> write good HLL code.  I believe that by studying
> machine organization really
> well, it's quite possible to write the same quality
> HLL code that someone who
> know assembly would be capable of writing.  We'll
> see if this text I'm working
> on takes people a little bit closer to that goal.
> Randy Hyde
> 
> 
> -
> To unsubscribe from this list: send the line
> "unsubscribe linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at 
http://vger.kernel.org/majordomo-info.html 

________________________________________________________________________
Missed your favourite TV serial last night? Try the new, Yahoo! TV.
       visit http://in.tv.yahoo.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-12-04  6:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-03 12:06 Nasm v/s Gas Anticipating a Reply
2002-12-03 18:57 ` h-peter recktenwald
2002-12-03 20:21 ` Jack Dennon
2002-12-03 21:33 ` Robert G. Plantz
2002-12-04  3:35   ` Randall Hyde
     [not found] <A8FBDFE1-0748-11D7-91BF-003065A88832@sonoma.edu>
2002-12-04  6:07 ` Randall Hyde
2002-12-04  6:36   ` Anticipating a Reply

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).