Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #1112
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.misty.com!news.iecc.com!.POSTED!nerds-end |
|---|---|
| From | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
| Newsgroups | comp.compilers |
| Subject | Re: Best tools for writing an assembler? |
| Date | Mon, 24 Feb 2014 20:42:56 +0000 (UTC) |
| Organization | Aioe.org NNTP Server |
| Lines | 34 |
| Sender | news@iecc.com |
| Approved | comp.compilers@iecc.com |
| Message-ID | <14-02-033@comp.compilers> (permalink) |
| References | <14-02-018@comp.compilers> <14-02-025@comp.compilers> <14-02-027@comp.compilers> |
| NNTP-Posting-Host | news.iecc.com |
| X-Trace | miucha.iecc.com 1393277874 86029 64.57.183.58 (24 Feb 2014 21:37:54 GMT) |
| X-Complaints-To | abuse@iecc.com |
| NNTP-Posting-Date | Mon, 24 Feb 2014 21:37:54 +0000 (UTC) |
| Keywords | assembler, tools |
| Posted-Date | 24 Feb 2014 16:37:54 EST |
| X-submission-address | compilers@iecc.com |
| X-moderator-address | compilers-request@iecc.com |
| X-FAQ-and-archives | http://compilers.iecc.com |
| Xref | csiph.com comp.compilers:1112 |
Show key headers only | View raw
Hans-Peter Diettrich <DrDiettrich1@aol.com> wrote: (snip) > Depending on your instruction set and addressing modes, it may be > simpler and more instructive to write your own assembler. During this > discussion I remembered that I wrote my first assemblers (and > disassemblers) in Forth, (snip) > Unfortunately Forth writes the generated code directly into RAM, which The traditional assembler makes (at least) two passes through the program, the first to assign addresses to all the labels, and later to generate the code using those addresses. But that was when memories were smaller. If you just generate into memory, you can easily fixup the addresses once they are defined. Then, at the end, write the whole thing out to a file. Both those cases work will if all instructions (and constants) have a known length, even when the actual addresses aren't yet known. There are some interesting cases where the instruction choice (and length) depends on the size of an address, which (in the case of a forward reference) depends on the instruction length. If you can avoid that, it is pretty easy. -- glen [Variable length instructions aren't that hard. You start by assuming everything will be the long form, then iterate over the code a few times shrinking what you can. That isn't always perfectly optimal (which is known to be NP complete), but it's pretty close. -John]
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Best tools for writing an assembler? tpphysik@gmail.com - 2014-02-18 16:04 -0800
Re: Best tools for writing an assembler? "C. Bergström" <cbergstrom@pathscale.com> - 2014-02-19 11:14 +0700
Re: Best tools for writing an assembler? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-02-19 04:25 +0000
Re: Best tools for writing an assembler? Ivan Godard <ivan@ootbcomp.com> - 2014-02-18 23:23 -0800
Re: Best tools for writing an assembler? Robert A Duff <bobduff@TheWorld.com> - 2014-02-19 18:20 -0500
Re: Best tools for writing an assembler? Sébastien Fricker <sebastien.fricker@gmail.com> - 2014-02-21 12:00 +0100
Re: Best tools for writing an assembler? "BartC" <bc@freeuk.com> - 2014-02-22 00:28 +0000
Re: Best tools for writing an assembler? noitalmost <noitalmost@cox.net> - 2014-02-23 11:22 -0500
Re: Best tools for writing an assembler? Sébastien Fricker <sebastien.fricker@gmail.com> - 2014-02-24 07:32 +0100
Re: Best tools for writing an assembler? Louis Krupp <lkrupp@pssw.com> - 2014-02-24 15:39 -0700
Re: Best tools for writing an assembler? Ivan Godard <ivan@ootbcomp.com> - 2014-02-24 15:04 -0800
Re: Best tools for writing an assembler? rpw3@rpw3.org (Rob Warnock) - 2014-02-25 13:00 +0000
Re: Best tools for writing an assembler? Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2014-02-25 04:09 +0100
Re: Best tools for writing an assembler? "James Harris" <james.harris.1@gmail.com> - 2014-02-24 23:18 +0000
Re: Best tools for writing an assembler? noitalmost <noitalmost@cox.net> - 2014-02-27 18:11 -0500
Re: Best tools for writing an assembler? George Neuner <gneuner2@comcast.net> - 2014-03-01 13:09 -0500
Re: Best tools for writing an assembler? federation2005@netzero.com - 2014-03-26 17:57 -0700
Re: Best tools for writing an assembler? federation2005@netzero.com - 2014-04-13 12:24 -0700
Re: Best tools for writing an assembler? Sébastien Fricker <sebastien.fricker@gmail.com> - 2014-02-19 09:59 +0100
Re: Best tools for writing an assembler? Robert A Duff <bobduff@shell01.TheWorld.com> - 2014-02-19 18:27 -0500
Re: Best tools for writing an assembler? Patrik Túri <tpphysik@gmail.com> - 2014-02-20 17:15 -0800
Re: Best tools for writing an assembler? Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2014-02-21 12:09 +0100
Re: Best tools for writing an assembler? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-02-24 20:42 +0000
Re: Best tools for writing an assembler? Ivan Godard <ivan@ootbcomp.com> - 2014-02-24 15:13 -0800
Re: Best tools for writing an assembler? hu47121@usenet.kitty.sub.org (Hannah) - 2014-02-25 00:43 +0000
Re: Best tools for writing an assembler? Walter Banks <walter@bytecraft.com> - 2014-02-27 14:14 -0500
Re: Best tools for writing an assembler? Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2014-02-25 04:23 +0100
Re: Best tools for writing an assembler? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-02-24 20:35 +0000
csiph-web