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

cpc: saving a basic program hangs the emulator #104

Open
karlvr opened this issue Dec 31, 2024 · 0 comments · May be fixed by #105
Open

cpc: saving a basic program hangs the emulator #104

karlvr opened this issue Dec 31, 2024 · 0 comments · May be fixed by #105

Comments

@karlvr
Copy link

karlvr commented Dec 31, 2024

I have tried mounting a blank disk image (that I made using iDSK) and I've tried mounting a game DSK (Moon Base Alpha) and the result is the same. I can load from the disk but when I try to save to the disk, the emulator just hangs with the motor running.

This is the blank DSK I'm using in case that's useful.

blank.dsk.zip

This is reproducible by dragging and dropping blank.dsk into https://floooh.github.io/tiny8bit/cpc.html and then typing save"test.

I'm hoping to be able to save to the DSK and then download a modified DSK file but looking at the code it looks like DSKs are one way at the moment. It looks like it might not be too hard to reverse the _fdd_cpc_parse_dsk function though... any suggestions or warnings appreciated!

Debugging save attempt

The CPU appears stuck in a loop at &C924. It's checking the input port &FB7E, which is returning &90 but it's looking for >= &C0 to exit the loop. I'm going to try to find out what this means :-)

I see that &FB7E is the 765 FDC (internal) Status Register (https://www.cpcwiki.eu/index.php/I/O_Port_Summary)... which sounds like we're barking up the right tree.

That's lead me to upd765.h and the _upd765_read_status method and this comment:

    /* FIXME: data direction is currently always set as FDC->CPU,
       since the emulation doesn't support write operations
    */

I think I have found out why my saves aren't working!

OK, I'm quaking... I think I've just successfully implemented writing to the disk. I'll make a PR.

@karlvr karlvr linked a pull request Dec 31, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant