Fix floppy access when overclocking is enabled - #360
Conversation
|
I also noticed that in any overclocking setup on the compact Macs, the floppy icon with the question mark flashes too quickly. This is timed by VIA T2 afaik. Note that they import DEFAULT_BUS_SPEED from MacII bus, which, of course, is incorrect. I also don't like the use of 16 MHz in terminology; there's Macs with many different clock speeds which makes it factually incorrect in the context of e.g. the VIA. I'm starting to wonder if a different approach may work better here: skipping bus.tick() from within the CPU itself. E.g. if the base speed is 8 MHz and you want to overclock to 32, only call bus.tick() every 4 CPU cycles. This will cause issues with wait states, though. To be accurate, I think wait states should then also be stretched. So 4 wait state cycles at 8 MHz become 16 at 32 MHz. This can also be achieved using the same mechanism (the CPU will just spinlock longer on BusResult::WaitState until bus.tick() is called again). |
Does Mac OS itself use hot loops to time IWM? |
|
Yes, seems it does: |
|
Do you think it would help to insert a CPU delay on accesses to DFF9FF? Or am I misreading the code? |
|
I inserted a bus-wait delay on accesses to IWM/SWIM registers. This seems to fix floppy access for overclocked macii and compact. Portable still fails. |
|
I fixed floppy booting for all of macii, compact and portable when overclocked. I wrote code to detect accesses to the IWM/SWIM registers and force them to run at 16MHz by inserting wait states. However, I'm not sure why I need to delay by 8 16MHz ticks instead of just 1 - there might be something conceptually wrong with this approach. As a result, floppy access is slower than it should be. |
|
I implemented a new throttling method. I'm turning off draft mode, please take a look! |
This PR makes the SWIM/IWM component run at native speed regardless of overclocking, fixing floppy access when overclocking is enabled.