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

MEGA65: make CPU "clock-cycles per opcode" emulation more precise #303

Open
lgblgblgb opened this issue Oct 13, 2021 · 0 comments
Open

MEGA65: make CPU "clock-cycles per opcode" emulation more precise #303

lgblgblgb opened this issue Oct 13, 2021 · 0 comments
Assignees

Comments

@lgblgblgb
Copy link
Owner

lgblgblgb commented Oct 13, 2021

Currently, most of opcode execution assumes that clock cycles/opcode is always the same as with C65, which is: some given number for "fast" (C65-fast, 3.5MHz) and "slow" (C64-kind-of) timing, but that's all. However there is serious discrepancy here:

  • At 40MHz mode, on MEGA65, some opcodes need additional cycle (cycles??)
  • 32-bit addressing opcodes should take account the fetch for the "BP pointer" which is currently not in Xemu!
  • maybe, 32 bit data ("Q") opcodes takes more time to execute (even not counting the time needed for the "prefixes" which is already emulated by Xemu that those take time)
  • probably in all "modes"/opcodes where it applies: conditional opcodes (ie sometimes needs more - or less?? - time, depending on things like branch is taken or not, and similar cases) does not take account the proper result

Because these factors are largely ignored currently by Xemu, Xemu seems to be too fast in many cases compared to a real MEGA65. Also please note that even with C65-stuff only at 3.5MHz, it must be checked, that all opcodes are OK from this cycles respect!

All of these, result in complains that Xemu seems to be faster in certain cases than a real MEGA65, especially noticeable when people do benchmarks on MEGA65 but having only the emulator to test with, which is later compared to the real thing, causing surprises.

For the 32-bit stuff though, first many missing opcodes needs to be emulated at all ... See: #202

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

No branches or pull requests

1 participant