

A macro-assembler in 96 lines (1300 bytes of object code) - gnosis
http://atariwiki.strotmann.de/wiki/Wiki.jsp?page=A%20FORTH%20ASSEMBLER%20FOR%20THE%206502#section-A+FORTH+ASSEMBLER+FOR+THE+6502-INTRODUCTION

======
kabdib
Maybe I'm an old fart, but "uses only 1300 bytes of object code" isn't
important to me if the input is virtually unreadable.

It might make sense in an embedded environment. I don't see this as being
attractive in the production assembly environments I've used (games, the
68K-based Macintosh ROMs, etc.).

"Another victory like that and we're done for, sir." :-)

~~~
kragen
For context, Bill Ragsdale (note the "s"!) wrote this article for Forth
Dimensions in 1981; it was published in the January/February 1982 issue. Might
it have been more important to you if you were doing self-hosted development
on a 6502?

I guess you're saying you don't like the reverse polish syntax:

    
    
              .A ROL,      -->  ROL A
             1 # LDY,      -->  LDY #1
         DATA ,X STA,      -->  STA DATA,X
         DATA ,Y CMP,      -->  CMP DATA,Y
            6 X) ADC,      -->  ADC (06,X)
        POINT )Y STA,      -->  STA (POINT),Y
        VECTOR ) JMP,      -->  JMP (VECTOR)
    

That's understandable, although I think it's not too hard to learn to read
that. It would probably take another page or two for a conventional parser. On
the other hand, I think the environment he's describing has some big
advantages over a conventional assembler, other than just code size:

1\. The macro system is a full-fledged Turing-complete programming language,
not some crippled text-substitution thing kludged onto the side of the
assembler.

2\. You can write loops and conditionals in it without labels, which makes it
a little closer to C than to assembly in the language level, in my book. To
me, that makes it _more_ readable, rather than less.

3\. You can test your assembly-language routines interactively as you write
them, as if you were programming in DDT, but without losing the ability to go
back to your source code.

In the long run, though, these potential advantages lost out to more
traditional IBM-punched-card-style assembly languages, and mostly to C. I
don't really understand why. Maybe because the successful companies already
weren't doing their 6502 development self-hosted?

~~~
justincormack
Makes more sense with the date! Perhaps an ARM port would be useful...

~~~
KGRGreer
How about a Forth Arm Assembler and Disassembler:
<http://yxit.co.uk/source/#ARM%20Assembler>

~~~
kragen
I imagine that could be very useful, but the code is pretty bad. Take a look
at the REGISTER word in <http://yxit.co.uk/source/forth/arm-asm.f>. It
contains 25 lines of code! And they're full of magic numbers and stack
operations!

