Solved

How to enter 640X480 mode??

Posted on 1998-02-02
8
276 Views
Last Modified: 2012-08-13
I or we all know that mode 13h = 320X200
But can anyone tell me the mode for 640X480???
0
Comment
Question by:justinng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1179937
answer coming.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1179938
11H is 640X480 in monochrome.  
12H is 640X480 in color.
0
 

Author Comment

by:justinng
ID: 1179939
erm...nietod...is that 256 colors mode?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:nietod
ID: 1179940
I don't know.  I assumed it was the maximum
0
 
LVL 22

Expert Comment

by:nietod
ID: 1179941
I found a table in ralph browns's interrupts books (the bible). 12H is 16 color.  The 256 color options seem to be hardware dependant, although I suspect that there is a standard interrupt that all SVGA supports, there is no listing as such.

Actually, they all seem to be 2EH!  It is just that they are listed by manufacturer.  Perhaps 2EH works for all.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1179942
Opps.  Now I see some 640X480X256 entries that are not 2Eh.  Although perhaps the cards will still recognize 2EH.
0
 
LVL 2

Accepted Solution

by:
Ready4Dis earned 10 total points
ID: 1179943
I can give you the source to use vesa modes. 640x480x256, and others. 1280x1024x256, 800x600x16m... so on, and so forth... here it is:
# include <stdio.h>
# include <conio.h>
# include <string.h>
# include <dos.h>
# include <stdlib.h> // for rand()
# include <math.h>   // for pow()


# define TEXT               0x03
# define VGA_320x200x4      0x04
# define VGA_320x200x256    0x13
# define SVGA_640x400x256   0x100
# define SVGA_640x480x256   0x101
# define SVGA_800x600x16    0x102
# define SVGA_800x600x256   0x103
# define SVGA_1024x768x16   0x104
# define SVGA_1024x768x256  0x105
# define SVGA_1280x1024x256 0x107
# define SVGA_132x25_TEXT   0x109
# define SVGA_132x43_TEXT   0x10A
# define SVGA_640x480x32k   0x110
# define SVGA_640x480x64k   0x111
# define SVGA_640x480x16M   0x112
# define SVGA_800x600x64k   0x114
# define SVGA_800x600x16M   0x115
# define SVGA_1024x768x32k  0x116
# define SVGA_1024x768x64k  0x117

unsigned char far *video_buffer = (char far *)0xA0000000;
char bits_per_pixel;
int screen_w;
int screen_h;

void setbank(int bank)
{
   static int current_bank;
      if (bank==current_bank) return;
   current_bank = bank;
   _AX = 0x4F05;
   _BX = 0;
   _DX = bank;
   geninterrupt(0x10);
}

void plot_pixel (int x, int y, int colour)
{
// bits_per_pixel is shifted right three times to get the number into bytes.
// eg: 8 bits per pixel >>3 = 8/(2^8) = 1 byte per pixel.
   long offset = ((long)y*screen_w+(long)x)*(bits_per_pixel>>3);
   setbank(offset>>16);
      _fmemset(video_buffer+offset,colour,bits_per_pixel>>3);
}

int set_mode(int mode)
{
   _AX = 0x4F02;
      _BX = mode;
      geninterrupt(0x10);
      if (_AX==0x4F) {
            return 1;
      } else return 0;
}

main ()
{
      unsigned long count;
      set_mode (SVGA_640x400x256);
// For modes with more than 256 colors, bits_per_pixel needs to be increased.
// 256 colors = 2^8; 32K colors = 2^15; 64K colors = 2^16; 16M colors = 2^24
      bits_per_pixel = 8;
      screen_w = 640;
      screen_h = 400;
      for (count=0;count<256;count++)
            plot_pixel(count,50,count);
      getch();
      set_mode (TEXT);
}
0
 

Author Comment

by:justinng
ID: 1179944
Thanx for this excellent solution!
I've increased the points from 5 to 10 to show my appreciation.

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

731 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question