354f1d644dea0f2801d6a46a107cb173113e4e8d
[retrocrawl] / src / amiga / main.c
1 #include <string.h>
2 #include "hwregs.h"
3 #include "copper.h"
4 #include "gfx.h"
5 #include "game.h"
6
7 static uint32_t coplist[32];
8
9 int main(void)
10 {
11         int i;
12
13         REG_INTENA = SETBITS(INTEN_VERTB | INTEN_MASTER);
14         REG_DMACON = CLRBITS(DMA_ALL);
15
16         init_gfx();
17
18         REG_COLOR0 = 0x111;
19         REG_COLOR1 = 0x23c;
20         REG_COLOR2 = 0xc32;
21         REG_COLOR3 = 0x22c;
22         REG_COLOR4 = 0xcc2;
23
24         wait_vblank();
25
26         uint32_t *copptr = coplist;
27         for(i=0; i<NBPL; i++) {
28                 uint32_t addr = (intptr_t)bplptr[i];
29                 int reg = REGN_BPL1PTH + i * 4;
30                 *copptr++ = COPPER_MOVE(reg, addr >> 16);
31                 *copptr++ = COPPER_MOVE(reg + 2, addr);
32         }
33         *copptr = COPPER_END;
34         REG32_COP1LC = (uint32_t)coplist;
35         REG_COPJMP1 = 0;
36
37         REG_DMACON = SETBITS(DMA_BPL | DMA_COPPER | DMA_BLITTER | DMA_MASTER);
38
39         game_init();
40
41         for(;;) {
42                 wait_vblank();
43                 game_draw();
44         }
45         return 0;
46 }