🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DOS -> Windows console in C++

Started by
9 comments, last by LackOfKnack 24 years, 5 months ago
Hey! Another newbie question, if you would: I''m making an experimental Tetris clone in Borland Turbo C++ for DOS 3.0, but the compiler keeps crashing and stuff while I''m multitasking. I tried opening the .cpp file (the only one I''m using at the moment) in Visual C++ 5, but it won''t compile. I think it has something to do with the graphics.h library: is there a VC++ equivalent for console applications that I can use? Thanks!
Lack
Lack
Christianity, Creation, metric, Dvorak, and BeOS for all!
Advertisement
(bump) Just need a quick answer, please.


Lack
Lack
Christianity, Creation, metric, Dvorak, and BeOS for all!
I don''t think you can use the DOS graphics calls in a console program, but it''s possible... I have never heard of it...
What does everyone else use while learning, before they move to DirectX or OpenGL? Isn''t there a console equivalent of graphics.h that I can use before I move on to Windows programming?



Lack
Lack
Christianity, Creation, metric, Dvorak, and BeOS for all!
From my past experience, the ''graphics.h'' in TurboC++ is for the BGI (Borland Graphics Interface) functions, ONLY available in Borland products, and is meant ONLY for DOS program. Plus, it is QUITE SLOW too.

MSVC++ builds Windows EXE + is not a Borland product anyway,
so ''graphics.h'' isn''t available. If u want to use graphics in MSVC++, the only way is to use DirectX, GDI or OpenGL.

(correct me if i''m wrong)
"after many years of singularity, i'm still searching on the event horizon"
I agree. I''m pretty sure the DOS graphics functions are only available in DOS, and Win32 console programs (and any programs made by a VC++ version above 1.5 I think) are only Windows programs. I never did any graphics in DOS, with the exception of some VERY simple things in Q-BASIC. I learned C++ in DOS and with Windows Console programs, then I messed around with Windows in Borland C++Builder 3. When I started learning games I went straight to DirectX with Builder and VC 6, and I didn''t have any real problems adjusting. From what I hear, DirectX programming is almost like DOS, except without many of the annoyances.

------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge
Shoot. That kind of blows my plan out of the water. I was going to learn C++ on my DOS compiler and get everything down, then learn how to do Windows and DirectX. Ah well.

Thanks for the info, it''s appreciated.


Lack
Lack
Christianity, Creation, metric, Dvorak, and BeOS for all!
I started with DIB sections, before heading on.

Dance with me......

http://members.xoom.com/CJdeVos/index.htm

You can use graphics without a library in DOS. The only thing it takes is some knowledge about assembler and some knowledge about the graphics system. I will demonstrate how to get into the widely known mode 13h (320x200x256).
Use this function to get into that:
void gfxmode(){   asm{      mov ax,0x13      int 0x10   };};

and back to text:
void textmode(){   asm{      mov ax,3      int 0x10   };};

do this to plot pixels:
unsigned char *screen=(unsigned char far *)0xA0000000L;screen[0]=15;

Forget not to use large memory mode.
Try it out.
Thanks for the link, CJ, but some of the pages were not found, specifically the example one. Also, what does DIB mean?

And thanks for the code sample - I''ll try it this weekend if I get time (late exams this year over Y2K fears.) So, you can use asm like that in a Win32 console?

Thanks for your help.


Lack
Lack
Christianity, Creation, metric, Dvorak, and BeOS for all!

This topic is closed to new replies.

Advertisement