Remix.run Logo
ksherlock 6 days ago

While the bullshit generator might think it's "Compatible with period assemblers for 6502 development", that's a weird-ass cross assembler. For my money, a commented disassembly like https://6502disassembly.com/a2-rom/Applesoft.html using a more standard assembler is easier to read. It's interesting to compare the two though.

ksherlock 6 days ago | parent [-]

to expand on that, this assembler include the address mode as part of the instruction opcode rather than as part of the operand.

normal:

    lda #0        ; load accumulator immediate
    lda (index),y ; load accumulator indirect,y
weird:

    ldai 0        ; load accumulator immediate
    ldady index   ; load accumulator indirect,y
zozbot234 6 days ago | parent | next [-]

It's not that weird, and it's a lot simpler. It maps directly to how the opcodes are represented in the binary machine code and saves the effort of parsing and pretty-printing the standard syntax. With a different ISA one might argue that there's simply too many insn+addressing mode combinations to represent each with its own mnemonic, but this doesn't really apply to something as simple as the 6502.

tom_ 6 days ago | parent [-]

I'd say it's definitely weird for a standalone assembler. For standalone 6502 assemblers, some approximation of the standard MOS-type syntax has always been near-universal. Though you're quite correct about some of the advantages of doing it this way.

(I say "near universal", because Acorn's MASM had a similar syntax. (See, e.g., https://github.com/stardot/AcornDmosBasic/blob/master/src/DB...) I don't remember ever seeing that described as anything other than an oddity.)

And, also, there are probably assemblers smooshed into Forth or Lisp (or implemented with assembler macros for an assembler targeting some completely unrelated CPU) that work in a similar way, because you're limited by the pre-existing syntax rules. But that feels like a separate category

kazinator 6 days ago | parent [-]

The standard 6502 assembly is already "weird" in that some operands are rolled into the opcode, but some are arguments.

E.g. various register-register transfer combinations have dedicated mnemonics: TXA, TAX, etc.

LDA (index),Y. has index and Y in the argument space, but the A operand is in the mnemonic. The comma doesn't separate operands but is a displacement operator.

In other words, we really want LD A, (index) + y. Or LD A, (index + x).

LocalH 5 days ago | parent | prev | next [-]

I remember having a package in the old C64 days (can't remember the name of it though), and the assembler used "LDAIM" for "lda #" etc. Not identical syntax, but it's not outside of the realm of feasibility.

6 days ago | parent | prev [-]
[deleted]