Jump to content
  • Advertisement

Archived

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

XELON

A Real Beginner Problem

This topic is 5458 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

quote:
Original post by XELON
quote:
Original post by Oxyd
Well - the answer is simple: You can''t do ANY graphics (except ascii-art) on the console (DOS screen).

Oxyd.


How did programmers make games before windows?

Spudder : Do I have to use an API? And SDL or others work on DOS or WINDOWS?


You can''t do bitmapped graphics in Console Applications, duh.

Share this post


Link to post
Share on other sites
Advertisement
I think I found how to show the image.And it can run on console


#include <dos.h>
#include <conio.h>

// Global Variables

int OldMode; // variable to save user''s original mode

unsigned char far *VgaScreen; // variable to point to screen


// Function Declarations

void OpenGraph();
void CloseGraph();

// Main Program

void main()
{
OpenGraph(); // open graphics mode 0x13

*VgaScreen = 1; // display a blue dot

getch(); // wait for a keypress

CloseGraph(); // back to user''s original mode

}

////////////////////////////////////////////////////

// OPENGRAPH //

// Gets into graphics mode 0x13 (320x200x256) //

////////////////////////////////////////////////////

void OpenGraph()
{
union REGS regs;

VgaScreen = MK_FP(0xA000, 0x0000); // set pointer to screen address

OldMode = peekb(0x0040, 0x0049); // save user''s video mode first


regs.h.ah = 0x00; // service 0, Set Video Mode

regs.h.al = 0x13; // set graphics mode to 320x200x256

int86(0x10, ®s, ®s); // execute BIOS call

}

////////////////////////////////////////////////////

// CLOSEGRAPH //

// Restores user''s original video mode //

////////////////////////////////////////////////////

void CloseGraph()
{
union REGS regs;

regs.h.ah = 0x00; // service 0, Set Video Mode

regs.h.al = OldMode; // set graphics mode back to user''s

int86(0x10, ®s, ®s); // execute BIOS call

}

Thanks for your help...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!