Re: What language are assemblers written in?
- From: spamtrap@xxxxxxxxxx
- Date: 9 Aug 2006 09:13:01 -0700
Hey Randy,
rhyde@xxxxxxxxxx wrote:
spamtrap@xxxxxxxxxx wrote:
Most x86 assemblers seem to be written in assembly themselves, not C.
There are a lot of assemblers in the world beyond x86 assemblers :-)
And most of those are written in C.
For example, writing an 8051 assembler in 8051 assembly language
wouldn't be too practical because there aren't too many general-purpose
8051 computer systems laying around on which you could execute such an
assembler (not to say that it couldn't, or hasn't, been done; but most
embedded assemblers I've seen are hosted on a PC or other large system
and not on the targer processor itself).
Any particular non-x86 assembler you're referring to? I want examples,
dang it! :-)
Most (but not all) of the C-based assemblers are portable, yet most
(not all) of the self-assembled ones are not.
FASM is portable, to an extent (e.g., across various OSes).
HLA v2.0 will also be portable in this same regard.
Well, yeah, if you're going to nitpick, FASM won't run on PPC or Alpha.
However, especially with x86 (which we all use), you don't really need
to cross assemble from a *nix mainframe or anything, so it doesn't
matter as much (IMO) if it'll run on other architectures..
Despite all of the
complaints I've heard, most C-based assemblers don't seem too slow (in
my limited experience, anyways). Your mileage may vary.
MASM and Gas are quite fast. NASM is a bit slow. HLA v1.x is a bit slow
(though this has little to do with the implementation language). Then
again, calling a compiler that processes about 50,000 lines per second
"slow" is a bit harsh. I remember back in the Apple II days when 20,000
lines per *minute* was considered amazingly fast.
FASM seems to be one of (if not *the*) fastest. They're mostly all fast
(unless you're talking about something atypical like 300,000k LOC on a
386). I don't see where NASM is so slow. I wish I had a concrete
example of how NASM is so sluggish because it always seemed fast enough
for me. Here's a good example of the whole "compiler optimizations beat
hand-written assembly" myth. If that were true, NASM would be plenty
fast (which I personally think it is even if I disagree with the
aforementioned myth). Heck, if that were true, it'd be faster than
FASM, which it ain't.
The below list is based on what I've noticed (hopefully pretty
accurate):
YASM: C (GCC)
NASM: C (various)
GAS: C (GCC)
OpenWatcom WASM: C (OpenWatcom)
NBasm32: C (DJGPP)
ArrowASM: C (Turbo)
NBasm16: itself
NGasm: itself
FASM: itself [Menuet, BSD, Linux, Win32, DOS, Dex4U, OctaOS]
Octasm: itself [OctaOS or DOS]
Wolfware: itself
A86/A386: itself
XASM: itself
Rosasm: itself
INTASM 0.52: itself
INTASM 0.27: Basic (QBasic)
Pass32: Pascal (Borland)
BLASM: Pascal (Delphi) [Win32 only, but older available for DOS]
Corrections and additions welcome. (e.g., I have no concrete proof
about POASM or GOASM, can only guess).
HLA v1.x is written with Flex/Bison/C (Gas contains some Flex/Bison,
too, IIRC).
HLA v2.0 is being written in HLA.
C is the main choice these days.
Note that your list contains *mainly* hobbyist assemblers. If you look
at the professional level assemblers (or look beyond the x86), you'll
find that C is the winner.
For instance?? MASM was probably written in C or C++ (only guessing).
Yes, I list hobbyist assemblers too because that's what I know and use:
I'm a hobbyist myself! :-)
I agree that C is used a lot (obviously), but I don't think that it's
necessarily more prevalent when writing assemblers (as shown by the
examples). I think it's a mistake to think that C is one of the only
languages that can be used (professionally or otherwise).
Take a look at http://99-bottles-of-beer.net/ and see that there are
many, many languages available for use. I'd wager that at least 50 of
those equal C in terms of usefulness. Not saying C isn't fairly nice,
but there are other options to explore.
P.S. More examples:
TMA: itself
GASM: C++ (though it looks like C)
ANASM: assembly (NASM)
Herbert K.'s ASS486 "Daniela": C
Cheers,
Randy Hyde
Cheers! :-)
.
- Follow-Ups:
- Re: What language are assemblers written in?
- From: Jerry Coffin
- Re: What language are assemblers written in?
- From: rhyde@xxxxxxxxxx
- Re: What language are assemblers written in?
- From: Frank Kotler
- Re: What language are assemblers written in?
- References:
- What language are assemblers written in?
- From: Sam
- Re: What language are assemblers written in?
- From: rhyde@xxxxxxxxxx
- Re: What language are assemblers written in?
- From: Sam
- Re: What language are assemblers written in?
- From: spamtrap
- Re: What language are assemblers written in?
- From: rhyde@xxxxxxxxxx
- What language are assemblers written in?
- Prev by Date: Re: What causes this infinite loop?
- Next by Date: Re: What causes this infinite loop?
- Previous by thread: Re: What language are assemblers written in?
- Next by thread: Re: What language are assemblers written in?
- Index(es):
Relevant Pages
|