White Flame wrote:
Things like LDA $00FE, which is (for timing or selfmod reasons) encoded as absolute addressing instead of zeropage, need to be indicated to the assembler so it doesn't reencode it to use zeropage.
Yea, that's a real trick. That will disassemble fine, I mean, why not, it says so in the code. But on assembly, it seems common for the assembler to assume that a zero page address is, in fact, zero page. You might be able to force this by something like:
Code:
LDA ZPADDR
ZPADDR = $00FE
In this case, the assembler may have to assume that ZPADDR is a 2 byte value, since it's undefined at that point. (I honestly don't even know what mine would do with this, probably make it a normal absolute load).
But, that would take a particularly knowledgable disassembler to see that the absolute address might be confused with a zero page address.
It doesn't help that most disassemblers aren't designed to be compiled.
None of the other problems bother me though, really. The disassembler doesn't have to know about data blocks and such, it simply has to know there it's a valid instruction or not. Having instructions interlaced with a bunch of DB statements is, yea, ugly, but it should reassemble back ok. Same with undefined op codes, as long as the disassembler remains ignorant of them.
If the goal is semi-readable assembly that can be reassembled, that's not really a big nut. You can probably pick a favorite assembler that you like and whip up an adequate disassembler in a couple hours, really, with simple labels. It's the more time in to finding blocks and such like that is where the time goes.