HPGCC3 Documentation 3.0 R003
|
Saturn architecture is object oriented, and each object is represented with a data structure analog to a C-style struct. One of the main differences between modern processors and the old Saturn is that memory is accessed in half-bytes, in other words, 4-bit chunks of data called nibbles. All data in memory is nibble-aligned therefore it cannot be accessed from the byte-oriented C environment using pointers.
RAM in the Saturn architecture is divided in 3 main areas: TEMPOB, USEROB and PORTS.
TEMPOB stands for TEMPorary OBjects, and it contains all temporary objects created during normal calculator operation. Every object in the stack, including all intermediate objects used during calculations that are not visible on the stack, are stored in TEMPOB.
USEROB stands for USER Objects, and contains objects that the user wants to keep. This region of memory contains objects organized in directories and subdirectories, being HOME the root directory. Objects stored in this area of memory are referred to by a name, as opposed to objects in TEMPOB which are all unnamed.
PORT memory is similar to USEROB, except there are restrictions to its usage: There can only be 2 types of objects (LIB's and BACKUP's) and there are no subdirectories in PORT memory. There are several PORT areas, numbered as 0, 1 and 2. PORT 0 and PORT 1 are in RAM, and PORT 2 is in flash memory. The difference between PORT 1 and PORT 0 is their physical location in memory. In the old Saturn architecture, PORT 0 was directly accessible while PORT 1 was in a 'paged' area of memory, and was therefore only temporarily accessible (slower).
Both HP49G+ and HP50G have identical memory layout, with one single bank of 512 KB of RAM.
Memory was divided by convenience in 128KB banks, which were used as follows:
Within the main RAM block (the last 256 KB), the first area is used by TEMPOB, then it is followed by free memory, and at the end of the block there is USEROB, followed by PORT 0. This layout is of critical importance for the Saturn module, because the developer needs to be aware that if HPGCC uses all free memory in this area, there will be no space left to either create new objects in TEMPOB (therefore making impossible to push a result to the stack from a C program), or to STO new objects in USEROB. HPGCC provides configuration options to reserve some free space for TEMPOB growth, and also for USEROB growth. C programs using the stack (or USEROB) to store limited amount of data can use these options to reserve some memory and take the rest of the main ram for the heap. For C programs that make intensive use of this area, it is recommended to instruct HPGCC to avoid using any memory from the main block (also through specific configuration options). By doing this, the C program will not interfere at all with the Saturn environment, at the expense of reducing the available memory in the C heap.
Calculator objects are data structures similar to a C-style struct but accessed in nibbles. The first field in this structure is always a 'Prolog'. A prolog is a 5-nibble (20-bits) number that indicates object type. The prolog is what allows the user to identify objects. The rest of the data is different for each object, and can be found in multiple references so it won't be explained here. In general, the calculator handles objects by making extensive use of pointers.
An object can exist individually in TEMPOB memory, in USEROB memory, or embedded within another object (like lists for example).