The Visual2A03 'program'

Equivalent code:

Code: Select all

```
.org 0
CLI
LDA #$C0
STA $4017
LDA #$01
STA $4013
LDA #$8F
STA $4010
LDA #$10
STA $4015
LDA #$01
STA $4014
STA $4014
forever: BPL forever
```

Here is the log output from the Visual2A03 'program'...cut down significantly. The interesting cycle is cycle 822. This log shows that the DMC DMA happens *right in the middle of* the sprite DMA without one impacting the other in any way [sprite data and DMC data are not 'clobbered']. Cycle 823 is the CPU driving the address bus for one cycle, presumably because the sprite DMA logic needs two cycles per transfer, and since it was held off, it has nothing to put on the bus until cycle 824.

Another interesting thing...I'd read that the DMC DMA always takes 4 cycles. But starting at cycle 38 c_rdy (the internal RDY to the 6502) is pulled low and the CPU is held off for what appears to be 3 cycles with the DMC fetch from $C000 being the last of the three. [Not 4?]

Code: Select all

```
cycle ab db rw Fetch pc a x y s p c_rdy
31 0012 8d 1 STA Abs 0012 10 c0 00 bd nv-Bdizc 1
31 0012 8d 1 STA Abs 0012 10 c0 00 bd nv-Bdizc 1
32 0013 15 1 0013 10 c0 00 bd nv-Bdizc 1
32 0013 15 1 0013 10 c0 00 bd nv-Bdizc 1
33 0014 40 1 0014 10 c0 00 bd nv-Bdizc 1
33 0014 40 1 0014 10 c0 00 bd nv-Bdizc 1
34 4015 40 0 0015 10 c0 00 bd nv-Bdizc 1
34 4015 10 0 0015 10 c0 00 bd nv-Bdizc 1
35 0015 a9 1 LDA # 0015 10 c0 00 bd nv-Bdizc 1
35 0015 a9 1 LDA # 0015 10 c0 00 bd nv-Bdizc 1
36 0016 01 1 0016 10 c0 00 bd nv-Bdizc 1
36 0016 01 1 0016 10 c0 00 bd nv-Bdizc 1
37 0017 8d 1 STA Abs 0017 01 c0 00 bd nv-Bdizc 1
37 0017 8d 1 STA Abs 0017 01 c0 00 bd nv-Bdizc 1
38 0018 14 1 0018 01 c0 00 bd nv-Bdizc 1
38 0018 14 1 0018 01 c0 00 bd nv-Bdizc 0
39 0018 14 1 0019 01 c0 00 bd nv-Bdizc 0
39 0018 14 1 0019 01 c0 00 bd nv-Bdizc 0
40 c000 00 1 0019 01 c0 00 bd nv-Bdizc 0
40 c000 00 1 0019 01 c0 00 bd nv-Bdizc 0
41 0018 14 1 0019 01 c0 00 bd nv-Bdizc 1
41 0018 14 1 0019 01 c0 00 bd nv-Bdizc 1
42 0019 40 1 0019 01 c0 00 bd nv-Bdizc 1
42 0019 40 1 0019 01 c0 00 bd nv-Bdizc 1
43 4014 40 0 001a 01 c0 00 bd nv-Bdizc 1
43 4014 01 0 001a 01 c0 00 bd nv-Bdizc 0
44 001a 8d 1 STA Abs 001a 01 c0 00 bd nv-Bdizc 0
44 001a 8d 1 STA Abs 001a 01 c0 00 bd nv-Bdizc 0
45 001a 8d 1 STA Abs 001b 01 c0 00 bd nv-Bdizc 0
45 001a 8d 1 STA Abs 001b 01 c0 00 bd nv-Bdizc 0
46 0100 00 1 BRK 001b 01 c0 00 bd nv-Bdizc 0
46 0100 00 1 BRK 001b 01 c0 00 bd nv-Bdizc 0
47 2004 00 0 BRK 001b 01 c0 00 bd nv-Bdizc 0
47 2004 00 0 BRK 001b 01 c0 00 bd nv-Bdizc 0
48 0101 00 1 BRK 001b 01 c0 00 bd nv-Bdizc 0
48 0101 00 1 BRK 001b 01 c0 00 bd nv-Bdizc 0
49 2004 00 0 BRK 001b 01 c0 00 bd nv-Bdizc 0
49 2004 00 0 BRK 001b 01 c0 00 bd nv-Bdizc 0
50 0102 00 1 BRK 001b 01 c0 00 bd nv-Bdizc 0
50 0102 00 1 BRK 001b 01 c0 00 bd nv-Bdizc 0
51 2004 00 0 BRK 001b 01 c0 00 bd nv-Bdizc 0
51 2004 00 0 BRK 001b 01 c0 00 bd nv-Bdizc 0
...
554 01fe 00 1 BRK 001b 01 c0 00 bd nv-Bdizc 0
554 01fe 00 1 BRK 001b 01 c0 00 bd nv-Bdizc 0
555 2004 00 0 BRK 001b 01 c0 00 bd nv-Bdizc 0
555 2004 00 0 BRK 001b 01 c0 00 bd nv-Bdizc 0
556 01ff 00 1 BRK 001b 01 c0 00 bd nv-Bdizc 0
556 01ff 00 1 BRK 001b 01 c0 00 bd nv-Bdizc 0
557 2004 00 0 BRK 001b 01 c0 00 bd nv-Bdizc 0
557 2004 00 0 BRK 001b 01 c0 00 bd nv-Bdizc 0
558 001a 8d 1 STA Abs 001b 01 c0 00 bd nv-Bdizc 1
558 001a 8d 1 STA Abs 001b 01 c0 00 bd nv-Bdizc 1
559 001b 14 1 001b 01 c0 00 bd nv-Bdizc 1
559 001b 14 1 001b 01 c0 00 bd nv-Bdizc 1
560 001c 40 1 001c 01 c0 00 bd nv-Bdizc 1
560 001c 40 1 001c 01 c0 00 bd nv-Bdizc 1
561 4014 40 0 001d 01 c0 00 bd nv-Bdizc 1
561 4014 01 0 001d 01 c0 00 bd nv-Bdizc 0
562 001d 10 1 BPL 001d 01 c0 00 bd nv-Bdizc 0
562 001d 10 1 BPL 001d 01 c0 00 bd nv-Bdizc 0
563 001d 10 1 BPL 001e 01 c0 00 bd nv-Bdizc 0
563 001d 10 1 BPL 001e 01 c0 00 bd nv-Bdizc 0
564 0100 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
564 0100 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
565 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
565 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
566 0101 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
566 0101 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
567 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
567 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
...
818 017f 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
818 017f 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
819 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
819 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
820 0180 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
820 0180 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
821 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
821 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
822 c001 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
822 c001 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
823 001d 10 1 BPL 001e 01 c0 00 bd nv-Bdizc 0
823 001d 10 1 BPL 001e 01 c0 00 bd nv-Bdizc 0
824 0181 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
824 0181 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
825 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
825 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
826 0182 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
826 0182 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
827 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
827 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
...
1074 01fe 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
1074 01fe 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
1075 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
1075 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
1076 01ff 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
1076 01ff 00 1 BRK 001e 01 c0 00 bd nv-Bdizc 0
1077 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
1077 2004 00 0 BRK 001e 01 c0 00 bd nv-Bdizc 0
1078 001d 10 1 BPL 001e 01 c0 00 bd nv-Bdizc 1
1078 001d 10 1 BPL 001e 01 c0 00 bd nv-Bdizc 1
1079 001e fe 1 001e 01 c0 00 bd nv-Bdizc 1
1079 001e fe 1 001e 01 c0 00 bd nv-Bdizc 1
1080 001f 00 1 001f 01 c0 00 bd nv-Bdizc 1
1080 001f 00 1 001f 01 c0 00 bd nv-Bdizc 1
1081 001d 10 1 BPL 001d 01 c0 00 bd nv-Bdizc 1
1081 001d 10 1 BPL 001d 01 c0 00 bd nv-Bdizc 1
1082 001e fe 1 001e 01 c0 00 bd nv-Bdizc 1
1082 001e fe 1 001e 01 c0 00 bd nv-Bdizc 1
1083 001f 00 1 001f 01 c0 00 bd nv-Bdizc 1
1083 001f 00 1 001f 01 c0 00 bd nv-Bdizc 1
```