Wrapper round x86 Assembler

Peter Hansen peter at engcorp.com
Tue Apr 13 08:51:54 EDT 2004


Fuzzyman wrote:

> Right ? I got confused by the mention that they could handle inline
> assembler.... so many of the compilers include an assembler as well...
> purely for 'inline assembly'.... ??

That's correct.  Of course, many also do the CC+AS thing, but
I think that's no longer the most common approach.

> My past experience of assembly was using an operating system that
> handled multitasking 'behind the scenes' (pre-emptive multitasking) -
> so there was no performance hit on the rest of your system from
> writing crappy assembly - and the internal architecture of the
> processor was useful enough to make coding fun.....

The 68K was certainly assembly-friendly, compared to anything
yet produced by Intel. :-)

> It does occur to me that for a certain subset of a 'pseudo assembly
> language' a 'cross-platform assembler' could work 

I really think that in most ways that matter (not quite all, but most)
this is exactly what C was designed to be and is.  It is only a very
thin layer on top of assembly, really.  You can think of it is a
pseudo-high-level language designed to allow assembly programmers to
write code roughly the way they would if they were not just hacking.
The Amiga's huge variety of STRUCT macros, for example, are
practically field-for-field identical to how C structs work, mostly
just providing an efficient method for specifying the offsets of
each field.  Pointers are nothing more than a more concise way of
expressing the "indirect" addressing mode.  Heck, C even has (or had)
the "goto" statement and labels!  And the for loop syntax is basically
just how assembly loops are done, but again in a more concise and
readable fashion.

I think anyone who attempted to do a "cross-platform assembler"
would quickly find themselves heading in the direction of something
like C.  (I know such things have actually been attempted, and even
exist, by the way.  They just aren't mainstream and clearly C has
greater success.)  Any attempt to stay at the level of hardware
registers would immediately prevent the term "cross-platform" from
applying.

-Peter



More information about the Python-list mailing list