If you're colluding with BASIC and reading TOP from its workspace, you should also read PAGE from its workspace. The BASIC might not have PAGE set to OSHWM. The BASIC program is defined as going from PAGE to TOP, not from OSHWM to TOP. OSHWM is an OS thing, TOP is a BASIC thing.In the Autosave thread mentioned, part of the code sets up an OSFILE call to save the BASIC program in current memory, by reading the value of "PAGE" using an OSBYTE call, and reading the value of "TOP" from the BASIC workspace in zero page.
It's common to find programs have a self-save routine in them along the lines of:
DEFPROCs:OSCLI "SAVE myprog "+STR$~PAGE+" "+STR$~TOP:ENDPROC
and either the programmer or the program can do PROCs to save itself.
Statistics: Posted by jgharston — Sat Feb 08, 2025 9:34 pm