summaryrefslogtreecommitdiffstats
path: root/src/main.c
blob: 33e7ebf0de01f1ef2fe589cd2addaa7f9029e18b (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
#include <string.h>

#include "common.h"
#include "gba-buttons.c"
#include "background-tiles.c"
#include "sprites.h"
#include "text.h"
#include "sequencer.c"
#include "bd-font.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_3 | DISP_BG_2;

    // Initialize text engine.
    txt_init_bitmap(TXT_MODE_MODE3, (Font){.data = bd_font, .char_width = 6});

    // Register interrupts.
    irq_init();
    irs_set(IRQ_VBLANK, irs_stub);

    init_sequencer();

    // Initialize timer.
    while(true) {
        bios_vblank_wait();
        poll_keys();

        handle_sequencer_input();
        update_sequencer_sprites();
        render_sequencer_sprites();
    };

    return 0;
}