Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS-DOS - Is it possible to program 24 bit graphics?

Is it possible to program in a color depth of 24 bits on a DOS machine? I know VGA supports 8 bit color depth, but is there a way to finagle out 24 bits? Research on Google has turned up nothing. I am programming on FreeDOS instead of MS-DOS, if that affects the answer.

like image 923
Jason Mills Avatar asked Dec 31 '25 01:12

Jason Mills


1 Answers

Yes, it is possible. You should read about VESA and appropriate drivers. Here is several functions

Then you will be able to do:

  mov ax,4f02h
  mov bx,103h
  int 10h

This usually provides ax with 004fh if VESA is inited and 103h (800x600x256) mode is set, you may use 11bh (1280x1024x16M) for example (http://www.delorie.com/djgpp/doc/rbinter/it/83/0.html)

UPDATE: I'm attaching some code from my very very very old pascal program:

{ preserve space for vesa info structure, in asm it will look like sets of db, dw }
tmodes=array[0..0] of word;
    tvesainfo=
     record
      abSignature:array[1..4] of char;
      lwVersion,hwVersion:byte;
      pfszOEMStr:pchar;
      rAbilities:longint;
{$F+}
      pfawModes:^tmodes;
{$F-}
      abData:array[1..238] of byte;
     end;

{ just pascal function, which calls ax 4f00 int 10h, passes address of structure above to fetch information from vesa driver, can be just simplified to asm block in it }
function vesatest(var vi:tvesainfo):boolean;
var
   os,sg:word;
   res:word;
begin
 os:=seg(vi);
 sg:=ofs(vi);
 asm
  mov ax,4f00h
  mov es,os
  mov di,sg
  int 10h
  mov res,ax
 end;
 if res=$004f then vesatest:=true
  else vesatest:=false;
end;

{ call function above and display basic information about vesa driver installed }
 if vesatest(vesainfo)=false then
  begin
   writeln('This computer doesn''t have VESA');
   halt(254);
  end;
 writeln('VESA signature - ',vesainfo.abSignature);
 writeln('VESA version - ',vesainfo.hwVersion,'.',vesainfo.lwVersion);
 writeln('VESA manufacturer - ',vesainfo.pfszOEMStr);
like image 65
Iłya Bursov Avatar answered Jan 02 '26 09:01

Iłya Bursov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!