Archived

This topic is now archived and is closed to further replies.

How is graphics used in DOS? Aka... Eye of the Beholder, Daggerfall, etc.

This topic is 4948 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m trying to wonder what they used for their graphics, and if there''s anything I can use to work on such projects w/ c++. Any input is appreciated.

Share this post


Link to post
Share on other sites
They mostly used a special DOS interrupt to dump the video card into video display mode, and modified video memory directly. If you want to do similar stuff, you''ll probably need to grab an old DOS compiler.

Share this post


Link to post
Share on other sites
You''ll want a DOS compiler. Turbo C/C++ can be found on the Borland website for free, and those will work perfectly. Those games probably just use the vga card in mode 13h. DOS may sound like fun, or more ''low level'', but it works in the same way as something like DirectDraw (in other words: get a pointer to the video memory, manipulate it, swap buffers). It really isn''t worth it, you can accomplish the same thing with DirectX. DDraw allows you to use even the mode x resolutions.

Share this post


Link to post
Share on other sites
Most of that era of games used mode 13h and wrote directly to video memory; this is quite easy even in C.

Doom and a few other games, use a tweaked mode known as "Mode X", which is basically the same, but uses the VGA page registers to do hardware page flipping and accelerate some operations.

Mark

Share this post


Link to post
Share on other sites
A few other things to note: 320x200x256-color (mode 13h) or some of the tweaked modes are the only ones that allow 256 colors to be displayed simultaneously using a standard VGA card (640x480 is available, but only with 16 colors). These colors can be any from a selection of 16 million colors (256 possible shades/channel RGB), and the VGA card contains a ''palette'' that specifies only 256 of these 16 million that can be displayed at once (this is also known as 8-bit color in DX/PSP/Photoshop). Direct access to the video card was then required, typically at address A000:0000. Note that all of this was required because memory was expensive, and 256 colors on the screen at once only required one byte per pixel.

To get higher resolutions like later DOS games did, you typically need two things: (1) A DOS-extender to access more than 640Kb RAM ("extended" or "expanded" memory (EMS/XMS)), and (2) Low-level code that either is written for (a) specific graphics cards, or (b) the VESA VBE (Video BIOS Extensions) which was/is still supported by most cards. Unfortunately, while cards still offer VESA VBE support, Windows XP does not allow access to these routines (any pre-XP Windows still allows access).

Also note that in the DOS days, video cards did not have much memory, so two different types of video memory layouts were common to support high resolutions: (1) paging, and (2) linear framebuffers. Today, we always program using a linear framebuffer (pixels are stored RGB contiguous in memory). Memory pages are slow and inefficient, and they were often tricky to program for (eg using VESA VBE, pages stopped every 64Kb, regardless whether this was in the middle of a scanline), but they allowed video cards to optimize their memory usage.


h20, member of WFG
0 A.D.

Share this post


Link to post
Share on other sites
You can port games to dos using the allegro game library. check it out: allegro.cc is my favorite resource for allegro, it''s not the official site but you can get links to the official site there.


(no affiliation I just think it''s a cool idea)

Share this post


Link to post
Share on other sites
I found an old link to a site with a bunch of useful information on this subject.

http://www.whisqu.se/per/docs/graphics1.htm
to
http://www.whisqu.se/per/docs/graphics91.htm

Tons of articles on dos graphics and game programming.

Share this post


Link to post
Share on other sites