Initialising Video Modes

Reply

Join Date: Oct 2005
Posts: 18
Reputation: JC_McGeekster is an unknown quantity at this point 
Solved Threads: 0
JC_McGeekster's Avatar
JC_McGeekster JC_McGeekster is offline Offline
Newbie Poster

Initialising Video Modes

 
0
  #1
May 3rd, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 29
Reputation: fulyaoner is an unknown quantity at this point 
Solved Threads: 2
fulyaoner's Avatar
fulyaoner fulyaoner is offline Offline
Light Poster

Re: Initialising Video Modes

 
0
  #2
May 3rd, 2007
Originally Posted by JC_McGeekster View Post
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;
}
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 18
Reputation: JC_McGeekster is an unknown quantity at this point 
Solved Threads: 0
JC_McGeekster's Avatar
JC_McGeekster JC_McGeekster is offline Offline
Newbie Poster

Re: Initialising Video Modes

 
0
  #3
May 3rd, 2007
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??
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 29
Reputation: fulyaoner is an unknown quantity at this point 
Solved Threads: 2
fulyaoner's Avatar
fulyaoner fulyaoner is offline Offline
Light Poster

Re: Initialising Video Modes

 
0
  #4
May 4th, 2007
Originally Posted by JC_McGeekster View Post
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;
}
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,358
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1463
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Initialising Video Modes

 
0
  #5
May 4th, 2007
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
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC