Making a C++ maze game

Started by
17 comments, last by GameDev.net 18 years, 2 months ago
Quote:Original post by AdamGL
You can have graphics in dos, but you'll need to access the video buffer manually. I don't now how so search it and you'll find something.


This is not as easy as it seems. It requires assembly instructions to initialize the correct screenmode and is generally more of a pain than it is worth.

Give SDL a try, don't try doing dos graphics yourself, even if you do get something working it will not be cross platform compatable and will most likely be inefficient.
_______________________"You're using a screwdriver to nail some glue to a ming vase. " -ToohrVyk
Advertisement
I remember learning in the early days of dos game programming it was mandatory that you knew how to access the video buffer, as you usually had to write all your own graphics code. IIRC it was something load loading the AX register with 0x0013 and then calling int 21. thats why VGA 320x200 used to be called mode 13.

to access the video memory(for mode 13 anyway) you just wrote directly to 0xA0000000.

I used to create a global pointer called screen and point it to the memory location ie:
unsigned char *screen = 0xA0000000;
Quote:Original post by Boder
Be careful though, there is no platform independent way in the standard library to clear the screen.

Windows: system("cls")
Nix: system("clear")


Or storing the whole screen into an array and filling it with zero.

Quote:Original post by Cosmic R
I remember learning in the early days of dos game programming it was mandatory that you knew how to access the video buffer, as you usually had to write all your own graphics code. IIRC it was something load loading the AX register with 0x0013 and then calling int 21. thats why VGA 320x200 used to be called mode 13.

to access the video memory(for mode 13 anyway) you just wrote directly to 0xA0000000.

I used to create a global pointer called screen and point it to the memory location ie:
unsigned char *screen = 0xA0000000;


I was wondering how to do that the other day but I couldn't remember how. Thanks.
Quote:
Original post by Cosmic R
I remember learning in the early days of dos game programming it was mandatory that you knew how to access the video buffer, as you usually had to write all your own graphics code. IIRC it was something load loading the AX register with 0x0013 and then calling int 21. thats why VGA 320x200 used to be called mode 13.


If I remember correct, the video bios is 10h, not 21h

10h is the video bios iterrupts, while 21h is the dos bios iterrupts.

Just a typo I guess
Quote:10h is the video bios iterrupts, while 21h is the dos bios iterrupts.

thats right, sorry I havent done it in about 10 years. 21h is for stuff like stdin and stdout and file functions. oh and incase anyone is going to do this, you'll need to know that 0x0003 is for text mode too.

I actually learnt all this from 2 sources - denthors asm tutorials(they were the bible back in the day...) and Andre LaMothe's Teach yourself game programming in 21 days - the best game programming book I ever read.
This code will work to put a pixel to the middle of the screen on 320x200x256 color resolution mode. This code will only work using Borland Turbo C++ Version 3 (DOS). Any other compiler produces code that kills the machine when it tries to flip video modes.

Unless you want to use at least a ten year old compiler, you're going to have to SDL or other more modern APIs.

unsigned char far *screen = (unsigned char far *)0xA0000000L;void setVideoMode(int MODE){     _asm {               mov ax, MODE               int 10h          }}void putPixel(int X, int Y, unsigned char COLOR){     *(screen + (Y<<6) + (Y<<8) + X) = COLOR;}int main()  // args...{     setVideoMode(19);     putPixel(160, 100, 15);     setVideoMode(3);     return 0;}
.
Quote:Original post by Cosmic R
I actually learnt all this from 2 sources - denthors asm tutorials(they were the bible back in the day...) and Andre LaMothe's Teach yourself game programming in 21 days - the best game programming book I ever read.


I second LaMothe. He's the reason I remember any of this mode 19 stuff.


.
Use C++ as a communicative language, and use APIs for your specific platform target. Win32 has some great functions for your purpose. Use it. That's what it's there for.

This topic is closed to new replies.

Advertisement