9 #include "hwregs.h" /* XXX */
14 void draw_tile(int tid, int x, int y, int light);
16 static uint16_t *sprdata[NUM_HWSPRITES];
17 static uint16_t *sprdata2[NUM_HWSPRITES];
19 /* hardcoded test sprite */
20 static struct sprite test_sprite;
21 static struct sprite test_sprite2;
27 printf("hello world\n");
39 REG_COLOR_PTR[i + 16] = sprpal[i];
42 sprdata[0] = sprdata2[0] = spr0a;
43 sprdata[1] = sprdata2[1] = spr0b;
44 sprdata[2] = sprdata2[2] = spr1a;
45 sprdata[3] = sprdata2[3] = spr1b;
46 sprdata[4] = sprdata2[4] = spr2a;
47 sprdata[5] = sprdata2[5] = spr2b;
49 test_sprite.width = test_sprite.height = 48;
50 test_sprite.origx = 24;
51 test_sprite.origy = 24;
52 test_sprite.img = test_sprite.mask = 0;
53 test_sprite.hwslices = 3;
55 test_sprite.hwspr[i] = i < 6 ? sprdata[i] : 0;
58 test_sprite2 = test_sprite;
60 test_sprite2.hwspr[i] = i < 6 ? sprdata2[i] : 0;
71 int i, j, xoffs, yoffs, ntiles;
74 for(i=0; i<YTILES; i++) {
75 xoffs = i & 1 ? TILE_W / 2 : 0;
76 ntiles = i & 1 ? XTILES - 1 : XTILES;
77 for(j=0; j<ntiles; j++) {
78 draw_tile(0, xoffs, yoffs, 0);
85 draw_sprite(&test_sprite, 160, 80);
86 draw_sprite(&test_sprite2, 160, 160);
91 void draw_tile(int tid, int x, int y, int light)
93 unsigned char *dest = bplptr[0] + (y * SCANSZ * NBPL) + x / 8;
94 unsigned char *src = test_tile;
98 REG32_BLTCON = BLTCON_USEA | BLTCON_USEB | BLTCON_USEC | BLTCON_USED |
100 REG32_BLTAFLWM = 0xffffffff;
103 REG_BLTCMOD = SCANSZ - TILE_W / 8;
104 REG_BLTDMOD = SCANSZ - TILE_W / 8;
105 REG32_BLTAPT = (intptr_t)test_tile_mask;
106 REG32_BLTBPT = (intptr_t)src;
107 REG32_BLTCPT = (intptr_t)dest;
108 REG32_BLTDPT = (intptr_t)dest;
109 REG_BLTSIZE = BLTSIZE(TILE_W, TILE_H * NBPL);