Jump to content



Photo
- - - - -

Reading Input


  • Please log in to reply
2 replies to this topic

#1 paul_brassington

paul_brassington

    Newbie

  • Members
  • Pip
  • 25 posts

  • Calculators:
    fx-9860g II SD

Posted 04 March 2013 - 09:22 PM

Hi Guys,

A million thanks for your help and my project is getting better. My objective as a maths teacher is to produce an add on that adds loads of functions of maths questions and answers.

My code is now:

#include "fxlib.h"
#include "dispbios.h"
#include "keybios.h"


int mainmenu();
void respondToMain(int);

int AddIn_main(int isAppli, unsigned short OptionNum) {


int response = mainmenu();
respondToMain(response);

}

#pragma section _BR_Size
unsigned long BR_Size;
#pragma section


#pragma section _TOP

int InitializeSystem(int isAppli, unsigned short OptionNum)
{
		return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
}

#pragma section

int mainmenu(){
unsigned int key;
int result;
Bdisp_AllClr_DDVRAM();
Bdisp_AreaReverseVRAM(5, 57, 20, 63); // F1
PrintMini(11,58,(unsigned char*)"1",MINI_REV);
Bdisp_AreaReverseVRAM(26, 57, 41, 63); // F2
PrintMini(32,58,(unsigned char*)"2",MINI_REV);
Bdisp_AreaReverseVRAM(47, 57, 62, 63); // F3
PrintMini(53,58,(unsigned char*)"3",MINI_REV);
Bdisp_AreaReverseVRAM(68, 57, 83, 63); // F4
PrintMini(74,58,(unsigned char*)"4",MINI_REV);
Bdisp_AreaReverseVRAM(89, 57, 104, 63); // F5
PrintMini(95,58,(unsigned char*)"5",MINI_REV);
PrintXY(10, 5,(unsigned char*)"1. Algebra", 0);
PrintXY(10, 15,(unsigned char*)"2. Number", 0);
PrintXY(10, 25,(unsigned char*)"3. Shape", 0);
PrintXY(10, 35,(unsigned char*)"4. Data", 0);
PrintXY(10, 45,(unsigned char*)"5. A Level", 0);
Bdisp_PutDisp_DD();
GetKey(&key);
switch(key){
case KEY_CTRL_F1:
result = 1;
break;
case KEY_CTRL_F2:
result = 2;
break;
}
return result;
}

void respondToMain(int response){
unsigned int key;
while(1){
GetKey(&key);
switch(response){
case 1:
PrintMini(10,10,(unsigned char*)"1",MINI_REV);
break;
case 2:
PrintMini(10,10,(unsigned char*)"2",MINI_REV);
break;
}
Bdisp_PutDisp_DD();
}
}

So how do I allow the user to put input and how do I get that into my code? Seems that would be easy but the SDK does not seem to have this functions. Seems strange to be not to have these but still.

Thanks again for all your help.

Paul Brassington

Edited by flyingfisch, 05 March 2013 - 11:00 PM.
wrapped your code in tags, makes it much easier to read. ;)


#2 hayzel

hayzel

    Newbie

  • Members
  • Pip
  • 10 posts

Posted 06 March 2013 - 08:42 AM

There is no bultin function to get user input as scanf for example in C.
You have to write your own with GetKey() or use an ready one made from others.

#3 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 06 March 2013 - 04:31 PM

I'd use InputString (syscall 0x0CC5).
Syntax: int InputString( unsigned char*buffer, unsigned char *heading, int maxlen );
How to use system calls: http://www.casiopeia...php?f=20&t=1376




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users