Re: 1-pass Assembler Design

"Glenn Kasten" <gkasten@auco.com>
16 Aug 1998 22:46:08 -0400

          From comp.compilers

Related articles
1-pass Assembler Design marvl@fusionmm.com (Marv Luse) (1998-08-13)
Re: 1-pass Assembler Design leichter@smarts.com (Jerry Leichter) (1998-08-16)
Re: 1-pass Assembler Design gkasten@auco.com (Glenn Kasten) (1998-08-16)
Re: 1-pass Assembler Design nr@labrador.cs.virginia.edu (Norman Ramsey) (1998-08-16)
Re: 1-pass Assembler Design ian@cygnus.com (1998-08-16)
Re: 1-pass Assembler Design adrian@dcs.rhbnc.ac.uk (1998-08-17)
Re: 1-pass Assembler Design meissner@cygnus.com (Michael Meissner) (1998-08-17)
Re: 1-pass Assembler Design kochenbu@khe.scn.de (1998-08-19)
Re: 1-pass Assembler Design jcrens@magicnet.net (Jack W. Crenshaw) (1998-08-19)
[1 later articles]
| List of all articles for this month |

From: "Glenn Kasten" <gkasten@auco.com>
Newsgroups: comp.compilers
Date: 16 Aug 1998 22:46:08 -0400
Organization: Compilers Central
References: 98-08-096
Keywords: assembler



> Does anyone have any suggestions for a practical scheme for doing this
[1-pass assembler]?


A long time ago (this dates me) I wrote an absolute 1-pass assember
for the 6502 used in the Apple II. It assembled directly into memory
rather than to a relocatable object file. For each undefined or
forward-referenced symbol, the assembler kept a singly-linked-list of
fixups. The list was stored in the same memory location as the
location to be fixed-up, and so used no additional memory for the
common cases. For complex fixups involving arithmetic, I recall that
the assembler had to keep a separate side table.


I don't think that John's suggestion of writing your output file with
holes, then patching it, is so gross. Actually, I like it. But rather
than explicitly doing the I/O, nowadays with virtual memory operating
systems, you could use map the entire object file into the virtual
address space of your assembler and "write" the object code in
whatever order you need to. The operating system's pager, if its any
good, should give acceptable performance, especially since object
files aren't usually that large. Glenn
--


Post a followup to this message

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