Alarm Siren wrote:
JeeK wrote:
WDC W65C816S 8/16-bit Microprocessor13 September, 2010
11 November, 2016
p. 35, Table 5-4 Opcode Matrix
Code:
MSB 0, LSB C: TSB: blue
MSB 7, LSB A: PLY: blue
MSB B, LSB 2: LDA (d): blue
MSB *, LSB 6: white
MSB *, LSB 7: red
Code:
< blue = new instruction
> blue = 65C02 + 65802/65816
< red = Old instruction with new addressing mode
> red = 65802/65816 only
I think that New Instruction / Old Instruction means New to the 65816, i.e. not present in the 65C02. Based on that definition, 0C and 7A should be white as they're present on the 65C02. B2 should be red - it exists on the 65C02 but is the (zp) addressing mode, not the 65816's (d) mode which is technically different (even if it can be thought of as a successor). *6 should be red for the same reason - its d or d,x modes instead of zp and zp,x. Finally *7 should be red as you said.
"New Instruction" won't hold however you (or WDC) want to turn it. It's not consistent anyway. It just not appropriate and simply ambiguous. My first try was also to hold on the legend's interpretation I it led to much more failures in coloring. Then I took the other way round and the colors showed me what was really meant.
And the result was:
> blue = 65C02 + 65802/65816
> red = 65802/65816 only
with only some minor fixes in color (apart from 2 columns which has to be swapped).
I would suggest to go with this, because it was also found in "Programming the 65816", p. 436, which uses a dot for blue and a star for red.
Alarm Siren wrote:
JeeK wrote:
p. 36, Table 5-5 Operation, Operation Codes, and Status Register
Code:
Mnemonic Operation Opcode Value
ADC (a) empty
AND A and M -> A
EOR (a,x) empty
JSL*
SBC al EF
STA a,y 99
TRB A and M -> M
I'm not actually entirely sure what you're trying to say on that one as the formatting is somewhat unclear. My best interpretation is as follows:
ADC is listed as having an (a) mode and it should not. I don't know for certain if this is correct (having not used the 65816) but it would make sense as no other instruction of this type has an (a) mode, plus the 17 opcode appears elsewhere as ORA [d],y.
Right, ADC has identical address modes as AND, ORA, EOR, CMP, SBC, LDA from the same instruction class.
Alarm Siren wrote:
AND's operation should be A and M -> A. I agree, though to use WDC's own notation (as listed in note 1 after the table) it should infact be A+M->A.
They wanted to render a logical "and" symbol but used a circumflex, which seem a little wrong to me.
For ORA WDC found the right symbol for the logical "or" symbol. In my opinion it should not rendered as "+", that's not equivalent a logical and (and not very common, not in times where text processing provides symbol tables of all kinds) .
I forgot to mention that EOR has the same notation problem. The proper symbol is missing, instead they used "xv" what ever the meaning of this combination of lowercase characters is, at least not known to me.
Alarm Siren wrote:
EOR is listed as having an (a,x) mode when it should not. Again this makes sense for the class of instruction, and the 5D opcode is listed twice.
It's wrong for this class of instruction. (a,x) is a rare used addressing mode just available for JMP and JSR.
Alarm Siren wrote:
JSL should have an asterisk to mark it as a new 65816 instruction. Agreed.
Right, that was meant.
Alarm Siren wrote:
SBC should have an opcode listed under the "al" addressing mode, specifically EF. Assuming that the table 5-4 is correct, then this change is also correct.
That's indeed correct. I proved it with several assemblers, monitors, emulators and other documentation sources.
Alarm Siren wrote:
STA should have an opcode listed under the "a,y" addressing mode, specifically 99. Assuming that the table 5-4 is correct, then this change is also correct.
That's indeed correct. I proved it with several assemblers, monitors, emulators and other documentation sources.
Alarm Siren wrote:
TRB's operation should be A and M -> M. This is not actually correct for TRB's effect on memory. Instead it should be (~A)+M->M, again using WDC's own notation. This is because TRB clears the memory bits that correspond to ones in A. Without the negation, it would instead clear the bits which correspond to zeroes in A.
You're absolutly right. My correction introduced a new one.
In addition, found an issue for XBA, too.
The table reworked:
Places of change are marked with underscores.
Code:
Mnemonic Operation Opcode Value
ADC (a) _empty_
AND A _and_ M -> A
EOR A _xor_ M -> A (a,x) _empty_
JSL_*_
SBC al _EF_
STA a,y _99_
TRB _(~A) and M->M_
XBA B _<->_ A
and ... logical symbol
xor ... logical symbol