serial debugging fail
[retrocrawl] / src / amiga / main.c
index e3cfcd5..46c777a 100644 (file)
@@ -1,19 +1,49 @@
+#include <string.h>
 #include "hwregs.h"
+#include "copper.h"
+#include "gfx.h"
+#include "game.h"
+#include "serial.h"
+
+static uint32_t coplist[128];
 
 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;
+       ser_init(38400);
+       ser_print("retrocrawl amiga starting up...\n");
+
+       init_gfx();
+
+       REG_COLOR0 = 0x111;
+       REG_COLOR1 = 0x23c;
+       REG_COLOR2 = 0xc32;
+       REG_COLOR3 = 0x22c;
+       REG_COLOR4 = 0xcc2;
+
+       wait_vblank();
+
+       init_copper(coplist, 32, COPPER_SINGLE);
+       for(i=0; i<NBPL; i++) {
+               uint32_t addr = (intptr_t)bplptr[i];
+               int reg = REGN_BPL1PTH + i * 4;
+               add_copper(COPPER_MOVE(reg, addr >> 16));
+               add_copper(COPPER_MOVE(reg + 2, addr));
+       }
+       *copperlist_end = COPPER_END;
+
+       game_init();
+
+       wait_vblank();
+       REG_DMACON = SETBITS(DMA_BPL | DMA_COPPER | DMA_BLITTER | DMA_SPRITE | DMA_MASTER);
 
-       for(;;);
+       for(;;) {
+               wait_vblank();
+               game_draw();
+       }
        return 0;
 }