Dans ce cas il faut que je mette a l'assembleur aussi. Tu pourrai pas m'aider à terminer le code parce qu'il parle de mettre un rte à la fin du code pour faire un handler d'interuption stp?
Merci d'avance.
// C Source File
// Created 31/08/2004; 22:44:45
#include <tigcclib.h>
#undef XFLAGS
#define XFLAGS 15
#undef XF_NO_ALPHA_LOCK
#define XF_NO_ALPHA_LOCK 0x0004000000000000ULL
void _main(void)
{
EV_defaultHandler(CM_ON);
int dialogkey,pass_ok;
const char *text;
char buffer[10];
const char *a="8908";
HANDLE dialog;
text="Welcome on my TI89";
pass_ok=0;
do
{
*buffer=0;
if(!(dialog=DialogNewSimple(140,50)))return;
DialogAddTitle(dialog,"Password",BT_OK,BT_CANCEL);
DialogAdd(dialog,0,0,0,XFLAGS,XF_NO_ALPHA_LOCK);
DialogAddRequest(dialog,4,24,"Request the password",0,5,5);
DialogAddText(dialog,4,15,text);
dialogkey=DialogDo(dialog,CENTER,CENTER,buffer,NULL);
HeapFree(dialog);
if(dialogkey!=13) DlgMessage("Password","You dream!!!",BT_OK,BT_NONE);;
if (!strcmp(a,buffer))
{
pass_ok = 1;
DlgMessage("Password","Access Granted",BT_OK,BT_NONE);
}
else DlgMessage("Password","Access Denied",BT_OK,BT_NONE);
}while(!pass_ok);
}
spectras
:Je ne comprend rien à l'assembleur est ce qu'il aurait moyen de "traduire" la source en C ?Non.
DEFINE_INT_HANDLER(testoff) { if (peekIO_btst(0x60001a,2)) return; if (!(ST_flags & 1)) return; ExecuteIntHandler(GetIntVec(TRAP_4))); }
Si:Euh, tu peux me rappeler la définition de DEFINE_INT_HANDLER et ExecuteIntHandler, j'ai comme un trou de mémoire ?
Et si tout marche comme prévu, DEFINE_INT_HANDLER fonctionnera bientôt sans assembleur inline, avec un __attribute__((interrupt_handler))Ah ça c'est une bonne idée. Parce que l'attribut existe déjà pour d'autres plateformes.
Flanker :
avec ça, t'auras pas toutes les extinctions de la calc. Vaut mieux intercepter le trap #4, c'est plus sûr
Kevin Kofler :
Si:DEFINE_INT_HANDLER(testoff) { if (peekIO_btst(0x60001a,2)) return; if (!(ST_flags & 1)) return; ExecuteIntHandler(GetIntVec(TRAP_4))); }
(J'ai fait ça à l'arrache, donc il y a peut-être des erreurs, mais c'est l'idée.)
// C Source File
// Created 31/08/2004; 22:44:45
#include <tigcclib.h>
#undef XFLAGS
#define XFLAGS 15
#undef XF_NO_ALPHA_LOCK
#define XF_NO_ALPHA_LOCK 0x0004000000000000ULL
#define ST_flags
DEFINE_INT_HANDLER(testoff)
{
if (peekIO_bit(0x60001a,2)) return;
if (!(ST_flags &1 )) return;
ExecuteIntHandler(GetIntVec(TRAP_4));
}
void _main(void)
{
int dialogkey,pass_ok;
const char *text;
char buffer[10];
const char *a="8908";
HANDLE dialog;
text="Welcome on my TI89";
pass_ok=0;
do
{
*buffer=0;
if(!(dialog=DialogNewSimple(140,50)))return;
DialogAddTitle(dialog,"Password",BT_OK,BT_CANCEL);
DialogAdd(dialog,0,0,0,XFLAGS,XF_NO_ALPHA_LOCK);
DialogAddRequest(dialog,4,24,"Request the password",0,5,5);
DialogAddText(dialog,4,15,text);
dialogkey=DialogDo(dialog,CENTER,CENTER,buffer,NULL);
HeapFree(dialog);
if(dialogkey!=13) DlgMessage("Password","You dream!!!",BT_OK,BT_NONE);;
if (!strcmp(a,buffer))
{
pass_ok = 1;
DlgMessage("Password","Access Granted",BT_OK,BT_NONE);
}
else DlgMessage("Password","Access Denied",BT_OK,BT_NONE);
}while(!pass_ok);
}
Pep
: Oui c'est fait à l'arrache mais corriger quelque truc mais j'ai un probleme avec ST_flags je ne comprend le compilateur me dit "Invalide type of 'unary *'
cerede2000 :
Je voit pas sur les tuto de la tict pour intercepter quelque chose comme tarp #4
matthieu :
dites , pk ca dans mon tsr ca fait line 111 emulator ?if(ev->Type==CM_OFF) { ngetchx(); }
// C Source File
// Created 31/08/2004; 22:44:45
#include <tigcclib.h>
#define OPTIMIZE_ROM_CALLS
#define MIN_200
#undef XFLAGS
#define XFLAGS 15
#undef XF_NO_ALPHA_LOCK
#define XF_NO_ALPHA_LOCK 0x0004000000000000ULL
#define ST_flags
#define SIZE_OF_PRG
#define MAGIC_TSR
#define sample_prg
int InstallTSR(unsigned char* signature) {
unsigned char* mem = HeapAllocPtr(12);
if (!mem) return 0;
*mem++ = (MAGIC_TSR >> 24) & 0xff;
*mem++ = (MAGIC_TSR >> 16) & 0xff;
*mem++ = (MAGIC_TSR >> 8) & 0xff;
*mem++ = (MAGIC_TSR ) & 0xff;
memcpy(mem,signature,8);
mem+=8;
memcpy(mem,sample_prg,SIZE_OF_PRG);
EX_patch(mem + 0x60001a, mem + SIZE_OF_PRG - 2 + 3 - 2);
enter_ghost_space();
ASM_call(mem + 0x60001a);
return 1;
}
DEFINE_INT_HANDLER(testoff)
{
if (peekIO_bit(0x60001a,2)) return;
if (!(ST_flags "&1" )) return;
ExecuteHandler(GetIntVec(TRAP_4));
}
void _main(void)
{
int dialogkey,pass_ok;
const char *text;
char buffer[10];
const char *a="8908";
HANDLE dialog;
text="Welcome on my TI89";
pass_ok=0;
do
{
*buffer=0;
if(!(dialog=DialogNewSimple(140,50)))return;
DialogAddTitle(dialog,"Password",BT_OK,BT_CANCEL);
DialogAdd(dialog,0,0,0,XFLAGS,XF_NO_ALPHA_LOCK);
DialogAddRequest(dialog,4,24,"Request the password",0,5,5);
DialogAddText(dialog,4,15,text);
dialogkey=DialogDo(dialog,CENTER,CENTER,buffer,NULL);
HeapFree(dialog);
if(dialogkey!=13) DlgMessage("Password","You dream!!!",BT_OK,BT_NONE);;
if (!strcmp(a,buffer))
{
pass_ok = 1;
DlgMessage("Password","Access Granted",BT_OK,BT_NONE);
}
else DlgMessage("Password","Access Denied",BT_OK,BT_NONE);
}while(!pass_ok);
}
Pep
: J'ai un probleme avec les >> dans ma source et je ne trouve pas d'ou cela vient quelqu'un pourrait m'aider.
matthieu :
et ben en fait juste if(ev->Type==CM_OFF) ; me fait un 111 inseré dans le sample tsr