if(argv[1]) bakapee1 = argv[1];
if(argv[2]) bakapee2 = argv[2];
}
- printf("1=%s 2=%s\n", bakapee1, bakapee2);
- while (getch() != 13);
fd = open(bakapee1,O_RDONLY|O_BINARY);
if (fd < 0) {
vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15!
}
}
- //while (getch() != 13);
- /* make distinctive pattern offscreen, render sprite, copy onscreen */
- {
- const unsigned int offscreen_ofs = (vga_state.vga_stride * vga_state.vga_height);
- unsigned int i,j,o,o2,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.
- // if the sprite's edge pixels are clear anyway, you can set this to 0.
- VGA_RAM_PTR omemptr;
- int xdir=1,ydir=1;
-
- /* starting coords. note: this technique is limited to x coordinates of multiple of 4 */
- x = 0;
- y = 0;
-
- /* do it */
- omemptr = vga_state.vga_graphics_ram; // save original mem ptr
- //while (1) {
- /* stop animating if the user hits ENTER */
- // if (kbhit()) {
- // if (getch() == 13) break;
- // }
-
- /* render box bounds. y does not need modification, but x and width must be multiple of 4 */
- if (x >= overdraw) rx = (x - overdraw) & (~3);
- else rx = 0;
- if (y >= overdraw) ry = (y - overdraw);
- else ry = 0;
- h = vrl_header->height + overdraw + y - ry;
- w = (x + vrl_header->width + (overdraw*2) + 3/*round up*/ - rx) & (~3);
- if ((rx+w) > vga_state.vga_width) w = vga_state.vga_width-rx;
- if ((ry+h) > vga_state.vga_height) h = vga_state.vga_height-ry;
-
- /* replace VGA stride with our own and mem ptr. then sprite rendering at this stage is just (0,0) */
- vga_state.vga_draw_stride_limit = (vga_state.vga_width + 3/*round up*/ - x) >> 2;
- vga_state.vga_draw_stride = w >> 2;
- vga_state.vga_graphics_ram = omemptr + offscreen_ofs;
-
- /* first draw pattern corresponding to that part of the screen. this COULD be optimized, obviously, but it's designed for study.
- * also note we don't have to use the same stride as the display! */
- for (i=rx;i < (rx+w);i++) {
- o = (i-rx) >> 2;
- vga_write_sequencer(0x02/*map mask*/,1 << (i&3));
- for (j=ry;j < (ry+h);j++,o += vga_state.vga_draw_stride)
- vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15!
- }
-
- /* then the sprite. note modding ram ptr means we just draw to (x&3,0) */
- draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));
-
- /* restore ptr */
- vga_state.vga_graphics_ram = omemptr;
-
- /* block copy to visible RAM from offscreen */
- vga_setup_wm1_block_copy();
- o = offscreen_ofs; // source offscreen
- o2 = (ry * vga_state.vga_stride) + (rx >> 2); // dest visible (original stride)
- for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += vga_state.vga_stride) 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();
-
- /* restore stride */
- vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = vga_state.vga_stride;
-
- /* step */
- x += xdir;
- y += ydir;
- if (x >= (vga_state.vga_width - 1) || x == 0)
- xdir = -xdir;
- if (y >= (vga_state.vga_height - 1) || y == 0)
- ydir = -ydir;
- //}
- }
+ //draw_vrl1_vgax_modex(0/*x-rx*/,0/*y-ry*/,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));
/* make distinctive pattern offscreen, render sprite, copy onscreen.
* this time, we render the distinctive pattern to another offscreen location and just copy.