VolksForth

Atari8bit-savesystem
Login

save-system

The word "save-system filename" saves the current VolksForth image to a compound file that can be loaded by Atari-DOS (COM-File).

It is important to use "save" to freeze the current state of the VolksForth image before saving!

: SAVESYSTEM
  $FFFF      $600 !
  ORIGIN 8 - $602 !
  HERE       $604 !
  FILE" W/O OPEN-FILE DROP 
  DUP $600 6 ROT 
  WRITE-FILE ( save header ) DROP
  DUP ORIGIN 8 - HERE 
      ORIGIN 8 - - 1+ ROT 
  WRITE-FILE DROP
  $02E0      $602 !
  $02E1      $604 !
  ORIGIN 8 - $606 !
  DUP $602 6 ROT 
  WRITE-FILE DROP 
  CLOSE-FILE DROP ;

' SAVESYSTEM ALIAS SAVE-SYSTEM

Todo: This implementation uses memory locations in page 6. It should be refactored to not use any external memory locations.