blob: 08816f3dbace859f75d00ab8a72127ab02592770 (
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
67
68
69
70
71
72
73
74
75
76
77
|
#include <string.h>
#include "common.h"
#include "gba-buttons.c"
#include "background-tiles.c"
#include "sprites.h"
#include "text.h"
#include "sequencer.c"
//
// Main functions.
//
// TODO: Cleanup OBJ/OAM memory copying and access.
//
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_sequencer_sprites();
// Initialize text engine.
// txt_init(0, COLOR_RED, 0);
// Register interrupts.
irq_init();
irs_set(IRQ_VBLANK, irs_stub);
// turn sound on
SOUND_STATUS = SOUND_ENABLE;
SOUND_DMG_MASTER = sound_volume(SOUND_SQUARE1 | SOUND_SQUARE2, 3);
SOUND_DSOUND_MASTER = SOUND_DMG100;
// Initialize timer.
int bpm = 120;
while(true) {
bios_vblank_wait();
poll_keys();
if (key_hold(KEY_UP)) {
bpm += 1;
set_time(bpm);
}
if (key_hold(KEY_DOWN)) {
bpm -= 1;
set_time(bpm);
}
if (key_pressed(KEY_START)) {
step_counter = 0;
set_time(bpm);
}
if (key_pressed(KEY_SELECT)) {
TIMER_CTRL_0 ^= TIMER_CTRL_ENABLE;
}
update_sequencer_sprites();
// txt_position(1,6);
// txt_clear_line();
// txt_printf(" BPM: %d\n\n", bpm);
// txt_clear_line();
// txt_printf(" Step: %d\n", step_counter);
// txt_clear_line();
// txt_printf(" Note: %s\n", note_names[active_note]);
render_sequencer_sprites();
};
return 0;
}
|