}
if(minf.attr & VBE_ATTR_LFB) {
vmptr->fb_addr = minf.fb_addr;
- } else {
- vmptr->bank_size = (uint32_t)minf.bank_size * 1024;
- if(!vmptr->bank_size) {
- vmptr->bank_size = 65536;
- }
}
vmptr->max_pages = minf.num_img_pages;
+ vmptr->win_gran = minf.win_gran;
printf("%04x: ", vbe.modes[i]);
vbe_print_mode_info(stdout, &minf);
void cleanup_video(void)
{
free(vmodes);
+ vmodes = 0;
}
struct video_mode *video_modes(void)
curmode = vm;
if(nbuf < 1) nbuf = 1;
if(nbuf > 2) nbuf = 2;
- pgcount = nbuf > vm->max_pages ? vm->max_pages : nbuf;
+ pgcount = nbuf > vm->max_pages + 1 ? vm->max_pages + 1 : nbuf;
pgsize = vm->ysz * vm->pitch;
fbsize = pgcount * pgsize;
vpgaddr[1] = 0;
blit_frame = blit_frame_banked;
+
+ /* calculate window granularity shift */
+ vm->win_gran_shift = 0;
+ vm->win_64k_step = 1;
+ if(vm->win_gran > 0 && vm->win_gran < 64) {
+ int gran = vm->win_gran;
+ while(gran < 64) {
+ vm->win_gran_shift++;
+ gran <<= 1;
+ }
+ vm->win_64k_step = 1 << vm->win_gran_shift;
+ }
+
+ printf(" granularity: %dk (step: %d)\n", vm->win_gran, vm->win_64k_step);
}
/* allocate main memory framebuffer */
static void blit_frame_banked(void *pixels, int vsync)
{
- int sz, offs;
+ int offs;
unsigned int pending;
unsigned char *pptr = pixels;
offs = 0;
pending = pgsize;
while(pending > 0) {
- sz = pending > curmode->bank_size ? curmode->bank_size : pending;
- //memcpy64((void*)0xa0000, pptr, sz >> 3);
- memcpy((void*)0xa0000, pptr, sz);
- pptr += sz;
- pending -= sz;
- vbe_setwin(0, ++offs);
+ //memcpy64((void*)0xa0000, pptr, 16384);
+ memcpy((void*)0xa0000, pptr, 65536);
+ pptr += 65536;
+ pending -= 65536;
+ offs += curmode->win_64k_step;
+ vbe_setwin(0, offs);
}
-
vbe_setwin(0, 0);
}
if(minf->attr & VBE_ATTR_LFB) {
fprintf(fp, " lfb@%lx", (unsigned long)minf->fb_addr);
} else {
- fprintf(fp, " %xkb/bank", (unsigned int)minf->bank_size);
+ fprintf(fp, " (%dk gran)", (int)minf->win_gran);
}
fprintf(fp, " [");
mkdir c:\tmp\rbench\src\dos
mkdir c:\tmp\rbench\tools
-copy Makefile.dos c:\tmp\rbench
+copy Makefile.dj c:\tmp\rbench
copy tools\lutgen.c c:\tmp\rbench\tools
+copy tools\pack.bat c:\tmp\rbench\tools
copy src\*.c c:\tmp\rbench\src
+copy src\*.s c:\tmp\rbench\src
copy src\*.h c:\tmp\rbench\src
copy src\dos\*.c c:\tmp\rbench\src\dos
copy src\dos\*.h c:\tmp\rbench\src\dos
-copy pack.bat c:\tmp\rbench