Personal Computer News


Save Your QL Variables

 
Published in Personal Computer News #079

Save Your QL Variables

Not many people have noticed that the Sinclair QL does not save the variables when a Basic program is saved.

This short program enables variables to be saved onto Microdrive two. The datasave procedure is used to save variables (just 'A in this case) and dataloads them back.

   2 DEFine PROCedure datasave
   3 DELETE mdv2_golf data
   4 OPEN_NEW #9,mdv2 golf
   5 PRINT#9,a
   6 REMark print#9.b and so on...
   7 CLOSE#9
   8 END DEFine
   9 REMark
  10 REMark
  11 DEFine PROCedure dataload
  12 OPEN_IN #9,mdv2 golf_data
  13 INPUT#9,a
  14 REMark input#9.b and so on...
  15 CLOSE#9
  16 END DEFine

To save more variables, just add more lines, e.g. B

   6 PRINT#9,B
  14 INPUT#9,B

Richard Sherford
Selsey, W. Sussex

Richard Sherford