OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 11:16 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Page Flipping in VBE 3.0 (function 07H)
PostPosted: Thu Feb 28, 2019 8:24 am 
Offline
Member
Member
User avatar

Joined: Wed Feb 06, 2019 10:41 am
Posts: 84
Hi.
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:
#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, &regs );
}
//+++++++++++++++++++++++++++++++++++++++++++++++++
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);
   }
}

The problem is that it never flip the second page. Only for the first time, the PAGE0 is rendered and done!
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.


Top
 Profile  
 
 Post subject: Re: Page Flipping in VBE 3.0 (function 07H)
PostPosted: Thu Feb 28, 2019 8:53 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5143
iman wrote:
I personally think the problem comes from the values in CX and DX registers during calling function 07H.

Correct. You're supposed to take the offset from the start of display memory and divide by 4, according to page 50 of the VBE Core Functions Standard 3.0.


Top
 Profile  
 
 Post subject: Re: Page Flipping in VBE 3.0 (function 07H)
PostPosted: Thu Feb 28, 2019 10:24 am 
Offline
Member
Member
User avatar

Joined: Wed Feb 06, 2019 10:41 am
Posts: 84
Thanks a lot for your reply.
Please correct me if I am wrong. My second page starts at address fb + (1024*768*4). So as you suggested I have to get the offset of the page, divide it by 4 and pass it to CX and DX.
Then it makes:
offset = 1024*768;
CX = LOW_WORD(offset); and DX = HIGH_WORD(offset);

I did as above, but the problem still remains as before.

_________________
Iman Abdollahzadeh
Github
Codeberg


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: DotBot [Bot], Majestic-12 [Bot], rdos, SemrushBot [Bot] and 97 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group