Serial Programming - upload.wikimedia....
Serial Programming - upload.wikimedia....
Serial Programming - upload.wikimedia....
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
4 <strong>Serial</strong> DOS<br />
4.1 Introduction<br />
It is now time to build on everything that has been established so far. While it is unlikely<br />
that you are going to be using MS-DOS for a major application, it is a good operating<br />
system to demonstrate a number of ideas related to software access of the 8250 UART and<br />
driver development. Compared to modern operating systems like Linux, OS-X, or Windows,<br />
MS-DOS can hardly be called an operating system at all. All it really offers is basic access<br />
to the hard drive and a few minor utilities. That really doesn't matter so much for what<br />
we are dealing with here, and it is a good chance to see how we can directly manipulate<br />
the UART to get the full functionality of all aspects of the computer. The tools I'm using<br />
are all available for free (as in beer) and can be used in emulator software (like VMware or<br />
Bochs) to try these ideas out as well. Emulation of serial devices is generally a weak point<br />
for these programs, so it may work easier if you work from a floppy boot of DOS, or on an<br />
older computer that is otherwise destined for the trash can because it is obsolete.<br />
For Pascal, you can look here:<br />
• Turbo Pascal http://bdn.borland.com/article/0,1410,20803,00.html version 5.5 -<br />
This is the software I'm actually using for these examples, and the compiler that most<br />
older documentation on the web will also support (generally).<br />
• Free Pascal http://www.freepascal.org/ - *note* this is a 32-bit version, although<br />
there is a port for DOS development. Unlike Turbo Pascal, it also has ongoing development<br />
and is more valuable for serious projects running in DOS.<br />
For MS-DOS substitution (if you don't happen to have MS-DOS 6.22 somewhere):<br />
• FreeDOS http://www.freedos.org/ Project - Now that Microsoft has abandoned development<br />
of DOS, this is pretty much the only OS left that is pure command line driven<br />
and following the DOS architecture.<br />
4.2 Hello World, <strong>Serial</strong> Data Version<br />
In the introduction 1 , I mentioned that it was very difficult to write computer software that<br />
implements RS-232 serial communications. A very short program shows that at least a<br />
basic program really isn't that hard at all. In fact, just three more lines than a typical<br />
"Hello World" program.<br />
1<br />
http://en.wikibooks.org/wiki/<strong>Programming</strong>%3A<strong>Serial</strong>%20Data%20Communications%23Intended%<br />
20Audience<br />
55