Solved

How to enter 640X480 mode??

Posted on 1998-02-02
8
259 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
  • 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

821 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