sprite DMA works
[mdlife] / src / main.c
index 9b02e61..faa6b9e 100644 (file)
@@ -7,17 +7,20 @@
 #define SPRITE_BASE            0x8000
 extern uint16_t cellspr_data[], cellspr_data_end[];
 
+uint32_t dbgval[4];
+
 int main(void)
 {
        uint16_t *src;
-       int tile;
+       int tile, i;
 
        z80_init();
        vdp_init();
        dbg_init();
 
-       vdp_setcolor(0, 0, 2, 2, 2);
-       vdp_setcolor(0, 15, 15, 15, 15);
+       for(i=0; i<16; i++) {
+               vdp_setcolor(0, i, i, i, i);
+       }
 
        /* upload sprite tiles */
        src = cellspr_data;
@@ -26,10 +29,31 @@ int main(void)
                VDP_DATA = *src++;
        }
 
+       dbg_setcursor(0, 0);
+       printf("xyzzy");
+
        for(;;) {
+               dbg_setcursor(32, 0);
+               for(i=0; i<4; i++) {
+                       printf("%08x\n", (unsigned int)dbgval[i]);
+               }
                spr_begin();
-               tile = SPRITE_BASE / 32 + 2;
-               spr_add(160, 100, VDP_TILENAME(tile, 0, VDP_TILE_FG), SPR_SIZE(1,1));
+               tile = VDP_ADDR2TILE(SPRITE_BASE);
+               spr_add(160, 50, VDP_TILENAME(tile, 0, VDP_TILE_FG), SPR_SIZE(1,1));
+               tile++;
+               spr_add(160, 60, VDP_TILENAME(tile, 0, VDP_TILE_FG), SPR_SIZE(1,1));
+               tile++;
+               spr_add(160, 75, VDP_TILENAME(tile, 0, VDP_TILE_FG), SPR_SIZE(1,1));
+               tile++;
+               spr_add(156, 90, VDP_TILENAME(tile, 0, VDP_TILE_FG), SPR_SIZE(1,1));
+               spr_add(164, 90, VDP_TILENAME(tile, 0, VDP_TILE_FG | VDP_TILE_HFLIP), SPR_SIZE(1,1));
+               spr_add(156, 98, VDP_TILENAME(tile, 0, VDP_TILE_FG | VDP_TILE_VFLIP), SPR_SIZE(1,1));
+               spr_add(164, 98, VDP_TILENAME(tile, 0, VDP_TILE_FG | VDP_TILE_HVFLIP), SPR_SIZE(1,1));
+               tile++;
+               spr_add(148, 120, VDP_TILENAME(tile, 0, VDP_TILE_FG), SPR_SIZE(2, 2));
+               spr_add(164, 120, VDP_TILENAME(tile, 0, VDP_TILE_FG | VDP_TILE_HFLIP), SPR_SIZE(2, 2));
+               spr_add(148, 136, VDP_TILENAME(tile, 0, VDP_TILE_FG | VDP_TILE_VFLIP), SPR_SIZE(2, 2));
+               spr_add(164, 136, VDP_TILENAME(tile, 0, VDP_TILE_FG | VDP_TILE_HVFLIP), SPR_SIZE(2, 2));
 
                vdp_wait_vblank();
                spr_submit();