Re: ASM vs HLL : absurd war

From: Alex McDonald (alex_mcd_at_btopenworld.com)
Date: 07/10/04


Date: Sat, 10 Jul 2004 20:38:26 +0000 (UTC)


"Percival" <pr_tiglao@yahoo.com> wrote in message
news:cck03k$2ji3$1@news.wplus.net...
> Betov wrote:
> > psi <i@m.t> écrivait news:9fsqe0dffka71i13m1lttffelbg94iprar@4ax.com:
> >
> >
> >>I'm a beginners so not a sage, so I can make errors.
> >>For me all are compilers:
> >>an assembly language is a language that *can* control every single bit
> >>of the executable (the result of the compiler). Is it right?
> >
> >
> > No.

No beating about the bush there, eh?

> >
> >
> > Betov.
> >
> > < http://betov.free.fr/RosAsm.html >
> >
> >
>
> I do not understand either...
> What is the difference between a compiler and assembler, other than the
> language that it deals with?

Assemblers take and assemble or compile operations that are specific to a
processor, or a family of processors; NASM/FASM/TASM/RoSAsm/HLA/etc are all
run on and generate code for the Intel x86. Source for assemblers is
platform dependent. Source for processor type A (say, SPARC) will not
assemble and run on processor type B (say, x86). Cross assemblers are run on
platform A but generate code for platform B. In general, assemblers do not
have backend code generators, although those that make heavy use of macros
may generate intermediate assembler source code for a second pass assembly.

In essence, assembler language A has a single target; the machine described
by A.

Writing a platform portable assembler is an oxymoron; by definition, it
would be a compiler, or .Net. Compilers take and assemble or compile
operations that are not specific to a family of processors;
C/C++/Ada/Prolog/Fortran/etc programs can be written and compiled for just
about every processor there is out there. Source for processor type A (say,
SPARC) will probably and run on processor type B (say, x86). Probably, in
that there may be different libraries or considerations such as endianness
or word size that may make the source dependent on a specific platform. Such
code is often described as "not portable"; others may describe it as "badly
written". Writing platform portable C code is difficult, but not impossible.
Other langauges, such as Fortran, are very portable. Some compilers are tied
to a specific platform, such as MSVC (WIndows on Intel); some are not, such
as gcc. They often, but not always, use assembler backends such as gas to
generate code for a specific target.

In essence, compiled language Z has several targets; the "virtual
environment" described by Z can be run on targets A, B C etc.

Microsoft's .Net environment contains several compilers (C#, VB etc) and one
assembler (ILASM). C# is definitely a compiler; it has a target that is a
"virtual environment". ILASM is platform dependent; it takes code generated
for a virtual machine (generally by C#, VB et al) and creates specific code
code the platform on which it is to execute (normally x86, but it can be
extended to other targets). ILASM is as close as an assembler gets to being
a compiler; but it has only one target; some would argue that makes it an
assembler (hence the name). MSIL (the language in which it is written), is a
CPU-independent set of instructions that can be efficiently converted to
native code. So some would argue that it is also a compiler, as MSIL is a
"virtual environment". Some would argue that it is also an interpreter, as
some of the "virtual environment" is never executed as native code.

In essence, .Net changes the rules; the bit "nearer the metal" is the
assembler, and the bit that sits on top is the compiler. Or it's a compiler
for an interpreter. Perhaps.

You'll note that there's no "high-level" argument here. That nonsense we'll
have to reserve for another thread.

HLA is an assembler. Or compiler. So is RosAsm with macros. Of course, you
may disagree with all or any of the above. In which case, welcome to the
hell that's ala.

-- 
Regards
Alex McDonald


Relevant Pages

  • Re: mixing C and assembly
    ... there are compiler extensions or assembly wrappers that link C functions to interrupts. ... Since you hang out gcc for not being "a full C implementation", and for having "extensions quite apart from extensions for the target", can you give me some examples of other available compilers that *are* "full C implementations", which have *no* compiler extensions, and which are targeted at embedded systems? ... The "C" function to set up the UART on an 8051 with a Keil compiler looks almost the same as assembler! ...
    (comp.arch.embedded)
  • Re: What micros do you actually hate to work with?
    ... with less than tiny asm ... hassle to work with 32 bit longs in assembler for an 8 bit uP, ... Microchip's C compiler tools and their assembly under MPLAB. ... is that other programmers for C are easier to find. ...
    (comp.arch.embedded)
  • Re: The Promise of Forth
    ... Declare variables, declare locals, let the compiler do the work ... Forth could be considered the assembler for a simplified virtual ... If you use locals then you have to initialise them each time. ... there are likely to be libraries that could be profitably used within ...
    (comp.lang.forth)
  • Testbed for Pelles Macro Assembler
    ... I have put together a basic testbed for Pelle's new macro assembler ... resource compiler and ANSI compliant C compiler. ... POASM also has some x86-64 bit support and as the x86-64 platform ...
    (alt.lang.asm)
  • The never ending assembly vs. HLL war
    ... > branch instruction excluded is not particularly effective optimization. ... > CPU, chances are pretty good it *won't* be optimal on a different CPU. ... > discussing the futility of optimizing it in *assembler* when the ... careful and consider the code the compiler is emitting (and adjust your ...
    (comp.lang.asm.x86)