diff --git a/ALGEBRA.G1A b/ALGEBRA.G1A index c06edd4..136b897 100644 Binary files a/ALGEBRA.G1A and b/ALGEBRA.G1A differ diff --git a/Eigen.dlr b/Eigen.dlr index 142eb0e..3be005d 100644 --- a/Eigen.dlr +++ b/Eigen.dlr @@ -1 +1,63 @@ [DLSimRunSpace] + +[Breakpoint] +File=C:\Prizm\Eigenmath\Eigenmath\console.c +Line=585 +Flags=00001012 +Sublevel=1 + +[Breakpoint] +File=C:\Prizm\Eigenmath\Eigenmath\console.c +Line=591 +Flags=00001012 +Sublevel=1 + +[Breakpoint] +File=C:\Prizm\Eigenmath\Eigenmath\console.c +Line=591 +Flags=00001012 +Sublevel=2 + +[Breakpoint] +File=C:\Prizm\Eigenmath\Eigenmath\Taumath.cpp +Line=14 +Flags=00001012 + +[Breakpoint] +File=C:\Prizm\Eigenmath\Eigenmath\console.c +Line=741 +Flags=00001012 +Sublevel=1 + +[Breakpoint] +Address=80000000:88023F0C +Count=00000028 +Name=Console_FMenu_Init:debug +Flags=00000042 + +[Breakpoint] +File=C:\Prizm\Eigenmath\Eigenmath\console.c +Name=FMenu_entries[3] +Flags=00002042 + +[Breakpoint] +File=C:\Prizm\Eigenmath\Eigenmath\console.c +Name=FMenu_entries[2].str +Flags=00002042 + +[Breakpoint] +File=C:\Prizm\Eigenmath\Eigenmath\console.c +Line=33 +Flags=00001012 + +[Breakpoint] +File=C:\Prizm\Eigenmath\Eigenmath\console.c +Line=741 +Flags=00001012 +Sublevel=2 + +[Breakpoint] +File=C:\Prizm\Eigenmath\Eigenmath\console.c +Line=585 +Flags=00001012 +Sublevel=2 diff --git a/Eigen.dlw b/Eigen.dlw index c65d9e3..88c4b8d 100644 --- a/Eigen.dlw +++ b/Eigen.dlw @@ -2,19 +2,20 @@ [_1] Type=5 -Order=2 -Top=3930 -Left=-255 -Height=6360 -Width=2250 +Order=1 +Top=2565 +Left=4500 +Height=7095 +Width=9090 State=0 Flags=00000020 +Setting=16:1:console.c OptionA=0 [_2] Type=1 -Order=1 -Top=-840 +Order=3 +Top=0 Left=13035 Height=4785 Width=5610 @@ -25,8 +26,8 @@ OptionB=15 [_3] Type=6 -Order=3 -Top=3930 +Order=2 +Top=4770 Left=13035 Height=6345 Width=5610 @@ -36,29 +37,29 @@ OptionA=0 [_4] Type=7 -Order=9 +Order=15 Top=3900 Left=1980 Height=3165 Width=5565 -State=0 +State=16 Flags=00000000 OptionA=0 [_5] Type=8 -Order=10 -Top=7065 -Left=1980 +Order=14 +Top=8520 +Left=1365 Height=3225 Width=5580 -State=0 +State=16 Flags=00000000 OptionA=0 [_6] Type=3 -Order=18 +Order=22 Top=0 Left=10788 Height=6348 @@ -69,22 +70,22 @@ OptionA=0 [_7] Type=2 -Order=17 -Top=6348 +Order=7 +Top=6345 Left=7800 -Height=3588 +Height=3585 Width=5220 -State=16 +State=0 Flags=00000000 OptionA=0 [_8] Type=17 Order=5 -Top=-825 -Left=-255 -Height=4755 -Width=2235 +Top=1005 +Left=2070 +Height=5790 +Width=4050 State=0 Flags=00000000 OptionA=0 @@ -92,8 +93,8 @@ OptionA=0 [_9] Type=15 Order=0 -Top=2490 -Left=5385 +Top=6420 +Left=5520 Height=6360 Width=14760 State=0 @@ -102,7 +103,7 @@ OptionA=0 [_10] Type=13 -Order=16 +Order=21 Top=2340 Left=2340 Height=6930 @@ -111,33 +112,78 @@ State=16 Flags=00000020 OptionA=0 +[_11] +Type=9 +Order=13 +Top=870 +Left=660 +Height=9750 +Width=25185 +State=16 +Flags=00000020 +Setting=80000000:080FA6AC:081010F8:FMenu_entries[2].str +OptionA=0 + +[_12] +Type=14 +Order=9 +Top=4410 +Left=2055 +Height=9750 +Width=25185 +State=16 +Flags=00000020 +OptionA=0 + +[_13] +Type=4 +Order=8 +Top=5910 +Left=120 +Height=9750 +Width=25185 +State=16 +Flags=00000020 +OptionA=0 + +[_14] +Type=10 +Order=4 +Top=7515 +Left=3045 +Height=9570 +Width=24855 +State=0 +Flags=00000020 +OptionA=0 + [_32] Type=16 -Order=8 +Order=11 Top=420 Left=3630 Height=6885 Width=12045 -State=0 +State=16 Flags=00000020 Setting=12:1:console.h OptionA=0 [_33] Type=16 -Order=11 -Top=1200 -Left=3885 +Order=6 +Top=7455 +Left=5340 Height=6675 Width=15765 -State=16 +State=0 Flags=00000020 -Setting=1:1:syscalls_.src +Setting=700:1:console.c OptionA=0 [_34] Type=16 -Order=14 +Order=19 Top=1230 Left=975 Height=6930 @@ -149,7 +195,7 @@ OptionA=0 [_35] Type=16 -Order=12 +Order=17 Top=3510 Left=2535 Height=6930 @@ -161,31 +207,31 @@ OptionA=0 [_36] Type=16 -Order=4 -Top=900 -Left=780 +Order=12 +Top=825 +Left=2010 Height=6930 Width=15765 -State=0 +State=16 Flags=00000020 -Setting=33:28:Taumath.cpp +Setting=9:3:Taumath.cpp OptionA=0 [_37] Type=16 -Order=6 +Order=16 Top=1665 Left=1560 Height=6930 Width=15765 -State=0 +State=16 Flags=00000020 -Setting=572:20:print.cpp +Setting=553:11:print.cpp OptionA=0 [_38] Type=16 -Order=15 +Order=20 Top=5055 Left=1200 Height=6930 @@ -197,19 +243,19 @@ OptionA=0 [_39] Type=16 -Order=7 +Order=10 Top=1035 Left=2685 Height=6675 Width=15765 -State=0 +State=16 Flags=00000020 -Setting=82:48:factorpoly.cpp +Setting=63:26:factorpoly.cpp OptionA=0 [_40] Type=16 -Order=13 +Order=18 Top=1305 Left=2205 Height=6675 diff --git a/Eigen.g1w b/Eigen.g1w index dada2f1..11317c7 100644 --- a/Eigen.g1w +++ b/Eigen.g1w @@ -157,9 +157,11 @@ SourceFile=:main.cpp SourceFile=:test.cpp SourceFile=:console.c SourceFile=:syscalls_.src +SourceFile=:memory.c HeaderFile=:defs.h HeaderFile=:prototypes.h HeaderFile=:setjmp.h HeaderFile=:stdafx.h HeaderFile=:console.h HeaderFile=:syscalls.h +HeaderFile=:memory.h diff --git a/FXSH_Build.bat b/FXSH_Build.bat index 2232ba9..b59899a 100644 --- a/FXSH_Build.bat +++ b/FXSH_Build.bat @@ -1,7 +1,7 @@ @echo off rem Do not edit! This batch file is created by CASIO fx-9860G SDK. -if exist debug\*.obj del debug\*.obj + if exist ALGEBRA.G1A del ALGEBRA.G1A cd debug diff --git a/INIT/CasioRAM.mem b/INIT/CasioRAM.mem index 2abb23c..bd27e9e 100644 Binary files a/INIT/CasioRAM.mem and b/INIT/CasioRAM.mem differ diff --git a/INIT/CasioUserROM.mem b/INIT/CasioUserROM.mem index eea51c2..7930e2e 100644 Binary files a/INIT/CasioUserROM.mem and b/INIT/CasioUserROM.mem differ diff --git a/SDCard/fmenu.cfg b/SDCard/fmenu.cfg new file mode 100644 index 0000000..80df80a --- /dev/null +++ b/SDCard/fmenu.cfg @@ -0,0 +1,24 @@ +F2 +cos( +sin( +tan( +F1 +test( +test( +F4 +je( +suis( +vivant( +F5 +pom( +gali( +georges( +F6 +return( +solve( +F3 +solve( +factor( +simplify( +matrix( +d( \ No newline at end of file diff --git a/console.c b/console.c index c53c3ef..8fef760 100644 --- a/console.c +++ b/console.c @@ -1,7 +1,11 @@ +#include + #include "console.h" #include "syscalls.h" +#include "memory.h" static struct line Line[LINE_MAX]; +static struct FMenu FMenu_entries[6]; static struct location Cursor; static unsigned char *Edit_Line; static int Start_Line, Last_Line; @@ -438,6 +442,8 @@ int Console_GetKey() return Console_Input(tmp_str); } + if (key >= KEY_CTRL_F1 && + key <= KEY_CTRL_F6) return Console_FMenu(key); if (key == KEY_CHAR_IMGNRY) return Console_Input((const unsigned char *)"i"); if (key == KEY_CHAR_MAT) return Console_Input((const unsigned char *)"matrix"); if (key == KEY_CHAR_DP) return Console_Input((const unsigned char *)"."); @@ -538,6 +544,91 @@ int Console_GetKey() return CONSOLE_NO_EVENT; } +int Console_FMenu(int key) +{ + unsigned char *entries[MAX_MENU_ITEMS] = {NULL}; + if(key == KEY_CTRL_F1) { + /*entries[0] = (unsigned char *)Console_Make_Entry((const unsigned char *)"sqrt("); + entries[1] = (unsigned char *)Console_Make_Entry((const unsigned char *)"cos("); + entries[2] = (unsigned char *)Console_Make_Entry((const unsigned char *)"root("); + return Console_Draw_FMenu(key, entries);*/ + return Console_Draw_FMenu(key, /*entries*/&FMenu_entries[0]); + } + if(key == KEY_CTRL_F2) { + return Console_Draw_FMenu(key, /*entries*/&FMenu_entries[1]); + } + if(key == KEY_CTRL_F3) { + return Console_Draw_FMenu(key, /*entries*/&FMenu_entries[2]); + } + if(key == KEY_CTRL_F4) { + return Console_Draw_FMenu(key, /*entries*/&FMenu_entries[3]); + } + if(key == KEY_CTRL_F5) { + return Console_Draw_FMenu(key, /*entries*/&FMenu_entries[4]); + } + if(key == KEY_CTRL_F6) { + return Console_Draw_FMenu(key, /*entries*/&FMenu_entries[5]); + } + return 0; +} + +unsigned char *Console_Make_Entry(const unsigned char* str) +{ + unsigned char* entry = NULL; + entry = calloc((strlen(str)+1), sizeof(unsigned char*)); + if(entry) memcpy(entry, str, strlen(str)+1); + + return entry; +} + +int Console_Draw_FMenu(int key, struct FMenu* menu) +{ + int i, nb_entries = 0, selector = 0, position_number, position_x, ret, longest = 0; + unsigned char **entries; + DISPBOX box; + + position_number = key - KEY_CTRL_F1; + + entries = menu->str; + nb_entries = menu->count; + + for(i=0; i longest) longest = strlen(entries[i]); + + position_x = 21*position_number; + if(position_x + longest*4 > 115) position_x = 115 - longest*4; + + box.left = position_x+3; + box.right = position_x + longest*4 + 7; + box.bottom = 50+7; + box.top = 50+7- nb_entries*7; + + Bdisp_AreaClr_VRAM(&box); + + Bdisp_DrawLineVRAM(3+position_x, 50+7, 3+position_x, 50+7-nb_entries*7); + Bdisp_DrawLineVRAM(7+position_x + longest*4, 50+7, 7+position_x+longest*4, 50+7-nb_entries*7); + + while(key != KEY_CTRL_EXE || key != KEY_CTRL_EXIT) { + for(i=0; i 0) selector--; + + if (key == KEY_CTRL_EXE) return Console_Input(entries[selector]); + if (key == KEY_CTRL_EXIT) return Console_Input((const unsigned char *)""); + + if (key >= KEY_CTRL_F1 && key <= KEY_CTRL_F6) { + Console_Input((const unsigned char *)""); + Console_Disp(); + return Console_FMenu(key); + } + } +} + /* 以下函数用于初始化。 */ @@ -566,9 +657,72 @@ int Console_Init() Case = LOWER_CASE; + for(i = 0; i < 6; i++) { + FMenu_entries[i].count = 0; + } + + Console_FMenu_Init(); + return CONSOLE_SUCCEEDED; } +void Console_FMenu_Init() +{ + //ToDo : handle when there's no file ... + int i, number=0, key; + //unsigned char debug[40] = {'\0'}; + unsigned char* tmp_realloc = NULL; + unsigned char temp[20] = {'\0'}; + unsigned char* original_cfg; + unsigned char* cfg = memory_load("\\\\fls0\\FMENU.cfg"); + + original_cfg = cfg; + + while(*cfg) { + for(i=0; i<20, *cfg && *cfg!='\r' && *cfg!='\n'; i++, cfg++) { + temp[i] = *cfg; + } + //if(temp[i-1] == '\r') temp[i-1]='\0'; + + if(temp[0] == 'F' && temp[1]>='1' && temp[1]<='6') number = temp[1]-'0' - 1; + else if(temp[0]) { + tmp_realloc=FMenu_entries[number].str; + FMenu_entries[number].str = realloc(tmp_realloc, sizeof(unsigned char*)*(FMenu_entries[number].count+1)); + + if(FMenu_entries[number].str != NULL) { + FMenu_entries[number].str[FMenu_entries[number].count] = malloc(strlen(temp)+1); + + if(FMenu_entries[number].str[FMenu_entries[number].count] == NULL) { + PrintMini(10,40, "Error realloc bis -> FMenu_init()", MINI_OVER); + GetKey(&key); + FMenu_entries[number].str = realloc(FMenu_entries[number].str, FMenu_entries[number].count); //May never fail. + FMenu_entries[number].count--; + } + + else { + //sprintf(debug, "number = %d and count = %d", number, FMenu_entries[number].count); + strcpy(FMenu_entries[number].str[FMenu_entries[number].count], temp); + ///PrintMini(10,30, debug, MINI_OVER); + //PrintMini(50,40, FMenu_entries[number].str[FMenu_entries[number].count], MINI_OVER); + //if(FMenu_entries[number].count>0)PrintMini(50,50, FMenu_entries[number].str[FMenu_entries[number].count-1], MINI_OVER); + //GetKey(&key); + //Bdisp_AllClr_VRAM(); + } + + FMenu_entries[number].count++; + } + else { + PrintMini(50,40, "Error realloc -> FMenu_init()", MINI_OVER); + GetKey(&key); + FMenu_entries[number].str = tmp_realloc; + } + } + memset(temp, '\0', 20); + cfg++; + } + free(original_cfg); +} + /* 以下函数用于显示所有行。 注意:调用该函数后,将首先清空显存。 diff --git a/console.h b/console.h index 77aa30b..4241b47 100644 --- a/console.h +++ b/console.h @@ -17,7 +17,7 @@ extern "C"{ enum CONSOLE_SCREEN_SPEC{ LINE_MAX = 32, LINE_DISP_MAX = 7, - COL_DISP_MAX = 21, + COL_DISP_MAX = 21,//21 EDIT_LINE_MAX = 2048 }; @@ -54,11 +54,18 @@ extern "C"{ int disp_len; }; + struct FMenu{ + unsigned char** str; + unsigned char count; + }; + struct location{ int x; int y; }; +#define MAX_MENU_ITEMS 10 + #define is_wchar(c) ((c == 0x7F) || (c == 0xF7) || (c == 0xF9) || (c == 0xE5) || (c == 0xE6) || (c == 0xE7)) #define printf(s) Console_Output((const unsigned char *)s); @@ -74,6 +81,10 @@ extern "C"{ int Console_GetKey(void); int Console_Init(void); int Console_Disp(void); + int Console_FMenu(int key); + void Console_FMenu_Init(void); + int Console_Draw_FMenu(int key, struct FMenu* menu); + unsigned char *Console_Make_Entry(const unsigned char* str); unsigned char *Console_GetLine(void); #ifdef __cplusplus diff --git a/memory.c b/memory.c new file mode 100644 index 0000000..9e9fa1a --- /dev/null +++ b/memory.c @@ -0,0 +1,291 @@ +/****************************************************************/ +/* */ +/* Memory */ +/* */ +/* Description: Fonctions de manipulation de la memoire */ +/* Auteur: LePhenixNoir */ +/* Version: 3.0 */ +/* Date: 11.06.2014 */ +/* Fichier: memory.c - Code des fonctions */ +/* */ +/****************************************************************/ + +#ifndef __FXLIB_H__ + #include "fxlib.h" +#endif + +#ifndef _STDIO + #include +#endif + +#ifndef _STDLIB + #include +#endif + +#ifndef _STRING + #include +#endif + +#include "memory.h" + +int memory_errors = 0; + +void memory_seterrors(int e) +{ + memory_errors = (e!=0); +} + +void memory_error(char *from, char *func, int val) +{ + unsigned int key; + char info[20]; + if(!memory_errors) return; + + sprintf(info,"%d",val); + PopUpWin(6); + + locate(4,2); Print((unsigned char *)"Memory ERROR !!"); + locate(3,4); Print((unsigned char *)"FROM:"); + locate(8,4); Print((unsigned char *)from); + locate(3,5); Print((unsigned char *)"FUNC:"); + locate(8,5); Print((unsigned char *)func); + locate(3,6); Print((unsigned char *)"INFO:"); + locate(8,6); Print((unsigned char *)info); + locate(3,7); Print((unsigned char *)"META:"); + locate(8,7); + + switch(val) + { + case 1: Print((unsigned char *)"NotEnoughRAM"); break; + case -1: Print((unsigned char *)"Nonexisting"); break; + case -5: Print((unsigned char *)"WrongDevice"); break; + case -8: Print((unsigned char *)"AccessDenied"); break; + case -14: Print((unsigned char *)"ReadOnly"); break; + case -31: Print((unsigned char *)"DeviceError"); break; + case -35: Print((unsigned char *)"NotEmpty"); break; + default: Print((unsigned char *)"Other"); break; + } + GetKey(&key); +} + +FONTCHARACTER *memory_char2font(char *adresse) +{ + FONTCHARACTER *adr; + int i; + + adr = calloc((strlen(adresse)+1),sizeof(FONTCHARACTER)); + for(i=0;i3?3:n);t++) + { + if(icoind[offset+i]!=255) for(i=0;i<32;i++) { + k = icons[icoind[offset+t]][i]; + for(j=0;j<8;j++) { + if(k&1) Bdisp_SetPoint_VRAM(11-j+8*(i&1),20*t+4+(i>>1),1); + k >>= 1; } } + PrintXY(24,20*t+9,(const unsigned char *)*(files+offset+t),0); + } + Bdisp_DrawLineVRAM(2,20*p+3,2,20*p+20); + Bdisp_DrawLineVRAM(3,20*p+2,99,20*p+2); + Bdisp_DrawLineVRAM(3,20*p+21,99,20*p+21); + Bdisp_DrawLineVRAM(100,20*p+3,100,20*p+20); + if(offset>0) PrintXY(114,6,(const unsigned char *)"\346\234",0); + if(offset+3