Continuing to work through nestest... I'm down to diverging at line 5530...
Here's the nestest log:
According to this doc, ZN flags should be set for the AAX/SAX operation:
In the nestest log we can see that A and X are 0x3E (0011 1110) and 0x17 (0001 0110). I believe the result is 0x16 (0001 0110). This should result in both Z and N flags being 0. However the status value in the next row is 0xE6 (1110 0110) which has both Zero and Neg flags set to 1!
So; what am I missing? Are ZN actually supposed to be set, or is my maths wrong?
Here's the nestest log:
Code:
5529: E756 18 CLC A:3E X:17 Y:44 P:E7 SP:FB CYC:262 SL:118
5530: E757 83 49 *SAX ($49,X) @ 60 = 0489 = 00 A:3E X:17 Y:44 P:E6 SP:FB CYC:268 SL:118
5531: E759 EA NOP A:3E X:17 Y:44 P:E6 SP:FB CYC:286 SL:118
5530: E757 83 49 *SAX ($49,X) @ 60 = 0489 = 00 A:3E X:17 Y:44 P:E6 SP:FB CYC:268 SL:118
5531: E759 EA NOP A:3E X:17 Y:44 P:E6 SP:FB CYC:286 SL:118
According to this doc, ZN flags should be set for the AAX/SAX operation:
Code:
AAX (SAX) [AXS]
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
AND X register with accumulator and store result in memory. Status
flags: N,Z
Addressing |Mnemonics |Opc|Sz | n
------------|-----------|---|---|---
Zero Page |AAX arg |$87| 2 | 3
Zero Page,Y |AAX arg,Y |$97| 2 | 4
(Indirect,X)|AAX (arg,X)|$83| 2 | 6
Absolute |AAX arg |$8F| 3 | 4
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
AND X register with accumulator and store result in memory. Status
flags: N,Z
Addressing |Mnemonics |Opc|Sz | n
------------|-----------|---|---|---
Zero Page |AAX arg |$87| 2 | 3
Zero Page,Y |AAX arg,Y |$97| 2 | 4
(Indirect,X)|AAX (arg,X)|$83| 2 | 6
Absolute |AAX arg |$8F| 3 | 4
In the nestest log we can see that A and X are 0x3E (0011 1110) and 0x17 (0001 0110). I believe the result is 0x16 (0001 0110). This should result in both Z and N flags being 0. However the status value in the next row is 0xE6 (1110 0110) which has both Zero and Neg flags set to 1!
So; what am I missing? Are ZN actually supposed to be set, or is my maths wrong?