X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2F0.c;h=6e4a8d44a2e2cf0591d5d268abcc76825ff8ddbf;hb=f0fd3a8d30adc6208e81d969668b0799664f2c63;hp=e434c85bb2866837d64b5a2ab9c3879d8648b3e3;hpb=180b0967619ed69d811932755b4aa4cd50180f43;p=16.git diff --git a/src/0.c b/src/0.c index e434c85b..6e4a8d44 100755 --- a/src/0.c +++ b/src/0.c @@ -82,15 +82,13 @@ int main(int argc,char **argv) { modexHiganbanaPageSetup(&gvar.video); gvar.video.page[1].dx=gvar.video.page[0].dx=16; gvar.video.page[1].dy=gvar.video.page[0].dy=16; - modexShowPage(&(gvar.video.page[1])); + modexShowPage(&(gvar.video.page[0])); - #define VMEMHEIGHT gvar.video.page[0].height - //+gvar.video.page[1].height + #define VMEMHEIGHT gvar.video.page[0].height+gvar.video.page[1].height //4 this dose the screen { unsigned int i,j,o; - /* fill screen with a distinctive pattern */ for (i=0;i < gvar.video.page[0].width;i++) { o = i >> 2; @@ -106,7 +104,6 @@ int main(int argc,char **argv) { * this time, we render the distinctive pattern to another offscreen location and just copy. * note this version is much faster too! */ { - const unsigned int pattern_ofs = 0x10000UL - gvar.video.page[0].pagesize;//(gvar.video.page[0].stridew * gvar.video.page[0].height); unsigned int i,j,o,o2; int x,y,rx,ry,w,h; unsigned int overdraw = 1; // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks. @@ -117,7 +114,7 @@ int main(int argc,char **argv) { //4 this dose the sprite? wwww /* fill pattern offset with a distinctive pattern */ for (i=0;i < gvar.video.page[0].width;i++) { - o = (i >> 2) + pattern_ofs; + o = (i >> 2) + (0x10000UL - (uint16_t)gvar.video.page[1].data); vga_write_sequencer(0x02/*map mask*/,1 << (i&3)); for (j=0;j < VMEMHEIGHT;j++,o += gvar.video.page[0].stridew) vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15! @@ -143,12 +140,12 @@ int main(int argc,char **argv) { h = vrl_header->height + overdraw + y - ry; w = (x + vrl_header->width + (overdraw*2) + 3/*round up*/ - rx) & (~3); if ((rx+w) > gvar.video.page[0].width) w = gvar.video.page[0].width-rx; - if ((ry+h) > VMEMHEIGHT) h = (VMEMHEIGHT)-ry; + if ((ry+h) > gvar.video.page[0].height) h = (gvar.video.page[0].height)-ry; /* block copy pattern to where we will draw the sprite */ vga_setup_wm1_block_copy(); o2 = gvar.video.page[0].pagesize; - o = pattern_ofs + (ry * gvar.video.page[0].stridew) + (rx >> 2); // source offscreen + o = (0x10000UL - (uint16_t)gvar.video.page[1].data) + (ry * gvar.video.page[0].stridew) + (rx >> 2); // source offscreen for (i=0;i < h;i++,o += gvar.video.page[0].stridew,o2 += (w >> 2)) vga_wm1_mem_block_copy(o2,o,w >> 2); /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */ vga_restore_rm0wm0(); @@ -178,10 +175,11 @@ int main(int argc,char **argv) { /* step */ x += xdir; y += ydir; - if (x >= (gvar.video.page[0].width - 1) || x == -(gvar.video.page[0].dx)) + if ((x + vrl_header->width) >= ((gvar.video.page[0].width + gvar.video.page[0].dx) - 1) || x == -(gvar.video.page[0].dx)) xdir = -xdir; - if (y >= (VMEMHEIGHT - 1) || y == -(gvar.video.page[0].dy)) + if ((y + vrl_header->height) >= ((gvar.video.page[0].height + gvar.video.page[0].dy) - 1) || y == -(gvar.video.page[0].dy)) ydir = -ydir; + //printf("[x%u y%u] [rx%u ry%u] [w%u h%u]\n", x, y, rx, ry, w, h); } }