summaryrefslogtreecommitdiff
path: root/src/main.cpp
blob: f147f2fccbf2f86c42cf8a4502a8c2f70df1e7cc (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
#include "palette.hpp"
#include "vector.hpp"
#include <tonc.h>

int main() {
  // interrupt & mode 4 foo
  irq_init(NULL);
  irq_enable(II_VBLANK);
  REG_DISPCNT = DCNT_MODE4 | DCNT_BG2;

  // initialize our palette
  palette::put_palette((std::uint16_t *)MEM_PAL);

  // begin
  bmp16_line(1, 3, 1 + SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT, 0x0101, vid_page,
             SCREEN_WIDTH);
  vid_flip();
  bmp16_line(2, 3, 2 + SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT, 0x0101, vid_page,
             SCREEN_WIDTH);

  std::uint32_t frame = 0;
  while (1) {
    frame = (frame + 1) % 60;
    if (frame == 0) {
      vid_flip();
    }

    VBlankIntrWait();
  }
}