BKUP Version 4.0 by Bob Apodaca (bapodaca@mit.edu)     Release Date: 08/17/94

Size:  3,099 bytes  Checksum: # 01EBh

This program can be distributed freely provided that the original 
instructions remain intact and unaltered.

This program is written entirely in system-rpl and is intended to make a backup
of any port(s) the user specifies.   There are options to save the stack  
and LASTARG, supplying a default name for the backup file, backing up flags,
backing up HOME, as well as xmodem support.  These options are selectable by a
menu system similar to the IOPAR menu.  It has been tested on an HP48GX Rev M.
and a HP48GX Rev R with 128k of unmerged HP memory in port 1.  It is believed
to fulfill its task, but the author does not assume any responsibility for
*anything*.


Requirements
------------

    You only need enough memory to store your flags, a list of library
    numbers, and the stack into a global variable.
    
    Depending which version of the HP48 you have, you may wish to use
    STOFIX (Library 1222), Xmodem (Library 555), and/or FXRECV.

    You also need a computer that is capable of going into Kermit server mode,
    and/or an IBM compatible that can run XYSRVR91.
    
    The following programs are currently available:
    
    Program         Location            Path                    Name 
    -------         --------            ----                    ----
    STOFIX          cbs.cis.com         pub/hp48g/utilities     stofix.zip
    FXRECV          Goodies Disc 9      HP                      fxrecv
    XYSRVR91        cbs.cis.com         pub/hp48g/uploads       xysrvr91.zip          
    Kermit 3.01     HP Back to Sch      fileman                 kermit.exe
    
    
Features
--------

	1. Compatible with all versions of the HP48 series.
    2. Only backs up the port(s) specified by the user.
	3. Can be executed from any subdirectory, it is not confined to HOME.
    4. Sends all libraries to the serial port without storing them in 
       a global variable.  If these libraries have names greater than 8
       characters, only the first 8 characters of the name are sent.
    5. Can also backup the entire stack and LASTARG so they can also be
	   restored when your HP is restored.
    6. Simple-to-use user interface.
    7. Supports more than one transfer protocol.
    8. Reminds you when you made the your last backup.
    9. Automatically does a warmstart if any libraries are restored.

    
Revision History
----------------

  Improvements in Version 4.0:
    
    1. Complete translation from user-rpl to system-rpl.  This has made
       the program more compact and fast.
    2. Made the program look for STOFIX, I finally realized that not everyone
       is going to own a rev. R HP48GX.
    3. The program can now send libraries without having to store them in a 
       global variable.  This eliminated the need to have enough memory to
       move the largest library into a global variable.
    4. The ports to be backed up are entirely determined by the user.  These
       are specified in BKPAR.
    5. Add multi-protocol capibility; kermit gets to be very slow when you have
       a lot of memory to backup.
    6. Abandoned the "ATLIB" program and associated programs.
       
  Improvements in Version 3.01:
    1. Removed an EVAL command that would execute programs when trying
       to put them back in the correct port.

  Improvements in Version 3.0:
	1. Added BKPAR to allow user to set program features.
	2. Added a user interface to allow user to select BKUP features.  
	   This interface is similiar to the ones built into the HP48 series.
	3. Made the library attaching program to it will work anytime a 
	   warmstart occurs.
	4. Rewrote code so that libraries in any other port than 0 are sent
	   to the IO port to be backed up.  
	5. Added capibility to back up backup objects.  If these backup 
	   objects have a name greater than 8 characters, only the first
	   8 characters are sent to the IO port.
	6. Feature to check to see if there will be enough memory to make 
	   a backup.
	7. Added capibility to backup stack and LASTARG.  
  
  Improvements in Version 2.0
	1. The program no longer assumes that if port 1 is unavailable that
	   port 2 will also be unavailable.  However, it assumes that if 
	   port 3 is unavailable, any ports after it will be unavailable.
	2. It distinguishes between merged RAM, independent RAM, and ROM.
	3. After detaching all libraries, it reorganizes the current 
	   directory.  This is handy when you actually have to use the 
	   backed up file: you don't have to search around the directory
	   to execute RESTO.
	4. It checks the objects returned by PVARS to make sure they are 
	   libraries before it tries to store them in the current directory.
	5. There is now a feature to attach libraries to a user specified
	   directory.  This is useful for those libraries that automatically
	   attach themselves to HOME and for libraries that don't
	   automatically reattach after a warmstart.
	6. When the program is finished, it makes four tones to notify the
	   user that the backup process is finished.
	7. LASTARG is disabled enliminating a DROP error in the IFEER loop.
	8. The method of storing the libraries was improved so now a list
	   of the variables that the libraries was stored in is no longer
	   needed.
	9. If there are no libraries on your HP48, a backup can still be 
	   made successfully.
    10. Because of improvements 1, 3, 4, and 5 the execution time is 
	   longer and the code is longer as well.


Future Versions
---------------

       If you have any ideas, send e-mail to: bapodaca@mit.edu
       

Installation
------------

	1. Download the BKUP directory to your HP48.
    2. Go into the BKUP directory.  There should be seven programs in 
	   the following order:
	   
       |BKUP| |RESTO| |CNFG| |INFO | |FLNM | |TG2N |
       
       |BKPA|  

	   You are finished installing BKUP.


Configuring BKUP
----------------

	   Press the softkey associated with CNFG.  You should see the 
	   current settings.  The following are the default settings:

       DAY MM/DD/YY HH:MM:SSA
       Back Up From:0  To:0
       Save Stk & Lastarg:        Yes
       Include P##MMMDD.BAK:      Yes
       Save Flags:                Yes
       Protocol:HP48 Kermit                  
       Archive HOME:              Yes 
       |PORT|STK|FLNM|FLAG|PROT|HOME|

       Press the corresponding key to toggle through program options.  Press
       ATTN to exit the program.  Any other key will give a BadKey beep.
       
       Key      Settings                  Effect
       ---      --------                  ------
       
       PORT     0 <= PORT <= 33
       
       STK      0 = Don't Save Stack      The program will Clear the Stack
                1 = Save Stack            The stack will be saved.
                
       FLNM     0 = Don't use FLNM prg    The user will be prompted for a
                                          filename to be sent to the PC.
                1 = Use FLNM prg          The filename generated by the FLNM
                                          program will be used and sent to 
                                          the PC without interupting the
                                          program execution.
                                            
       FLAG     0 = Don't Save Flags
                1 = Save Flags            
                
       PROT     0 = HP48 Kermit           Files will be sent & recieved with 
                                          the built in Kermit protocol.
                1 = HP48G(X) Xmodem       Files will be sent & recieved with
                                          the HP48G(X) Xmodem protocol.
                2 = HP48G(X) Xmodem       Files will be sent using HP48G(X) 
                    & FXRECV              Xmodem and will be recieved with
                                          FXRECV.  Also, while the calculator
                                          is being backed up, a copy of FXRECV
                                          will be sent.
                                          
                3 = Library 555 Xmodem    File will be sent using the xSEND &
                                          xRECV commands.  Note: this library
                                          is assumed to be in port 0.  Also,
                                          since this program is a part of the
                                          backing-up/restoration process, it
                                          will not be restored by the RESTO
                                          program.  However, BKUP will send a
                                          copy of it to your PC.
                                         
       HOME     0 = Don't ARCHIVE HOME    A list containing the library numbers
                                          backed up, flags, and stack will be
                                          send to the PC and saved in the
                                          current directory.
                
                1 = ARCHIVE HOME          Home will be archived using the
                                          selected protocol and a list
                                          containing library numbers backed up,
                                          flags, and stack will be stored in the
                                          current directory (but not sent to
                                          your PC).
                                                                                  
       NOTE: When STOFIX is present in port 0, it will be used for storing
             objects in your HP.  Also, STOFIX will be sent to your PC, but
             it will not be restored.  When restoring your HP48's port objects,
             this library should be placed in port 0 before the RESTO program
             is exectued so the RESTO program can access the "sto" command.
                                          

Backing-Up your HP48
--------------------

    1. Press the softkey associated with the BKUP program.


Restoring a backed up file
--------------------------

	1. Make sure IOPAR is set correctly.

    2. Download the backed up file (let's call it HP48.BAK) to your HP.
       If you Archived HOME, this will be a backup HOMEDIR.  In this
       backup there will be a file called HP48.BAK.  It is a list
       containing your flags, stack, and library numbers.
       
       If you did not Archive HOME, then download HP48.BAK to your HP48.
       It will be a list of your flags, stack, and library numbers.
    
    3. If you Archived HOME, recall 'HP48.BAK' to the stack.  You 
       should see "Backup HOMEDIR"  or "Backup Homedir" on level one of the
       stack.  Execute RESTORE (the user-rpl command).  

    4. Go into the BKUP4 directory and put 'HP48.BAK' on the stack.  Note:
       this is the name 'HP48.BAK' on the stack, NOT the contents of
       'HP48.BAK'.   Put your computer is Kermit server mode or double
       check that XYSRVR91 is ready.
	
    5. Execute the RESTO program.
	
    6. You are finished.  If you selected to have the stack saved, after a
       Warmstart, press the STK softkey and your stack will be restored.

       If you wish to remove libraries or objects affiliated with
       a port, simply go to your dos prompt and type:

       > del *.p

       Where p is the port number of the backed up objects.  This will
       make cleaning up your hard drive a snap.


Streamlining BKUP
-----------------

	  If you have only a small amount of memory and or don't wish to use
	  all the feature built in to BKUP then do the following:

      Execute CNFG to configure BKUP.  Set the "Use P##MMDD.BAK" options to
      "No".  Select the port(s) you wish to backup.  After you have completed
      the following instructions, and you wish to change the port to be backed
      up, change the first two numbers in BKPAR.  Remember, the end port MUST be
      greater than OR EQUAL TO the start port.

	  Now, PURGE the following list:
	  
      { CNFG INFO FLNM }

      This is the absolute smallest ( ~1500 bytes ) you can make BKUP, if you
      delete anything else the program will not work properly (if at all).


Thanks to
---------

	Jason Olson (antioch@mit.edu) for his testing.
	Bernd Hendel (BHENDEL@vmprofs.estec.esa.nl) for all his testing, 
	     suggested improvements, and time.
    Keith Maddock (madd0118@nova.gmi.edu) for bringing some bugs to my
         attention, suggesting some improvements, and testing.
    Randy Ding (randyd@alpha2.csd.uwm.edu) for his tireless system-rpl help.
    Rick Greville ( ? ) for his Xmodem (Library 555) program.
    Cary McCallister (sysop@hpcvbbs.external.hp.com) for FXRECV.
    Detlef Mueller (detlef@dmhh.hanse.de) for STOFIX (Library 1222).     
         
Description of Programs
-----------------------

Softkey Name    Variable Name   Description           
------------    -------------   -----------
BKUP            BKUP            BacKUP - the main program that backs up any 
                                         port that the user desires.

RESTO           RESTO           RESTOre - restores the HP48 to it's original
                                          state.

CNFG            CNFG            CoNFiGure - Lets the user select the options
                                            that he/she would like BKUP to 
                                            use.

INFO            INFO            INFOrmation - my name, BKUP release date,
                                              Version number, and my e-mail
                                              address.

BKPA            BKPAR           BacKup PARameters - the file that BKUP uses
                                                    to know whether or not
                                                    to execute certain 
                                                    features.

FLNM            FLNM            FiLeNaMe - Checks the date then spits out 
                                           P##MMMDD.BAK, where MMM is a three                                                
                                           letter abbreviation of the month,
                                           DD is the date, and ## is the start
                                           port and end port.

TG2N           TG2NM            TaGged to NaMe - takes a tagged object on
                                                 level 1 and outputs a name
                                                 in the form of: L#.P
                                                 where # is the library
                                                 number or backup object name
                                                 and P is the port number the
                                                 object is stored in.
