Re: a compembler for x86 that looks nearly portable

"David Thompson" <david.thompson1@worldnet.att.net>
6 Feb 2002 23:47:15 -0500

          From comp.compilers

Related articles
a compembler for x86 that looks nearly portable rickh@capaccess.org (2002-01-07)
Re: a compembler for x86 that looks nearly portable RLWatkins@CompuServe.Com (R. L. Watkins) (2002-01-13)
Re: a compembler for x86 that looks nearly portable rickh@capaccess.org (2002-01-17)
Re: a compembler for x86 that looks nearly portable RLWatkins@CompuServe.Com (R. L. Watkins) (2002-01-24)
Re: a compembler for x86 that looks nearly portable rickh@capaccess.org (2002-01-28)
Re: a compembler for x86 that looks nearly portable rickh@capaccess.org (2002-01-28)
Re: a compembler for x86 that looks nearly portable david.thompson1@worldnet.att.net (David Thompson) (2002-02-06)
| List of all articles for this month |

From: "David Thompson" <david.thompson1@worldnet.att.net>
Newsgroups: comp.compilers
Date: 6 Feb 2002 23:47:15 -0500
Organization: AT&T Worldnet
References: 02-01-038 02-01-043 02-01-074 02-01-125 02-01-153
Keywords: assembler
Posted-Date: 06 Feb 2002 23:47:14 EST

Rick Hohensee <rickh@capaccess.org> wrote :
....
> I found a programmer's cheatsheet for MACRO-11 at
> www.spies.com/arcade/simulation/cpuRefCards/Macro-11
>
> Fascinating. It does afford some portability, but not at the register
> level, it seems. It also clearly is a good portion of the "machine" C
> models. C strings for example are predicted in MACRO-11 thus...
>
> |.ASCIZ /string/ |ASCII string with Zero byte terminator |


I'm not quite sure what this means. MACRO-11 was a macro assembler
for PDP-11 computers; like any assembler it primarily supported
instructions that map directly to machine instructions for the (real)
CPU, which are not portable at all, although as our moderator notes
the VAX was somewhat similar. The registers in MACRO-11 instructions
are exactly the hardware registers of the PDP-11 -- and pretty simple;
many hardware features, like virtual memory control, real time clock,
and IIRC even floating-point, are implemented as (pseudo) "I/O" ports
which in the -11 architecture are all memory-mapped.


Like (all?) other assemblers MACRO-11 also had pseudo-ops to generate
data and control the assembly process; these were pretty basic and
almost unavoidably similar to most other assemblers. MACRO-11 also
provided a modest macro capability, similar if not identical to (some)
other DEC assemblers, and functionally like some others as well. It
is true that .ASCIZ conveniently generated zero-terminated strings;
many, but not nearly all, other assemblers, and I/O libraries and/or
operating systems, also used terminated (and not always with zero)
rather than counted strings.


> (osimplay BTW does cell-prefixed arbitrary data ranges, NOT those
> hideous .ASCIZ things.) As C probably originated as a pre-processor
> to MACRO-11, and as GNU Gas is similar to MACRO-11, I found that one
> can write the data structure of a Forth dictionary entirely in the
> assembler, such as MACRO-11. ...


"Preprocessor" is stretching the point; I consider that term to apply
only when at least substantial chunks of the output are the same as,
or similar in form and structure to, the input; C was always a true
(if not very smart, or optimizing) compiler.


It is true that many C compilers, including the early Unix ones,
generated assembler output which was then assembled; on PDP-11 Unix
this assembler was 'as' which is not syntax compatible with MACRO-11,
although unsurprisingly the same (PDP-11) machine instructions and
data types were supported. gcc also/still compiles to assembler,
normally 'gas' which was originally inspired by and uses a syntax
based on as, but whose instructions vary depending on the (target)
CPU. (I believe you can modify or create a gcc backend to produce
output suitable for another assembler if you really want to.)


> Hmmm, was MACRO-11 code portable across the PDPs?
>
> Rick Hohensee
> [Macro-11 was an assembler for the PDP-11, which was utterly unlike the
> PDP 1, 4, 5, 6, 7, 8, 9, 10, 12, 14, or 15. The Vax was somewhat like
> a stretched -11, but the assemblers were quite different. -John]


Although there were about a dozen models of the PDP-11 (and LSI-11),
and _almost all_ of the machine instructions were portable across
them. (A few instructions only exist, or have somewhat different
effects, on certain models.) However, there were several DEC
operating systems for -11s; if an assembler program contained any OS
calls, mostly provided as invocations of system-supplied macros, as
nearly(?) all did, _those_ weren't portable across OSes.


--
- David.Thompson 1 now at worldnet.att.net


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.