I'm not sure how long a RAM card has to be left without power before it loses memory, but, as Wayne noted, that's no doubt the easiest way to clear one. Note that with the card inserted and the calculator turned on, the card gets its power from the calculator. Some SMI and TDS cards use a non-removable rechargeable battery (recharged by a turned-on calculator), which (if fully charged) should hold its charge for a month or so. For the 48GX's slot 1, be sure that port 1 is "free" (see below) before removing the card (or its battery).
Of course when a card is powered up again, it will contain random data. To easily "organize" the memory of all ports in a 48GX, use the PINIT command.
If you choose to clear the card by purging objects, of course first off, the card has to be write-enabled.
For the 48GX's slot 1, port 1 has to be "free", not "merged" with system RAM, to use it as an independent memory port. To check, do 1 PVARS; if this returns a list to level 2 and a number to level 1, then port 1 is already free. If 1 PVARS returns { } to level 2 and "SYSRAM" to level 1, then port 1 is merged. To free (and clear) a merged port 1, do {} FREE1 (or {} 1 FREE). Port 1 can be merged by the MERGE1 command (or 1 MERGE), but note that will also move anything that was in port 1 to port 0.
Port objects "in use", for example, referenced on the stack, by a local environment, a "user-defined" error message, or as an attached library, cannot be purged. A warmstart ([ON] and [C] together) may be the easiest way to make sure that nothing is referenced except auto-attaching libraries. For the libraries, maybe use the LIBS command to get a list of the attached libraries and the DETACH command (which can also take a list of library numbers as its argument) to detach all libraries in the port(s) that you want to clear. Note that if the 48 series is turned off (even an automatic turn-off) and back on again, then any library configuration routines will be run, and most libraries will auto-attach.
To purge a port variable ("backup object"), use it's port-tagged named, for example :1:TEST PURGE. To purge a library, use its port-tagged library number instead, for example, :1:999 PURGE.
The PURGE command can also take a list of port-tagged names and library numbers, and, with a free port, the PVARS command returns a list of the port-tagged names and library numbers of all objects stored in a given port to level 2, followed by its available capacity in level 1. So, for example, 1 PVARS DROP PURGE should clear everything in port 1, unless something there is still referenced, in which case it will stop purging with an "Object In Use" error.
The slot 1 card can have only a single port, but the slot 2 card of a 48GX may have multiple ports of 128KiB each. If you want to purge everything on a multi-port card, you could loop through all ports and clear them with one command line or program, but it may be just as easy to handle each one separately.
Some TDS cards have multiple banks of 128KiB each, but with only one bank at a time available as a port. These are intended for the 48SX, but they work in the 48GX. These cards include a SWITCH library, to control which bank is available as a port. For these, it may be best to leave a copy of the SWITCH library in each bank (unless the card is going to be stored without power). For these, start with bank 1, clear the port, then switch to the next bank and clear the port again, and so on. If you have one of these cards, then it's best to have the SWITCH library safely backed up to your PC at least.
Oliver Klotz makes (made?) a 4MiB (32-bank) card for the 48GX's slot 2, with 30 banks available at a time as ports 2 through 31, and a physical switch on the card to control which 2 banks are used as ports 30 and 31. Of course in this case you'd clear ports 2 through 31, and then toggle the switch and clear ports 30 and 31 again.
There's also a multi-bank Klotz card intended for the 48SX (but usable in a 48GX) with only one 128KiB bank (selected by physical switch settings) at a time available as a port. These can be treated much like the TDS multi-bank cards.
For a 48SX the above would mostly apply, except that its slot 2 is like the 48GX's slot 1, and the FREE1 and MERGE1 commands aren't available, so the FREE and MERGE commands would have to be used instead. The 48SX also doesn't include the PINIT command, so to "organize" a card's memory, just store any object in each port, after which the "dummy object" can be purged.
Regards,
James
Edited: 28 July 2007, 2:26 a.m.