Hi Ed,
Well I'm glad that worked out. I've had a couple of other thoughts you might consider trying in an effort to get HXA to help you translate things.
Those opcodes defined for the 65c02 and other variant instruction sets, for instance. One idea is to define macros that implement them:
Code:
.macro PHX
TXA
PHA
.endm
Of course this doesn't exactly duplicate PHX because the A register is trashed, which could be A Bad Thing (OTOH, what else can easily be done?).
Another idea, still using macros, is to make such instructions explicitly illegal as a tip that Something Needs To Change Here:
Code:
.macro PHX
.fatal "Unimplemented on the 65Org16"
.endm
The error message that pops up should show the offending source line, which therefore shows the PHX (or whatever), so all bad instructions could reference the same macro:
Code:
.macro XNOTIMP
.fatal "Unimplemented on the 65Org16"
.endm
.macro PHX
XNOTIMP
.endm
Which would at least save writing out the same error message every time. If you didn't want to stop assembly at each bad instruction, you could change "fatal" to "error".
New instructions which accept or require arguments are no problem because there's no requirement they actually be used in the body of the macro:
Code:
.macro STZ, ?addr, ?reg="@"
XNOTIMP
.endm
This handles both "STZ addr" and "STZ addr,x" forms by using a default argument in case "X" is not specified (it could just as well be a null string as "@", and in some ways it would be simpler to do so if it was actually going to be used, but it's an idiom I developed before HXA could handle null strings).
New address modes on old instructions would be trickier, and most likely would require re-writing the existing instruction macros to recognize and reject the new mode, but it could be done.
As things now stand, I believe the ADC macro accepts "ADC (addr)" as "ADC addr" because the value of an expression enclosed in parentheses is the same as the value of the same expression without parentheses. That is, expression evaluation ignores them, so for them to be "meaningful" they have to be noticed and acted on before evaluation takes place. The 6502 instruction macros do pay attention if they also see a ",Y", but otherwise I don't think they care.
This method also has the advantage that macro names can be preceeded by labels, so the error happens whether or not there is a label on the same source line.