Register

How to find and display the Prizm's built-in MENU-icons

Learn how to program. Code snippets for creating sprites etc. Submit your own or use those of others.
Senior Member
Posts: 116
Joined: Mon Mar 02, 2015 10:53 am
Calculators: Casio fx-CG20

Re: How to find and display the Prizm's built-in MENU-icons

Postby AmazoNKA » Sat Jun 18, 2016 4:40 pm

SimonLothar wrote:
AmazoNKA wrote:So I'm keen to know if there is a system call or some flag or memoty file which can detect that currently running add in is the first one run on the calculator so far please.
I did not find such a feature.

A little byproduct of my investigations:
The flag which controls the MENU-key behaviour can be read and changed using the following code.
Code: Select all
//
unsigned char APP_MenuKeyFlag( unsigned char value ){
unsigned int ea;
unsigned int j;
unsigned char*pMenuKeyFlag;
  if ( OSVersionAsInt() <= 0x02020000 ){
    ea = *(unsigned int*)0x8002007C; // get pointer to syscall table
    ea += 0x1e6e*4;  // // get pointer to syscall 1e6e
   
    ea = *(unsigned int*)( ea );
    j = *(unsigned char*)( ea + 1 );
    j *= 4;
    j = ( ea + j + 4 ) & 0xFFFFFFFC;
    pMenuKeyFlag = (unsigned char*)(*( unsigned int*)( j ) + 3 );
  }else{
    pMenuKeyFlag = 0;
  }
  j = 0;
  if ( pMenuKeyFlag ){
   j = *pMenuKeyFlag;
   *pMenuKeyFlag = value;
  }
  return j;
}


But beware. If you set the flag to 1, the calculator cannot leave your addin any more, unless restarted with the RESTART-button. So provide for some function to set the flag back to 0.
And the flag seems to control some other features, too, f. i. if you connect the calculator to some USB-port, the connection dialog does not pop up.

This is a big discovery and to me looks like a shorter version of the other routine you published for enabling and disabling menu button. Thanks again

Senior Member
Posts: 116
Joined: Mon Mar 02, 2015 10:53 am
Calculators: Casio fx-CG20

Re: How to find and display the Prizm's built-in MENU-icons

Postby AmazoNKA » Fri Aug 19, 2016 7:28 pm

SimonLothar wrote:syscall 0D08 is the call to display a string.
Bdisp_MMPrint(int*x, int*y, unsigned char*, int mode, int xmax, int, int, int color, int, int, int );

Examples:
x = 0x30;
y = 0x50;
Bdisp_MMPrint( &x, &y, "ABCDEFGHIJK", 2, 0x50, 0, 0, 0, 0, 1, 0 ); // black
x = 0x30;
y = 0x60;
Bdisp_MMPrint( &x, &y, "DEFGHI", 2, 100, 0, 0, 0xF800, 0, 1, 0 ); // red

Dear Simon, I'm not sure if I'm just passing the string incorrectly or should use a different system call but things which display natively ok with os and addins names including ' and acute French characters do not seem to render into the right font - maybe it is a matter of passing right hex code but if i pass \x##\x## or similar values in the string they just show as that hex code literary not the character they should show... I wonder what you think is happening and if there is a work around please. Thanks

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: How to find and display the Prizm's built-in MENU-icons

Postby SimonLothar » Sat Aug 20, 2016 2:18 am

Meanwhile I renamed syscall 0D08 to Bdisp_MMPrint_pxpy.
As for the multibyte-characters syscall 0x0D08 and 0x0D09 work in the same way.
F. i. this works well for me
Bdisp_MMPrint( x, y, "\xE5\x01\xE5\x02\xE5\x03\xE5\x04\xE5\x05", 2, 500, 0, 0, 0xF800, 0, 1, 0 );
giving ÀÁÂÃÄ


Image
I'll be back!

Senior Member
Posts: 116
Joined: Mon Mar 02, 2015 10:53 am
Calculators: Casio fx-CG20

Re: How to find and display the Prizm's built-in MENU-icons

Postby AmazoNKA » Sat Aug 20, 2016 12:29 pm

You are absolutely right - i must have made a mistake with my hexes overrunning into three digits etc and doing something wrong trying to fix it. Nice to see it works for most multibyte characters :-)

Previous

Return to Tutorials & Code Snippets

Who is online

Users browsing this forum: No registered users and 13 guests