----------------------------------------------------
 Savelib 1.0 by Mikael Sundberg <inzomniac@usa.net>
----------------------------------------------------

  Warning! bad english..

WHAT IS SAVELIB?

  Savelib is a library for saving highscores, statistics and other 
  data to TIOS strings. This will allow programs to be archived and 
  still save data between executions.

WHY USE SAVELIB?

  * VERY easy to add support to existing programs
  * Allows your programs to be archived and still save highscores etc.
  * Configurable, lets user select which folder to save in etc..
  * Data is saved encrypted (Make's it harder to cheat (VERY light encryption))
  * Data can be in a BSS block (smaller executable)
  * Rather small, less than 2k in size

HOW DOES IT WORK?

  Do this if you would like to add support to an existing program:

  1. Add a label above the data you wish to save
  2. Add a label below the data you wish to save
  
     EXAMPLE:

     sl_start
     highscore  ds.b 100
     max_score  dc.l 0
     sl_end
  
  3. Add a string containing the name of the file to save to
  
     EXAMPLE:
     
     sl_name    dc.b "sample",0 ; Save in a file named "sample"
  
  4. Add savelib::eloadm macro at the wery beginning of you program
     with your new labels as parameters

     EXAMPLE: 
     
     _main      savelib::eloadm sl_name,sl_start,sl_end
                ..
                ..
                
     (Make sure you don't jumb back to the _main label, if 
      you do your data will be loaded again)

  5. Add savelib::esavem macro at the wery end of you program
     same parameters as savelib::esavem macro

     EXAMPLE: 
     
                ..
                ..
                savelib::esavem sl_name,sl_start,sl_end
                
                rts ; last RTS that will terminate program

SAMPLES

  The easiest way to learn how to use the library is to look at the samples

  samples\sample1 : Loads data from a file and saves it back again
  samples\sample2 : Same as sample1, but data is in a BSS block
  samples\sample3 : Uses custom folder and flags

OTHER FILES

  savelib.h     ; Header file
  savelib.89z   ; The library
  savelib.txt   ; This document
  slconf.89z    ; Configuration utility
  sllog.89z     ; View the 10 last error messages (for debugging)

MACROS

  There are four macros in savelib.h that simplifies the use of savelib. 

  * savelib::savem
	
    USAGE: savelib::savem <name>,<start>,<end>
      esavem and savem saves data to a file named as the string at the label
      <name>. The data is read from the <start> label until the <end> label.

  * savelib::esavem

    Does the same thing as savelib::savem but it will also diplay an error 
    message to the user if something goes wrong.

  * savelib::loadm

    USAGE: savelib::loadm <name>,<start>,<end>
      eloadm and loadm loads data from a file named as the string at the label 
      <name>. The data is written from the <start> label until the <end> label.

  * savelib::eloadm

    Does the same thing as savelib::loadm but it will also diplay an error 
    message to the user if something goes wrong.

FUNCTIONS

  Look in savelib.h for function parameters and return values

  * savelib::load    -  loads data from file
  * savelib::save    -  Saves data to file
  * savelib::errstr  -  Get error string
  * savelib::errmsg  -  Show error message

VARIABLES

  * savelib::oflags  -  Pointer to custom flag-byte (or 0 if no custom flags)

    Lets the developer override the default flags. write the address 
    to the new flags to this variable. It will be cleared after every 
    call to a savelib function, so you have to set it every time you want 
    to use custom flags.

    The flags are:
    
    bit 0: Disable savelib
    bit 1: Autocreate folder
    bit 2: Hide all created files
    bit 3: Ignore file not found error
    bit 4: Ignore all errors
    bit 5: - unused -
    bit 6: - unused -
    bit 7: - unused -

  * savelib::ofolder -  Pointer to custom folder (or 0 if no custom folder)

    Used in the same way as oflags, but it shold point to a folder name instead 
    (null-terminated).

ERROR CODES

   These messages can be obtained by calling savelib::errstr (look in savelib.h)

   0: Operation succesfull
   1: Error creating file
   2: Wrong filetype
   3: Corrupt handle
   4: Data error (size < 0)
   5: Folder not found
   6: File not found
   7: Error writing to file
   8: Error reading from file
   9: Error resizing file
  10: Too much data
  11: Error creating folder
  12: File already exists
  13: Size mismatch
  14: Unknown error

HISTORY

  1.0: * First public release
       * Fixed some bugs

  0.2: * Added ofolder and oflags that will let the developer override 
         the default folder and flags
       * Rewrote many functions

  0.1: * First version... buggy..

NOTE

  Use this library at you own risk. I can't be held responsible
  for any damage this software may cause.
  
----------------------------------------------------
 Savelib 1.0 by Mikael Sundberg <inzomniac@usa.net>
----------------------------------------------------