(Comp.sys.handhelds) Item: 2695 by darrylo at hpnmdla.hp.com Author: [Darryl Okahata] Subj: How to backup the ENTIRE HP-48SX memory Date: Mon Apr 08 1991 Here is a beta-release of a program to backup the ENTIRE contents (libs and all) of an HP-48SX. It's not perfect, it's huge (about 1000 bytes), and it's probably inefficient (I just slapped this together). Also, while I've tried to work out any bugs, there's no guarantee that it works. ;-) The big advantage of these functions, over previously-released ones, is that you only need as much memory as the largest library/port variable to do a backup, as the libraries/port variables are saved in separate files and not as a concatenated list in main memory. The code at the end of this message contains two functions: BACKUP and RECOVER. In order to use these functions, you need to backup to a kermit SERVER; you must place the destination machine in kermit SERVER mode to use these routines. If you do not have a kermit that supports SERVER mode, you cannot use these routines. You must also use binary transfer mode; if you accidentally use ASCII mode, the transfer will take hours. Also, the clock display must be turned off, due to the archive bug; if the display is turned on, the clock will be turned off, and you will be asked to redo the operation. You press BACKUP to archive the contents of your HP-48SX. BACKUP sends each variable/library to the kermit server, one by one (it first checks to see if you have enough memory, though). They are stored in files named like: Lpnnn Where "p" is the port number (0..2), and "nnn" is a number from 1 to however many variables are in the port. As each port object is sent to the server, a note of its type (variable vs library) is made and is saved away (this is used to restore the backup). After all port objects have been saved, the flags are saved in a variable, and an ARCHIVE is done (the ARCHIVE file name is hard-coded to "BACKUP"). The HP-48SX will also terminate the kermit server at the end of the backup. Filename collisions are a problem here. I strongly suggest starting the kermit server in an empty directory before starting the backup. Here's a summary of the backup process: 1. Make sure the HP-48SX is using wire/binary transfer. 2. Place kermit into SERVER mode. 3. Press BACKUP. Have a cup of coffee while you wait. If the suppress error beep flag (-56) is not set, the calculator will beep when the full backup is complete. To restore the contents of your HP-48SX, you do the following: 1. Go to the directory containing the backup files. 2. Using kermit, transfer the "backup" archive back to the HP-48SX, and RESTORE it. 3. Put kermit into server mode. 4. Go to the HP-48SX directory that contains the BACKUP and RECOVER functions. 5. Press RECOVER. The calculator will transfer the necessary files and place the objects into the correct ports. That's it. ***** Known problems: * This program backs up EVERYTHING in RAM (of course, it doesn't touch ROM). It backs up *ALL* libraries, backup objects, other variables, etc.. You cannot tell it to not backup something, other than purging the object, or pulling the RAM card out of the calculator. * This program is huge, due partly to the extensive checks that makes sure that enough memory is present before doing the BACKUP/RECOVER. Perhaps these checks should be deleted (but I like having user-friendly programs ...)? * No kermit error checking is done. * Currently, some of the constants used to estimate the minimum amount of RAM needed are stored in variables ("M" and "S"). Perhaps these should be hard-coded? * The current set of functions can be placed anywhere, as long as the directory hierarchy is maintained. Some RAM can be saved if these functions were hard-coded to work in a particular directory (such as "{HOME BACKUP}"). Does anyone have any preferences? * Does anyone know how to force binary kermit transfers? * I consider this to be a beta-release. As such, the code is not commented. -- Darryl Okahata UUCP: {hplabs!, hpcea!, hpfcla!} hpnmd!darrylo Internet: darrylo%hpnmd@relay.hp.com DISCLAIMER: this message is the author's personal opinion and does not constitute the support, opinion or policy of Hewlett-Packard or of the little green men that have been following him all day. ---------- Resp: 1 of 1 by cook at hplvec.LVLD.HP.COM Author: [Steve Cook] Date: Sun Apr 28 1991 22:53 Lines: 3 I found that the hp48 has to be in STD mode before the backup routine will work properly. This is a handy program. Thanks for your effort, Darryl. [STD is in the program on disk. -jkh-]