Graphics video memory in c using far pointer

Graphics video memory:

Segment number 0XA is known as graphics video memory. This segment has 720 columns and 400 rows.
Intersection of rows and columns is known as pixel. Size of each pixel is one byte which stores color information.

Example:

(q)What will be output of following c program?

#include <dos.h>
#include<stdio.h>

int main(){

int j;
union REGS i,o;
char far *ptr=(char *)0XA0000000;

i.h.ah=0;
i.h.al=0x13;
int86(0x10,&i,&o);

for(j=1;j<=100;j++){
*(ptr+j)=4;
}


return 0;
}

Output: One red color line in the graphics console as shown in the following figure

0 comments:

Post a Comment

Don't Forget to comment