Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the dot clock's timing source? #1612

Open
ReiquelApplegate opened this issue Aug 19, 2024 · 4 comments
Open

What is the dot clock's timing source? #1612

ReiquelApplegate opened this issue Aug 19, 2024 · 4 comments

Comments

@ReiquelApplegate
Copy link

In ares/sfc/ppu/counter/inline.hpp:

//one PPU dot = 4 CPU clocks.
//
//PPU dots 323 and 327 are 6 CPU clocks long.

According to fullsnes the dot clock is the master clock divided by 4, not the cpu clock divided by 4. If it were the cpu clock wouldn't switching between fastrom/slowrom change how many dots appear on a scanline?

@LukeUsher
Copy link
Member

SlowROM and FastROM do not change the cpu clock itself but the ROM access speed; this still has the effect of slowing down execution but doesn’t impact other timing. Specifically the cpu inserts additional wait states when accessing slow ROM to give it chance to stabilise.

See

alwaysinline auto CPU::wait(n24 address) const -> u32 {

@ReiquelApplegate
Copy link
Author

CPU::wait can return either 6, 8, or 12. Aren't those the number of master cycles a single CPU cycle takes?

@LukeUsher
Copy link
Member

The first branch in wait specifically takes romspeed into account; where romspeed is set to the number of wait states configured for the memory region.

@ReiquelApplegate
Copy link
Author

Yes but shouldn't the comment instead read:

//one PPU dot = 4 master cycles .
//
//PPU dots 323 and 327 are 6 master cycles long.

This quote from the emu author is why I think that:

(for others: a cycle is 6, 8 or 12 master clocks depending on the memory area and FastROM setting)

source: https://forums.nesdev.org/viewtopic.php?p=104265#p104265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants