I am in dos environment and have a segment memory of 64k(In 16bit dos,begin with:0xA000:0000),mapping directly to the framebuffer of the svga card.
I can manipulate the pixel displayed on the screen by writing data to that segment(and also with the help of a function that selects page so as to access the whole video memory using just 64k).
The putpixel function is something like:
char far* scr = 0xA0000000
addr = (unsigned long)y*((unsigned long)COLS*4)+((unsigned long)x*4);// offset bytes
scr+=addr; // scr will be limited in one segment
if((NewPage=addr>>16)!=OldPage) { // equal to:addr/65536
OldPage = NewPage;
SelectPage(NewPage);
}
// color--4bytes,store the value of the pixel
*scr++=color;
*scr++=color>>8;
*scr++=color>>16;
The question is,how can I avoid flickering if I need to putpixels and clear them very often on the screen?(For example,I need to make a small piece of image move on the screen fluently).
I have heard about double buffering but in dos,I do not know how to deal with page changing(because you copy 64k to 0xA0000000 directly).
Does anyone has experience of svga programing in dos ? Should I wait for vertical blanking of CRT before calling putpixel?
I have found the document but don't know how to program directly on the register of svga video card:
https://web.stanford.edu/class/cs140/projects/pintos/specs/freevga/vga/crtcreg.htm#15
for vga card, a lot of people use this to wait:
while(!inportb(0x3da)&0x08);
Does anyone know how to do this for svga programing ?(or there may be another way to solve this?)