Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 07 Sep 1998 11:17:26 +1000
From:      chris/reman <c.day@student.unsw.edu.au>
To:        Joel Ray Holveck <joelh@gnu.org>, chris/reman <z2172268@student.unsw.edu.au>
Cc:        Mike Smith <mike@smith.net.au>, Mark Murray <mark@grondar.za>, Chuck Robey <chuckr@Glue.umd.edu>, Rodrigo Ormonde <ormonde@aker.com.br>, hackers@FreeBSD.ORG
Subject:   Re: Assembler with FreeBSD 
Message-ID:  <3.0.5.32.19980907111726.0091a750@pop3.student.unsw.edu.au>
In-Reply-To: <199809051555.KAA26672@detlev.UUCP>
References:  <Your message of "Sat, 05 Sep 1998 19:43:00 %2B1000."             <35F107A4.F617A64E@student.unsw.edu.au>

next in thread | previous in thread | raw e-mail | index | archive | help
At 10:55 AM 9/5/98 -0500, Joel Ray Holveck wrote:
>>>>> You don't really want to use gas, because it was never made for human
>>>>> use, just as a back end for gcc, and it's reactions to errors stink.
>>>> No way! GAS fixed the arse-about-face assembler that intel created!!
>>>> They made the assembler language user-drool-friendly!
>>> The syntax is fine.  It's error handling, however, sucks.
>> I think the AT&T syntax used in gas really sux, considering that
>> most x86 assemblers (MASM, TASM, A86, NASM) all use standard Intel
>> syntax I don't see why I should bother trying to learn a new way of
>> expressing an already hard to use language, it's like someone
>> decided to release a version of gcc with a ; at the start of
>> statements, and the logic was x + y = z, just because thats how we
>> normally write it andn not the arse-around way that ansi c uses.
>The syntax was designed to be Unix-based.  Remember that gas uses the
>standard Unix assembler syntax, most as-based tools are designed to
>emit Unix syntax, etc.  It would be silly for as to make an exception
>in Intel's case.
>
>Recall that the assemblers you named are all DOS assemblers, with the
>exception of NASM, which was designed to emulate one.  This isn't
>lossage that the Unix community created.  It's something that Intel
>did and we chose to ignore because of its drain bramage.

Well, people have said that there is no point using ASM in Unix because C
compiles are better at compiling optimised code, someone mentioned that it
was not true, and that hand-coded asm is better iff you know what you're
doing.

Well, alot of unices run on RISC workstations, and the amount of
optimisations and rules which need to be remembered and followed for
hand-coded ASM in a RISC environment is just not worth it, a c compiler
will give you far better optimised code on RISC, that is the whole point of
RISC, move the complexity to the compiler, which is easily changed.

When coding for CISC especially x86, hand-coded assembly has shown ,for a
long time now, that it improves code size and speed, that is why alot of 3d
realtime renderers used in the demoscene use hand-coded asm to pair
instructions better, pipeline or unroll tight loops, and to take advantage
of modern instructions (eg mmx (Not saying that these aren't in modern C
compilers, but in ASM if you know the opcode you get it for free)).

I agree that GAS should use AT&T style ASM, as that is what it is used to
getting from GCC, in fact GAS in DJGPP uses it, since it uses GCC +
binutils.  But I think for readability and the number of good books on ASM
for x86 maybe NASM for FreeBSD is the way to go.  It will link in with your
C stuff, just as well as GAS, and it is a sort of cross-compiler as well
(It does (I think) .obj, ELF, and a.out).

I would just recommend, trying one of each type say NASM and GAS and then
sticking with the one you like best, and learning all the great features
that make ASM such a great language to work with (offsets, macros, relative
vs real vs effective addresses, optimising).  And most of all, have fun!

regards, chris


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.5.32.19980907111726.0091a750>