On a Commodore 64, I have a custom interrupt routine running in parallel with a main program, and I need to detect if the KERNAL is currently performing a LOAD or SAVE operation via I/O. Unfortunately, I cannot modify the main program's code to signal the start and end of these operations because the main program comes from an external source with a fixed codebase.
I'm looking for a minimum-invasive solution to detect when the LOAD or SAVE routine is active. Specifically, I would like to know:
- Is there a Zero Page variable or memory location that indicates the current status of a LOAD/SAVE operation?
- I noticed that the status variable at address $90 sets Bit 6 ($40 == EOF) after a LOAD operation completes, but this doesn't help in detecting when a LOAD begins, and its value is $00 after a reset.
- I prefer not to hook into the vectors if possible, as I want to keep my solution lightweight and avoid extensive modifications.
Is there a reliable way to detect the active state of the KERNAL I/O routines without modifying the main program?
I am looking preferably for a solution that would also work on other CBM 8bit machines (Commodore Pet, VIC 20, Plus/4, C128, etc.).