Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 552519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:30:30+00:00 2026-05-13T11:30:30+00:00

I’m doing a bit of retro programming for fun. What I want to create

  • 0

I’m doing a bit of retro programming for fun. What I want to create is a DOS game using EGA graphics but I am having a bit of trouble finding a good reference on the web. Everybody who talks about doing DOS programming assumes that the programmer will use mode 13h, and although some pages mention the other graphics modes, I haven’t found one yet that discusses their proper use.

Here’s what I’m trying to get working right now:

//------------------------------------------------------------------------------
//  DOS graphics test
//
//  Thanks to the following links:
//    http://gamebub.com/cpp_graphics.php
//
//  Written for Digital Mars C compiler to be compiled as a DOS 16 bit binary.
//------------------------------------------------------------------------------

#include <dos.h>
#include <stdio.h>

#define SCREEN_WIDTH  320;
#define SCREEN_HEIGHT 200;

unsigned char far *vram = (unsigned char far *)0xA0000000L;

//------------------------------------------------------------------------------
void set_video_mode(unsigned char mode)
{
    union REGS in, out;
    in.h.ah = 0;
    in.h.al = mode;
    int86(0x10, &in, &out);
}

//------------------------------------------------------------------------------
void plot_pixel(unsigned int x, unsigned int y, unsigned char color)
{
    // this is wrong because it's only 4 bpp not 8
    vram[y * 320 + x] = color;
    //vram[((y<<8)+(y<<6))+x] = color;
}

//------------------------------------------------------------------------------
int main(int argc, char* argv[])
{
    // EGA 320 x 200 x 16
    set_video_mode(0x0d);

    for (unsigned char i = 0; i < 255; i++)
    {
        vram[i] = i;
    }

    //plot_pixel(10, 10, 1);

    getc(stdin);
    return 0;
}

This sample code works great if you change set_video_mode() to take 0x13 instead of 0x0d, but like I said I’m trying to get EGA graphic here, not VGA. 🙂 I realize that in order to do four bits-per-pixel I’m going to either need to assume that plot_pixel writes two pixels at the same time or do a some bit twiddling to make sure I only write the four bits that I actually want.

My problem is that I’m not seeing what I expect as output–in particular, no colors! Everything seems to be mono colored, which is not what I want at all. Is there some kind of different procedure for employing a color palette in this graphics mode than in 13h? Or have I somehow invoked a completely different graphics mode from the one I intended? Guidance would be very much appreciated.

I don’t think my compiler args would be relevant, but just in case:

..\dm\bin\dmc test.c -o test -mm
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:30:30+00:00Added an answer on May 13, 2026 at 11:30 am

    Mode 0x0d is planar based while 0x13 is not (without special configuration as Mode X). You should check more document to see how to work in planar mode.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
We're building an app, our first using Rails 3, and we're having to build
Seemingly simple, but I cannot find anything relevant on the web. What is the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I need to clean up various Word 'smart' characters in user input, including but
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
i want to parse a xhtml file and display in UITableView. what is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.