brought the code over from the amiga test
[lugburz] / 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 #include "serial.h"
7
8 static uint32_t coplist[128];
9
10 int main(void)
11 {
12         int i;
13
14         REG_INTENA = SETBITS(INTEN_VERTB | INTEN_MASTER);
15         REG_DMACON = CLRBITS(DMA_ALL);
16
17         ser_init(38400);
18         ser_print("lugburz amiga starting up...\n");
19
20         init_gfx();
21
22         REG_COLOR0 = 0x111;
23         REG_COLOR1 = 0x23c;
24         REG_COLOR2 = 0xc32;
25         REG_COLOR3 = 0x22c;
26         REG_COLOR4 = 0xcc2;
27
28         wait_vblank();
29
30         init_copper(coplist, 32, COPPER_SINGLE);
31         for(i=0; i<NBPL; i++) {
32                 uint32_t addr = (intptr_t)bplptr[i];
33                 int reg = REGN_BPL1PTH + i * 4;
34                 add_copper(COPPER_MOVE(reg, addr >> 16));
35                 add_copper(COPPER_MOVE(reg + 2, addr));
36         }
37         add_copper(COPPER_VWAIT(50));
38         add_copper(COPPER_MOVE(REGN_COLOR0, 0xf00));
39         add_copper(COPPER_VWAIT(60));
40         add_copper(COPPER_MOVE(REGN_COLOR0, 0x111));
41         *copperlist_end = COPPER_END;
42
43         game_init();
44
45         wait_vblank();
46         REG_DMACON = SETBITS(DMA_BPL | DMA_COPPER | DMA_MASTER);
47
48         for(;;) {
49                 wait_vblank();
50                 game_draw();
51         }
52         return 0;
53 }