blob: decd40d3ef9d80b1d0730aa50d7948af68fbed09 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#include <string.h>
#include "common.h"
#include "gba-buttons.c"
#include "background-tiles.c"
#include "sprites.h"
#include "text.h"
//
// Main functions.
//
// TODO: Cleanup OBJ/OAM memory copying and access.
//
//
// BIOS calls
//
int bios_div(int num, int denom);
int normal_div(int num, int denom) {
return num / denom;
};
int main(void) {
// Configure the display in mode 0 to show OBJs, where tile memory is
// sequential.
DISP_CTRL = DISP_ENABLE_SPRITES | DISP_MODE_0 | DISP_BG_0;
// Initialize sprite button overlay.
init_sprite_pal(0, COLOR_WHITE);
init_sprites(0);
init_button_sprites();
// Initialize text engine.
txt_init(0, COLOR_RED, 0);
size_t n_iter = 1000;
profile_start();
int test = 0;
for (size_t i = 0; i < n_iter; ++i) {
txt_printf("Bios div: %d\n", bios_div(5 * i, 5));
}
u32 bios_div_perf = profile_stop();
profile_start();
for (size_t i = 0; i < n_iter; ++i) {
txt_printf("Code div: %d\n", normal_div(5 * i, 5));
}
u32 code_perf = profile_stop();
txt_printf("C code div perf: %d\n", code_perf);
txt_printf("BIOS div perf: %d\n", bios_div_perf);
int frame_counter = 0;
while(true) {
wait_vsync();
poll_keys();
frame_counter++;
// update_button_sprites();
};
return 0;
}
|