Well,
I ran the Visual6502 this morning using this code:
Code:
*= $0000
LDX #$80
LDY #$81
LOOP LDA #$21
ADC $0080, X
ADC $0080, Y
ADC ($80), Y
SED
JMP LOOP
0080 .WORD $0082
0100 .BYTE $22
0101 .BYTE $23
0102 .BYTE $24
The first time through, the ADC instructions used the extra cycle for page crossing, as expected. After the SED and jump, they used the exact same cycles. I thought that if decimal mode was set, these will use an added cycle for any BCD adjust. I even tried it with a carry past 99 but the extra cycle does not appear.
I adjusted X & Y so a page was not crossed and I used 1 less cycle as expected. The BCD math did not add a cycle in this case either.
Am I missing something, or is this a Visual6502 bug?
Here's the trace:
Code:
cycle ab db rw Fetch pc a x y s p
0 0000 a2 1 LDX # 0000 aa 00 00 fd nv‑BdIZc
0 0000 a2 1 LDX # 0000 aa 00 00 fd nv‑BdIZc
1 0001 80 1 0001 aa 00 00 fd nv‑BdIZc
1 0001 80 1 0001 aa 00 00 fd nv‑BdIZc
2 0002 a0 1 LDY # 0002 aa 80 00 fd Nv‑BdIzc
2 0002 a0 1 LDY # 0002 aa 80 00 fd Nv‑BdIzc
3 0003 81 1 0003 aa 80 00 fd Nv‑BdIzc
3 0003 81 1 0003 aa 80 00 fd Nv‑BdIzc
4 0004 a9 1 LDA # 0004 aa 80 81 fd Nv‑BdIzc
4 0004 a9 1 LDA # 0004 aa 80 81 fd Nv‑BdIzc
5 0005 21 1 0005 aa 80 81 fd Nv‑BdIzc
5 0005 21 1 0005 aa 80 81 fd Nv‑BdIzc
6 0006 7d 1 ADC Abs,X 0006 21 80 81 fd nv‑BdIzc
6 0006 7d 1 ADC Abs,X 0006 21 80 81 fd nv‑BdIzc
7 0007 80 1 0007 21 80 81 fd nv‑BdIzc
7 0007 80 1 0007 21 80 81 fd nv‑BdIzc
8 0008 00 1 0008 21 80 81 fd nv‑BdIzc
8 0008 00 1 0008 21 80 81 fd nv‑BdIzc
9 0000 a2 1 0009 21 80 81 fd nv‑BdIzc
9 0000 a2 1 0009 21 80 81 fd nv‑BdIzc
10 0100 22 1 0009 21 80 81 fd nv‑BdIzc
10 0100 22 1 0009 21 80 81 fd nv‑BdIzc
11 0009 79 1 ADC Abs,Y 0009 21 80 81 fd nv‑BdIzc
11 0009 79 1 ADC Abs,Y 0009 21 80 81 fd nv‑BdIzc
12 000a 80 1 000a 43 80 81 fd nv‑BdIzc
12 000a 80 1 000a 43 80 81 fd nv‑BdIzc
13 000b 00 1 000b 43 80 81 fd nv‑BdIzc
13 000b 00 1 000b 43 80 81 fd nv‑BdIzc
14 0001 80 1 000c 43 80 81 fd nv‑BdIzc
14 0001 80 1 000c 43 80 81 fd nv‑BdIzc
15 0101 23 1 000c 43 80 81 fd nv‑BdIzc
15 0101 23 1 000c 43 80 81 fd nv‑BdIzc
16 000c 71 1 ADC (zp),Y 000c 43 80 81 fd nv‑BdIzc
16 000c 71 1 ADC (zp),Y 000c 43 80 81 fd nv‑BdIzc
17 000d 20 1 000d 66 80 81 fd nv‑BdIzc
17 000d 20 1 000d 66 80 81 fd nv‑BdIzc
18 0020 81 1 000e 66 80 81 fd nv‑BdIzc
18 0020 81 1 000e 66 80 81 fd nv‑BdIzc
19 0021 00 1 000e 66 80 81 fd nv‑BdIzc
19 0021 00 1 000e 66 80 81 fd nv‑BdIzc
20 0002 a0 1 000e 66 80 81 fd nv‑BdIzc
20 0002 a0 1 000e 66 80 81 fd nv‑BdIzc
21 0102 24 1 000e 66 80 81 fd nv‑BdIzc
21 0102 24 1 000e 66 80 81 fd nv‑BdIzc
22 000e f8 1 SED 000e 66 80 81 fd nv‑BdIzc
22 000e f8 1 SED 000e 66 80 81 fd nv‑BdIzc
23 000f 4c 1 000f 8a 80 81 fd NV‑BdIzc
23 000f 4c 1 000f 8a 80 81 fd NV‑BdIzc
24 000f 4c 1 JMP Abs 000f 8a 80 81 fd NV‑BDIzc
24 000f 4c 1 JMP Abs 000f 8a 80 81 fd NV‑BDIzc
25 0010 04 1 0010 8a 80 81 fd NV‑BDIzc
25 0010 04 1 0010 8a 80 81 fd NV‑BDIzc
26 0011 00 1 0011 8a 80 81 fd NV‑BDIzc
26 0011 00 1 0011 8a 80 81 fd NV‑BDIzc
27 0004 a9 1 LDA # 0004 8a 80 81 fd NV‑BDIzc
27 0004 a9 1 LDA # 0004 8a 80 81 fd NV‑BDIzc
28 0005 21 1 0005 8a 80 81 fd NV‑BDIzc
28 0005 21 1 0005 8a 80 81 fd NV‑BDIzc
29 0006 7d 1 ADC Abs,X 0006 21 80 81 fd nV‑BDIzc
29 0006 7d 1 ADC Abs,X 0006 21 80 81 fd nV‑BDIzc
30 0007 80 1 0007 21 80 81 fd nV‑BDIzc
30 0007 80 1 0007 21 80 81 fd nV‑BDIzc
31 0008 00 1 0008 21 80 81 fd nV‑BDIzc
31 0008 00 1 0008 21 80 81 fd nV‑BDIzc
32 0000 a2 1 0009 21 80 81 fd nV‑BDIzc
32 0000 a2 1 0009 21 80 81 fd nV‑BDIzc
33 0100 22 1 0009 21 80 81 fd nV‑BDIzc
33 0100 22 1 0009 21 80 81 fd nV‑BDIzc
34 0009 79 1 ADC Abs,Y 0009 21 80 81 fd nV‑BDIzc
34 0009 79 1 ADC Abs,Y 0009 21 80 81 fd nV‑BDIzc
35 000a 80 1 000a 43 80 81 fd nv‑BDIzc
35 000a 80 1 000a 43 80 81 fd nv‑BDIzc
36 000b 00 1 000b 43 80 81 fd nv‑BDIzc
36 000b 00 1 000b 43 80 81 fd nv‑BDIzc
37 0001 80 1 000c 43 80 81 fd nv‑BDIzc
37 0001 80 1 000c 43 80 81 fd nv‑BDIzc
38 0101 23 1 000c 43 80 81 fd nv‑BDIzc
38 0101 23 1 000c 43 80 81 fd nv‑BDIzc
39 000c 71 1 ADC (zp),Y 000c 43 80 81 fd nv‑BDIzc
39 000c 71 1 ADC (zp),Y 000c 43 80 81 fd nv‑BDIzc
40 000d 20 1 000d 66 80 81 fd nv‑BDIzc
40 000d 20 1 000d 66 80 81 fd nv‑BDIzc
41 0020 81 1 000e 66 80 81 fd nv‑BDIzc
41 0020 81 1 000e 66 80 81 fd nv‑BDIzc
42 0021 00 1 000e 66 80 81 fd nv‑BDIzc
42 0021 00 1 000e 66 80 81 fd nv‑BDIzc
43 0002 a0 1 000e 66 80 81 fd nv‑BDIzc
43 0002 a0 1 000e 66 80 81 fd nv‑BDIzc
44 0102 24 1 000e 66 80 81 fd nv‑BDIzc
44 0102 24 1 000e 66 80 81 fd nv‑BDIzc
45 000e f8 1 SED 000e 66 80 81 fd nv‑BDIzc
45 000e f8 1 SED 000e 66 80 81 fd nv‑BDIzc
46 000f 4c 1 000f 90 80 81 fd NV‑BDIzc
46 000f 4c 1 000f 90 80 81 fd NV‑BDIzc
Daryl
_________________
Please visit my website ->
https://sbc.rictor.org/