Hum... j'ai "dévié" l'auto int 5 comme le 1.
Je precise que je n'oubliais pas de remttre l'int a son etat d'origine a la fin.
Et maintenant le sprite ne demarre plus...
Je vous donne le source, je commence a desesperer !
Me suis-je fixé un objectif si compliqué ?
#define OPTIMIZE_ROM_
#define SAVE_
#include <tigcclib.h>
short _ti89;
// Effacer tous les ecrans (nuances de gris)
short ClrScrGray() {
TRY
if (IsGrayMode()) {
SetPlane(LIGHT_PLANE);
ClrScr();
SetPlane(DARK_PLANE);
ClrScr();
}
else {
ClrScr();
}
return(1);
ONERR
return(0);
ENDTRY
}
// Afficher le sprite
void DispSprite (short x, short y, short h, unsigned char *Light, unsigned char *Dark) {
Sprite8 (x, y, h, Light, GetPlane(LIGHT_PLANE), SPRT_XOR);
Sprite8 (x, y, h, Dark, GetPlane(DARK_PLANE), SPRT_XOR);
}
// Attend x /20 secondes
void delay(short x) {
OSFreeTimer(USER_TIMER);
OSRegisterTimer(USER_TIMER, x);
while (!OSTimerExpired(USER_TIMER));
}
// Main Function
void _main(void)
{
short fin=0;
short x=0, y=0;
signed char xx=1, yy=0;
unsigned char Curs_LIGHT[] = {0x3C,0x42,0x99,0xBD,0xBD,0x99,0x42,0x3C};
unsigned char Curs_DARK[] = {0x3C,0x7E,0xE7,0xC3,0xC3,0xE7,0x7E,0x3C};
// on redirige AUTO INT 1 & 5 vers "rien" pour utiliser a la fois les
// niveaux de gris et _rowread.
INT_HANDLER save_int_1;
INT_HANDLER save_int_5;
save_int_1 = GetIntVec (AUTO_INT_1);
save_int_5 = GetIntVec (AUTO_INT_5);
SetIntVec (AUTO_INT_1, DUMMY_HANDLER);
SetIntVec (AUTO_INT_5, DUMMY_HANDLER);
// On peut envoyer le GrayOn sans problemes maintenant.
GrayOn();
ClrScrGray();
DispSprite(x, y, 8, Curs_LIGHT, Curs_DARK);
// boucle de deplacement
while (fin!=1) {
delay(1);
if (_rowread(0x7E)&0x2) {
// gauche
xx=-1; yy=0;
}
if (_rowread(0x7E)&0x8) {
// droite
xx=1; yy=0;
}
if (_rowread(0x7E)&0x1) {
// haut
xx=0; yy=-1;
}
if (_rowread(0x7E)&0x4) {
// bas
xx=0; yy=1;
}
if (_rowread(0x3F)&0x1) {
fin=1;
}
// on efface le sprite.
DispSprite(x, y, 8, Curs_LIGHT, Curs_DARK);
// on change les coordonnées.
x+=xx;
y+=yy;
// on vérifie qu'on ne sort pas de l'écran.
// si c'est le cas on reparait de l'autre coté.
if (y>92) y=0;
if (x>152) x=0;
if (y<0) y=92;
if (x<0) x=152;
// on affiche le sprite aux nouvelles coordonnées.
DispSprite(x, y, 8, Curs_LIGHT, Curs_DARK);
}
SetIntVec (AUTO_INT_1, save_int_1);
SetIntVec (AUTO_INT_5, save_int_5);
GrayOff();
}