-
Notifications
You must be signed in to change notification settings - Fork 55
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
A library should be written to save and restore BASIC ZP on commodore
#343
Comments
I agree. One small side note - perhaps the more appropriate behavior for a C= program would be to jump to the reset vector, as opposed to infinitely looping? |
This came up in discussion, and it's only a slight preference on my part. The benefit of warm restart is that the machine is interactive on exit without a hardware reboot; the disadvantage is that any output on screen is cleared. Metaphorically, there isn't really an environment to return to if BASIC is replaced, so looping is vaguely akin to a kernel panic or exit, as it retains a message indicating what happened. This should also just be a question of defaults; it should already be relatively straightforward to provide reset on exit behavior (perhaps this would also make a good library in the SDK?). |
This may be too obvious to write, but it seems natural that more platforms than Commodore could benefit from having the option to save and restore zero page. Seems like the sort of thing you might want to opt into, per platform or per project. Personally, I feel that graceful exit should be the default on all platforms, but reasonable people may disagree. |
If saving/restoring a ZP region can guarantee a clean exit, then:
That limits the desired applicability of the technique somewhat. It's not particularly applicable on Atari DOS programs, for example, since the program may continually interact with the DOS, and the DUP (menu) can be freely overwritten, since the DOS detects this and reloads it on exit. |
For context, see #341 and #315.
Our current
commodore
targets clobber BASIC ZP. This does seem a reasonable default behavior for a C program: it's like BASIC, but unlike the KERNAL, so it should clobber BASIC but preserve the KERNAL. Thecommodore
targets used to exit by returning to a possibly broken BASIC, but #341 changes them to infinitely loop instead.It may still be desirable to be able to return to BASIC. This would either require not using the BASIC area, or saving and restoring the BASIC ZP to a buffer. The latter seems more appropriate for a C program. Accordingly, we should see if there's a way to create a library, includable with
-lsave-basic
, that can save and restore ZP before and aftermain
, across the variouscommodore
targets.The text was updated successfully, but these errors were encountered: