DOS Guest OS Serial Port

Discussions about using non Windows and Linux guests such as FreeBSD, DOS, OS/2, OpenBSD, etc.
mohtes
Posts: 10
Joined: 14. Apr 2017, 18:03

DOS Guest OS Serial Port

Post by mohtes »

Hi
I have a need to run a virtual box with a serial COM Port at 19200 baud rate. Does virtual box serial driver support running at 19200 baud rate?
I can use the MODE/DMODE command and set the serial baud rate to lower values (2400, 9600, etc.); but I am unable to set the baud rate to 19200. Is there a limitation on the baud rate?

I have tested this issue with FreeDOS, MS DOS 7.0, and PC DOS 7.0. The problem seem to exists on all these DOS OS's.

The host machine is running windows 7 / windows XP.

Has anyone been able to run a DOS Guest OS with serial baud rate above 9600?

A quick response is highly appreciated.
Thanks
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: DOS Guest OS Serial Port

Post by mpack »

mohtes wrote: I have a need to run a virtual box with a serial COM Port at 19200 baud rate. Does virtual box serial driver support running at 19200 baud rate?
As I recall, 9600 was the maximum that DOS itself allowed. But that would be polled so probably useless. In fact ISTR anything above 2400 was useless, at least for receive.

Most DOS serial port apps back in the day didn't use DOS or BIOS for I/O, as the latter used an antiquated polled I/O model and blocked when the port was busy. Instead apps implemented their own interrupt driven drivers and talked directly to the hardware. In a VM that means they will talk directly to the virtual hardware. And yes, the virtual hardware doesn't prevent you from putting any value you like into the UART baud rate divisor registers.

DOS stands for "Disk Operating System". Mainly it let you execute programs while it managed disk space. This is long before the days of Windows where one expects the OS to manage all hardware present. I'm intrigued as to what DOS era app you could have which needs high serial speeds but has you setting the baud rate with the (what should be irrelevant) DOS MODE command?
erdeslawe
Volunteer
Posts: 241
Joined: 8. Jul 2015, 10:23

Re: DOS Guest OS Serial Port

Post by erdeslawe »

I agree with mpack.

From what I remember (from a couple of decades, or more, ago) any baud rate above 9600 had to be manipulated by whatever application was being run in the DOS environment, i.e. the controller software for the device that was to use the COM/Serial Port; which is much the same as a software/firmware Drivers and device management software enables the full capability of equipment attached to a 'modern' Windows/Linux/Mac system. In short, you probably need to start with the software and/or hardware manuals, as 'plug'n'play simply didn't exist back then and there was often a dark art involved in setting up some of the equipment in use.
mohtes
Posts: 10
Joined: 14. Apr 2017, 18:03

Re: DOS Guest OS Serial Port

Post by mohtes »

Thanks for the replies and feedback.
There are maintenance applications tools that were build 20+ years ago that were then certified software tools for use on a specific equipment/application. It would be cost prohibited to redesign and redo these maintenance application tools to run on modern hardware and OS.

I have tried the same DOS setup on different virtual environment and I have seen different results.
If the limitation is truly a DOS issue, then I would expect baud rate limitation to exists regardless on what virtual environment platform you use. In my experiment I have found that if you run the same DOS OS on the VMWare as the Guest OS; then it will allow you to set the baud rate to 19200. So why would the behavior of DOS MODE command be different between the Virtual Box and a VMWare? If it is truly a DOS limitation, then it should behave the same regardless of the Virtual Environment, but that is not the case.

I can not use VMWare due to other limitations.

Any suggestions/comments/feedback are welcome.
Thanks in advance.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: DOS Guest OS Serial Port

Post by mpack »

I guess the limitation is in the BIOS, not in DOS, since all DOS does is make BIOS calls. I never had to consider that before, since like I mentioned, I like everyone else wrote my own serial drivers and used the hardware directly.

Hmm. I have a circa 1988 BIOS call reference right here, lets see... Int 14H Function 00H (Init Comms Port) has a limit of 9600, so if DOS makes this call it'll have that limit. The way the parameters are encoded in AL doesn't allow for any larger numbers. Int 14H Function 04H (Extended Init Comms Port) is from the PS/2 era, and it provides for baud rates up to 19200. It doesn't look like the parameter is a baud rate divisor, must be a table index, meaning higher numbers ought to generate an error.

You didn't really answer my question: if this tool was written for the DOS era then why is it using DOS for high speed serial comms? Nobody did that. Is this just you wanting it to go faster?

Anyway, since my previous post I have recalled that some people did make installable drivers for FidoNET that could handle high speeds (relative to what DOS/BIOS supported). You might want to look for remnants of those. The driver API was called FOSSIL I think. https://en.wikipedia.org/wiki/FOSSIL. Unfortunately I doubt that the API will be BIOS compatible, so I don't know if it will help.
mohtes
Posts: 10
Joined: 14. Apr 2017, 18:03

Re: DOS Guest OS Serial Port

Post by mohtes »

Thanks for the information.
You didn't really answer my question: if this tool was written for the DOS era then why is it using DOS for high speed serial comms? Nobody did that. Is this just you wanting it to go faster?
I have been handed a laptop that is running PC DOS 7.0. The laptop has built-in serial comport. This hardware communicated to the external device at 19200. The laptop communicates with the hardware at 19200 without any issue. I don't know all the historical details/reasons why this laptop was built/configured/setup this way. There is no one around to ask regarding reasons per say.

My task/objective is to virtualize this hardware setup if at all possible. I am not sure it is possible to virtualize it. I am looking for confirmation/reason/justification as to why this can or can not be virtualized.

Thanks in advance
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: DOS Guest OS Serial Port

Post by mpack »

Yes, it should be possible to virtualize it. In fact it may work better as a VM than as a physical machine, because in the VM there is a host OS implementing interrupt driven serial comms, which may make a DOS app's polled comms more reliable. That remains to be seen however.

By the way, I had a look at the VirtualBox BIOS code. It looks like Int14 Function 04H is not supported, so 9600bps will indeed be the maximum if you set baud rate using this BIOS - which of course will be the case regardless of which DOS version you install. It would be trivial to write a little DOS program to set the baud rate divisors to something else, i.e. a cut down MODE command - but accessing the virtual UART directly.
mohtes
Posts: 10
Joined: 14. Apr 2017, 18:03

Re: DOS Guest OS Serial Port

Post by mohtes »

Thanks for the update.

I am not very familiar with the Virtual Box BIOS setup. Is there a screen/option that needs to be modified?
Could you please provide a detailed how to do this part?

Is it possible to get a software patch for virtual box that would allow me to set the baud rate to the 19200?

I realize that replacing a DOS MODE COMMAND maybe a trivial task for someone with a lot of experience, but I don't have the experience or the software tool set to recreate/replace DOS MODE COMMAND. Do you have a software tool for DOS that can replace DOS MODE COMMAND?

It would be a great to show that Virtual Box setup would perform better than the real hardware. Any help/support would be very much appreciated.
Thanks in Advance.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: DOS Guest OS Serial Port

Post by mpack »

mohtes wrote: I am not very familiar with the Virtual Box BIOS setup. Is there a screen/option that needs to be modified?
This is not a setup option. VirtualBox implements a legacy PC BIOS which does not implement function int14 Function 04H. The only fix would be a change to the BIOS source code.
mohtes wrote: Is it possible to get a software patch for virtual box that would allow me to set the baud rate to the 19200?
You can raise a suggestion on BugTracker, but I wouldn't hold my breath until they get around to it. I suspect that DOS is not a high priority.
mohtes wrote: I realize that replacing a DOS MODE COMMAND maybe a trivial task for someone with a lot of experience, but I don't have the experience or the software tool set to recreate/replace DOS MODE COMMAND. Do you have a software tool for DOS that can replace DOS MODE COMMAND?
It isn't necessary to replace the entire functionality of the MODE command, all you want is something to configure the UART. I could write it, though I'm pretty rusty on DOS development - I don't think I've done it since 1990 or so, i.e. since Windows 3.0 came out. I'll consider looking at this if I have time. But can you give me a solid reason why 9600 isn't good enough?
mohtes
Posts: 10
Joined: 14. Apr 2017, 18:03

Re: DOS Guest OS Serial Port

Post by mohtes »

Thanks for your response.
can you give me a solid reason why 9600 isn't good enough?
The external hardware that this laptop communicates with only works with 19200 baud rate. Running a laptop at baud rate 9600 does not establish communication with the external hardware.

Any help/support is appreciated.
Thanks
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: DOS Guest OS Serial Port

Post by mpack »

Ok, I knocked up something you can try - see the attachment. You need to unpack this and get it into the VM somehow (I find it convenient to mount the DOS VDI in another VM which supports both FAT16 disks and shared folders, e.g. XP - which allows me to easily transfer files from one to the other. Of course the DOS VM can't be running at the time).

I have confirmed that this new tool allows me to set a 19200bps baud rate in a VirtualBox DOS VM.

This program was something I found in a disk folder from 1989. The purpose when I originally wrote it was simply to report the current settings of all UARTs found, but I've now modified it to let you configure a serial port too. The command takes multiple parameters in any order: "COM1" "COM2" "COM3" "COM4" selects the given comm port. Defaults to COM1. "300" "600" "1200" "2400" "4800" "9600" "19200" "38400" "57600" or "115200" sets the baud rate to that value, default is 2400. "8N1" sets the port for 8 data bits, no parity, 1 stop bit - and this is the default. You can also select "7E1", i.e. 7 data bits even parity one stop bit.

If you run it without arguments then it simply reports the current UART configurations as was its original purpose.

Examples: "UARTCFG 19200" (sets COM1 to 19200bps, 8N1). Only the baud rate is explicit since the rest matches defaults. "UARTCFG COM2 2400 7E1", "UARTCFG COM1 38400 8N1". Etc.

Let's be clear that I've knocked this up in a hurry with tools and an OS environment I have only a hazy recollection of, so I would not test the error handling capabilities of this software unnecessarily if I was you. Don't try to configure UARTs that don't exist, and don't try parameters that I've not listed. Use it as is, at your own risk.

Note that just because I've given you a tool that allows you to configure a higher baud rate this is NOT a warranty from me that your baud rate will be practical in a VirtualBox DOS VM.
Attachments
UARTCFG.zip
(7.64 KiB) Downloaded 221 times
Last edited by mpack on 18. Apr 2017, 11:48, edited 4 times in total.
Reason: Updated attachment
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: DOS Guest OS Serial Port

Post by mpack »

And btw, I have calculated that it must be 27 years since I last ran this compiler. Luckily I never throw things out, in fact I never even delete them from my hard disk, so the compiler and libraries were sitting there waiting for me to remember how to use them!
mohtes
Posts: 10
Joined: 14. Apr 2017, 18:03

Re: DOS Guest OS Serial Port

Post by mohtes »

Hi mpack

Thank you very much for the support and the information.

I have downloaded your program and installed it on the DOS Guest OS. The program seems to run without crashing but I am not able to set the baud rate parameters correctly.

Does the UARTCFG support ODD parity? When I try to set ODD parity it doesn't seem to work.

I am looking for the equivalent command to this: DMODE COM1:19200,o,8,1.

Any help or support is very much appreciated.
Thanks in advance.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: DOS Guest OS Serial Port

Post by mpack »

I gave a complete list of supported configurations above. I will add your requested additional configuration, however I should mention that odd parity is a very unusual choice, as is using 8 data bits with parity. But yes, it can be done.
 Edit: . Ok, I have updated the attachment. You should now be able to configure the complete gamut of line control register configurations, i.e. 8N1, 8N2, 8E1, 8E2, 8O1, 8O2, 7E1, 7E2, 7O1, 7O2. You will want 8O1. 
mohtes
Posts: 10
Joined: 14. Apr 2017, 18:03

Re: DOS Guest OS Serial Port

Post by mohtes »

Hi mpack

Thank you very much for the updated application.
I wanted to share some update/feedback.
I tested your application on the original dos laptop by replacing the DMODE command (DMODE COM1:19200,o,8,1) with your application command (UARTCFG COM1 19200 8O1). I ran a batch file and I was able to communicate with the external hardware. That means the UARTCFG program is working as expected.

Then I copied the UARTCFG application to the Virtual Box (DOS Guest OS). I configured the COM1 using the same command (UARTCFG COM1 19200 8O1). Then I tried running my batch file. It fails to establish communication with the external hardware. Not sure why it does not communicated over Virtual Box.

I am using the same exact communication cable between the two setups. I am using the same COM Port (COM1) on both setup. The Virtual BOX setup fails to establish communication with the external hardware.

DOS HARDWARE LAPTOP
Latitude CPi D300XT (Bios Revision A05) - Pentium II-300 MHz with 64 MB RAM
PC DOS 7.0


VIRTUAL SETUP
Panasonic Toughbook CF-30 - Intel Core 2 Duo CPU L2400 @ 1.66GHz Processor
Host OS - Windows 7 (32 bits)
VirtualBox - (Guest OS PC DOS 7.0) with Floppy Drive and Serial COM Port


DOS Hardware Laptop - Works
Virtualbox Setup - Does NOT Work

I am baffled as to why Virtualbox setup does not work.
I know the Virtualbox is running much faster than the old dos laptop. Is there a way to make the virtualbox run slower (CPU Speed) ?

Any ideas/suggestion/comment/feedback is welcome.
Thanks in advance.
Post Reply