User:Ulfalizer: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
(Add quick link to clocks section of tutorial)
(Add interrupt timing info)
Line 1: Line 1:
= Misc. timing stuff brought together in one place =
= Misc. timing stuff brought together in one place =


== Read (LDA $1234, NOP) ==
== Reads and writes ==
 
=== Read (LDA $1234, NOP) ===


http://www.qmtpro.com/~nes/chipimages/visual2a03/?graphics=false&logmore=Execute,phi2&a=0&d=ad3412ea&steps=25
http://www.qmtpro.com/~nes/chipimages/visual2a03/?graphics=false&logmore=Execute,phi2&a=0&d=ad3412ea&steps=25
Line 28: Line 30:
</pre>
</pre>


== Write (LDA #$AB, STA $1234, NOP) ==
=== Write (LDA #$AB, STA $1234, NOP) ===


http://www.qmtpro.com/~nes/chipimages/visual2a03/?graphics=false&logmore=Execute,phi2&a=0&d=a9ab8d3412ea&steps=29
http://www.qmtpro.com/~nes/chipimages/visual2a03/?graphics=false&logmore=Execute,phi2&a=0&d=a9ab8d3412ea&steps=29
Line 55: Line 57:
</pre>
</pre>


== Read/write observations ==
=== Read/write observations ===


* Values appear to be read during '''φ2''' ('''db''x''''' pins buffered on '''cclk''').
* Values appear to be read during '''φ2''' ('''db''x''''' pins buffered on '''cclk''').
* '''db''' changes during '''φ2''' for writes too.
* '''db''' changes during '''φ2''' for writes too.
* [[Visual_circuit_tutorial#Clocks|Clocks section of tutorial]].
* [[Visual_circuit_tutorial#Clocks|Clocks section of tutorial]].
== [[CPU_interrupts|Interrupts]] ==
Sampled during '''φ1''': '''irq''' inverts into 1599, which is driven low by '''cclk''' (i.e., always driven low during '''φ2''').
=== Visual 6502 links ===
Smallest IRQ assertion interval that will trigger an IRQ for LDA #FF:
http://visual6502.org/JSSim/expert.html?logmore=Execute,irq&a=0&d=58A9FF1890FE&irq0=5&irq1=6&steps=20
Ditto for LSR $AB:
http://visual6502.org/JSSim/expert.html?logmore=Execute,irq&a=0&d=5846AB1890FE&irq0=11&irq1=12&steps=20
Ditto for LSR $AB with NMI instead of IRQ:
http://visual6502.org/JSSim/expert.html?logmore=Execute,nmi&a=0&d=58461890FE&nmi0=11&nmi1=12&steps=20


== M2 duty cycle ==
== M2 duty cycle ==

Revision as of 19:41, 5 June 2013

Misc. timing stuff brought together in one place

Reads and writes

Read (LDA $1234, NOP)

http://www.qmtpro.com/~nes/chipimages/visual2a03/?graphics=false&logmore=Execute,phi2&a=0&d=ad3412ea&steps=25

Tick-by-tick from http://nesdev.org/6502_cpu.txt interleaved with steps from Visual 2A03:

 #  address R/W description
--- ------- --- -------------------------------------------------
 1    PC     R  fetch opcode, increment PC
    ab    db  rw  pc    phi2
    0000  ad  1   0000  0
    0000  ad  1   0000  1
 2    PC     R  fetch low byte of address, increment PC
    ab    db  rw  pc    phi2
    0001  34  1   0001  0
    0001  34  1   0001  1
 3    PC     R  fetch high byte of address, increment PC
    ab    db  rw  pc    phi2
    0002  12  1   0002  0
    0002  12  1   0002  1
 4  address  R  read from effective address
    ab    db  rw  pc    phi2
    1234  00  1   0003  0
    1234  00  1   0003  1

Write (LDA #$AB, STA $1234, NOP)

http://www.qmtpro.com/~nes/chipimages/visual2a03/?graphics=false&logmore=Execute,phi2&a=0&d=a9ab8d3412ea&steps=29

Tick-by-tick from http://nesdev.org/6502_cpu.txt interleaved with steps from Visual 2A03:

 #  address R/W description
--- ------- --- ------------------------------------------
 1    PC     R  fetch opcode, increment PC
    ab    db  rw  pc    phi2
    0002  8d  1   0002  0
    0002  8d  1   0002  1
 2    PC     R  fetch low byte of address, increment PC
    ab    db  rw  pc    phi2
    0003  34  1   0003  0
    0003  34  1   0003  1
 3    PC     R  fetch high byte of address, increment PC
    ab    db  rw  pc    phi2
    0004  12  1   0004  0
    0004  12  1   0004  1
 4  address  W  write register to effective address
    ab    db  rw  pc    phi2
    1234  12  0   0005  0
    1234  ab  0   0005  1

Read/write observations

  • Values appear to be read during φ2 (dbx pins buffered on cclk).
  • db changes during φ2 for writes too.
  • Clocks section of tutorial.

Interrupts

Sampled during φ1: irq inverts into 1599, which is driven low by cclk (i.e., always driven low during φ2).

Visual 6502 links

Smallest IRQ assertion interval that will trigger an IRQ for LDA #FF: http://visual6502.org/JSSim/expert.html?logmore=Execute,irq&a=0&d=58A9FF1890FE&irq0=5&irq1=6&steps=20

Ditto for LSR $AB: http://visual6502.org/JSSim/expert.html?logmore=Execute,irq&a=0&d=5846AB1890FE&irq0=11&irq1=12&steps=20

Ditto for LSR $AB with NMI instead of IRQ: http://visual6502.org/JSSim/expert.html?logmore=Execute,nmi&a=0&d=58461890FE&nmi0=11&nmi1=12&steps=20

M2 duty cycle

The M2 duty cycle is 5/8 - forum post and CPU pin-out page. Low for 9/8 PPU cycles, high for 15/8 PPU cycles. Low for 4.5 master cycles, high for 7.5 master cycles.