Video memory


Video memory is the memory area corresponding to the monitor i.e what is written on the video memory is displayed on the monitor. The example that I would like to illustrate is a little old fashioned and workable in DOS O.S.

char far *scr = 0xb8000000;

main()

{

int i,j;

for(i=0; i < 2000; i++)

for(j=0; j < 2000 ; j++)

*(scr + (2000 * i ) + )  = ‘A’;

}//end

I just wanted to display ‘A’ all over screen which other wise would have done using printf ( any inbuilt function) also. The time difference noticed while executing the program using print and using video memory access method is astonishing. By directly writing on the video memory we by pass 2000 X 2000 function call and the efficiency is remarkable.

regarding the pointer details – as we know intel architecture fllows segment memory model. memory is divided into Code Segment, Data Segment, Extra Segment, Stack Segment. A usual pointer such as int *ptr can point only within data /extra segment. To point to a location outside this segment we have to use far pointer.

Leave a comment