Sinclair ZX81 (16K only - probably*) File size according to EightyOne - 163** bytes (yes 163!) Byte count undetermined
Firstly, we should make our file, so using direct mode, type:
To make sure that they are there, print them to the screen, as follows:
This should appear on the display:
Now, to save this to file (as the variable stack is saved along with other important memory locations used by the interpreter), simply type:
If you're using a real ZX81 then press play and record on tape, whilst emulators like EightyOne will create a tape image for you.
Now clear the RAMs with:
RAND USR 0
Now rewind the tape (or the emulator should auto-detect and start the virtual tape from the beginning), and type:
So our file is back in memories, so we need to add it together. Simply:
And the answer is:
*I specify 16K because any less and the ZX81 will typically rearrange the memory and this could affect the var stack (mostly to do with collapsing the DFILE), as the DFILE is static with 16K then this should be less of an issue.
**The ZX81 file is saving more than just the VAR stack of three whole variables above, and although each number appears to be an integer, the ZX81 is storing these variables as 24-bit floating point numbers rather than 1 byte integers.