Saving variables

General Chit Chat about Sinclair Computers and their Clones
Post Reply
Bill H
Posts: 163
Joined: Sat Nov 27, 2010 6:05 pm

Saving variables

Post by Bill H »

I had this thought yesterday, it is probably not possible, but the thought was:right now, on the zx81 / ts1000 if you want to save variables with your program you can but when you load it you have to do a goto to restart the program, running erases them. My thought was, since variables are right after the program code, could you not make a few pokes to the system variables to move the end of program / beginning of variable pointers ( sorry i forget the correct names) to past the variable data and the save. This would in essence make the variables program code as I don't think the rom looks at the programs when you load it for errors. You can then have the program make a few pokes when first run to restore the pointers and now the variables are accessible as variables.

Does this make sense or am I getting senile?

Bill H
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: Saving variables

Post by sirmorris »

Hi Bill,

Sounds plausible. The display file sits between the code and the variables and i wonder if this would have a bearing on things.

C
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: Saving variables

Post by PokeMon »

Bill H wrote:right now, on the zx81 / ts1000 if you want to save variables with your program you can but when you load it you have to do a goto to restart the program, running erases them.
I don't understand the problem. Why use RUN when you can use GOTO for not destroy variables ?
By the way you can save a program by entering SAVE through a line number in your program (e.g. with a defined key or function) and when the program is loaded from tape it automatically continues its run and not destroy defined variables. :)
Post Reply