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

Change CPU cycles per frame...again #83

Closed
Tracked by #197
torch2424 opened this issue Apr 25, 2018 · 2 comments
Closed
Tracked by #197

Change CPU cycles per frame...again #83

torch2424 opened this issue Apr 25, 2018 · 2 comments
Assignees
Labels
bug Something isn't working Core/Wasm Issues concerning the core library of Wasmboy

Comments

@torch2424
Copy link
Owner

https://github.com/torch2424/wasmBoy/blob/master/wasm/cpu/cpu.ts#L63

Currently it is timed by scanlines. But I think this is wrong.

screen shot 2018-04-25 at 10 45 50 am

The keyword here is "normally" suggesting that it can take more or less, and in Mode 1, it only takes a few cycles.

And the Realboy Blog Post states: "Because the Game Boy’s CPU is clocked at 4194304hz (that is, 4194304 cycles per second)". 4194304 / 60 = 69905.06666666667 cycles per frame.

Which matches up with codeslinger's reasoning: "According to game pan docs site the amount of clock cycles the gameboy can exectue every second is 4194304 which means that if each frame we update the emulator 60 times a second the each frame will execute 69905(4194304/60) clock cycles. This will ensure the emulator is run at the correct speed".

@torch2424 torch2424 added bug Something isn't working Core/Wasm Issues concerning the core library of Wasmboy labels Apr 25, 2018
@torch2424 torch2424 self-assigned this Apr 25, 2018
@torch2424 torch2424 changed the title Investigate how many CPU cycles per frame...again Change CPU cycles per frame...again Apr 25, 2018
@torch2424
Copy link
Owner Author

Actually cycles are right, just need to fix comment. Gameboy doesn't run at 60fps, runs at like 59.73 fps

@torch2424
Copy link
Owner Author

Oh this is already fixed 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Core/Wasm Issues concerning the core library of Wasmboy
Projects
None yet
Development

No branches or pull requests

1 participant