Another Assembler

For kicks I spent a few days writing a 6502 assembler in Python (I had a need for one, and getting there is half the fun).

It’s under the ABRMS license (“Anyone But Richard M Stallman”). So, in the unlikely event that you need a simple and nearly free 6502 assembler, and in the likely event that you’re not RMS, you’re in luck.


Author: landon

My mom thinks I'm in high tech.

16 thoughts on “Another Assembler”

  1. 6502 is still the best processor. It is teh c00l.

    Is the ABRMS licence usable by others? It sums up my feelings fantastically and one I would definitely like to use!

  2. ‘It’s under the ABRMS license (“Anyone But Richard M Stallman”)’

    That’s not a very charitable license, feelings about copyleft aside.

    I guess I just don’t understand. I’ve just never felt like enough of an asshole to create a license like that.

  3. DadHacker is a GNU hater :-(. I guess when you’ve seen and done it all sooner or later you encounter something you never want to tolerate again…

    1. Don’t confuse dislike of RMS with dislike of GNU, although I’m not saying its necessarily true simply you’re making a link which doesn’t necessarily exist.

      Personally I can’t stand RMS, having heard him speak in Brussels and met him afterwards. He has some a relatively unique skill which he does something, says you absolutely shouldn’t do exactly what he did, then somehow gets the crowd to think this is the great and the one true way. Personally I’m rather ambivalent to GNU.

      The ABRMS licence is a very clever, very insightful criticism of RMS and his manner. If you read the GNU licence and especially Cathedral/Bazaar and thought deeply about him/it you would probably come to a similar conclusion.

      I’m just incredibly jealous I didn’t think of it 🙂

    2. It’s not about hating free software. I’m a believer in that; I released my first game for free in 1982. Note that the github thing I put up is essentially totally free (something I would have been restricted from doing, by my employer, up to a year ago).

      I have a personal dislike for RMS and I think that his philosophy of economy is at best naïve and dangerously unworkable. 25 years ago he was exhorting me to quit my job in protest to support some of his politics and he wasn’t pleasant about it. Thus, ABRMS.

      If RMS really wants a miserable little 6502 assembler I can always amend the license. I’m not unreasonable. But he has to ask. 🙂

  4. ABRMS licence supporter here. I can’t understand why anyone would support the GNU manifesto (have the zealot minions actually read the thing?).

  5. > Labels starting with ‘.’ are local between labels that don’t start with ‘.’

    Love those local labels! Makes one want to print out the symbol table on an ASR-33 and frame it.

    I adopted the same scheme for my homebrew RISC assembler; most of the commercial assemblers I’ve used over the years have had only those forwards/backwards reference counting locals, which hurt my brain.

    > Binary output is in Kim-1 format.

    My first 6502 embedded development was done with a cross assembler running on a decked-out KIM-1 : multi-slot backplane, static RAM board, and a single-sided, single-density, 35 track floppy with a linear (pack required upon deletion) filesystem 🙂

    1. I’ve never understood the backwards / forwards label thing. I think it’s too dang complicated, and typically all you get are numbers; not very meaningful. I think these were invented by people who really didn’t write all that much assembly.

      With “dot is local” you never run short of meaningful, short names, which is always a problem in assembler.

      1. I first met the b,f,h style on a Univac assembler, and used the
        [digit+]$ style on DEC assemblers. I agree that the .[label]
        style is nicer, but have been bitten by the last-minute need
        to insert a global (at least file-global) symbol, messing up the whole premise of the scope of surrounding local symbols. The DEC assemblers had the .enable LSB (Local Symbol Block) hack to deal with this, but it was in fact a hack. Later in life we abused the DEC Macro facility to make something a little more PL-360
        (Structured assembly, with IF-ELSE-ENDIF, DO-WHILE etc. for control transfers, and normal assembly for imperative stuff). Far the better, other than lack of mindshare-portability.

        1. I’ve been in the “need to insert a global label but that will break my local ones” only a couple of times. Probably a scoping syntax would make this work better (e.g., globalLabel . localLabel). That would be really easy to implement, if anyone really wanted it, and makes sense philosophically.

          I remember looking at the Atari Coin-op “high level assembler” and really not understanding it. It was definitely a mind set you had to be in. I’m guessing that the coin-op games were less space constrained from the consumer titles I was working on, and I justified my active ignorance with fear about losing bytes to naive macros doing code generation for you. I never measured the efficiency of the high-level assembly output, my bad.

          1. Everything is easy at the “BSing at the coffee machine” level. Some things get nasty quickly as you hammer out the details. The usual hack for inserting a global was to use a symbol
            NewGlobal = .
            rather than a label

            As for “High Level Assembly”, it was an option, not a requirement. It was, as I said, inspired by Wirth’s PL360 and by the Forth Assembler. I don’t recall any particular code-size issues other than the typical case in 6502 assembly about the lack of unconditional branch. So where a “fully aware programmer” could “know” that V was clear and use a BVC for “Else”, the ELSE macro couldn’t make that assumption. Other than that, the “loss” would have been minimal, and mostly from abstaining from total pasta-code.
            The usual caveats about “superman tools” apply. I won’t claim that everybody who wrote macros should have. As with C, there could be “magical thinking” where “Unix is written in C, so if I use C I’ll be as smart as K, T, and R”.
            Further note: the DEC macro system was not just a “blind text substitution, then pipe to assembler” thing like most “macrto assembler” today. Macros has access to the symbol table and current context (section, location in section, etc).
            Big difference that allows macros to be _smarter_ than raw code could safely be. Later versions of the in-house assembler could pass arbitrary expressions (even conditionals) through to the linker, allowing a certain amount of optimization at link time.
            Pay no attention to the old guy in the corner missing the good old days…

Leave a Reply

Your email address will not be published. Required fields are marked *