
Au niveau optimisation, j'ai gagné 500 increment counter facilement. Je commence à comprendre que je code comme un porc en ASM et je vais m'habituer à optimiser mon code dès son écriture.

// C Source File
// Created 08/08/2003; 22:05:40
//#define USE_TI89 // Compile for TI-89
#define USE_TI92PLUS // Compile for TI-92 Plus
//#define USE_V200 // Compile for V200
#define MIN_AMS 100 // Compile for AMS 1.00 or higher
#define USE_KERNEL
#define SAVE_SCREEN // Save/Restore LCD Contents
#include <tigcclib.h> // Include All Header Files
#include "polysnd2.h"
#include "cool.h"
INT_HANDLER OldInt1 = NULL;
INT_HANDLER OldInt2 = NULL;
INT_HANDLER OldInt5 = NULL;
volatile unsigned long counter ;
DEFINE_INT_HANDLER (Interrupt_handler5)
{
counter++;
}
DEFINE_INT_HANDLER (myint2)
{
pokeIO (0x60001B,0);
}
void _main (void)
{
unsigned long cpu_speed=0;
OldInt1 = GetIntVec (AUTO_INT_1);
OldInt2 = GetIntVec (AUTO_INT_2);
OldInt5 = GetIntVec (AUTO_INT_5);
SetIntVec (AUTO_INT_1, DUMMY_HANDLER);
SetIntVec (AUTO_INT_2, myint2);
counter=0;
EnableSound ();
InstallSound ();
Interrupt5 (Interrupt_handler5);
PlayMode (STEREO);
SetTempo (140);
PlaySound_voice1 (cool1);
PlaySound_voice2 (cool2);
SetState (ALLVOICES);
while (_keytest (RR_ESC)!=TRUE) {
cpu_speed++;
if (counter>=5000) {
printf_xy (0,0,"%lu",cpu_speed);
cpu_speed=0;
counter=0;
}
}
UninstallSound ();
DisableSound ();
SetIntVec (AUTO_INT_1, OldInt1);
SetIntVec (AUTO_INT_2, OldInt2);
}
Mais le 67%, il signifie quoi ? 67% de quoi ?Ca signifie que 67% du temps initial est disponible pour exécuter ton propre code. En gros, ta TI aura 67% de sa vitesse pendant que le son est joué.
Parce que le CPU il est tout le temps utilisé.Le CPU est tout le temps utilisé, mais parfois à rien faire. Donc c'est ce temps passé à attendre que l'on calcule.
Brunni
:Mais le 67%, il signifie quoi ? 67% de quoi ?Ca signifie que 67% du temps initial est disponible pour exécuter ton propre code. En gros, ta TI aura 67% de sa vitesse pendant que le son est joué.
j'avais essayé de la faire assez simple pour qu'elle soit facilement compréhensible
Moi j'avais pensé utiliser ta lib pour C&C (projet V4pOR T34m pas avant 2048)
// C Source File
// Created 02/03/2003; 11:55:37
#define USE_TI92PLUS
//#define USE_TI89
#define USE_KERNEL
//#define OPTIMIZE_ROM_CALLS
#include <tigcclib.h>
#include "PolySnd.h"
#include "graphx.h"
#include "image.h"
#include "temp.h"
#include "Freqs.h"
#include "File6.h"
INT_HANDLER old_int5;
INT_HANDLER old_int2;
INT_HANDLER old_int1;
INT_HANDLER old_int4;
DEFINE_INT_HANDLER (int_5)
{
__counter_duree++;
if (__counter_duree<__sound_unittps && (__sound_unittps!=0))
{
__counter_time1++;
__counter_time2++;
if (__counter_time1<__sound_distor1)
{
__counter_voice1++;
__counter_voice2++;
if (__counter_voice1>__sound_frequency1)
{
asm ("bchg.b #0,(0x60000E)");
__counter_voice1=0;
}
}
else __counter_time1=0;
if (__counter_time2<__sound_distor2)
{
if (__counter_voice2>__sound_frequency2)
{
asm ("bchg.b #1,(0x60000E)");
__counter_voice2=0;
}
}
else __counter_time2=0;
}
//else {__counter_duree=0;__sound_unittps=0;}
}
void _main(void)
{
__counter_duree=0;
__counter_voice1=0;
__counter_voice2=0;
__sound_unittps=0;
__sound_frequency1=0;
__sound_frequency2=0;
__sound_distor1=0;
__sound_distor2=0;
unsigned char Save_0x600015=peekIO(0x600015);
old_int5 = GetIntVec (AUTO_INT_5);
old_int2 = GetIntVec (AUTO_INT_2);
old_int1 = GetIntVec (AUTO_INT_1);
old_int4 = GetIntVec (AUTO_INT_4);
//pokeIO (0x600017, 0xCC);
*(unsigned char*)0x600015 &= 0b11001111;
pokeIO (0x600017, 0xFF);
SetIntVec (AUTO_INT_5,int_5);
SetIntVec (AUTO_INT_2,DUMMY_HANDLER);
SetIntVec (AUTO_INT_1,DUMMY_HANDLER);
SetIntVec (AUTO_INT_4,DUMMY_HANDLER);
GrayOn();
SetPlane (0);
BitmapPut (0,0,pic1,ScrRect,A_NORMAL);
SetPlane (1);
BitmapPut (0,0,pic2, ScrRect,A_NORMAL);
EnabledSound();
FontSetSys (F_4x6);
while (1)
{
printf_xy (200,0,"%d",__counter_duree);
printf_xy (200,8,"%d",__counter_time1);
printf_xy (200,16,"%d",__counter_time2);
printf_xy (200,24,"%d",__counter_voice1);
printf_xy (200,32,"%d",__counter_voice2);
printf_xy (200,56,"%d",__sound_unittps);
printf_xy (200,62,"%d",__sound_frequency1);
printf_xy (200,70,"%d",__sound_frequency2);
printf_xy (200,78,"%d",__sound_distor1);
printf_xy (200,86,"%d",__sound_distor2);
if (_keytest (RR_ESC)) break;
if (_keytest (RR_Q)) __sound_frequency1++;
if (_keytest (RR_W)) __sound_frequency1--;
if (_keytest (RR_A)) __sound_frequency2++;
if (_keytest (RR_S)) __sound_frequency2--;
if (_keytest (RR_E)) __sound_distor1++;
if (_keytest (RR_R)) __sound_distor1--;
if (_keytest (RR_D)) __sound_distor2++;
if (_keytest (RR_F)) __sound_distor2--;
if (_keytest (RR_PLUS)) __sound_unittps++;
if (_keytest (RR_MINUS)) __sound_unittps--;
//printf_xy (200,0,"%d",__counter_duree);
if (_keytest (RR_ESC)) break;
/*if (_keytest (RR_A))
{
beep (50,50,3,3,200);
}*/
}
DisabledSound();
GrayOff();
pokeIO (0x600017,0xB2);
pokeIO (0x600015,Save_0x600015);
SetIntVec (AUTO_INT_5,old_int5);
SetIntVec (AUTO_INT_1,old_int1);
SetIntVec (AUTO_INT_2,old_int2);
SetIntVec (AUTO_INT_4,old_int4);
}