• Announcements

Archived

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

Mode 13h in DOS

Recommended Posts

misterags    122
Can someone give me the code to switch to mode 13h in DOS, (in C++ form), I am wanting to load bitmaps, if someone wants to show me the full code to load a bitmap, that would be great too. (By the way, all in DOS) misterags.

Share on other sites
Martee    476
  asm mov ax, 13;asm int 10h;

Of course, whether or not this will work depends on what compiler you are using.

~~~~~~~~~~
Martee

Share on other sites
misterags    122
Thanks but that didn''t work... I''m using MS VC++ 6.0. Umm, asm doesn''t seem to be a key word. here are the errors:

error C2061: syntax error : identifier ''move''

error C2059: syntax error : ''bad suffix on number''

error C2062: type ''int'' unexpected

Share on other sites
vTheHero    136
VC++ is Win32 only so there is absolutely no way you can write a DOS program with it. DOS is dead so I would recommend working with something else, however if your learning to program in DOS (which I think is pretty cool) you can download Turbo C from Borland for free which supports the asm command. I believe that DJGPP, also a free compiler, will allow that command as well but it is 32bit protected mode DOS so it is considerable more complicated. Best of Luck.

The Hero

P.S. VC++ supports the asm command but it will not allow you to directly access mode 13h so the errors you are getting are because it is mov not move and VC++ does not support interrupts (the int command)

Edited by - vTheHero on August 5, 2001 12:58:59 AM

Share on other sites
Premandrake    175
As a side note, mov ax,13 won''t work either. There is a reason it is called mode 13h you know =). use "mov ax,0x13" to get the proper mode.

Share on other sites
MatrixCubed    199
The keyword for inline assembly in VC++ is __asm:

__asm{    mov ax, 0x13    int 10h}

Check the following links for DOS graphics programming tutorials:

http://www.theparticle.com/pgraph.html
http://atschool.eduweb.co.uk/camdean/pupils/amac/vga.htm
http://mega.ist.utl.pt/~fjds//vga13tut1.html
http://www.programmersheaven.com/

That should get you started... good luck!

MatrixCubed
http://MatrixCubed.org

Share on other sites
Guest Anonymous Poster
You don''t need asm, simply do:

if( OperatingSystem == MS_DOS )
{
printf("You are in middle age\n");
exit(1);
}

Share on other sites
Guest Anonymous Poster

sorry, but you said VC++ does not support interrupts?

but what''s this, i heard it''s a user defined breakpoint, and int simply is an interrupt:

__asm int 3;

Share on other sites
coelurus    259
Are you trying to program DOS-stuff in VC++? To be honest, that sounds quite wierd, why don''t you get DJGPP? It''s a 32-bits compiler for DOS, and a free one too! Go to http://www.delorie.com.

I''ve got my reasons why not to use VC++ in DOS:
Unnecessarily big sourcecodes and binaries
Slower
DJGPP is made for DOS-programming, not VC++

There are some more...

If you decide to get DJGPP, check out my homepage; http://seawasp.hjorten.nu/~coelurus for some sourcecodes (algorithms, graphics, 3d etc).

Share on other sites
Martee    476
You forgot the main reason: VC++ cannot produce DOS applications!

~~~~~~~~~~
Martee

Share on other sites
Guest Anonymous Poster
realy good people do not do retro stuff

Share on other sites
Electron    122
Anonymous poster: "realy good people do not do retro stuff"

Really good people STARTED in DOS and worked upward.
Really good people learned to program everything WITHOUT API''s and tools.
And what you call middle age is what they call good old memories from a forgotten magical realm.

Electron

"64 kb of memory ought to be enough for anybody-Bill gates -89

Share on other sites
TerranFury    142
Mode13h is wonderful - lots of fun. Go with it. It''s really quite easy under DJGPP. Go to http://www.inversereality.org/tutorials/tutorial.html .

Share on other sites
Impossible    134
The exact explanation of why mode 13h and interrupts in general don''t work with VC++ is that VC++ creates Win32 programs only. In Win32 (or linux, or any modern 32-bit OS) only device drivers, the kernel, etc, have permission to access the hardware and applications need to use an API. If you read about the 386 architecture and OS design you''ll understand this a little better.

Share on other sites
Guest Anonymous Poster
There''s a tutorial for programming in VGA (mode 13h) for DOS here:

http://www.brackeen.com/home/vga/

Share on other sites
"DOS is deader than death..." *sing*

Share on other sites
coelurus    259
This post is getting bigger than "save gamedev"...

True, DOS is out. But it''s a perfect environment for starting the programming-demons in you head. The low-level abilities are just perfect with memory access, playing with interrupts etc. I started out in Turbo Pascal, then I used DJGPP and at last I''m sitting in Linux.

And I''m glad I did. I couldn''t have done what I have done in Linux, if I didn''t program in DOS. Many neat tricks, asm etc is not learnt in Windows, but in DOS. Those tricks, asm blabla can then be used in Windows or Linux to give incredible speed-ups for graphics, sound and so on.

DOS-programming is OUT, but DOS-programmers are NOT!

Share on other sites
Guest Anonymous Poster
i think you can program for dos in VC++, just select console application when you make a new project. And mode 13h IS an exelent starting point when learning gameprogramming, but directdraw isn''t that hard to start with either...

Share on other sites
thedustbustr    191
"i think you can program for dos in VC++, just select console application when you make a new project"

Go ahead and compile a console app, reboot into dos, run it. You will get the following printed to the screen: "This program must be run under Win32"