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

TI drifts in NTSC mode #733

Open
dansanderson opened this issue Sep 14, 2023 · 4 comments
Open

TI drifts in NTSC mode #733

dansanderson opened this issue Sep 14, 2023 · 4 comments
Labels
new New report, not classified yet

Comments

@dansanderson
Copy link
Contributor

Test Environment (required)
Platform: MEGA65
ROM Release: 920385
Core Commit: cae3b0b

Describe the bug
The TI timer variable counts inaccurately in NTSC mode.

To Reproduce

5 T=TI
10 ?TI-T:GOTO 10

Run this along with a stopwatch. In PAL mode, it matches. In NTSC mode, it drifts by about a second per minute.

Additional context
This was originally filed as MEGA65/mega65-rom-public#78 to research whether the ROM is setting registers correctly. We fixed an issue where TOD50 was not being set correctly in NTSC mode, but this didn't fix the drift, and would not have adequately explained the drift anyway. I don't know enough about expected behavior of the CIA to know if this is a core issue, but I don't have any active leads on changes that could be made in the ROM, so I'm creating a corresponding core issue for further research.

@dansanderson dansanderson added the new New report, not classified yet label Sep 14, 2023
@lydon42
Copy link
Member

lydon42 commented Dec 12, 2023

Something seems to be wrong here... if I change NTSC/PAL with freezer, then do clr ti, I always end up with 193 in DD0E. This seems to be wrong. Tested with development head and 920385.

Edit: and I know that TOD50 does work, as I discovered the problem while working on RTC tick detection in freezer...

@lydon42
Copy link
Member

lydon42 commented Dec 12, 2023

And it's 50Hz vs. 60Hz, which means if you have the wrong TOD50 setting you should be loosing a just over a second every ten seconds (this is what I was seeing in my 14 sec RTC tick test).

@lydon42
Copy link
Member

lydon42 commented Dec 12, 2023

In freezer TOD50 is manipulated correctly. The freezer switch function also manipulates frozen memory... but when I exit freezer, the restored system again has the old settings... but CIAs are saved to frozen memory, so it should be possible to manipulate them.

What confuses me is that ROM seems to set CIA1 and CIA2 TOD50 differently. Or is CIA1 not used as a timer and because of this the flag has no meaning?

@dansanderson
Copy link
Contributor Author

I only see references to CIA2 in the ROM code for TI, I don't know why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new New report, not classified yet
Projects
None yet
Development

No branches or pull requests

2 participants