While getting DOSBox setup on my Linux machines so that I could run EMU71 I noticed that DOSBox supports serial port virtualization using TCP/IP. (DOSBox is an x86/DOS emulator, a bit like Bochs, but DOS emulation is part of it and it is much easier to use. It runs on top of Linux, OS/X, Windows, and many other platforms.)
The setup is pretty straightforward (I tested this with DOSBox on Windows/XP).
Put the following in your configuration file.
[serial]
serial1=nullmodem server usedtr port:5000
serial2=dummy
serial3=disabled
serial4=disabled
DOSBox uses your existing filesystem--no need to create an image. Create a dosbox directory with EMU71 (http://membres.lycos.fr/jeffcalc/emu71.html) and BNU (http://www.pcmicro.com/bnu/) installed, then mount as drive C, e.g. my dosbox directory on Linux is /home/egan/dosbox, for Windows/XP c:\home\egan\dosbox. The command for any OS to mount within dosbox is:
mount c /home/egan/dosboxFirst run bnu.com. BNU provides INT 14 needed by EMU71 serial port emulation.
c:Next make sure you have SERIAL1 in your EMU71.INI file. I have mine as my 6th HPIL device.
cd bnu
bnu.com
That’s it.
To test it I created a small reverse echo service using Perl. It will run on any computer with Perl. I tested it with Windows/XP.
#!/usr/bin/perluse strict;
use IO::Socket;
use IO::File;my $host = shift;
my $port = shift;my $sock = IO::Socket::INET->new(
PeerAddr => $host,
PeerPort => $port,
);if(!defined($sock)) {
die "could not open socket";
}while(<$sock>) {
chomp();
my $line = $_;
$line =~ s/[^[:print:]]//g;
my $revline = reverse($line);
print "recv: $line\n";
print "send: $revline\n";
print $sock "$revline\n";
}exit(0);
All this service does is connect to the host and port passed on the command line and waits for a message and then returns the reverse string of the message.
To test start up the service:
echorev.pl localhost 5000From EMU71 type:
10 DIMA$[64] @ DIMB$[64]
20 INPUT "STRING: ";A$
30 OUTPUT :6 ;A$
40 ENTER :6 ;B$
50 DISP "GNIRTS:";B$
60 GOTO 20RUN
Example session:
Windows/XP + Cygwin/X (for Perl):
$ ./echorev.pl localhost 5000
recv: FOO BLAH BLEH BAR
send: RAB HELB HALB OOF
recv: aaaabbbbCCCCddddEEEE
send: EEEEddddCCCCbbbbaaaa
Windows/XP + Dosbox + EMU71:
I am sure that there are other serial port virtualization solutions that may run natively on Windows so that EMU71 would not need to run in DOSBox.