While picking at some of the code I've been working with (looking for places where shortcuts were taken to shave a byte or three or where some likely obfuscation was thrown in), I find a few instructions that seem to accomplish nothing:
(Note: 6800 code follows; I could have rewritten it 6502 style but I wanted to show the setup going into the TST instruction)
Code:
LDX #$0083
STX $00D8
LDA A #$01
STA A $00DE
...
INX
LDA A #$83
ADD A $00DE
STA A $00D9
CLR $00D8
CPX $00D8
TST $00CC
BNE $F6FE
So it loads the index register with $83, bumps it up to $84, then saves the same value to $D8, compares the present value of X to the value in $D8...
then moves to do a test on the flag at $00CC (this other location only ever goes between a 0 and a 1).
So, what does all that rigamarole with X and $D8 accomplish? Does it just force some flags into a predetermined state before moving on to TST?