Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1111

Re: Best tools for writing an assembler?

From glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups comp.compilers
Subject Re: Best tools for writing an assembler?
Date 2014-02-24 20:35 +0000
Organization Aioe.org NNTP Server
Message-ID <14-02-032@comp.compilers> (permalink)
References <14-02-018@comp.compilers> <14-02-025@comp.compilers>

Show all headers | View raw


Patrik Tzri <tpphysik@gmail.com> wrote:

> About using an existing assembler -- it's like writing Machine Description
> files for GCC right? Well my problem is that those stuff seemed quite complex
> and would take a while to understand all syntax and options, and then define
> all 'generalized' instructions.
> Any good "Getting Started" guide on that with any assembler or compiler which
> would make it easier to learn?
> [Adapting an assembler is much easier than retargeting a compiler.
> The assembler doesn't know anything about the semantics of
> instructions, just what field goes where. -John]

Some years ago, I used a system to assemble 8080, 6800, or 6809 code
using the OS/360 assembler. Each instruction is a macro, though many
call other macros to generate the appropriate addressing mode.  Once
you get the addressing modes right, the rest are very easy to write,
mostly putting in the appropriate opcode and calling the one to do the
right address mode.

In addition, there was a program to generate motorola hex files from
OS/360 object files, and another to fix up the lising file.  The usual
OS/360 assembler listing file has the generated code to the left of
each instruction. For a macro, you only see that if you have the macro
expansion shown. The fix-up program moves it up such that it is to the
left of the macro call, and then doesn't show the macro expansion (all
DC instructions).

It uses assembler arithmetic to generate little endian addresses on a
big endian system, using one byte (AL1) address constants.

Some of the assembler contentions remain, though, such as constants
still being in OS/360 format (X'1234') instead of the more traditional
intel form (01234H).  I do remember taking some existing source and,
with just a little editing, getting it to assemble. Also, the comment
and label conventions will be those for the OS/360 assembler, but that
wasn't much of a problem. (As I remember, the intel assembler uses a
colon after a label, and the OS/360 assembler doesn't want one there.)

It is very convenient in that the host assembler does all the
keeping track of forward references.

-- glen
[This is a classic and very useful hack.  The assembler for at least
one of IBM's minis, maybe the System 7, worked that way. -John]

Back to comp.compilers | Previous | Next — Previous in thread | Find similar | Unroll thread


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