While working on an issue on old FutureDisk BASIC code, I noticed that usage of the CLEAR command moves the BASIC file work area, the string work space and the stack pointer. BASIC changes the values for HIMEM (#FC4A), MEMSIZ (#F672) and STKTOP (#F674). But BASIC does not store the initial value.
If I want to restore the BASIC work area to initial setting (i.e. after boot at prompt) I cannot find a correct way to do it.
On MSX 1,2,2+ and TurboR started with SHIFT (i.e. diskrom skipped), the CLEAR command to go back to initial would be:
CLEAR 200,&HF380.
This is documented as &HF380 is the bottom of the BIOS work area.
The documentation for the DOS 1 diskrom available shows address #F349 containing the lowest address in use by the disk work area.
However, experimentation shows that probably disk basic adds another 218 bytes to the work area that I cannot find any reference for in any documentation.
Coincidentally the jump entry for the BSAVE command at #F37A contains the initial value of HIMEM after boot at prompt.
As a workaround you could use the address at #F37B as address for the CLEAR command.
But this does not look like the right way.
For DOS2 I have no clue at all how to reconstruct the BASIC work area. The disk work area did not reveal any useful address.
Any ideas from the experts?
