I am writing a VESA driver for my OS.
I have VBE 3.0 available, 14 MiB of VRAM, 1024 * 768 * 32 (bpp) mode. All these information have been acquired by calling int 10H functionality in PM mode.
There are two screen buffers. One starts at linear framebuffer address (fb) and the second one starts right after the first one.
I would like to implement page flipping with the use of VBE function 07H.
The code that i used is as follows:
Code: Select all
#define HIGH_WORD(U32) ((uint16_t)(U32>>16))
#define LOW_WORD(U32) ((uint16_t)(U32&0x0000FFFF))
//+++++++++++++++++++++++++++++++++++++++++++++++++
void page_flip(unsigned long address) {
regs16_t regs;
regs.ax = 0x4F07;
regs.bx = 0x00;
regs.cx = LOW_WORD(address);
regs.dx = HIGH_WORD(address);
int32( 0x10, ®s );
}
//+++++++++++++++++++++++++++++++++++++++++++++++++
void test(unsigned char* fb) {
unsigned int i, j, k, J = 0;
unsigned char * PAGE0 = fb;
unsigned char * PAGE1 = (unsigned char*)( fb + ( 4096*768 ) );
for(j=0; j<768;j++) {
J = j*4096;
for(i=0; i<4096;i+=4) {
PAGE0[J + i ] = 0;
PAGE0[J + i + 1] = 0;
PAGE0[J + i + 2] = 255;
PAGE0[J + i + 3] = 0;
PAGE1[J + i ] = 255;
PAGE1[J + i + 1] = 0;
PAGE1[J + i + 2] = 0;
PAGE1[J + i + 3] = 0;
}
}
for(k=0;k<1000;k++) {
page_flip((unsigned long)PAGE0);
page_flip((unsigned long)PAGE1);
}
}
I would appreciate if anybody can give me a hint that what the source of my issue might be.
For information: the int32 function had been successfully in assembly implemented and have been already utilized a lot for other VBE functionalities.
I personally think the problem comes from the values in CX and DX registers during calling function 07H.
Best.
Iman.