Solved

How to enter 640X480 mode??

Posted on 1998-02-02
8
233 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
 
LVL 22

Expert Comment

by:nietod
ID: 1179940
I don't know.  I assumed it was the maximum
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now