1 /* speedtest.c for GP2X (CPU/LCD/RAM-Tuner Version 2.0)
2 Copyright (C) 2006 god_at_hell
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 #include "gp2xminilib.h"
34 unsigned char cad[256];
45 float ifloat = (float)i;
68 sprintf(cad,"%u is primnumber",i);
69 v_putcad(1,13,0xffffff,0xB00000,cad);
70 //primout = fopen("/mnt/sd/primnumber.txt", "a");
71 //fprintf(primout,"%u: %u\n", l, i);
84 unsigned char cad[256];
85 short direction = 0; //clockwise ... 0 = Up, 1 = Right
86 unsigned short col1, col2;
87 col1=gp2x_video_color15(0,0,0,0);
88 col2=gp2x_video_color15(0xFF,0xFF,0xFF,0);
91 for(i = 0; i < 9000; i++)
93 for(n = 0; n < 500000; n++);
94 if(gp2x_screen15[(320*anty) + antx]==col1)
96 for(n = 0; n < 3; n++)
99 for(m = 0; m < 3; m++)
101 gp2x_screen15[320*(anty+n)+antx+m] = col2;
104 sprintf(cad,"%u steps left ",8999-i);
105 v_putcad(1,3,0x000000,0xffffff,cad);
107 for(n = 0; n < 3; n++)
110 for(m = 0; m < 3; m++)
112 gp2x_screen15[320*(anty+n)+antx+m] = col2;
115 sprintf(cad,"%u steps left ",8999-i);
116 v_putcad(1,3,0x000000,0xffffff,cad);
118 if(direction == 0) antx-=3;
119 if(direction == 1) anty-=3;
120 if(direction == 2) antx+=3;
121 if(direction == 3) anty+=3;
123 if(direction < 0) direction=3;
125 if(gp2x_screen15[(320*anty) + antx]==col2)
127 for(n = 0; n < 3; n++)
130 for(m = 0; m < 3; m++)
132 gp2x_screen15[320*(anty+n)+antx+m] = col1;
135 sprintf(cad,"%u steps left ",8999-i);
136 v_putcad(1,3,0x000000,0xffffff,cad);
138 for(n = 0; n < 3; n++)
141 for(m = 0; m < 3; m++)
143 gp2x_screen15[320*(anty+n)+antx+m] = col1;
146 sprintf(cad,"%u steps left ",8999-i);
147 v_putcad(1,3,0x000000,0xffffff,cad);
149 if(direction == 0) antx+=3;
150 if(direction == 1) anty+=3;
151 if(direction == 2) antx-=3;
152 if(direction == 3) anty-=3;
154 if(direction > 3) direction=0;
159 void speedtest(short test)
162 if(test == 0) BACKGROUND=0xB00000;
163 if(test == 1) BACKGROUND=0xFFFFFF;
165 short cpuspeed = start;
166 unsigned char cad[256];
171 speed = fopen("/mnt/sd/speed.txt", "w");
172 ClearScreen(BACKGROUND);
173 if(test == 0) v_putcad(1,1,0x00ff00,BACKGROUND,"Prim-Speedtest");
174 if(test == 1) v_putcad(1,1,0x006600,BACKGROUND,"Ant-Speedtest");
175 v_putcad(1,6,0xffffff,BACKGROUND,"Testing Speed");
178 sprintf(cad,"%uMhz checked",cpuspeed-5);
179 v_putcad(1,9,0xffffff,BACKGROUND,cad);
182 ClearScreen(BACKGROUND);
183 if(test == 0) v_putcad(1,1,0x00ff00,BACKGROUND,"Prim-Speedtest");
184 if(test == 1) v_putcad(1,1,0x006600,BACKGROUND,"Ant-Speedtest");
185 v_putcad(1,6,0xffffff,BACKGROUND,"Testing Speed");
188 sprintf(cad,"%uMhz checked",cpuspeed-5);
189 if(test == 0) v_putcad(1,9,0xffffff,BACKGROUND,cad);
190 if(test == 1) v_putcad(1,9,0x000000,BACKGROUND,cad);
193 fprintf (speed,"set CPU-Frequency = %uMHz\r\n",cpuspeed);
196 if(test == 0) prim();
199 fprintf(speed,"%uMhz checked\n\n", cpuspeed);
200 cpuspeed = cpuspeed + 5;