+#include <string.h>
#include "hwregs.h"
+#include "copper.h"
+#include "gfx.h"
+#include "game.h"
+
+static uint32_t coplist[32];
int main(void)
{
- REG_INTENA = SETBITS(INTEN_VERTB | INTEN_MASTER);
+ int i;
+ REG_INTENA = SETBITS(INTEN_VERTB | INTEN_MASTER);
REG_DMACON = CLRBITS(DMA_ALL);
- REG_BPLCON0 = BPLCON0_COLOR;
- REG_BPLCON1 = 0;
- REG_DIWSTART = 0x2c81;
- REG_DIWSTOP = 0x2cc1;
- REG_DDFSTART = 0x38;
- REG_DDFSTOP = 0xd0;
- REG_COLOR0 = 0x237;
+ init_gfx();
+
+ REG_COLOR0 = 0x111;
+ REG_COLOR1 = 0x23c;
+ REG_COLOR2 = 0xc32;
+ REG_COLOR3 = 0x22c;
+ REG_COLOR4 = 0xcc2;
+
+ wait_vblank();
+
+ uint32_t *copptr = coplist;
+ for(i=0; i<NBPL; i++) {
+ uint32_t addr = (intptr_t)bplptr[i];
+ int reg = REGN_BPL1PTH + i * 4;
+ *copptr++ = COPPER_MOVE(reg, addr >> 16);
+ *copptr++ = COPPER_MOVE(reg + 2, addr);
+ }
+ *copptr = COPPER_END;
+ REG32_COP1LC = (uint32_t)coplist;
+ REG_COPJMP1 = 0;
+
+ REG_DMACON = SETBITS(DMA_BPL | DMA_COPPER | DMA_MASTER);
+
+ game_init();
- for(;;);
+ for(;;) {
+ wait_vblank();
+ game_draw();
+ }
return 0;
}