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

#include "common.h"
#include "gba-buttons.c"
#include "background-tiles.c"
#include "sprites.h"
#include "text.h"
#include "sequencer.c"
#include "small-font.c"

//
// Main functions.
//

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 = small_font,
                .char_width = 4,
                .char_height = 8,
                .char_map = small_font_map,
            });

    // 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;
}