MEGA65 / mega65-freezemenu

Freeze Menu Program for the MEGA65
GNU General Public License v3.0
8 stars 11 forks source link

Remove infinite loops when attempting to clear "use real drive" flags #36

Closed johnwayner closed 2 years ago

johnwayner commented 2 years ago

Must be in hypervisor mode to clear the use real floppy flags. So this will not work and will hang the system.

They sometimes appear to work due to a hypervisor trap having earlier set the flags to zero (to show a .d81 listing).

There is a side effect to this change: If the internal disk is enabled and "No Disk" is selected without previewing or selecting a d81, the internal drive will still be active. The hypervisor needs to clear these two bits before launching the freezer (according to Paul).

gurcei commented 2 years ago

Heya @johnwayner, I was curious to get familiar with this matter. Are there any steps I can try to replicate the issue prior to fix, and then witness the improved behaviour after the fix?

johnwayner commented 2 years ago

If you enter the freezer with the real floppy in use (configured as default or previously selected via freezer), or while using the freezer select the real floppy, if you try to then exit the freezer WITHOUT the floppy selected (say you changed your mind and went back to select a d81 instead of the floppy), then the freezer will hang when exiting. The loops I removed try to set protected bits that only the hypervisor can change. Thus the loops will spin forever.

gurcei commented 2 years ago

Ok, I can confirm @johnwayner's fix resolves the issue.

I feel happy to merge this in. Maybe just one thing lingering in my mind was if there was some intent behind whoever added this in. Sniffing around in Git, seems like @frehwagen added this change in on commit# 795e407:

Fixed operation with real floppy drive 1 selection, made real floppy control more reliable. Not sure if it now work 100%, feels like sometimes set values become lost in $D6A1.

Maybe I'll just give Falk some time to comment on this, in-case he recalls more of the backstory on it (and if it perhaps related to Geos?)

Hmm, the commit was from 21/11/2019, so a while back, possibly when the core was less stable, so I do wonder, if it indeed was added in relation to Geos support, does Geos work fine without it now?

gurcei commented 2 years ago

Well, I gave Geos a test drive now, it seems to be behaving itself for me, so I'm thinking it's safe to merge in now. If falk has any concerns, we can come back to this.