saturn.h File Reference

Saturn domain "hacking" and RPL stack manipulation library for the HP-49g+ calculator. More...

Go to the source code of this file.

Data Structures

struct  _sat_cpu
 The emulated Saturn CPU as a memory area in ARM domain. More...
struct  sat_list_struct
 An RPL List Object. More...
struct  _sat_stack_element
 A descriptor for an RPL stack element in Saturn notation. More...
struct  _sat_stack_data
 Data structure, that models a single stack element. More...

Defines

#define SWAP4(x)   (((x) << 4) | ((x) >> 4))
 Swap low and high nibbles in a byte.
#define ALIGN(x, a)   (((unsigned)(x)+(a)-1) & (~((unsigned)(a)-1)))
 Align an address 'x' to a 'a' bit boundary.
#define BOOL   int
 Standard definition for BOOLEAN type.
#define FALSE   0
 The BOOLEAN constant FALSE.
#define TRUE   !FALSE
 The BOOLEAN constant TRUE.
#define SAT_STACK_BIAS   1
 How many stack levels are used by the launcher.
#define SAT_DOINT   0x2614
 Saturn data prologue: ZINT (Typical Exact Integer).
#define SAT_DOCSTR   0x2a2c
 Saturn data prologue: STRING.
#define SAT_DOREAL   0x2933
 Saturn data prologue: REAL.
#define SAT_DOEREL   0x2955
 Saturn data prologue: EXTENDED REAL.
#define SAT_DOHXS   0x2a4e
 Saturn data prologue: UINT (HEX STRING).
#define SAT_DOBINT   0x2911
 Saturn data prologue: BINT.
#define SAT_DOCMP   0x2977
 Saturn data prologue: COMPLEX.
#define SAT_DOECMP   0x299D
 Saturn data prologue: EXTENDED COMPLEX.
#define SAT_DOCHAR   0x29BF
 Saturn data prologue: CHAR.
#define SAT_DOARRY   0x29e8
 Saturn data prologue: ARRAY.
#define SAT_DOLNKARRY   0x29e8
 Saturn data prologue: LINKED ARRAY.
#define SAT_DOIDNT   0x2e48
 Saturn data prologue: ID (variable name).
#define SAT_DOLAM   0x2e6D
 Saturn data prologue: LAM ID (variable name).
#define SAT_DOROMP   0x2e92
 Saturn data prologue: XLIB (ROM Pointer).
#define SAT_DORRP   0x2a96
 Saturn data prologue: RRP (Directory objects).
#define SAT_DOSYMB   0x2AB8
 Saturn data prologue: SYMBOLIC.
#define SAT_DOLIST   0x2A74
 Saturn data prologue: LIST.
#define SAT_DOCOL   0x2D9D
 Saturn data prologue: SECONDARY (Programs).
#define SAT_DOGROB   0x2B1E
 Saturn data prologue: GROB.
#define SAT_SEMI   0x312b
 Saturn composite object terminator: SEMI.
#define SAT_DOBAK   0x2B62
 Saturn data prologue: BACKUP.
#define SAT_DOCODE   0x2DCC
 Saturn data prologue: CODE.
#define SAT_DOEXT   0x2ADA
 Saturn data prologue: UNIT OBJECT.
#define SAT_DOFLASHP   0x26AC
 Saturn data prologue: FLASH PTR.
#define SAT_DOLIB   0x2B40
 Saturn data prologue: LIBRARY.
#define SAT_DOMATRIX   0x2686
 Saturn data prologue: SYMBOLIC ARRAY.
#define SAT_DOTAG   0x2AFC
 Saturn data prologue: TAGGED OBJECT.
#define SAT_DOAPLET   0x26D5
 Saturn data prologue: DOAPLET.
#define SAT_DOEXT0   0x2B88
 Saturn data prologue: LIBDATA.
#define SAT_DOACPTR   0x2BAA
 Saturn data prologue: ACPTR (internal object).
#define SAT_DOEXT1   SAT_DOACPTR
#define SAT_DOEXT2   0x2BCC
 Saturn data prologue: EXT2.
#define SAT_DOEXT3   0x2BEE
 Saturn data prologue: EXT3.
#define SAT_DOEXT4   0x2C10
 Saturn data prologue: EXT4.
#define SAT_DOLNGREAL   0x263A
 Saturn data prologue: LNGREAL.
#define SAT_DOLNGCOMP   0x2660
 Saturn data prologue: LNGCOMP.
#define REAL_0   0x2f937
#define REAL_1   0x2f94c
#define REAL_2   0x2f961
#define REAL_3   0x2f976
#define REAL_4   0x2f98b
#define REAL_5   0x2f9a0
#define REAL_6   0x2f9b5
#define REAL_7   0x2f9ca
#define REAL_8   0x2f9df
#define REAL_9   0x2f9f4
#define SAT_PROLOGUE_STRING   SAT_DOCSTR
#define SAT_PROLOGUE_UINT   SAT_DOHXS
#define SAT_DATA_TYPE_INT   28
 HP calculator Data Type: INT.
#define SAT_DATA_TYPE_LONG   10
 HP calculator Data Type: LONG.
#define SAT_DATA_TYPE_STRING   2
 HP calculator Data Type: STRING.
#define SAT_DATA_TYPE_REAL   0
 HP calculator Data Type: REAL.
#define SAT_DATA_TYPE_UNSUPPORTED   -999
 Marker for unsupported Data Type.
#define sat_moveup(a, b, c)   sat_memmove(a,b,c)
 C implementation of Saturn MOVEUP.
#define sat_movedown(a, b, c)   sat_memmove(a,b,c)
 C implementation of Saturn MOVEDOWN.
#define sat_peek_sat_addr(sat_addr)   sat_peek((sat_addr),5)
 Convenience macro for peeking Saturn addresses (5 nibbles).
#define sat_peek_sat_byte(sat_addr)   ((unsigned char) sat_peek((sat_addr),2))
 Convenience macro for peeking one byte (2 nibbles).
#define sat_poke_sat_byte(sat_addr, val)   sat_poke((sat_addr), (unsigned) (val), 2)
 Convenience macro for poking a single byte (2 nibbles) to Saturn memory.
#define sat_poke_sat_bytes(sat_addr, bytes, n)   sat_poke_nibbles((sat_addr), (bytes), (2*(n)))
 Convenience macro for poking many bytes (2*n nibbles) to Saturn memory.
#define sat_poke_sat_addr(sat_addr, val)   sat_poke((sat_addr), (val), 5)
 Convenience macro for poking a Saturn address (5 nibbles) to Saturn memory.
#define SAT_INTRPPTR   0x8076B
 Saturn CPU storage area: D0.
#define SAT_DSKTOP   0x806F8
 Saturn CPU storage area: D1.
#define SAT_RSKTOP   0x806F3
 Saturn CPU storage area: B.
#define SAT_AVMEM   0x80E9B
 Saturn CPU storage area: D.
#define SAT_TEMPTOP   0x806EE
 Saturn emu storage area: TEMPTOP.
#define SAT_EDITLINE   0x806FD
 Saturn emu storage area: EDITLINE.
#define SAT_ERROR   0x80EA5
 Saturn error message number address: ERROR.
#define SAT_TRUE   0x3a81
 SysRPL flags: TRUE.
#define SAT_FALSE   0x3ac0
 SysRPL flags: FALSE.
#define sat_stack_pop_string(s)   sat_pop_str((s))
 Alias name mapping for maintaining API consistency.
#define sat_stack_pop_string_alloc   sat_pop_str_alloc
 Alias name mapping for maintaining API consistency.
#define sat_stack_pick_string(l, b)   sat_pick_str((l),(b))
 Alias name mapping for maintaining API consistency.
#define sat_stack_pick_string_alloc(l)   sat_pick_str_alloc((l))
 Alias name mapping for maintaining API consistency.
#define sat_stack_push_bool   sat_pushtruefalse
 An alias for sat_pushtruefalse.

Typedefs

typedef unsigned long long ULONGLONG
typedef long long LONGLONG
typedef _sat_cpu SAT_CPU
 The emulated Saturn CPU as a memory area in ARM domain.
typedef _sat_cpuSAT_PCPU
 The emulated Saturn CPU as a memory area in ARM domain.
typedef sat_list_structSAT_LIST
 An RPL List Object.
typedef _sat_stack_element SAT_STACK_ELEMENT
 A descriptor for an RPL stack element in Saturn notation.
typedef _sat_stack_elementSAT_PSTACK_ELEMENT
 A descriptor for an RPL stack element in Saturn notation.
typedef _sat_stack_data SAT_STACK_DATA
 Data structure, that models a single stack element.
typedef _sat_stack_dataSAT_PSTACK_DATA
 Data structure, that models a single stack element.

Functions

void sat_poke (int sat_addr, unsigned val, int nibbles)
 Poke up to 8 nibbles of data to Saturn domain.
void sat_poke_nibbles (unsigned sat_addr, const char *data, int nibbles)
 Poke many nibbles to Saturn domain.
unsigned sat_peek (int sat_addr, int nibbles)
 Peek up to 8 nibbles of data from Saturn domain.
void sat_memmove (int satsrc, int satdest, int nibbles)
 C implementation of Saturn MOVEUP/MOVEDOWN.
int sat_getfreetempob ()
 Obtain maximum object size that can be created with sat_createtemp().
int sat_createtemp (int objsize)
 Create a temporary object in the Saturn Heap.
int sat_shrinklastob (int objaddr, int newsize)
 Change the allocated size of the last object in tempob.
BOOL sat_push_string (int type_prolog, int size_nibbles, const char *data)
 Push a string on the RPL stack.
unsigned int sat_map_s2a (unsigned int sat_addr)
 Translate a Saturn memory address to ARM domain.
unsigned int sat_map_a2s (unsigned int arm_addr)
 Translate an ARM memory address to Saturn domain.
void * sat_peek_sat_bytes (void *target, unsigned sat_addr, int nbytes)
 Peek many nibbles from Saturn domain into ARM memory.
unsigned char * sat_concatnib (unsigned char *dest, unsigned int destLen, unsigned char *source, unsigned int sourceLen)
 Combines 2 strings of binary Saturn data.
unsigned sat_stack_init ()
 DEPRECATED: Initialize RPL stack access This function MUST be called before any other high level stack API function. The returned value is NOT intended for any usage other then storing it!
void sat_stack_exit (unsigned rpl_stack_bias)
 DEPRECATED: Finalize RPL stack access This function MUST be called before exiting the program Failing this may cause a calculator crash (TTRM with memory clear!)
int sat_stack_depth ()
 Get number of elements on the RPL stack (DEPTH).
int sat_get_stack_element (int index, SAT_STACK_ELEMENT *element)
 Get a stack element (GET).
int sat_stack_drop ()
 Pop one element off the stack (DROP).
int sat_stack_dropn (int n)
 Pop many elements off the stack (DROPN).
int sat_stack_swap ()
 Swap elements on level 1 and 2 (SWAP).
int sat_stack_nip ()
 Swap then drop (NIP).
int sat_stack_push_string (const char *str)
 Push a string onto the RPL stack.
char * sat_pop_str (char *buf)
 Pop a string from the RPL stack.
char * sat_pick_str (int level, char *buf)
 Pick a string at level 'level' from the RPL stack.
char * sat_pick_str_alloc (int level)
 Pick a string at level 'level' from the RPL stack with automatically allocated memory.
char * sat_pop_str_alloc ()
 Pop a string from the RPL stack with automatically allocated memory.
int _sat_stack_push_int (int z, int radix, int binary)
 Push a string representation of an integer onto the stack The integer is converted to a string and then pushed via sat_stack_push_string().
int sat_stack_push_int (int z)
 Push a string representation (base=10) of an integer onto the stack The integer is converted to a string and then pushed via sat_stack_push_string().
int sat_stack_push_double (double d)
 Push a string representation of a double onto the stack The double value is converted to a string and then pushed via sat_stack_push_string().
BOOL sat_push_zint_llong (LONGLONG num)
 Push a LONGLONG onto the RPL stack as a ZINT Accepts a number of Type 'LONGLONG', and pushes it as an Exact Integer (ZINT).
BOOL sat_push_zint_array (unsigned int digits, unsigned int negative, unsigned char *source)
 Helper function for pushing ZINTs onto the Stack Accepts an array of binary digits, and pushes then onto the stack egc {1,2,3,4,5,6,7,8,9} for 123456789. It also accepts a negative flag (if TRUE, number is treated as negative) and number of digits.
LONGLONG sat_pop_zint_llong ()
 Pop a ZINT off the RPL stack into a LONGLONG Pop a ZINT (exact integer) off the RPL stack into a LONGLONG (64 bit signed integer).
SAT_LIST sat_list_create (unsigned int maxSize)
 Creates an RPL List Object Creates a List object of type SAT_LIST, used for holding multiple Saturn objects.
void sat_list_destroy (SAT_LIST list)
 destroys an RPL List Object Frees the memory takes by a SAT_LIST
BOOL sat_push_list (SAT_LIST list)
 Pushes an RPL List Object (of type SAT_LIST) onto the RPL Stack.
void sat_list_add_real (SAT_LIST list, double num)
 adds a Double to an RPL List as a Real
void sat_list_add_zint_array (SAT_LIST list, unsigned int digits, unsigned int negative, unsigned char *source)
 Helper function for adding ZINTs to an RP List Accepts an array of binary digits, and adds to a List eg {1,2,3,4,5,6,7,8,9} for 123456789. It also accepts a negative flag (if TRUE, number is treated as negative) and number of digits.
char * sat_convert_zint_array (unsigned int digits, unsigned int negative, unsigned char *source, unsigned char *dest)
 Helper function for converting an array of digits to a Zint. Accepts an array of binary digits, and creates a binary Zint object eg {1,2,3,4,5,6,7,8,9} for 123456789. It also accepts a negative flag (if TRUE, number is treated as negative) and number of digits.
void sat_list_add_zint (SAT_LIST list, LONGLONG num)
 adds a LONGLONG to an RPL List as a ZINT
unsigned char * sat_convert_double_real (double number, unsigned char *realStr)
 Helper function that dakes in a double, and returns a binary Real Object.
int sat_stack_levels_avail ()
 Inquiry function that tells how many stack levels are available for pushing.
char * _sat_decode_string (unsigned sat_addr)
 Decode a Saturn string object.
int sat_decode_stack_element (SAT_STACK_DATA *data, SAT_STACK_ELEMENT *stack)
 Decode a stack element to a SAT_STACK_DATA type.
double sat_pop_real ()
 Pop a Real from the Stack, as a Double. The Real object is popped from the RPL stack, and transformed into a double.
void sat_pushptr (int sataddr)
 Push a pointer in the stack.
BOOL sat_push_bint (int bint)
 Push a bint on the RPL stack.
BOOL sat_push_real (double number)
 Push a real on the RPL stack.
BOOL sat_push_char (char byte)
 Push a char on the RPL stack.
BOOL sat_push_comp (ULONGLONG real, ULONGLONG imag)
 Push a complex number on the RPL stack.
BOOL sat_push_realarray (int rows, int columns, ULONGLONG *arry)
 Push a real array on the RPL stack.
LONGLONG sat_BCD2LONGLONG (unsigned addr, int digits)
double sat_real2double (unsigned addr)
ULONGLONG sat_double2real (double n)
int sat_decode_real (unsigned address, double *val)
int sat_check_type (unsigned int level, unsigned int prologue)
 type checks a stack type
int sat_stack_pop_stdargs (char ***argv)
 Build a standard C main (argc,**argv) tuple from the RPL stack.
int _sat_stack_pop_stdargs (const char *arg0, char ***argv)
 Build a standard C main (argc,**argv) tuple from the RPL stack arg0 denotes an (optional) program name. If arg0 == NULL, _sat_stack_pop_stdargs() follows the semantics of it's default frontend sat_stack_pop_stdarg(). This function's purpose is mainly to ease the adaption of "standard" C programs, which provide a program name in argv[0].
void sat_errorsto (int errno)
 C version of the sysRPL ERRORSTO. Sets current error number.
void sat_pushtruefalse (BOOL arg)
 Push saturn flag FALSE if arg is FALSE, TRUE otherwise.

Variables

SAT_CPU_saturn_cpu


Detailed Description

Saturn domain "hacking" and RPL stack manipulation library for the HP-49g+ calculator.

This library contains routines, that enable an applications programmer to access the RPL data on the calculator's stack and performing generalized data exchange with the Saturn emulator. The latter - "hacking" functions - consist mainly of a set of "peek" and "poke" functions for various data entities like "nibbles","bytes","words" and "strings" and address translation functions ARM <-> Saturn. There are just a few, easy to remember, high level API functions, which allow for complete control over the stack. The programmer does not need to know about Saturn internals.

Overview

The features include:

Quick Start Examples

The following program pushes the string "Hello, World!" onto the RPL Stack Note that before doing _any_ stack operations, you must call sat_stack_init() Save the value it returns, then use it as a parameter to sat_stack_exit at the end.

 #include <hpgcc49.h> 

 int main()
 {
    // Initialize RPL stack
    unsigned rpl_stack_bias = sat_stack_init();

    sat_stack_push_string("Hello, World!");
    
    sat_stack_exit(rpl_stack_bias); //close it
    return 0;
 }

This program takes an integer (a'Zint' in HP terms) off the stack, doubles it, and pushes the result. This example has minimal error checking. Ideally you would use sat_stack_depth to detect if the stack is empty first, and check the type before usage.

 #include <hpgcc49.h> 

 int main()
 {
    // Initialize RPL stack 
    unsigned rpl_stack_bias = sat_stack_init();

    sat_push_zint_llong(sat_pop_zint_llong()*2);
    
    sat_stack_exit(rpl_stack_bias); //close it
    return 0;
 }

This program pops 2 ZINTs off the stack, adds them, and pushes the result. It is more complicated because it does error checking. IT checks that at least 2 items are on the stack, and that they are both of type ZINT

 #include <hpgcc49.h> 

 int main()
 {
    // Initialize stack access
    unsigned rpl_stack_bias = sat_stack_init();

    if (sat_stack_depth()<2){ //check for enough items
    sat_stack_push_string("Error: Too Few Arguments!");
    goto exit;
 } 
    
    SAT_STACK_ELEMENT first; //examine the elements on stack
    SAT_STACK_ELEMENT second; //we don't pop them yet.
    
    sat_get_stack_element(1,&first); //look at first element from stack
    sat_get_stack_element(2,&second);//look at second element from stack
    
    //Now, check that both 'first' and 'second' are ZINTs
    //One way to do this is by checking the 'prologue'. It identifies
    //the type of the object. Use 'SAT_DOINT' to check for ZINTs
    if( (first.prologue!=SAT_DOINT)||(second.prologue!=SAT_DOINT)){
    
    sat_stack_push_string("Error: Bad Argument Type!"); //bail out
    goto exit;    
    
    }
    
    //now, pop the actual values off the stack
    
    LONGLONG first_val = sat_pop_zint_llong(); //first element value
    LONGLONG second_val = sat_pop_zint_llong(); //second element value
    
    sat_push_zint_llong(first_val+second_val); //push the addition

 exit:
    sat_stack_exit(rpl_stack_bias);
    return 0;
 }

The following program expects two exact integer values, converted to strings, on the stack. It performs some operations with them and pushes a result back. As a string as well. It treats the stack as parameters to a classic C program using 'argc' and 'argv' values.

Note:
In this example, all data exchange is done with strings. This seems to be a limitiation. Actually it can be very useful. Remember that there are the STR-> and ->STR functions at the emulator's end, which are rather powerful. It is easy to pass complicated objects by converting them to strings. In C we have conversion routines for the basic C data types "int" [atoi()] and "double" [atof()]. Output conversion, for pushing results, may be done with "sprintf".
 #include <hpgcc49.h>

 // Template for RPL stack pop/push usage
 // Ingo Blank, 2004-11-24


 int
 main()
 {
     // argument counter
     int argc = 0;

     // Initialize stack access
     unsigned rpl_stack_bias = sat_stack_init();

     // Determine number of elements in the stack
     int level = sat_stack_depth();

     // Dynamically dimension argument vector just as big as needed
     char *argv[level];

     while (sat_stack_depth()) {

         SAT_STACK_ELEMENT e;
         SAT_STACK_DATA d;

         // Get element at level #1, i.e. stack-top
         sat_get_stack_element(1,&e);

         // decode it ...
         sat_decode_stack_element(&d,&e);

         // check validity and store in argument vector

         // Note that elements are stored in *reverse* order, since
         // the stack is a LIFO structure
         if (d.type == SAT_DATA_TYPE_STRING)
             // remove single quotes from algebraic objects (if present)
             argv[++argc,--level] = str_unquote(d.sval,'\'');
         else
             ; // unsupported data type, error message, bail out, ignore ...

         // pop one element off the stack and continue loop
         sat_stack_drop();
     }

     // Now all RPL data is stored in the argv[] vector

     // your program here ...


     // Since the program does no screen output, skip init sequence

     //sys_intOff();
     //sys_slowOn(); 
     //clear_screen();

     // Demo: take two arguments, convert them to integers and apply the 4
     // basic arithmetic operations to them

     if (argc >= 2) {
         int x = atoi(argv[0]);
         int y = atoi(argv[1]);
         char buf[64];

         // print the result formatted as an HP list object {,,,}
         sprintf(buf,"{%d %d %d %d}",x+y,x-y,x*y,y ? x/y : 0);

         // push the string back to the stack
         // the receiving (User)RPL pogram can convert it with STR-> to a
         // proper list object
         sat_stack_push_string(buf);
     }

     // Finalize stack access
     // NEVER forget that, or risk a device crash!
     sat_stack_exit(rpl_stack_bias);

     // Since the program does no screen output, skip exit sequence

     //sys_slowOff();
     //sys_intOn();

     return 0;
 }

Definition in file saturn.h.


Define Documentation

#define ALIGN ( x,
 )     (((unsigned)(x)+(a)-1) & (~((unsigned)(a)-1)))

Align an address 'x' to a 'a' bit boundary.

Definition at line 292 of file saturn.h.

#define BOOL   int

Standard definition for BOOLEAN type.

Definition at line 299 of file saturn.h.

#define FALSE   0

The BOOLEAN constant FALSE.

Definition at line 307 of file saturn.h.

#define REAL_0   0x2f937

Definition at line 600 of file saturn.h.

#define REAL_1   0x2f94c

Definition at line 601 of file saturn.h.

#define REAL_2   0x2f961

Definition at line 602 of file saturn.h.

#define REAL_3   0x2f976

Definition at line 603 of file saturn.h.

#define REAL_4   0x2f98b

Definition at line 604 of file saturn.h.

#define REAL_5   0x2f9a0

Definition at line 605 of file saturn.h.

#define REAL_6   0x2f9b5

Definition at line 606 of file saturn.h.

#define REAL_7   0x2f9ca

Definition at line 607 of file saturn.h.

#define REAL_8   0x2f9df

Definition at line 608 of file saturn.h.

#define REAL_9   0x2f9f4

Definition at line 609 of file saturn.h.

#define SAT_AVMEM   0x80E9B

Saturn CPU storage area: D.

Definition at line 921 of file saturn.h.

#define SAT_DATA_TYPE_INT   28

HP calculator Data Type: INT.

Definition at line 622 of file saturn.h.

#define SAT_DATA_TYPE_LONG   10

HP calculator Data Type: LONG.

Definition at line 628 of file saturn.h.

#define SAT_DATA_TYPE_REAL   0

HP calculator Data Type: REAL.

Definition at line 640 of file saturn.h.

#define SAT_DATA_TYPE_STRING   2

HP calculator Data Type: STRING.

Definition at line 634 of file saturn.h.

#define SAT_DATA_TYPE_UNSUPPORTED   -999

Marker for unsupported Data Type.

Definition at line 647 of file saturn.h.

#define SAT_DOACPTR   0x2BAA

Saturn data prologue: ACPTR (internal object).

Definition at line 573 of file saturn.h.

#define SAT_DOAPLET   0x26D5

Saturn data prologue: DOAPLET.

Definition at line 565 of file saturn.h.

#define SAT_DOARRY   0x29e8

Saturn data prologue: ARRAY.

Definition at line 493 of file saturn.h.

#define SAT_DOBAK   0x2B62

Saturn data prologue: BACKUP.

Definition at line 537 of file saturn.h.

#define SAT_DOBINT   0x2911

Saturn data prologue: BINT.

Definition at line 477 of file saturn.h.

#define SAT_DOCHAR   0x29BF

Saturn data prologue: CHAR.

Definition at line 489 of file saturn.h.

#define SAT_DOCMP   0x2977

Saturn data prologue: COMPLEX.

Definition at line 481 of file saturn.h.

#define SAT_DOCODE   0x2DCC

Saturn data prologue: CODE.

Definition at line 541 of file saturn.h.

#define SAT_DOCOL   0x2D9D

Saturn data prologue: SECONDARY (Programs).

Definition at line 525 of file saturn.h.

#define SAT_DOCSTR   0x2a2c

Saturn data prologue: STRING.

Definition at line 459 of file saturn.h.

#define SAT_DOECMP   0x299D

Saturn data prologue: EXTENDED COMPLEX.

Definition at line 485 of file saturn.h.

#define SAT_DOEREL   0x2955

Saturn data prologue: EXTENDED REAL.

Definition at line 468 of file saturn.h.

#define SAT_DOEXT   0x2ADA

Saturn data prologue: UNIT OBJECT.

Definition at line 545 of file saturn.h.

#define SAT_DOEXT0   0x2B88

Saturn data prologue: LIBDATA.

Definition at line 569 of file saturn.h.

#define SAT_DOEXT1   SAT_DOACPTR

Definition at line 574 of file saturn.h.

#define SAT_DOEXT2   0x2BCC

Saturn data prologue: EXT2.

Definition at line 578 of file saturn.h.

#define SAT_DOEXT3   0x2BEE

Saturn data prologue: EXT3.

Definition at line 582 of file saturn.h.

#define SAT_DOEXT4   0x2C10

Saturn data prologue: EXT4.

Definition at line 586 of file saturn.h.

#define SAT_DOFLASHP   0x26AC

Saturn data prologue: FLASH PTR.

Definition at line 549 of file saturn.h.

#define SAT_DOGROB   0x2B1E

Saturn data prologue: GROB.

Definition at line 529 of file saturn.h.

#define SAT_DOHXS   0x2a4e

Saturn data prologue: UINT (HEX STRING).

Definition at line 473 of file saturn.h.

#define SAT_DOIDNT   0x2e48

Saturn data prologue: ID (variable name).

Definition at line 501 of file saturn.h.

#define SAT_DOINT   0x2614

Saturn data prologue: ZINT (Typical Exact Integer).

Definition at line 455 of file saturn.h.

#define SAT_DOLAM   0x2e6D

Saturn data prologue: LAM ID (variable name).

Definition at line 505 of file saturn.h.

#define SAT_DOLIB   0x2B40

Saturn data prologue: LIBRARY.

Definition at line 553 of file saturn.h.

#define SAT_DOLIST   0x2A74

Saturn data prologue: LIST.

Definition at line 521 of file saturn.h.

#define SAT_DOLNGCOMP   0x2660

Saturn data prologue: LNGCOMP.

Definition at line 594 of file saturn.h.

#define SAT_DOLNGREAL   0x263A

Saturn data prologue: LNGREAL.

Definition at line 590 of file saturn.h.

#define SAT_DOLNKARRY   0x29e8

Saturn data prologue: LINKED ARRAY.

Definition at line 497 of file saturn.h.

#define SAT_DOMATRIX   0x2686

Saturn data prologue: SYMBOLIC ARRAY.

Definition at line 557 of file saturn.h.

#define SAT_DOREAL   0x2933

Saturn data prologue: REAL.

Definition at line 463 of file saturn.h.

#define SAT_DOROMP   0x2e92

Saturn data prologue: XLIB (ROM Pointer).

Definition at line 509 of file saturn.h.

#define SAT_DORRP   0x2a96

Saturn data prologue: RRP (Directory objects).

Definition at line 513 of file saturn.h.

#define SAT_DOSYMB   0x2AB8

Saturn data prologue: SYMBOLIC.

Definition at line 517 of file saturn.h.

#define SAT_DOTAG   0x2AFC

Saturn data prologue: TAGGED OBJECT.

Definition at line 561 of file saturn.h.

#define SAT_DSKTOP   0x806F8

Saturn CPU storage area: D1.

Definition at line 909 of file saturn.h.

#define SAT_EDITLINE   0x806FD

Saturn emu storage area: EDITLINE.

Definition at line 933 of file saturn.h.

#define SAT_ERROR   0x80EA5

Saturn error message number address: ERROR.

Definition at line 939 of file saturn.h.

#define SAT_FALSE   0x3ac0

SysRPL flags: FALSE.

Definition at line 952 of file saturn.h.

#define SAT_INTRPPTR   0x8076B

Saturn CPU storage area: D0.

Definition at line 903 of file saturn.h.

#define sat_movedown ( a,
b,
 )     sat_memmove(a,b,c)

C implementation of Saturn MOVEDOWN.

Obsolete: Defined as a macro that calls sat_memmove

Parameters:
satsrc The source address in Saturn domain
satdest The destination address in Saturn domain
nibbles Number of nibbles to move

Definition at line 755 of file saturn.h.

#define sat_moveup ( a,
b,
 )     sat_memmove(a,b,c)

C implementation of Saturn MOVEUP.

Obsolete: Defined as a macro that calls sat_memmove

Parameters:
satsrc The source address in Saturn domain
satdest The destination address in Saturn domain
nibbles Number of nibbles to move

Definition at line 742 of file saturn.h.

#define sat_peek_sat_addr ( sat_addr   )     sat_peek((sat_addr),5)

Convenience macro for peeking Saturn addresses (5 nibbles).

Definition at line 840 of file saturn.h.

#define sat_peek_sat_byte ( sat_addr   )     ((unsigned char) sat_peek((sat_addr),2))

Convenience macro for peeking one byte (2 nibbles).

Definition at line 846 of file saturn.h.

#define sat_poke_sat_addr ( sat_addr,
val   )     sat_poke((sat_addr), (val), 5)

Convenience macro for poking a Saturn address (5 nibbles) to Saturn memory.

Definition at line 895 of file saturn.h.

#define sat_poke_sat_byte ( sat_addr,
val   )     sat_poke((sat_addr), (unsigned) (val), 2)

Convenience macro for poking a single byte (2 nibbles) to Saturn memory.

Definition at line 883 of file saturn.h.

#define sat_poke_sat_bytes ( sat_addr,
bytes,
 )     sat_poke_nibbles((sat_addr), (bytes), (2*(n)))

Convenience macro for poking many bytes (2*n nibbles) to Saturn memory.

Definition at line 889 of file saturn.h.

#define SAT_PROLOGUE_STRING   SAT_DOCSTR

Definition at line 615 of file saturn.h.

#define SAT_PROLOGUE_UINT   SAT_DOHXS

Definition at line 616 of file saturn.h.

#define SAT_RSKTOP   0x806F3

Saturn CPU storage area: B.

Definition at line 915 of file saturn.h.

#define SAT_SEMI   0x312b

Saturn composite object terminator: SEMI.

Definition at line 533 of file saturn.h.

#define SAT_STACK_BIAS   1

How many stack levels are used by the launcher.

Definition at line 424 of file saturn.h.

#define sat_stack_pick_string ( l,
 )     sat_pick_str((l),(b))

Alias name mapping for maintaining API consistency.

Definition at line 1092 of file saturn.h.

#define sat_stack_pick_string_alloc (  )     sat_pick_str_alloc((l))

Alias name mapping for maintaining API consistency.

Definition at line 1098 of file saturn.h.

#define sat_stack_pop_string (  )     sat_pop_str((s))

Alias name mapping for maintaining API consistency.

Definition at line 1080 of file saturn.h.

#define sat_stack_pop_string_alloc   sat_pop_str_alloc

Alias name mapping for maintaining API consistency.

Definition at line 1086 of file saturn.h.

#define sat_stack_push_bool   sat_pushtruefalse

An alias for sat_pushtruefalse.

Definition at line 1446 of file saturn.h.

#define SAT_TEMPTOP   0x806EE

Saturn emu storage area: TEMPTOP.

Definition at line 927 of file saturn.h.

#define SAT_TRUE   0x3a81

SysRPL flags: TRUE.

Definition at line 947 of file saturn.h.

#define SWAP4 (  )     (((x) << 4) | ((x) >> 4))

Swap low and high nibbles in a byte.

Definition at line 286 of file saturn.h.

#define TRUE   !FALSE

The BOOLEAN constant TRUE.

Definition at line 315 of file saturn.h.


Typedef Documentation

typedef long long LONGLONG

Definition at line 54 of file saturn.h.

typedef struct _sat_cpu SAT_CPU

The emulated Saturn CPU as a memory area in ARM domain.

typedef

struct _sat_cpu {
    
    unsigned int     Read[257];
    unsigned int     Write[257];
    unsigned char     unknown_data[260];
    unsigned int    A;
    unsigned int    Ah;
    unsigned int    B;
    unsigned int    Bh;
    unsigned int    C;
    unsigned int    Ch;
    unsigned int    D;
    unsigned int    Dh;
    
    unsigned int    R0;
    unsigned int    R0h;
    unsigned int    R1;
    unsigned int    R1h;
    unsigned int    R2;
    unsigned int    R2h;
    unsigned int    R3;
    unsigned int    R3h;
    unsigned int    R4;
    unsigned int    R4h;
    
    unsigned int    D0;
    unsigned int    D1;
    unsigned int    P;
    unsigned int    ST;
    unsigned int    HST;
    unsigned int    CARRY;
    unsigned int    DECIMAL_MODE;
    
} SAT_CPU, *SAT_PCPU;

typedef struct sat_list_struct * SAT_LIST

An RPL List Object.

typedef struct _sat_cpu * SAT_PCPU

The emulated Saturn CPU as a memory area in ARM domain.

typedef

struct _sat_cpu {
    
    unsigned int     Read[257];
    unsigned int     Write[257];
    unsigned char     unknown_data[260];
    unsigned int    A;
    unsigned int    Ah;
    unsigned int    B;
    unsigned int    Bh;
    unsigned int    C;
    unsigned int    Ch;
    unsigned int    D;
    unsigned int    Dh;
    
    unsigned int    R0;
    unsigned int    R0h;
    unsigned int    R1;
    unsigned int    R1h;
    unsigned int    R2;
    unsigned int    R2h;
    unsigned int    R3;
    unsigned int    R3h;
    unsigned int    R4;
    unsigned int    R4h;
    
    unsigned int    D0;
    unsigned int    D1;
    unsigned int    P;
    unsigned int    ST;
    unsigned int    HST;
    unsigned int    CARRY;
    unsigned int    DECIMAL_MODE;
    
} SAT_CPU, *SAT_PCPU;

typedef struct _sat_stack_data * SAT_PSTACK_DATA

Data structure, that models a single stack element.

   typedef struct _sat_stack_data
   {
       int    type;
       union {
           int        ival;
           double        dval;
           LONGLONG    lval;
           char        *sval;
       };
   } SAT_STACK_DATA, *SAT_PSTACK_DATA;

typedef struct _sat_stack_element * SAT_PSTACK_ELEMENT

A descriptor for an RPL stack element in Saturn notation.

  typedef struct _sat_stack_element
   {
       unsigned    addr;
       unsigned    prologue;
       
   } SAT_STACK_ELEMENT, *SAT_PSTACK_ELEMENT;

typedef struct _sat_stack_data SAT_STACK_DATA

Data structure, that models a single stack element.

   typedef struct _sat_stack_data
   {
       int    type;
       union {
           int        ival;
           double        dval;
           LONGLONG    lval;
           char        *sval;
       };
   } SAT_STACK_DATA, *SAT_PSTACK_DATA;

typedef struct _sat_stack_element SAT_STACK_ELEMENT

A descriptor for an RPL stack element in Saturn notation.

  typedef struct _sat_stack_element
   {
       unsigned    addr;
       unsigned    prologue;
       
   } SAT_STACK_ELEMENT, *SAT_PSTACK_ELEMENT;

typedef unsigned long long ULONGLONG

Definition at line 53 of file saturn.h.


Function Documentation

char* _sat_decode_string ( unsigned  sat_addr  ) 

Decode a Saturn string object.

Parameters:
sat_addr address of object in Saturn doamin
Returns:
Pointer to decoded string
Note:
Internal primitive, don't use in applications

int _sat_stack_pop_stdargs ( const char *  arg0,
char ***  argv 
)

Build a standard C main (argc,**argv) tuple from the RPL stack arg0 denotes an (optional) program name. If arg0 == NULL, _sat_stack_pop_stdargs() follows the semantics of it's default frontend sat_stack_pop_stdarg(). This function's purpose is mainly to ease the adaption of "standard" C programs, which provide a program name in argv[0].

Parameters:
arg0 Program name or NULL for none.
argv Address of a char ** array, to hold the strings
Returns:
The number of arguments pushed (argc), including the program name (if any)

int _sat_stack_push_int ( int  z,
int  radix,
int  binary 
)

Push a string representation of an integer onto the stack The integer is converted to a string and then pushed via sat_stack_push_string().

Parameters:
z an Integer
radix The base
binary 1=use "#zzz[o|d|h]" representation
Returns:
Number of bytes pushed ( 0 on error )

LONGLONG sat_BCD2LONGLONG ( unsigned  addr,
int  digits 
)

int sat_check_type ( unsigned int  level,
unsigned int  prologue 
)

type checks a stack type

Parameters:
level The stack level to check
prologue The type prologue being tested
Returns:
TRUE if types match, FALSE otherwise

unsigned char* sat_concatnib ( unsigned char *  dest,
unsigned int  destLen,
unsigned char *  source,
unsigned int  sourceLen 
)

Combines 2 strings of binary Saturn data.

This helper function acts like a strcat, but for binary Saturn data. Note: This function still needs more testing.

Parameters:
dest Pointer to destination space
destLen size of 'dest' in nibbles
source Pointer to source data
destLen size of 'source' in nibbles

unsigned char* sat_convert_double_real ( double  number,
unsigned char *  realStr 
)

Helper function that dakes in a double, and returns a binary Real Object.

Parameters:
number the Number to transform into a Real
realStr some storage space to put the binary representation (use at least 14 bytes)
Returns:
pointer to the result (same as realStr)

char* sat_convert_zint_array ( unsigned int  digits,
unsigned int  negative,
unsigned char *  source,
unsigned char *  dest 
)

Helper function for converting an array of digits to a Zint. Accepts an array of binary digits, and creates a binary Zint object eg {1,2,3,4,5,6,7,8,9} for 123456789. It also accepts a negative flag (if TRUE, number is treated as negative) and number of digits.

Parameters:
digits Number of digits in source
negative Set to TRUE for negative numbers
source the number as an array. Include binary values 0-9 ONLY.
dest storage space for the encoded ZINT.

int sat_createtemp ( int  objsize  ) 

Create a temporary object in the Saturn Heap.

C implementation of the HP49's ROM library routine

Parameters:
objsize Size of object in nibbles
Returns:
Pointer to prologue of newly created object or NULL on error

int sat_decode_real ( unsigned  address,
double *  val 
)

int sat_decode_stack_element ( SAT_STACK_DATA data,
SAT_STACK_ELEMENT stack 
)

Decode a stack element to a SAT_STACK_DATA type.

Parameters:
data Pointer to decoded structure
stack Pointer to a raw stack element
Returns:
0 = success, -1 = error

ULONGLONG sat_double2real ( double  n  ) 

void sat_errorsto ( int  errno  ) 

C version of the sysRPL ERRORSTO. Sets current error number.

Parameters:
errno Calculator error message number.

int sat_get_stack_element ( int  index,
SAT_STACK_ELEMENT element 
)

Get a stack element (GET).

Parameters:
index Stack Index [1..DEPTH]
element Pointer to a SAT_STACK_ELEMENT structure
Returns:
zero on success or -1 on error

int sat_getfreetempob (  ) 

Obtain maximum object size that can be created with sat_createtemp().

Returns:
Number of available nibbles in TEMPOB.

void sat_list_add_real ( SAT_LIST  list,
double  num 
)

adds a Double to an RPL List as a Real

Parameters:
list the List object
num a number to add as a Real

void sat_list_add_zint ( SAT_LIST  list,
LONGLONG  num 
)

adds a LONGLONG to an RPL List as a ZINT

Parameters:
list the List object
num a 64 bit number to add as a ZINT

void sat_list_add_zint_array ( SAT_LIST  list,
unsigned int  digits,
unsigned int  negative,
unsigned char *  source 
)

Helper function for adding ZINTs to an RP List Accepts an array of binary digits, and adds to a List eg {1,2,3,4,5,6,7,8,9} for 123456789. It also accepts a negative flag (if TRUE, number is treated as negative) and number of digits.

Parameters:
list the RPL List
digits Number of digits in source
negative Set to TRUE for negative numbers
source the number as an array. Include binary values 0-9 ONLY.

SAT_LIST sat_list_create ( unsigned int  maxSize  ) 

Creates an RPL List Object Creates a List object of type SAT_LIST, used for holding multiple Saturn objects.

Parameters:
maxSize the size allocates for the List object, in Bytes
Returns:
an RPL List Object, of type 'SAT_LIST'. 0 If not enough RAM.

void sat_list_destroy ( SAT_LIST  list  ) 

destroys an RPL List Object Frees the memory takes by a SAT_LIST

Parameters:
list the list to free

unsigned int sat_map_a2s ( unsigned int  arm_addr  ) 

Translate an ARM memory address to Saturn domain.

Parameters:
arm_addr Memory address in ARM domain
Returns:
Address in Saturn domain. Returns 0xffffffff if arm_addr is not visible from Saturn domain.

unsigned int sat_map_s2a ( unsigned int  sat_addr  ) 

Translate a Saturn memory address to ARM domain.

Parameters:
sat_addr Memory address in Saturn domain
Returns:
Address in ARM domain

void sat_memmove ( int  satsrc,
int  satdest,
int  nibbles 
)

C implementation of Saturn MOVEUP/MOVEDOWN.

This function moves a number of nibbles in Saturn domain. Automatically chooses direction to avoid overwriting.

Parameters:
satsrc The source address in Saturn domain
satdest The destination address in Saturn domain
nibbles Number of nibbles to move

unsigned sat_peek ( int  sat_addr,
int  nibbles 
)

Peek up to 8 nibbles of data from Saturn domain.

This function reads up to 32 bit data in 4 bit chunks (nibbles) from Saturn memory.

Parameters:
sat_addr The address in Saturn domain
nibbles Number of nibbles to poke
Returns:
The datum itself

void* sat_peek_sat_bytes ( void *  target,
unsigned  sat_addr,
int  nbytes 
)

Peek many nibbles from Saturn domain into ARM memory.

This function copies 2*strlen(data) nibbles from Saturn to ARM memory.

Parameters:
target Pointer to (allocated) memory in ARM domain
sat_addr Source address in Saturn domain
nbytes Number of bytes to copy

char* sat_pick_str ( int  level,
char *  buf 
)

Pick a string at level 'level' from the RPL stack.

Parameters:
level Stack level to pick from
buf Pointer to (big enough!) string buffer
Returns:
Pointer to string picked from the RPL stack

char* sat_pick_str_alloc ( int  level  ) 

Pick a string at level 'level' from the RPL stack with automatically allocated memory.

Parameters:
level Stack level to pick from
Returns:
Pointer to string popped off the RPL stack
Note:
The returned pointer has to be freed explicitly

void sat_poke ( int  sat_addr,
unsigned  val,
int  nibbles 
)

Poke up to 8 nibbles of data to Saturn domain.

This function stores up to 32 bit data in 4 bit chunks (nibbles) to Saturn memory.

Parameters:
sat_addr The address in Saturn domain
val The datum itself
nibbles Number of nibbles to poke

void sat_poke_nibbles ( unsigned  sat_addr,
const char *  data,
int  nibbles 
)

Poke many nibbles to Saturn domain.

This function stores 2*strlen(data) nibbles to Saturn memory. It calls sat_poke() as it's "work-horse".

Parameters:
sat_addr The address in Saturn domain
data The data string
nibbles Number of nibbles to poke

double sat_pop_real (  ) 

Pop a Real from the Stack, as a Double. The Real object is popped from the RPL stack, and transformed into a double.

Returns:
The Real, as a double. If there was an error returns 0.0

char* sat_pop_str ( char *  buf  ) 

Pop a string from the RPL stack.

Parameters:
str Pointer to (big enough!) string buffer
Returns:
Pointer to string popped off the RPL stack

char* sat_pop_str_alloc (  ) 

Pop a string from the RPL stack with automatically allocated memory.

Returns:
Pointer to string popped off the RPL stack
Note:
The returned pointer has to be freed explicitly

LONGLONG sat_pop_zint_llong (  ) 

Pop a ZINT off the RPL stack into a LONGLONG Pop a ZINT (exact integer) off the RPL stack into a LONGLONG (64 bit signed integer).

Returns:
the value off the stack, or 0 if error.

BOOL sat_push_bint ( int  bint  ) 

Push a bint on the RPL stack.

Pushes a sysRPL BINT object on the stack

Parameters:
bint 20-bit unsigned number
Returns:
TRUE on success

BOOL sat_push_char ( char  byte  ) 

Push a char on the RPL stack.

Pushes a character on the stack

Parameters:
byte 8-bit character
Returns:
TRUE on success

BOOL sat_push_comp ( ULONGLONG  real,
ULONGLONG  imag 
)

Push a complex number on the RPL stack.

Pushes a complex number on the stack

Parameters:
real 64-bit BCD calculator real number
imag 64-bit BCD calculator real number
Returns:
TRUE on success

BOOL sat_push_list ( SAT_LIST  list  ) 

Pushes an RPL List Object (of type SAT_LIST) onto the RPL Stack.

Parameters:
list the List object to push.
Returns:
Returns TRUE if sucessful

BOOL sat_push_real ( double  number  ) 

Push a real on the RPL stack.

Pushes a double, as a 'real' number on the RPL stack

Parameters:
number A 'Double' floating point number.
Returns:
TRUE on success

BOOL sat_push_realarray ( int  rows,
int  columns,
ULONGLONG arry 
)

Push a real array on the RPL stack.

Pushes an array of real numbers on the stack

Parameters:
rows Number of rows in the matrix
columns Number of columns in the matrix
arry Pointer to an array of (rows*columns) 64-bit BCD calculator real numbers
Returns:
TRUE on success

BOOL sat_push_string ( int  type_prolog,
int  size_nibbles,
const char *  data 
)

Push a string on the RPL stack.

This function works with ZINT,HXS,CSTR,LIBDATA and CODE data types

Parameters:
type_prolog The data type's prologue
size_nibbles Number of nibbles to push
data Pointer to data string
Returns:
TRUE on success

BOOL sat_push_zint_array ( unsigned int  digits,
unsigned int  negative,
unsigned char *  source 
)

Helper function for pushing ZINTs onto the Stack Accepts an array of binary digits, and pushes then onto the stack egc {1,2,3,4,5,6,7,8,9} for 123456789. It also accepts a negative flag (if TRUE, number is treated as negative) and number of digits.

Parameters:
digits Number of digits in source
negative Set to TRUE for negative numbers
source the number as an array. Include binary values 0-9 ONLY.
Returns:
TRUE if sucessful.

BOOL sat_push_zint_llong ( LONGLONG  num  ) 

Push a LONGLONG onto the RPL stack as a ZINT Accepts a number of Type 'LONGLONG', and pushes it as an Exact Integer (ZINT).

Parameters:
num the number to push as a ZINT (LONGLONG).
Returns:
TRUE if sucessful.

void sat_pushptr ( int  sataddr  ) 

Push a pointer in the stack.

Pushes a data pointer to the stack and adjusts the available memory.

Parameters:
sataddr Saturn address of the object

void sat_pushtruefalse ( BOOL  arg  ) 

Push saturn flag FALSE if arg is FALSE, TRUE otherwise.

Parameters:
arg Boolean True/False to push on the calculator stack

double sat_real2double ( unsigned  addr  ) 

int sat_shrinklastob ( int  objaddr,
int  newsize 
)

Change the allocated size of the last object in tempob.

C implementation of the HP49's ROM routines Shrink$ and Stretch$

Parameters:
objaddr Address of the object's prolog
newsize New size to allocate for the object
Returns:
TRUE if object size was changed, FALSE if not enough memory (when stretching only)

int sat_stack_depth (  ) 

Get number of elements on the RPL stack (DEPTH).

Returns:
Number of elements on stack or zero if empty

int sat_stack_drop (  ) 

Pop one element off the stack (DROP).

Returns:
Number of dropped elements (1 on success)

int sat_stack_dropn ( int  n  ) 

Pop many elements off the stack (DROPN).

Returns:
Number of dropped elements

void sat_stack_exit ( unsigned  rpl_stack_bias  ) 

DEPRECATED: Finalize RPL stack access This function MUST be called before exiting the program Failing this may cause a calculator crash (TTRM with memory clear!)

Note:
This function is deprecated as of version 2.0. It's merely a dummy for maintaining backwards compatibility.

unsigned sat_stack_init (  ) 

DEPRECATED: Initialize RPL stack access This function MUST be called before any other high level stack API function. The returned value is NOT intended for any usage other then storing it!

Returns:
a transparent pointer to a stack bias element in Saturn memory
Note:
This function is deprecated as of version 2.0. It's merely a dummy for maintaining backwards compatibility.

int sat_stack_levels_avail (  ) 

Inquiry function that tells how many stack levels are available for pushing.

Returns:
Number of available levels (0 = stack is full)

int sat_stack_nip (  ) 

Swap then drop (NIP).

Returns:
Number of dropped elements (1 on success)

int sat_stack_pop_stdargs ( char ***  argv  ) 

Build a standard C main (argc,**argv) tuple from the RPL stack.

Contrary to the "standard" argv, this argv array holds exactly argc values, i.e. we have NO program name. Note also, that the arguments are stored in reverse order as they were push to the stack and that no null pointer is appended as the last element. (Remember the stack is a LIFO - Last In First Out - structure )

Parameters:
argv Address of a char ** array, to hold the strings
Returns:
The number of arguments pushed (argc)

int sat_stack_push_double ( double  d  ) 

Push a string representation of a double onto the stack The double value is converted to a string and then pushed via sat_stack_push_string().

Parameters:
d a double
Returns:
Number of bytes pushed ( 0 on error )

int sat_stack_push_int ( int  z  ) 

Push a string representation (base=10) of an integer onto the stack The integer is converted to a string and then pushed via sat_stack_push_string().

Parameters:
z an Integer
Returns:
Number of bytes pushed ( 0 on error )

int sat_stack_push_string ( const char *  str  ) 

Push a string onto the RPL stack.

Parameters:
str Pointer to (zero delimited) string
Returns:
Number of bytes pushed ( 0 on error )

int sat_stack_swap (  ) 

Swap elements on level 1 and 2 (SWAP).

Returns:
Number of swaps (1 on success)


Variable Documentation

SAT_CPU* _saturn_cpu


Generated on Fri Feb 16 16:43:16 2007 for HP-GCCLibrary by  doxygen 1.5.0