How can I initialise different video modes... like SVGA 800x600 mode, EGA 640x350 mode, et cetera using interrupts... what exactly must I do? Could you demonstrate an example or two for EGA 640x350 and how I can then write to the memory? Thank you.

Recommended Answers

All 4 Replies

How can I initialise different video modes... like SVGA 800x600 mode, EGA 640x350 mode, et cetera using interrupts... what exactly must I do? Could you demonstrate an example or two for EGA 640x350 and how I can then write to the memory? Thank you.

may be you can search on 10h BIOS Video Interrupt.
and to change the video mode, use

int10h F : 0 interrupt

a simple code for you...

void set_video_mode(int vmode)
{
           union REGS regs;
           regs.h.ah = 0;        
           regs.h.al = vmode;
 
           int86(0x10, &regs, &regs);
}
 
int main(void)
{
         set_video_mode(1);
         printf(“hello world!\n”);
         getch();
         
         return 0;
}

Yes, very well.. I already knew this much. Say I set vmode to 10....

10h = G 80x25 8x14 640x350 4 2 A000 64k EGA
= G 640x350 16 A000 256k EGA,VGA

How can I now write to the video memory, displaying a pixel somewhere??

Yes, very well.. I already knew this much. Say I set vmode to 10....

How can I now write to the video memory, displaying a pixel somewhere??

sure.. Use that lines of codes.

void writep(int row, int col, int color)
{
         union REGS regs;
         
         regs.h.ah = 0x0c;
         regs.h.al = color;
         regs.h.bh = 0;
         regs.x.dx = row;
         regs.x.cx = col;
         int86(0x10, &regs, &regs);
}
 

int main(void)
{
         set_video_mode(16);
         writep(100, 100, WHITE);
         getch();
         set_video_mode(3);
 
         return 0;
}

writing to video ram is easy as writing to any other ram -- just set a pointer to 0xA0000:0000 and write to it. But be warned that it will be ungodly sloooooow. Here is a link to some more useful information

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.