DOS programming - Where to start? Books?

Announcements, advice, random banter, unrelated discussion, et cetera.

DOS programming - Where to start? Books?

Postby SirNickity » 2019-11-22 @ 23:44

First, just so you know what I know and what I'm looking for, here's:

My programming experience:
I started with BASIC on a TRS-80, then VB 3.0 in Win 3.x up until .NET. I later picked up perl and C in Linux, then embedded C on AVR, and tried my hand at AVR ASM and have dabbled in ARM as well. I'm no savant, but I keep my indices within array bounds, if ya know whadda mean.

OK... so, I'm just fascinated by hardware, enjoy the puzzle of coding, and have a warm fondness for DOS, Win 3.x, Win 9x, XP, and BeOS. But, the only PC programming I'm familiar with at this point is gcc / libc CLI apps under Linux. I want to start writing DOS programs and drivers, and then move on to Win16, then get back into Win32 after years away since abandoning VB. For now, I'm starting at 0. Or, perhaps 3.3.

To prepare for this, I've bought a lot of:
Books:
- Pretty much the entire System Architecture hardware series: ISA, 486, Pentium, PCI, PnP, etc.
- The Sound Blaster book
- Graphics Programming in C (motivating educational practical project: writing VGA test patterns to calibrate my OSSC's sampling settings at various resolutions for my fleet of retro boxen)
- System BIOS for IBM PC/XT/AT Computers & Compatibles
- Microsoft MS-DOS Programmer's Reference
- Programming Windows 3.1
- And -- if I can find it -- I have a book on x86 ASM as well. But I think it may be more of an opcode reference.

Software
I bought MS Visual Studio C++ 4.0 (which comes with 1.52) and 6.0. MS C 7.0 and MSASM 6.1, Watcom C 7.0, and a couple Intel compilers found their way in my disk box as well.

Most of the above focus on very specific things. References of software interrupts, DOS API, particular hardware, the x86 architecture.. but I need an introduction, a place to start.

So...

What next?
There are a couple MASM books on Amazon, but 5.x/6.x is a pretty deep cut these days so not all the books have any reviews, and none of them have more than a few. I'm not sure if there's kind of a beloved "go-to" reference or if I should just take my chances with one and hope for the best. Maybe the Peter Norton book? Seems to have done OK by the two or three people that have read it since the turn of the millennium.

Then, I need something that glues all this together. DOS is a different kind of beast. I (think I) get segment:offset addressing, but I have no idea what a "memory model" is, nor when or why I should choose small or large. I'm not really sure how memory allocation works -- AFAIK, you're given kind of a blank check, rather than having to allocate from the OS, but I could be way wrong. This might all be covered in a good MASM book, but it would apply to C as well, so if there's a really great generic DOS C book, that might be a good place to dip toes into the rather strange environment that DOS is.

BTW
I did manage to write my first DOS .com file by looking up an 8086 instruction code reference, looking up how to convert them from mnemonics to opcodes, creating a file in a hex editor, and running it in DOSBox. I successfully greeted the world "Hello", and then got kind of crazy and figured I would report what version of DOS this is. That required an int-to-string routine, which I wrote on paper... but converting all the various MOV instructions to opcodes by hand got really tiresome (it is NOT straight-forward), so I installed MASM, and then proceeded to get way in over my head with assembly code boilerplate, the exact syntax it wants for variants with reg-to-reg, mem-to-reg, etc.

I have watched a couple YouTube intros, but ... sigh... I mean, I appreciate the effort, but not everyone is meant to be a teacher, and it's obvious a lot of them don't quite understand it themselves. (Like one, that said you just need to end your program in 0d 0a 24, because that's how you end DOS programs. That lit up my BS detector, and since "$" is not a great Google search term, it took a while to figure out that it's actually just a string terminator because.... reasons... probably CP/M's fault.)
SirNickity
Oldbie
 
Posts: 963
Joined: 2018-11-08 @ 04:51

Re: DOS programming - Where to start? Books?

Postby Jo22 » 2019-11-23 @ 00:32

probably CP/M's fault.

Oh, that reminds me of DOS' ancient CALL 5 interface for CP/M compatibility.. Really fascinating stuff! :cool:

http://hitchhikersgui.de/A20_line
viewtopic.php?p=682638#p682638

http://www.os2museum.com/wp/who-needs-t ... nd-anyway/
http://www.os2museum.com/wp/a-word-on-the-call-5-spell/
"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//
User avatar
Jo22
l33t
 
Posts: 3986
Joined: 2009-12-13 @ 07:06
Location: Europe

Re: DOS programming - Where to start? Books?

Postby SirNickity » 2019-11-23 @ 01:31

I have a feeling A20 is one of those things that IBM wishes it would have handled differently. (Or, did wish.. when they still had an interest in PCs.)

Oh no, we can access 16MB of memory now, and all your programs that assume life ends at 1MB are broken. Boo hoo, write a patch, ya Melvin... ;-D I got 99 problems and A20 ain't one.
SirNickity
Oldbie
 
Posts: 963
Joined: 2018-11-08 @ 04:51

Re: DOS programming - Where to start? Books?

Postby TheMobRules » 2019-11-23 @ 04:02

My go-to book for MASM programming back in college was The Art of Assembly Language. But beware, there are different editions of the book: one for 32-bit Windows, another one for 32-bit Linux and the most common one which you will probably find on Amazon, that focuses on HLA (High Level Assembly). None of these are very useful for DOS programming, the one you want is known as DOS 16-bit edition: this is the one I used, and you can probably get it online as a PDF.

Maybe there are better books out there but I remember this one being both a very good introduction to x86 assembly and a solid MASM reference.

EDIT: for C programming on DOS, instead of a specific book I would recommend the classic Kernighan/Ritchie + reference docs of whatever compiler you are using
TheMobRules
Member
 
Posts: 490
Joined: 2016-1-19 @ 23:29

Re: DOS programming - Where to start? Books?

Postby pan069 » 2019-11-23 @ 09:11

For DOS programming, books can be a great resource. there's a lot of information on the web but when it comes to DOS, nothing beats good 'ol books.

On that note; I see you already have a few books, good start. If you don't mind, I'd like to suggest another one for you, a book that will explain pretty much everything you need to know when it comes to DOS/x86 programming:

PC Intern: The Encyclopedia of System Programming

https://www.amazon.com/PC-Intern-Encycl ... 1557553041

Personally. when I do DOS development I just work on my Linux desktop with a modern code editor (Sublime or VSCode), I use OpenWatcom on Linux so I build my binaries (.com or .exe) from the Linux command line and then run the program directly in DOSBox. Then, to test if it works on actual hardware, I copy it over to a real machine.

Those old machines, either DOS or Windows, just aren't productivity beasts. :)
Last edited by pan069 on 2019-11-24 @ 06:54, edited 1 time in total.
User avatar
pan069
Member
 
Posts: 218
Joined: 2018-12-06 @ 06:30
Location: Sydney / Australia

Re: DOS programming - Where to start? Books?

Postby Jo22 » 2019-11-23 @ 10:19

SirNickity wrote:I have a feeling A20 is one of those things that IBM wishes it would have handled differently. (Or, did wish.. when they still had an interest in PCs.)

Oh no, we can access 16MB of memory now, and all your programs that assume life ends at 1MB are broken. Boo hoo, write a patch, ya Melvin... ;-D I got 99 problems and A20 ain't one.

Yeah, maybe. ;)
In practice, though, DOS and its programs do not have as much trouble with A20 as the press constantly claims them to have.
If you read the links I mentioned before, you'll realize address-wrapparound is a non-issue for the CALL 5 stuff, for example. :)
It works either way. General speaking, DOS itself can run with or without an A20 just fine.
It's the memory managers (Himem etc) that are having issues mainly. Luckily, they can be replaced by third-party ones.
"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//
User avatar
Jo22
l33t
 
Posts: 3986
Joined: 2009-12-13 @ 07:06
Location: Europe

Re: DOS programming - Where to start? Books?

Postby BloodyCactus » 2019-11-23 @ 13:22

if you have a c compiler, you dont need to "know dos" since the clibs abstract everything away. if your doing asm, sure, dos books like the norton pink shirt are great.. otherwise meh.
--/\-[ Stu : Bloody Cactus :: http://kråketær.com :: http://mega-tokyo.com ]-/\--
User avatar
BloodyCactus
Oldbie
 
Posts: 946
Joined: 2016-2-03 @ 13:34
Location: Lexington VA

Re: DOS programming - Where to start? Books?

Postby BeginnerGuy » 2019-11-23 @ 14:43

pan069 wrote:For DOS programming, books can be a great resource. there's a lot of information on the web but when it comes to DOS, nothing beats good 'ol books.

On that note; I see you already have a few books, good start. If you don't mind, I'd like to suggest another one for you, a book that will explain pretty much everything you need to know when it comes to DOS/x86 programming:

PC Intern: The Encyclopedia of System Programming

https://www.amazon.com/PC-Intern-Encycl ... 1557553041

Personally. when I do DOS development I just work on my Linux desktop with a modern code editor (Sublime or VSCode), I use OpenWatcom on Linux so I build my binaries (.com or .exe) from the Linux command line and then run the program directly in DOSBox. Then, to test if it works on actual hardware, I copy it over to a real machine.

Those old machines, either DOS or Windows, just aren't productivity beats. :)


I'm actually missing the cd room for tischer's encyclopedia of pc programming.. its always a gamble whether or ot they'll really have the disk when you buy thrift books. If anybody has a copy of that please share (or pm about it if this is potential copyright bait)

Edit: it appears somebody added it to archive.org in recent years, will download when im at a pc to check for sure!
Sup. I like computers. Are you a computer?
User avatar
BeginnerGuy
Oldbie
 
Posts: 863
Joined: 2016-12-19 @ 08:32
Location: SI Register

Re: DOS programming - Where to start? Books?

Postby brostenen » 2019-11-23 @ 18:00

This book might be usefull...
Don't eat stuff off a 15 year old never cleaned cpu cooler.
Those cakes make you sick....

My blog: http://to9xct.blogspot.dk

001100 010010 011110 100001 101101 110011

Jah ich will trynen... Die Leute wie macht scheisse in dem Grünen.
User avatar
brostenen
l33t++
 
Posts: 5499
Joined: 2014-5-07 @ 21:13
Location: Northern Jutland, Denmark.

Re: DOS programming - Where to start? Books?

Postby SirNickity » 2019-11-25 @ 20:50

pan069 wrote:For DOS programming, books can be a great resource. there's a lot of information on the web but when it comes to DOS, nothing beats good 'ol books.

Absolutely. The Internet has all the info you ever wanted, but sometimes finding what you need can be like looking for a dropped SMD chip resistor in deep pile carpet.

So I decided to give the Norton book a shot, and picked up the PC Intern book as well since it covers Win95, which will be useful later on. I have a feeling I'll probably grab the Advanced MS-DOS Programming book eventually, but it seems to have the most overlap with what I've already got.

No surprise, but I did not find The Art of Assembly 16-bit Edition, just the ubiquitous HLA one. I recognized the cover of that one, as it turns out I have looked at the HLA edition before, and was turned off by the decision to put training wheels on ASM. I do understand the intent -- and it's laudable that they want to provide some of the creature comforts of high level languages, and avoid bombarding a new assembly programmer with the tedium of a low-level language, but uh... that IS kinda the point. If you're using ASM, you're there for a reason and willing to forego the amenities. Otherwise why not just write in C? Anyway, I'll keep my eyes peeled for an older edition, or an electronic copy.

Thanks all -- great suggestions. :cool:
SirNickity
Oldbie
 
Posts: 963
Joined: 2018-11-08 @ 04:51

Re: DOS programming - Where to start? Books?

Postby BloodyCactus » 2019-11-26 @ 01:25

Some books are better than others... some of my stacks below. of interest I'd list;

applied cryptography
data compression book
peter norton guide to ibm pc
the indispensable pc hardware book
programmer's guide to the ega and vga (2nd or 3rd ed)
dos + windows protected mode
dissecting dos (mildly interesting)
mastering algorithms in c

Image

Image

Image

Image
--/\-[ Stu : Bloody Cactus :: http://kråketær.com :: http://mega-tokyo.com ]-/\--
User avatar
BloodyCactus
Oldbie
 
Posts: 946
Joined: 2016-2-03 @ 13:34
Location: Lexington VA


Return to Milliways

Who is online

Users browsing this forum: MSN [Bot] and 5 guests