So to speed things up, I decided to use the implementation in 32 bit VBE standard (more specifically the function "Set Display Start" that serves to make hardware scrolling). Tested on different video cards (Trident Cyber Blade, Nvidia TNT2 / GF MX 440 / 9600GT, SIS Mirage / 730). In all cases it worked correctly (the speed gain was nonsense using page flipping).
So I decided to test on my notebook Acer Aspire 3050 (ATI Xpress X1100). Incredibly, ATI card handles GPF on function "Set Display Start").
Following is the code that implements VBE PMode functions:
Code: Select all
void getFunctionsVideo()
{
video.context.ax = 0x4F0A;
video.context.bx = 0x0000;
executeVirtual(0x10, & video.context);
if (video.context.ax == 0x4F)
{
video.functionsInfo = malloc(video.context.cx);
memcpy(video.functionsInfo, cast(void *, ((video.context.es << 4) + video.context.di)), video.context.cx);
video.functions.setWindow = cast(unsigned int, video.functionsInfo) + video.functionsInfo->setWindow;
video.functions.setDisplay = cast(unsigned int, video.functionsInfo) + video.functionsInfo->setDisplay;
video.functions.setPalette = cast(unsigned int, video.functionsInfo) + video.functionsInfo->setPalette;
video.functions.selector = 0x10;
unsigned int ioPrivInfo = cast(unsigned int, video.functionsInfo);
if (video.functionsInfo->ioPrivInfo > 0)
{
unsigned short * io = cast(unsigned short *, (ioPrivInfo + video.functionsInfo->ioPrivInfo));
while (* io != 0xFFFF)
io++;
io++;
// *** ATI CARD NOT CREATES A DESCRIPTOR ***
if (* io != 0xFFFF)
{
printf("\nPORT IO.: %X / %X\n", * cast(unsigned int *, io), * (io + 2));
setGlobalEntryDescriptor(6, * cast(unsigned int *, io), * (io + 2), 0x92, 0xCF);
video.functions.selector = 0x30;
}
}
putchar('\n');
}
}
...
// *** Remembering ATI Xpress does not require the creation of a descriptor ***
void scrollVideo(unsigned int offset)
{
__asm__ __volatile__
(
"call * %0"
:
: "r" (video.functions.setDisplay), "b" (0x0), "c" (offset & 0xFFFF), "d" (offset >> 16)
);
}