News for hackers. Stuff that matters.
Re:6502 “Illegal” Opcodes Demystified by andi999 on Sunday June 06, 2021 @10:17AM (#27413333)
Does anybody know if the mnemonics can be derived from the opcode? (like lda). I remember I was looking for a table of a dissambler, I couldn't find one, and was always wondering how this is implemented.
Re:6502 “Illegal” Opcodes Demystified by ectopod on Sunday June 06, 2021 @12:54PM (#27414419)
You can convert from an opcode to an index into a lookup table of mnemonics quite efficiently, and vice versa. You can also pack a single three character mnemonic into two bytes, so the lookup table may be hard to spot. Assemblers and disassemblers running on 6502 used to do this because space was at a premium.
Re:6502 “Illegal” Opcodes Demystified by vidarh on Sunday June 06, 2021 @04:04PM (#27415846)
Now I want to golf a 6502 opcode -> mnemonic decoder...

Not that I have any use for one.

Re:6502 “Illegal” Opcodes Demystified by dirkt on Sunday June 06, 2021 @12:05PM (#27414038)
Not sure what you mean, but all 6502 disassemblers I've seen use a table to get the mnemonic (and the addressing mode) from the opcode.

Mnemonics are arbitrary, there is no other way.