• Please review our updated Terms and Rules here

Interesting things to do?

TheLazy1

Experienced Member
Joined
Jun 2, 2009
Messages
370
Location
Toronto, Ontario, Canada
So I got my 286 setup and working and want to get started on some DOS programming in C.
Where would be a good place to begin?

I have never done anything with DOS before, only some win32 and DS programming.

What are some essential things to know?
What is the best compiler that will run on a 286 with 4MB ram?

Thanks :D
 
Interesting question.

I do all of my DOS programming on a 386-40 using Borland Turbo C++ 3.0. It features:

  • IDE (Integrated Development Environment)
  • Debugger
  • C or C++ with inline assembler
  • Support for 6 different memory models
  • Support for small or large projects

It was too slow for my 286-6Mhz machine, but if you use it from the command line it might be tolerable. An older version of it might work better too. Otherwise, you'll have to go back a generation to the smaller C compilers that targeted the 286. (Old versions of MS C might work.)

Another possibility is Pascal. Turbo Pascal - it's not your target language, but older versions of Turbo Pascal work very well on that class of hardware.


Mike
 
I tried open watcom but that did not work, unless I did something wrong or got the wrong version.
Borland C++ does not seem to work for me, it errors out for not having DPMI or something like that.

Turbo C 2.01 seems to work but I was just curious about the other options, I think I'll need a better IDE though.
Another option is to send source files to my main pc for compilation, but that would probably be a pain to set up.
 
I use the 'cross compile' approach for the PCjr. There is no way in hell that Turbo C++ 3.0 will run on that. :)

Older versions of Turbo C have the benefit that they are free to download and use.

The 286 is a little bit of a problem - it's ok for command line use with an older compiler, but the better compilers available toward the end of the DOS age are too much for it. I wound up upgrading my 286-6Mhz to this 386-40 specifically to run Turbo C++.

Turbo Pascal though .. different story. Version 3 ran great even on the smallest machines. From a single floppy even ...
 
Does no one have a copy of Lattice C? For a time, Microsoft sold it. It'll run on an 8088.

If you browse the Simtel library, there's also a "Small C" compiler that will work fine on 8088+.Here's a copy.
 
Last edited:
I use the 'cross compile' approach for the PCjr. There is no way in hell that Turbo C++ 3.0 will run on that. :)

I also don't think any of the major DOS compilers have PCjr/Tandy support. Turbo C certainly doesn't.

The 286 is a little bit of a problem - it's ok for command line use with an older compiler, but the better compilers available toward the end of the DOS age are too much for it. I wound up upgrading my 286-6Mhz to this 386-40 specifically to run Turbo C++.

Applications than ran on 8086/8088s were usually written in assembly language (with some exceptions; Microsoft used C for all their full-screen apps after 1986), and it wasn't until developers moved up to the 286 that you started to see compilers used extensively. As an example, all versions of Lotus 123 and WordPerfect that ran on 8086s were written in assembly, and C was used afterwards.
 
Is there a type of program you're looking at writing specifically? I came from simple basic and qbasic programming when I was young so my biggest hurdle and question was why no IDE had a good help file like I was used to in qb. That's why I loved TurboC (but as pointed out I was running TurboC 3 on a 386 also) but I loved their browsable help to learn C.

Other than that a book on assembly/dos interrupts is a great resource. One book my friends and I loved was The Indispensable PC Hardware Book which we had plenty of copies at our local half price years back for a few bucks. But lots of good dos programming books are out there and cover the dos and bios interrupts. Then you can hammer away in whatever editor you like and compile it. We did some programming in debug originally, it's only a PITA when you end up adding a code segment and have to adjust your jmp and other memory references (doable, just a pain). I ended up just writing my code in a batch or text file so I could add comments and script debug to write and compile it so it was a little less painful. Writing on the fly wasn't bad, just coming back to the code after a few days when it's longer got to where I'd start slipping or losing track of something here and there.
 
I also don't think any of the major DOS compilers have PCjr/Tandy support. Turbo C certainly doesn't.

The compiler generates 8088/8086 code, and 8087 code if you have an FPU. It has a full C runtime. It doesn't explicitly support the 3 voice sound and enhanced CGA modes, but the regular CGA modes work just fine. If you need the enhanced CGA modes you can probably get an add-on for the Tandy line. Otherwise, you have to provide your own graphics routines.

For everything I'm doing it supports my PCjr just fine. And that includes some heavy duty TCP/IP networking.


Applications than ran on 8086/8088s were usually written in assembly language (with some exceptions; Microsoft used C for all their full-screen apps after 1986), and it wasn't until developers moved up to the 286 that you started to see compilers used extensively. As an example, all versions of Lotus 123 and WordPerfect that ran on 8086s were written in assembly, and C was used afterwards.

Compiled BASIC was popular for lower end applications. PASCAL was extremely popular. The C compilers became popular, not because the 80286 processors were capable of running it but because the language became more popular as Unix spread in the mid 1980s. There are some small C compilers that will run given a dual floppy or hard drive system.
 
I have TCP/IP working with apps that use wattcp so a few network ideas popped into my head.
FTP Gives me only 140KB/s though so my idea of streaming video is out :D unless it's just the app and not a hardware limit.

I still want to get my hercules card installed and write a 1bpp video encoder to play small clips on it. Space is a concern though having 2 monitors on one pc.
Things I like to do are mostly useless things that might look good but are essentially useless to most people.
:cool:

Programming on the same machine as my target is one of the reason I put this old 286 together in the first place.
I do want to learn assembly though, so this is probably my chance to actually do it.
 
Applications than ran on 8086/8088s were usually written in assembly language (with some exceptions; Microsoft used C for all their full-screen apps after 1986), and it wasn't until developers moved up to the 286 that you started to see compilers used extensively. As an example, all versions of Lotus 123 and WordPerfect that ran on 8086s were written in assembly, and C was used afterwards.

Heck, HLL compilers were used extensively in microcomputer software pre-PC. Sorcim's Supercalc was a mixture of Pascal and assembly; a huge amount of Intel's stuff was written in PL/M. DRI was flogging its PL/I compiler to developers back in the x80 days. There are tons of apps written in CBASIC--and the Small-C compiler I noted is a port to x86 from x80. I still have a few CP/M applications written in (gasp!) FORTRAN.

The general idea for lots of things was to use assembly where speed was critical and to use a higher-level language for the rest.

Clipper, anyone?
 
We did some programming in debug originally, it's only a PITA when you end up adding a code segment and have to adjust your jmp and other memory references (doable, just a pain). I ended up just writing my code in a batch or text file so I could add comments and script debug to write and compile it so it was a little less painful.

:) I knew I was'nt the only one!

Jack
 
Is there a type of program you're looking at writing specifically? I came from simple basic and qbasic programming when I was young so my biggest hurdle and question was why no IDE had a good help file like I was used to in qb. That's why I loved TurboC (but as pointed out I was running TurboC 3 on a 386 also) but I loved their browsable help to learn C.

I agree those help files made life just so much easier, I had loads of books, but for speed you couldn't beat the built-in help.

I also second those that have suggested Turbo Pascal, it runs much quicker than turboc and the resulting executables run at comparable speeds, but are generally smaller and use less memory. It even has the built-in help files mentioned above. I know that it means learning a new language, but this variant of Pascal is fairly simple to learn, and would probably pay off quite quickly in productivity terms.

If you do decide to dig-down a bit deeper into the machines internals, I can't help but recommend Ralph Brown's Interrrupt List.
 
Interesting question.

I do all of my DOS programming on a 386-40 using Borland Turbo C++ 3.0. It features:

  • IDE (Integrated Development Environment)
  • Debugger
  • C or C++ with inline assembler
  • Support for 6 different memory models
  • Support for small or large projects

It was too slow for my 286-6Mhz machine, but if you use it from the command line it might be tolerable. An older version of it might work better too. Otherwise, you'll have to go back a generation to the smaller C compilers that targeted the 286. (Old versions of MS C might work.)

Another possibility is Pascal. Turbo Pascal - it's not your target language, but older versions of Turbo Pascal work very well on that class of hardware.


Mike

when i tried it on my 286, it wouldn't even run... i believe as you told me in the past 3.0 requires a 386? or maybe i'm imagining things. i do that sometimes. :rockedov:
 
to that person that wrote this

to that person that wrote this

Q U O T E D T E X T

TheLazy1
Member Join Date: Jun 2009
Posts: 31



--------------------------------------------------------------------------------

I have TCP/IP working with apps that use wattcp so a few network ideas popped into my head.
FTP Gives me only 140KB/s though so my idea of streaming video is out unless it's just the app and not a hardware limit.

I still want to get my hercules card installed and write a 1bpp video encoder to play small clips on it. Space is a concern though having 2 monitors on one pc.
Things I like to do are mostly useless things that might look good but are essentially useless to most people.


Programming on the same machine as my target is one of the reason I put this old 286 together in the first place.
I do want to learn assembly though, so this is probably my chance to actually do it.

~~~ end quote

I still want to get my hercules card installed and write a 1bpp video encoder to play small clips on it.
/
I WROTE a 1bpp (sorta) encoder for DOS, which uses SUPER VIDEO CONVERTER to drop down a full video file to an animated GIF, then transcoded to 16 colors as shades of gray which correspond to the shades required to tickle a CGA composite screen.

It looks viewable on a monochrome (non Composite CGA 16 colors or APPLE graphics colors emulation) b/w color screen, as it would look on a DOS computer using a graphics card (which ISN'T A TRUE CGA CARD).

I was able to transcode four,.. 2 to 5 minute video clips, on a 2Gigabyte DOS FORMATTED hard drive, until I hit the END OF SPACE limit on the drive.

DOS has that limit for 2G, and I used it well. The transcoder is NOT OPTOMIZED in any way, it just does a simple color/compare algorhythm to convert a standard RGB color into it's (color of 16) match, then draw that color using only on and off bits, to represent it (actually to draw it in color, again on said ACTUAL CGA CARD), and it dumps it to a BINARY ONLY FILE, where a reader program spools out the bytes individually to the screen, and at the rate the hard drive spins, it actually has a matching frame rate, actually a tiny bit faster than the actual rate it had on the FLV player from YOUTUBE which is where the video came from.

I captured GERI'S GAME from the Pixar Shorts DVD using some capturing program, I think an external device that writes straight to a USB hard drive, or was it a USB TV tuner, whatever it was, I got the mini-movie (5 minutes) as a video file, then an animated GIF, then into my transcoder (a re-write of an animated GIF decoder which is something I DID NOT WRITE), and into the *.CGA file, then back out on the screen as a *.CGA file reader that dumps the bytes STRAIGHT TO THE VIDEO BUFFER, one 64K drive access at a time.

The transcoder is a compiled *.EXE from QuickBasic v4.5, and so is the player. The player has a buffer overrun problem, (which I have yet to solve), so I wrote a simple utility to close open files after the program crashes at the end of the file.

If you want something like this for yourself, I could take the time to run (emulated) under DOSBOX, and get the program WITH INSTRUCTIONS and the SUPER VIDEO CONVERTER (FREE DOWNLOAD) INSTALLER etc etc etc for you.



EMAIL ONLY:
kiyotewolf at gmail dot com
kikibearbear at gmail dot com

INSTANT MSG ONLY:
kiyotewolf at hotmail dot com
kiyotewolfe at yahoo dot com

SKYPE: kiyotewolf (i think)
 
I'd be interested in seeing it. Could you post a youtube clip of it or something? That'd be pretty neat in general. One or two folks here have written something similar. If they pipe up it may be interesting to trade notes.
 
youtube clip?

youtube clip?

I will try to get it on youtube.

I have a screen-cap program, and my palm-top-laptop is powerful enough (maybe) to run full emulation as well as video capture.

Good thing is, the transcode video decoder can run at a low emulated FPS/CPU cycle clock, so I should be able to capture something meaningful with the two running concurrently.

One known bug is (that I found), certain color schemes that dominate the screen, like dark colors, will gamma out to at-random uniform colors, which make the colored (emulated colored) version of the video bleed out into unnecessary blotches of ink, which is quite ugly to look at. But, that is only with live-feed video, aka real life actor type video captures.

What DOES transcode well under the current iteration of the transcoder, is animated cartoon video clips, and anything CG.

It IS possible to more intelligently transcode the video, using dithering techniques and more sophisticated means of matching colors based on such things as HUE SATURATION LUMINOSITY, and other color matching routines that would take the INTENDED COLOR MATCH out of a SOURCE FRAME IMAGE down into the TARGET COLOR PALETTE, but that MAY add a ton more processing time to the transcoder.

Currently, the transcoder operates under at least a 3 HOUR WAIT PERIOD per 3 to 5 minute video clip.

It DOES use SOME optimizations while transcoding, like REPEAT LAST COLOR DO NOT RE-MATCH COLOR (because we just did) PER PIXEL, and it DOES write out a couple megabyte sized matching LUT (Look Up Table) to knock off even more time, so I did put SOME thought into making it MORE EFFICIENT that it might've been left to suffer with otherwise.

What is necessary to handle the files using a REAL DOS COMPUTER, almost without fail, is some form of 100MB removable media, and my DOS COMPATIBLE MEDIA OF CHOICE is a Lpt1: ZIP drive (external).

I come across them from time to time, and I collect them as if they were the Holy Grail. They are just SO DANG USEFUL.

The other option is emulation, or, if you don't mind seeing the CGA graphics in B/W, you can run it straight from ANY WINDOWS command prompt, or if you wanna see it in color, in DOSBOX.

If I remember correctly, I included SOFT-SWITCHES/REGISTER TRIGGER OUT'S AND INP'S to toggle on emulation of the CGA COMPOSITE VIDEO graphics simulation, so when you run the player under DOSBOX, it comes out (if the emulated graphics card is set to CGA that is) in 16 color COLOUR.

The colors emulated in DOSBOX of CGA (composite monitor aka that phono-plug you used to hook up your Apple ][e & Commodore 64 with to your TV or CRT type video), are NOT QUITE A MATCH, but pretty close to the 16 colors on an Apple.

(I probably just repeated myself but who cares.)



Will work on a USER FRIENDLY version of all code/programs/compiled programs, also include sources, and example files, and host it on my website of choice,..

http://www.abogclubinc.webs.com

Gimmie 1 to 2 weeks to pull it together.

Right now, I'm in-between places to live, and time to COMPUTE IS SCARCE.



God I type way too much.....



Lock de la Lion

email:(?)
kikibearbear at gmail dot com
kiyotewolf at gmail dot com
I/M:(?)
kiyotewolfe at yahoo dot com
 
Back
Top