Closed atsampson closed 6 years ago
Thanks. I have been wanting this feature, as you can imagine since you have recreated some source files.
I'll hold off on merging until you feel ready.
Symbolic disassembly of the accumulator field is tricky, because there are usually many symbols defined with values in the 1-17 range. There are usually a few I/O channels which overlap with accumulator symbols, for example.
I think printing labels and symbolic jump targets is a clear win.
It's less clear for some other instructions. E.g. it should probably be ADDI T,1
rather than ADDI T,A
.
I can imagine there being a command line option. Set to 0, no symbols will be used. At 1, print symbols for labels and jump instructions. At 2, use symbols everywhere.
I've added a option for how aggressively to find symbols; it can be not at all (the default), use only non-killed symbols like DDT, or use all symbols. Decoding jump instructions only needs a bit more work.
I've also added some tests, which inevitably found a bug in my search code :-)
I think this is good to merge now. Do you feel ready?
The jump thing can wait. It'll be good to get some experience using this.
Yes, go for it - I'm happy enough now.
Thanks!
Some thoughts about this:
I think there should probably be an option to enable/disable this.
It currently shows halfkilled and killed symbols if it can't find a regular symbol, which means it's more likely to find something, but it's often ambiguous. It's also not very aware of what fields are likely to contain symbols in an instruction. So it'd be useful if it showed (a) the raw values and (b) alternative symbols in the comments on the RHS.
It doesn't do anything about the constants area. We could keep track of which addresses within the program's range were mentioned in instructions, and synthesise labels for them when they're encountered later.
(Because I've just run into this:) For AOBJN pointers, it would be useful if this also recognised values that are the negative version of a symbol.
(So, essentially, don't merge this as is, but let me know what you think...)