-
Notifications
You must be signed in to change notification settings - Fork 83
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
[C64] implement 2Mhz CPU speed for C128 running in C64 mode #101
Comments
It'll also affect SDRAM timings, not sure if the current controller can cope with that. Also it shouldn't clash with VIC II memory access, so if 2MHz is enabled, VIC II should be disabled. Then the VIC memory cycle can be used for the 8502. |
As far as i understand this would not need ram timing changes. Instead the cpu just also gets the vic memory slots assigned. The vic would then just display garbage while the cpu is running at 2 Mhz which also happens on the real c128 in c64 mode. So in thery there shouldn't be many things to change. But i am not sure it's worth tje effort and even less the confusion this option may cause with many users. |
Yepp, probably it's enough to have a second cpuEnable together with enableVic, but set cpuHasBus to 1 in the VIC II cycle, too. |
Experimented with turbo mode, but at the end you have to switch back to 1 MHz mode if the CPU does IO to CIA, SID, etc... because at 2MHz these can miss reads and writes. And also have to adjust these peripherals CE (do the clock stretching). The result however was not very reliable, so at the end I gave up on this. |
i had a quick look at c128 schematics, looks like the cpu is always clocked at 2mhz, i have to verify this with an oscilloscope, the 2mhz line go to MMU too, then there are some logic chips that drive the RDY signal of cpu, i think that when in 1mhz mode the cpu is somehow halted for 1 cycle, so it is acting like is feeded with 1 mhz clock. i found this interesting article about pheriperal driving with 2mhz 6502 |
Halting with RDY is not the same as giving it a 1 MHz clock, for example RDY doesn't stop a write cycle. |
ok i investigated a little further, the cpu is not actually clocked @2mhz forever, and when the cpu is "forced" @2mhz (for example using FAST command on c128) it do not stay @2mhz forever, the clock line return @1Mhz during dynamic ram refresh and during i/o access. some interesting infos are found in C128 service manual (pag 33 and 34): |
That make sense, actually that's what I deduced. But not trivial to implement. |
I finally added this feature. Looks like the 1541 doesn't work with it, I wonder if it's the same with a C128 - 1541 combo. |
there are some games (notably the new "Super Mario Bros") that are able to take advantage of the 2Mhz CPU speed that you can get when running the C128 in C64 mode.
I think it would be nice if we have this option in the MiST core too (e.g. "Enable 2Mhz 8502: Off;On;")
I tried to code it myself but got lost in the fine details of the state machine,
sysCycleDef
and the intricate jungle of enable signals. I thought it would be as easy as adding an extra CPU cycle, but of course it wasn't.Summary of the 2Mhz mode:
$D030
, otherwise the register is always$FF
1
=> 2Mhz speed is active (not exactly 2Mhz, it's just that clock speed is doubled)1
When running at 2Mhz, the VIC-II can't cope with the new speed and displays garbage in the active area, but borders are ok. Games usually enable it during the blanking/border periods.
All other chips receive an effective 1Mhz frequency:
The text was updated successfully, but these errors were encountered: