Write Assembler

6502 Assembly Language was a fun, simple jumping off point for a huge cohort of teenage programmers. Once, while taking a walk in Iowa City, Iowa, I stumbled across some graffiti among other graffiti (the usual signatures, and such) on a fence near a public park. It was something like this, in big, friendly spray paint:
 LDA #$0A
 LDY $D0
 JMP $8D02
I never programmed the 6502 (IIRC), but of course I learned it a bit back then anyway, and based on vague memory and educated guesses, this looks like "load CARRIAGE-RETURN into accumulator, load magic number 0xD0 into index register Y, and jump to a system call, eventually resulting in a display of the carriage return. This might have been in an interrupt routine triggered on end-of-line wrap, or 0xD0 might have meant "display character", and the return address for the application code may already be on the stack -- it's hard to say, since I never had any real experience with the cpu nor any of the "operating systems" that ran on it. But that's the sort of starting-point guess that an experienced reverse-engineer begins with, in the absence of other info.

But from the context I assume that this used to be a really well known idiom to insiders, so I'm surprised no one has spoken up to clarify after all this time.
On which of the various 65xx machines is that code snip supposed to do something? -- AdamVandenberg

Apple ][, I think. Looks familiar. I don't remember what this was a hook too and I'm far too lazy to dig mine out, hook it up, and try it.
Ah... the last time I saw 6502 assembler was... the last time I watched TheTerminator (!) -- AndrewMcGuinness

Yeah, I remember seeing that at the theatre when I first saw the flick. It was with a buddy during my first stint at Motorola. I made a comment about the 6502 machine code and the universal response was, "Shhh!" -- MartySchrader
AhHa. I get it now. The original author meant, "write assembly," not create a compiler for assembly language source code.
However, perhaps writing an assembler would be a fun project.

There's a few ideas scattered here and there on writing a "better assembler" -- AssemblyLanguage suggests "support for object-oriented methods", ForthAssistedHandAssembly is one particular "better assembler", LearningAssemblyLanguage, etc.

While reading CodeGenerationIsaDesignSmell, I wondered -- I wonder if it's possible to write a compiler that generates really pretty, easy-to-understand assembly language code ? For example, if it does some clever strength-reduction trick, it would explain (in comments) to a human reader. Maybe if some code were right on the verge of triggering some clever optimization, it could explain (in comments) "I can't do (whizzy optimization) because (one trivial little prerequisite)", so a human programmer could fix the original source code to enable that optimization. -- DavidCary

Your notions have been implemented haphazardly here and there, but I don't know of a reference on any of them offhand; they tend to arise as an off-the-cuff clever feature by thoughtful programmers, rather than from research projects or management edicts (although doubtless there are exceptions to that that I'm not remembering). -- DougMerritt
Does "HighLevelAssembler?" make sense, or is it an oxymoron ? See http://en.wikipedia.org/wiki/High-level_assembler
CategoryUseless

EditText of this page (last edited November 13, 2014) or FindPage with title or text search