Handmade Network»Forums
6 posts
Getting into old school MS-DOS game programming
Edited by sudo459 on Reason: Initial post
Hey everyone,

I've decided to, purely as a hobby, start programming with (in?) MS-DOS. So far, it's incredibly difficult due to the lack of information, but I feel like I can manage. The main problem I seem to be having is that I feel a bit scared to run my programs. Since I'm using real hardware, crashes, at least I think, could potentially be devastating. Without the memory protection of modern OS's, and running in real mode, I worry how my program will misbehave if it overwrites memory. My question is, how likely is it, that if my program misbehaves it will damage my computer or cause data loss? And, in what ways could this happen?
Mārtiņš Možeiko
2562 posts / 2 projects
Getting into old school MS-DOS game programming
Damaging computer - no, that won't happen. Data loss - yes, that could happen. For example, when you would write to disk with wrong data, overwriting something important (either in your application, or OS files).

But I would really suggest to develop using DosBox. Yes, it's not a real hardware, but it will help you a lot. It's close enough to real hw, unless you are really pushing boundaries. But this last step could be done separately on real hw. Begin with easy stuff, use DosBox.
6 posts
Getting into old school MS-DOS game programming
I see. Thanks. I do wonder, other than a safer environment, what does DOSBox offer as far as making it easier to develop on, other than of course different emulated hardware setups? Ive tinkered around with Watcom's debugger, and Ive had trouble getting it to do remote debugging in DOSBox. It would just crash both dosboxes. Granted, I havent tried it on real hardware either, yet. And dosbox to real doesnt work either, naturally.
Mārtiņš Možeiko
2562 posts / 2 projects
Getting into old school MS-DOS game programming
Edited by Mārtiņš Možeiko on
what does DOSBox offer as far as making it easier to develop on
Easier to recover form mistakes. Something locks up / terribly crashes? Just reset whole emulation. Restarting app will be much faster than whole PC.

Also it has some kind of integrated debugger, but I've never tried it: https://github.com/Henne/dosbox-s.../master/src/debug/debug.cpp#L1277

6 posts
Getting into old school MS-DOS game programming
That DOSBox debugger looks interesting, I'll have to check it out. Thanks again. Also, I must have forgotten restart time. It's not much faster, but I could see how waiting a few more seconds to restart the program when doing a test could get annoying.
Dan
3 posts / 1 project
Getting into old school MS-DOS game programming
I have done a lot of MS-DOS game programming. There is absolutely no reason to be scared running your programs. Whenever you write software for any platform, you only read/write to memory locations you know about -- DOS is no exception. The same goes when writing files to disk. You have the power to overwrite system files, but this is difficult to accidentally do.

When you accidentally buffer overflow, either it happens silently, causes a general protection fault (putting you back at the prompt), or rarely requires a restart. To do something dangerous, you would have to very precisely modify another program's RAM, which is extraordinarily unlikely.

The benefits of DOS are many -- your program has 100% processor control, it can call BIOS interrupts, and can even write directly to video memory. You can also experiment with self-modifying programs!
6 posts
Getting into old school MS-DOS game programming
I guess I'm used to "modern" memory protection and being able to directly access hardware and system memory gave me the feeling of "with great power come great responsibility". I love the prospect of being able to have near total control over my computer, and, as I explore, I'm learning a ton about what the computer actually does.
Thanks for this by the way, I'm glad I can program without fear of a run away loop damaging my computer! Of course, this doesn't mean I get to be sloppy with my programming...