Introduction
This document explains how to add and remove RAM to emulated HP 48SX and 48GX ports. The concept of ports is explained as well as some of the related commands.
Description of 48SX and 48GX Ports
The HP 48GX and 48SX calculators both had 2 card slots where RAM and ROM expansion cards could be added, unlike their HP 48G and 48S siblings. In some documentation, the word “card” and “port” are used interchangeably (ex: 48GX ports). Emulators such as Droid48 and Droid48sx allow for RAM expandability since they emulate the HP 48GX and 48SX calculators, respectively.
RAM cards could be used in one of 2 ways. First is as “free” memory (also called “independent” memory). Here, a real RAM card was intended to be used as a storage device similar to a USB FLASH drive. A user can backup their data into a RAM card, execute programs and libraries from there, remove the card, and either store the RAM card in a their desk for later or share the RAM card with another calculator. The second way was as “merged” memory (also called “user” memory). Here, a real RAM card was used to upgrade the calculator’s built-in RAM. Unlike “free” memory, this added to the main memory available to execute programs, store more data in the HOME directory, and etc. When the MEM
command was used, the amount of free space available was internal RAM + merged RAM minus the amount RAM that was in use. However, simply removing a merged RAM card would often corrupt memory, causing the calculator to reset, and lose most of its data. To remove a merged RAM card, the user needed to run the FREE command first.
The 48GX and 48SX were similar but had some differences in their card slots. Card slot 1 on the GX and SX worked the same (some documentation calls this Port1). It could hold a 32KB or 128KB RAM card that operated in “free” or “merged” mode. On the SX, card slot 2 worked the same way (some documentation calls this Port2). The GX’s card slot 2 was different. It could only be used in “free” mode but could handle RAM cards as large as 4MB, though it would be divided into 128KB chunks, each labeled as Port2, Port3, up to Port33. Thus, while an SX only had 32KB of built-in RAM compared to the GX’s built-in 128KB, because the SX allows for 2 merged RAM cards, it could have a maximum of 288KB (32 + 128 + 128) of main memory for program execution compared to the GX’s maximum of 256KB (128 + 128).
ROM expansion cards are not directly supported in the emulators Droid48 and Droid48sx. However, the contents of a ROM card can be downloaded from a real HP 48 calculator and then uploaded into a RAM port in the emulator.
Backup objects are stored with names like :1:MYDATA
where the 1 is the port it is stored in and MYDATA is the friendly name. Libraries have names like :1:1234
where the 1234 is the library number. The STO
, RCL
, EVAL
, and PURGE
commands can be with these types of names and can also be used with lists of these kinds of names.
There is sometimes confusion about when to use the term ports versus cards. Unfortunately, the usage of the terms overlaps. Here is a summary:
- A physical card that can be inserted into a 48SX or 48GX calculator is always called a “card”.
- The physical slot that a card can be inserted is sometime called a “card slot” and sometimes a “port slot”.
- A memory chunk up to 128KB size in the Library menu is always called a “port”.
- Other than port0, an SX card slot mapped to exactly 1 port. However, a card in a 48GX port could provide up to 32 ports.
Add or Remove Emulated RAM
Use the Settings screen to add or remove RAM in Droid48 and Droid48sx.
- In Droid48 or Droid48sx, go into the Setting screen.
- Under “Port1 settings” and/or “Port2 settings”, select the RAM size you want.
- Hit the phone’s Back button
- Read the instructions on the screen. DO NOT press Ok.
- Tap the phone’s Recent Apps button to bring up the list of running apps.
- Kill Droid48 or Droid48sx (swipe left, swipe right, or tap the X button in the upper right)
- Relaunch Droid48 or Droid48sx
- Tap the
ON
button several times. The emulator’s screen will turn off then turn back on. - Save the state of the emulator. In Droid48, tap the upper right corner of the emulator screen and select “Save memory/state”. In Droid48sx, tap the emulator screen and press the Save Checkpoint icon.
Useful commands
MERGE
This merges a RAM card with the built-in RAM. Level 1 of the stack is either the number 1
or 2
representing the card to merge. The value of 2
is not allowed on the GX. This command does not leave data on the stack.
GX menu location: no menu, must be typed
SX menu location: Left-Shift
, Memory (VAR
button)
MERGE1 (GX-only)
This merges a RAM card in port 1 with the built-in RAM. It does not use any values from the stack and does not leave data on the stack.
GX menu location: Left-Shift
, Library (button 2
)
SX menu location: not available
FREE
This unmerges a RAM card in port 1 or 2 and changes it to “free” memory. Level 2 of the stack is a list of names of backup objects and libraries from port0 (part of the calculator’s built-in RAM) to be moved into the newly freed port1 or port2. This list can be empty. If the names are specified in the list, they are of the form :0:MYBACKUP
for backup objects or :0:1234
for libraries. Level 1 of the stack is either the number 1
or 2
representing the card to free. The value of 2
is not allowed on the GX. This command does not leave data on the stack. For example:
2: { :0:MYDATA :0:1234 }
1: 2
Here, the FREE
command would move the backup object MYDATA and library 1234 from port0 to port2 as the card is freed. Their new names will be :2:MYDATA
and :2:1234
.
GX menu location: no menu, must be typed
SX menu location: Left-Shift
, Memory (VAR
button)
FREE1 (GX-only)
Similar to FREE but is hardcoded to port1. Level 1 is the same style of list that the FREE command uses.
GX menu location: Left-Shift
, Library (button 2
)
SX menu location: not available
PVARS
This command reports the usage of a port. Level 1 is the port number to report on. On return, level 2 is a list of names of backup objects and libraries stored in that port. Level1 is one of 3 things: the number of bytes available on that port, the string "SYSRAM"
if the port is merged, or "ROM"
if it is a ROM card on a real calculator. For example, executing 1 PVARS
could return:
2: { :1:MYDATA :1:1234 }
1: 80816.5
GX menu location: Left-Shift
, Library (button 2
)
SX menu location: Left-Shift
, Memory (VAR
button)
PINIT (GX-only)
Sometimes a RAM card has garbage data on it or data on it has become corrupted. Execute the PINIT command to make all ports usable again. If the RAM card had data on it that became corrupted, the uncorrupted data is saved. It is safe to use the command if the RAM cards are working fine. This command does not use any values from the stack and does not leave data on the stack.
GX menu location: Left-Shift
, Library (button 2
)
SX menu location: not available
ARCHIVE
Creates a backup of the entire HOME directory, user key assignments, and all alarms. Level 1 is the backup object’s name (ex: :1:JUNE26
). This command does not leave data on the stack. If you want to also backup the flag settings, first use RCLF
to put them on the stack, store in variable in the HOME directory, and then use the ARCHIVE
command.
GX menu location: Left-Shift
, Memory (VAR
button)
SX menu location: Left-Shift
, Memory (VAR
button)
RESTORE
Restores a backup of the entire HOME directory, user key assignments, and all alarms (all previous data will be overwritten). Level 1 is the backup object’s name (ex: :1:JUNE26
) to be restored. This command does not leave data on the stack. If you want to also restore the flag settings, execute the RESTORE
command, then recall the previous stored flag settings from the HOME directory onto the stack, and then use the STOF
command.
GX menu location: Left-Shift
, Memory (VAR
button)
SX menu location: Left-Shift
, Memory (VAR
button)
Notes
Note1: While ports 1 through 33 are located on RAM card, port0 is special. It acts similar to other ports except that it can only behave like “free” memory and it is part of the built-in RAM. Backup objects and libraries can be stored in port0 but they consume part of the memory available for executing programs and the HOME directory.
Note2: The port number can be a wildcard with the RCL
, EVAL
, and PURGE
commands where instead of a number, an & character is used. For example, entering :&:MYDATA PURGE
will delete the first instance of MYDATA the calculator finds. The calculator starts searching with the highest port number, works down to port 0, and then finally main memory. The STO
command ignores the & and instead always stores in main memory. To type the & character, press the alpha
key, then Left-Shift
, then the ENTER
key.
Note3: Performing a PURGE
of an object stored in a port sometimes causes an “in use” error. This occurs if the object is referenced on the stack, by a local environment, a “user-defined” error message, or is an attached library. Try turning the emulator off and then on again with Right-Shift
, OFF (ON
button), and then press ON
a few times. Then try PURGE
again.
Note4: due to a limitation in the GX, Port33 is never usable on a 4MB card. Only ports 2 through 32 are usable.
References
- “HP 48 Series Advanced User’s Reference Manual”, 1994, 4th edition, Hewlett-Packard, http://www.hpcalc.org/details.php?id=6036
- “HP 48SX Scientific Expandable Owner’s Manual Volume I and II”, 1990, 4th edition, Hewlett-Packard
- “HP48 FAQ Section 10: Appendix B: GX Specific Information”, http://www.hpcalc.org/hp48/docs/faq/48faq-10.html
- “Ram card on HP48GX”, http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv015.cgi?read=89814
- “HP 48G Calculator – Resetting the Calculator”, http://support.hp.com/us-en/document/bpia5166