SuperH-based fx calculators
fx legacy app

legacy syscalls overview

Application parameters

It could be reasonable to assume that applications parameters match the parameters sent to addins. This is from the default C-file from the SDK explaining the parameters:

//****************************************************************************
//  AddIn_main (Sample program main function)
//
//  param   :   isAppli   : 1 = This application is launched by MAIN MENU.
//                        : 0 = This application is launched by a strip in eACT application.
//
//              OptionNum : Strip number (0~3)
//                         (This parameter is only used when isAppli parameter is 0.)
//
//  retval  :   1 = No error / 0 = Error
//
//****************************************************************************
int AddIn_main(int isAppli, unsigned short OptionNum) { ... }


Calling the functions below with 1 in r4 ('isAppli') seems to start them in a state similar or identical to what the main menu does.

 

System calls

0x0005: int App_RegisterAddins();

Scans the storage memory for G1A-files and updates the addin array.
Example: copy a file from SD-card to storage memory, register addins and start the new addin with App_Start.

 

0x0009: int FindFreeAddinSlot( void );

Returns the next free addin slot (position in the addin array, see RAM).
The addin array index starts with 0.

 

0x000A: int GetAddinHeaderAddr( int addinno, int offset, void*result );

addinno is the index of an registered addin. The first addin has the index 0.
Returns 1 if the addin with the required index exists, else returns 0.
If the addin exists, result is set to the pointer to the addin-header increased by offset.
F. i. with offset = 0x1D4, result would contain a pointer to the application's name.

 

0x000E: int App_GetAddinEstripInformation( int addinno, int estripno, TAddinEstripInformation*result );

addinno is the index of the addin to query.
estripno is the index of the estrp to query (0..5).
returns 1 if estripno is in the range 0..5.
returns 0 if not.

typedef struct {
        short p1;       // unused
        short estrip_no;
        void*addin_array_start; // RAM-address of the queried addin in the addin-array
        void*estrip_location;   // address of the queried estrip in storage memory
        void*addin_smem_location;       // address of the queried addin in storage memory
        void*estrip_icon_location;      // address of the queried estrip's icon in storage memory
} TAddinEstripInformation;



 

0x046B: int App_BuiltInCount();

Returns the number of built-in applications.

 

0x049A: int App_Start( int R4, int R5, int index, int force );

Jumps to a registered application.
index is the index of the application. Starts at zero. The maximum number of built-in applications can be retrieved with 0x46B.
The user apps start with the next number.
If force!=0, a consecutive start of the same addin is allowed!
R4 and R5 have to be zero.

An addin started from MAIN MENU cannot be restarted immediately after is has been finished, t. i. not staying in a while(1)...GetKey()...loop.
This allows an immediate restart:

short*APP_EnableRestart(){
    short*pEnableRestartFlag;
      switch ( OSVersionAsInt() ){
            case 0x01020000: case 0x01030000: pEnableRestartFlag =  (short*)0x88006970; break;
            case 0x01040000: case 0x01050000: case 0x01051000: pEnableRestartFlag =  (short*)0x88006974; break;
            case 0x01100000: case 0x01110000: pEnableRestartFlag =  (short*)0x88006CC4; break;
            case 0x02000000: pEnableRestartFlag =  (short*)0x8800773C; break;
            default : pEnableRestartFlag = 0;
      }
      if ( pEnableRestartFlag ) *pEnableRestartFlag = 1;
      return pEnableRestartFlag;
}

Has to be called before returning from an addin.

0x0985: int App_CONICS( int R4, int R5 );

Does not complain with R4=0 and R5=0. Further investigation might be neccessary.

 

0x0998: int App_DYNA( void );


 

0x09DF: int App_EACT( void );


 

0x09E2: int App_EQUA( int R4, int R5 );

skips some normally displayed intermediate dialog
Does not complain with R4=0 and R5=0 and starts with "Simultaneous". Further investigation might be neccessary.

 

0x09F5: int App_PROG( void );

This call is not rejected by the SDK emulator. Instead it runs BASIC.

 

0x0A00: int App_FINANCE( int R4, int R5 );

Does not complain with R4=0 and R5=0. Further investigatione might be neccessary.

 

0x0A48: int App_GRAPH_TABLE( int R4, int R5 );

Displays "Condition error" with R4=0 and R5=0 but starts anyhow.
Does not complain with R4=0 and R5=1 and enters GRAPH-app. Further investigation might be neccessary.

 

0x0A4A: int App_LINK( void );


 

0x0A6A: int App_Optimization( void );

Executes MEMORY's Optimization. If no SD-slot is present, the optimization starts immediately. Otherwise, if the intermediate dialog should be answered automatically, KBD_PutKey has to push either '1' or '2' into the keybuffer beforehand.
The SD-slot can be detected with 0x468.
Example:

if (CheckForSD_Option() ) KBD_PutKey( '1', 1 );
App_Optimization();


This piece cannot be called out of an storage-memory-addin without special precautions; see SMEM_Optimitation for details.

 

0x0A6B: int App_MEMORY( void );


 

0x0A75: int App_RECUR( int R4, int R5 );

Does not complain with R4=0 and R5=0. Further investigation might be neccessary.

 

0x0AAE: int App_RUN_MAT( int R4, int R5 );

Does not complain with R4=0 and R5=0. Further investigation might be neccessary.

 

0x0AC6: int App_RUN_STAT( int R4, int R5 );

Displays "Dimension error" with R4=0 and R5=0 but starts anyhow.
Does not complain with R4=0 and R5=1. Further investigation might be neccessary.

 

0x0AC8: int App_SYSTEM( void );

 

(31.07.2012 06:04:15)