Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba6692a67f | ||
|
|
a83cdf8510 | ||
|
|
115b9f06bb | ||
|
|
d7fea97432 | ||
|
|
d6fed2b307 | ||
|
|
0e2c375a60 | ||
|
|
d029f1e38a | ||
|
|
951a63f1af | ||
|
|
5339ac0613 | ||
|
|
804ffb5855 | ||
|
|
be3f806a61 | ||
|
|
04ed9e43eb | ||
|
|
51657d20ba | ||
|
|
95b02ffc72 | ||
|
|
320032775a |
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
# ignore these files
|
||||
*~
|
||||
*.o
|
||||
*.exe
|
||||
# the end
|
||||
49
README.md
49
README.md
@@ -2,28 +2,35 @@
|
||||
|
||||
<B>tu58em</B> was originally based on the 1984 Dan Ts'o tu58 program, but has been almost completely rewritten to make it compile error free, improve the program flow, and add new functionality. It has been compiled within the CYGWIN environment, and will run either within a CYGWIN window or an MSDOS command window with the associated cygwin1.dll helper file. <B>tu58em</B> has been tested under Win2K, WinXPsp3, and Win7sp1. <B>tu58em</B> has compiled error free under Linux (Ubuntu 12.02LTS) but has not yet been rigorously tested in that environment.
|
||||
|
||||
Each emulated .dsk image file is exactly 256KB (512 blocks of 512 bytes) of data and is a byte-for-byte image of the data on a TU-58 cartridge tape. As currently configured <B>tu58em</B> will support up to 8 drives per controller as DD0: to DD7: (altho this is easily changed in the source).
|
||||
Each emulated .dsk image file is exactly 256KB (512 blocks of 512 bytes) of data and is a byte-for-byte image of the data on a TU-58 cartridge tape. As currently configured <B>tu58em</B> will support up to 8 drives per controller as DD0: to DD7: (altho this is easily changed in the source). <B>tu58em</B> will support disk image files as large as the TU58 protocol allows (ie, 32MB, or 64K 512B blocks); however most standard DEC operating system drivers restrict TU58 drives to 256KB each. The DEC driver must be patched to allow for larger than 256KB disk images.
|
||||
|
||||
<B>tu58em</B> has been tested using both native RS232 serial COM ports and serial ports emulated thru USB serial adapters.
|
||||
|
||||
Note: <B>tu58em</B> is compiled using the CYGWIN serial interface library routines (ie, termios.h) and is the preferred version that should be used. <B>tu58ew</B> bypasses the CYGWIN serial interface layer and makes direct Windows serial comm routine calls. This version was done early on because of deficiencies in the CYGWIN serial library. However, the required features are now present so in reality <B>tu58ew</B> should be considered deprecated.
|
||||
|
||||
As of v1.4m Mark Blair's updates for VAX mode operation (for VAX-730 microcode boot support) and background mode are integrated.
|
||||
|
||||
A cygwin folder with a precompiled 32b cygwin executable (tu58em.exe) is included for those without cygwin environment access. Under Windows, just open a standard CMD.EXE window, change to the cygwin folder, and run the <B>tu58em.exe</B> executable as a command line program.
|
||||
|
||||
If the emulator is run with no options, it prints a usage screen:
|
||||
|
||||
```
|
||||
E:\DEC> tu58em
|
||||
ERROR: no units were specified
|
||||
FATAL: illegal command line
|
||||
tu58 tape emulator v1.4k
|
||||
tu58 tape emulator v1.4o
|
||||
Usage: ./tu58em [-options] -[rwci] file1 ... -[rwci] file7
|
||||
Options: -V | --version output version string
|
||||
-v | --verbose enable verbose output to terminal
|
||||
-d | --debug enable debug output to terminal
|
||||
-m | --mrsp enable standard MRSP mode (byte-level handshake)
|
||||
-n | --nosync disable sending INIT at initial startup
|
||||
-x | --vax remove delays for aggressive timeout of VAX console
|
||||
-b | --background run in background mode, no console I/O except errors
|
||||
-t | --timing 1 add timing delays to spoof diagnostic into passing
|
||||
-T | --timing 2 add timing delays to mimic a real TU58
|
||||
-s | --speed BAUD set line speed [1200..230400; default 9600]
|
||||
-s | --speed BAUD set line speed 1200..3000000; default 9600
|
||||
-S | --stop BITS set stop bits 1..2; default 1
|
||||
-p | --port PORT set port to PORT [1..N or /dev/comN; default 1]
|
||||
-r | --read|rd FILENAME readonly drive
|
||||
-w | --write FILENAME read/write drive
|
||||
@@ -36,20 +43,25 @@ E:\DEC>
|
||||
Most of the switches should be pretty obvious:
|
||||
|
||||
```
|
||||
-V prints the program version and exits
|
||||
-v sets verbose mode, which outputs status as the emulator runs
|
||||
-d sets debug mode, which dumps out all packets sent/received
|
||||
-m enables MRSP mode (VERY MUCH UNTESTED) instead of the default original RSP mode
|
||||
-n disables the sending of INIT characters at startup
|
||||
-t adds time delays to allow the emulator to pass the DEC ZTUUF0 TU-58 Performance Exerciser diagnostic
|
||||
-T adds time delays to make the emulator nearly as slow as a real TU-58 (just for fun)
|
||||
-s BAUD sets the baud rate (115200, 57600, 38400, 19200, 9600, 4800, 2400, 1200 are supported)
|
||||
-p PORT sets the com port as a number (1,2,3,...) or if not numeric the full path (/dev/com1)
|
||||
-r FILENAME set the next unit as a read only drive using file FILENAME
|
||||
-w FILENAME set the next unit as a read/write drive using file FILENAME
|
||||
-c FILENAME set the next unit as a read/write drive using file FILENAME, zero the file before use
|
||||
-i FILENAME set the next unit as a read/write drive using file FILENAME, initialize RT-11 filesystem before use
|
||||
-z FILENAME set the next unit as a read/write drive using file FILENAME, initialize XXDP filesystem before use
|
||||
-V prints the program version and exits
|
||||
-v sets verbose mode, which outputs status as the emulator runs
|
||||
-d sets debug mode, which dumps out all packets sent/received
|
||||
-m enables MRSP mode (VERY MUCH UNTESTED) instead of the default original RSP mode
|
||||
-n disables the sending of INIT characters at startup
|
||||
-x remove delays for aggressive timeout of VAX console
|
||||
-b run in background mode, no console I/O except errors
|
||||
-t adds time delays to allow the emulator to pass the DEC ZTUUF0 TU-58 Performance Exerciser diagnostic
|
||||
-T adds time delays to make the emulator nearly as slow as a real TU-58 (just for fun)
|
||||
-s BAUD sets the baud rate; the following rates are supported. the default will be 9600 if not set.
|
||||
3000000, 2500000, 2000000, 1500000, 1152000, 1000000, 921600, 576000, 500000,
|
||||
460800, 230400, 115200, 57600, 38400, 19200, 9600, 4800, 2400, 1200
|
||||
-p PORT sets the com port as a number (1,2,3,...) or if not numeric the full path (/dev/com1)
|
||||
-S STOP sets the number of stop bits (1 or 2), default is 1
|
||||
-r FILENAME set the next unit as a read only drive using file FILENAME
|
||||
-w FILENAME set the next unit as a read/write drive using file FILENAME
|
||||
-c FILENAME set the next unit as a read/write drive using file FILENAME, zero the file before use
|
||||
-i FILENAME set the next unit as a read/write drive using file FILENAME, initialize RT-11 filesystem before use
|
||||
-z FILENAME set the next unit as a read/write drive using file FILENAME, initialize XXDP filesystem before use
|
||||
```
|
||||
|
||||
A sample run of <B>tu58em</B>, using COM3 at 38.4Kb, a read/only tape on DD0: using file boot.dsk, and a read/write tape on DD1: initialized with an RT-11 filesystem as file rt11.dsk:
|
||||
@@ -59,7 +71,7 @@ E:\DEC> tu58em -p 3 -s 38400 -r boot.dsk -i rt11.dsk
|
||||
info: initialize RT-11 directory on 'rt11.dsk'
|
||||
info: unit 0 r file 'boot.dsk'
|
||||
info: unit 1 rwci file 'rt11.dsk'
|
||||
info: serial port 3 at 38400 baud
|
||||
info: serial port 3 at 38400 baud 1 stop
|
||||
info: TU58 emulation start
|
||||
info: R restart, S toggle send init, V toggle verbose, D toggle debug, Q quit
|
||||
info: emulator started
|
||||
@@ -80,3 +92,4 @@ info: write unit=1 sw=0x00 mod=0x00 blk=0x0006 cnt=0x0400
|
||||
info: TU58 emulation end
|
||||
E:\DEC>
|
||||
```
|
||||
|
||||
|
||||
39
common.h
39
common.h
@@ -2,18 +2,49 @@
|
||||
// tu58 - Emulate a TU58 over a serial line
|
||||
//
|
||||
// Original (C) 1984 Dan Ts'o <Rockefeller Univ. Dept. of Neurobiology>
|
||||
// Update (C) 2005-2012 Don North <ak6dn_at_mindspring_dot_com>
|
||||
// Update (C) 2005-2016 Donald N North <ak6dn_at_mindspring_dot_com>
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// o Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// o Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// o Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is the TU58 emulation program written at Rockefeller Univ., Dept. of
|
||||
// Neurobiology. We copyright (C) it and permit its use provided it is not
|
||||
// sold to others. Originally written by Dan Ts'o circa 1984 or so.
|
||||
//
|
||||
|
||||
|
||||
|
||||
//
|
||||
// TU58 Emulator Common Definitions
|
||||
//
|
||||
|
||||
|
||||
|
||||
// Common includes
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -75,7 +106,7 @@ void devrxinit (void);
|
||||
int32_t devrxavail (void);
|
||||
int32_t devrxerror (void);
|
||||
uint8_t devrxget (void);
|
||||
void devinit (char *, int32_t);
|
||||
void devinit (char *, int32_t, int32_t);
|
||||
void devrestore (void);
|
||||
void coninit (void);
|
||||
void conrestore (void);
|
||||
@@ -101,6 +132,8 @@ extern uint8_t verbose;
|
||||
extern uint8_t nosync;
|
||||
extern uint8_t timing;
|
||||
extern uint8_t mrspen;
|
||||
extern uint8_t vax;
|
||||
extern uint8_t background;
|
||||
|
||||
|
||||
// the end
|
||||
|
||||
BIN
cygwin/cygwin1.dll
Normal file
BIN
cygwin/cygwin1.dll
Normal file
Binary file not shown.
BIN
cygwin/tu58em.exe
Normal file
BIN
cygwin/tu58em.exe
Normal file
Binary file not shown.
BIN
cygwin1.dll
BIN
cygwin1.dll
Binary file not shown.
35
file.c
35
file.c
@@ -2,18 +2,49 @@
|
||||
// tu58 - Emulate a TU58 over a serial line
|
||||
//
|
||||
// Original (C) 1984 Dan Ts'o <Rockefeller Univ. Dept. of Neurobiology>
|
||||
// Update (C) 2005-2012 Don North <ak6dn_at_mindspring_dot_com>
|
||||
// Update (C) 2005-2016 Donald N North <ak6dn_at_mindspring_dot_com>
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// o Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// o Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// o Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is the TU58 emulation program written at Rockefeller Univ., Dept. of
|
||||
// Neurobiology. We copyright (C) it and permit its use provided it is not
|
||||
// sold to others. Originally written by Dan Ts'o circa 1984 or so.
|
||||
//
|
||||
|
||||
|
||||
|
||||
//
|
||||
// TU58 File access routines
|
||||
//
|
||||
|
||||
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
|
||||
75
main.c
75
main.c
@@ -2,12 +2,41 @@
|
||||
// tu58 - Emulate a TU58 over a serial line
|
||||
//
|
||||
// Original (C) 1984 Dan Ts'o <Rockefeller Univ. Dept. of Neurobiology>
|
||||
// Update (C) 2005-2012 Don North <ak6dn_at_mindspring_dot_com>
|
||||
// Update (C) 2005-2017 Donald N North <ak6dn_at_mindspring_dot_com>
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// o Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// o Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// o Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is the TU58 emulation program written at Rockefeller Univ., Dept. of
|
||||
// Neurobiology. We copyright (C) it and permit its use provided it is not
|
||||
// sold to others. Originally written by Dan Ts'o circa 1984 or so.
|
||||
//
|
||||
|
||||
// Extensively rewritten to work reliably under the CYGWIN unix subsystem.
|
||||
// Has been tested up to 38.4Kbaud hosted on a 1GHz Pentium3 Win2K platform.
|
||||
// Added native windows serial comm support compile option (for break detect).
|
||||
@@ -41,6 +70,12 @@
|
||||
// Fix source for ubuntu linux 12.04 (time structs)
|
||||
// v1.4k - 11 Jun 2015 - donorth - Integrate Mark Blair's changes for MacOSX compilation
|
||||
// - No functionality changes on other platforms
|
||||
// v1.4m - 23 Feb 2016 - donorth - Added M. Blair's vax console timeout changes for '730
|
||||
// - Added M. Blair's background mode option (no status).
|
||||
// v1.4n - 06 Apr 2016 - donorth - Added capability for baud rates >230K, up to 3M
|
||||
// v1.4o - 09 Jan 2017 - donorth - Removed baud rate 256000, it is nonstandard for unix.
|
||||
// Changed serial setup to use cfsetispeed()/cfsetospeed().
|
||||
// Added capability for 1 or 2 stop bits; default is 1
|
||||
//
|
||||
|
||||
|
||||
@@ -48,19 +83,22 @@
|
||||
#include <getopt.h>
|
||||
|
||||
|
||||
static char copyright[] = "(C) 2005-2014 Don North <ak6dn" "@" "mindspring.com>, " \
|
||||
static char copyright[] = "(C) 2005-2017 Don North <ak6dn" "@" "mindspring.com>, " \
|
||||
"(C) 1984 Dan Ts'o <Rockefeller University>";
|
||||
|
||||
static char version[] = "tu58 tape emulator v1.4k";
|
||||
static char version[] = "tu58 tape emulator v1.4o";
|
||||
|
||||
static char port[32] = "1"; // default port number (COM1, /dev/ttyS0)
|
||||
static long speed = 9600; // default line speed
|
||||
static long stop = 1; // default stop bits, 1 or 2
|
||||
|
||||
uint8_t verbose = 0; // set nonzero to output more info
|
||||
uint8_t timing = 0; // set nonzero to add timing delays
|
||||
uint8_t mrspen = 0; // set nonzero to enable MRSP mode
|
||||
uint8_t nosync = 0; // set nonzero to skip sending INIT at restart
|
||||
uint8_t debug = 0; // set nonzero for debug output
|
||||
uint8_t vax = 0; // set to remove delays for aggressive VAX console timeouts
|
||||
uint8_t background = 0; // set to run in background mode (no console I/O except errors)
|
||||
|
||||
|
||||
|
||||
@@ -70,11 +108,13 @@ uint8_t debug = 0; // set nonzero for debug output
|
||||
void info (char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
fprintf(stderr, "info: ");
|
||||
vfprintf(stderr, fmt, args);
|
||||
fprintf(stderr, "\n");
|
||||
va_end(args);
|
||||
if (!background) {
|
||||
va_start(args, fmt);
|
||||
fprintf(stderr, "info: ");
|
||||
vfprintf(stderr, fmt, args);
|
||||
fprintf(stderr, "\n");
|
||||
va_end(args);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -124,17 +164,20 @@ int main (int argc,
|
||||
|
||||
// switch options
|
||||
int opt_index = 0;
|
||||
char opt_short[] = "dvVmnTtp:s:r:w:c:i:z:";
|
||||
char opt_short[] = "dvVmnxbTtp:s:r:w:c:i:z:S:";
|
||||
static struct option opt_long[] = {
|
||||
{ "debug", no_argument, 0, 'd' },
|
||||
{ "verbose", no_argument, 0, 'v' },
|
||||
{ "version", no_argument, 0, 'V' },
|
||||
{ "mrsp", no_argument, 0, 'm' },
|
||||
{ "nosync", no_argument, 0, 'n' },
|
||||
{ "vax", no_argument, 0, 'x' },
|
||||
{ "background", no_argument, 0, 'b' },
|
||||
{ "timing", required_argument, 0, -2 },
|
||||
{ "port", required_argument, 0, 'p' },
|
||||
{ "baud", required_argument, 0, 's' },
|
||||
{ "speed", required_argument, 0, 's' },
|
||||
{ "stop", required_argument, 0, 'S' },
|
||||
{ "rd", required_argument, 0, 'r' },
|
||||
{ "read", required_argument, 0, 'r' },
|
||||
{ "write", required_argument, 0, 'w' },
|
||||
@@ -153,6 +196,7 @@ int main (int argc,
|
||||
case -2 : timing = atoi(optarg); if (timing > 2) errors++; break;
|
||||
case 'p': strcpy(port, optarg); break;
|
||||
case 's': speed = atoi(optarg); break;
|
||||
case 'S': stop = atoi(optarg); break;
|
||||
case 'r': fileopen(optarg, FILEREAD); n++; break;
|
||||
case 'w': fileopen(optarg, FILEWRITE); n++; break;
|
||||
case 'c': fileopen(optarg, FILECREATE); n++; break;
|
||||
@@ -162,6 +206,8 @@ int main (int argc,
|
||||
case 'n': nosync = 1; break;
|
||||
case 'T': timing = 2; break;
|
||||
case 't': timing = 1; break;
|
||||
case 'x': vax = 1; break;
|
||||
case 'b': background = 1; break;
|
||||
case 'd': verbose = 1; debug = 1; break;
|
||||
case 'v': verbose = 1; break;
|
||||
case 'V': info("version is %s", version); break;
|
||||
@@ -188,9 +234,12 @@ int main (int argc,
|
||||
" -d | --debug enable debug output to terminal\n" \
|
||||
" -m | --mrsp enable standard MRSP mode (byte-level handshake)\n" \
|
||||
" -n | --nosync disable sending INIT at initial startup\n" \
|
||||
" -x | --vax remove delays for aggressive timeouts of VAX console\n" \
|
||||
" -b | --background run in background mode, no console I/O except errors\n" \
|
||||
" -t | --timing 1 add timing delays to spoof diagnostic into passing\n" \
|
||||
" -T | --timing 2 add timing delays to mimic a real TU58\n" \
|
||||
" -s | --speed BAUD set line speed [1200..230400; default 9600]\n" \
|
||||
" -s | --speed BAUD set line speed 1200..3000000; default 9600\n" \
|
||||
" -S | --stop BITS set stop bits 1..2; default 1\n" \
|
||||
" -p | --port PORT set port to PORT [1..N or /dev/comN; default 1]\n" \
|
||||
" -r | --read|rd FILENAME readonly drive\n" \
|
||||
" -w | --write FILENAME read/write drive\n" \
|
||||
@@ -200,11 +249,11 @@ int main (int argc,
|
||||
version, argv[0], NTU58-1);
|
||||
|
||||
// give some info
|
||||
info("serial port %s at %d baud", port, speed);
|
||||
info("serial port %s at %d baud %d stop", port, speed, stop);
|
||||
if (mrspen) info("MRSP mode enabled (NOT fully tested - use with caution)");
|
||||
|
||||
// setup serial and console ports
|
||||
devinit(port, speed);
|
||||
devinit(port, speed, stop);
|
||||
coninit();
|
||||
|
||||
// play TU58
|
||||
|
||||
6
makefile
6
makefile
@@ -16,8 +16,10 @@ PROG = tu58em
|
||||
COMM = -UWINCOMM
|
||||
endif
|
||||
|
||||
BIN = ../../../../../tools/exe
|
||||
# put your binary installation directory here...
|
||||
BIN = /cygdrive/e/DEC/tools/exe
|
||||
|
||||
# compiler flags and libraries
|
||||
CC = gcc
|
||||
CFLAGS = -I. -O3 -Wall -c $(COMM)
|
||||
ifeq ($(comm),mac)
|
||||
@@ -55,7 +57,7 @@ purge : clean
|
||||
-rm -f $(PROG) $(PROG).exe
|
||||
|
||||
install : $(PROG)
|
||||
cp $< $(BIN)
|
||||
[ -d $(BIN) ] && cp $< $(BIN)
|
||||
|
||||
serial.o : serial.c common.h
|
||||
$(CC) $(CFLAGS) serial.c
|
||||
|
||||
133
serial.c
133
serial.c
@@ -2,18 +2,49 @@
|
||||
// tu58 - Emulate a TU58 over a serial line
|
||||
//
|
||||
// Original (C) 1984 Dan Ts'o <Rockefeller Univ. Dept. of Neurobiology>
|
||||
// Update (C) 2005-2012 Don North <ak6dn_at_mindspring_dot_com>
|
||||
// Update (C) 2005-2016 Donald N North <ak6dn_at_mindspring_dot_com>
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// o Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// o Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// o Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is the TU58 emulation program written at Rockefeller Univ., Dept. of
|
||||
// Neurobiology. We copyright (C) it and permit its use provided it is not
|
||||
// sold to others. Originally written by Dan Ts'o circa 1984 or so.
|
||||
//
|
||||
|
||||
|
||||
|
||||
//
|
||||
// TU58 serial support routines
|
||||
//
|
||||
|
||||
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef WINCOMM
|
||||
@@ -374,27 +405,47 @@ void devtxput (uint8_t c)
|
||||
static int32_t devbaud (int32_t rate)
|
||||
{
|
||||
#ifdef WINCOMM
|
||||
static int32_t baudlist[] = { 230400, 230400,
|
||||
115200, 115200,
|
||||
57600, 57600,
|
||||
38400, 38400,
|
||||
19200, 19200,
|
||||
9600, 9600,
|
||||
4800, 4800,
|
||||
2400, 2400,
|
||||
1200, 1200,
|
||||
-1, -1 };
|
||||
#else // !WINCOMM
|
||||
static int32_t baudlist[] = { 230400, B230400,
|
||||
115200, B115200,
|
||||
57600, B57600,
|
||||
38400, B38400,
|
||||
19200, B19200,
|
||||
9600, B9600,
|
||||
4800, B4800,
|
||||
2400, B2400,
|
||||
1200, B1200,
|
||||
static int32_t baudlist[] = { 3000000, 3000000,
|
||||
2500000, 2500000,
|
||||
2000000, 2000000,
|
||||
1500000, 1500000,
|
||||
1152000, 1152000,
|
||||
1000000, 1000000,
|
||||
921600, 921600,
|
||||
576000, 576000,
|
||||
500000, 500000,
|
||||
460800, 460800,
|
||||
230400, 230400,
|
||||
115200, 115200,
|
||||
57600, 57600,
|
||||
38400, 38400,
|
||||
19200, 19200,
|
||||
9600, 9600,
|
||||
4800, 4800,
|
||||
2400, 2400,
|
||||
1200, 1200,
|
||||
-1, -1 };
|
||||
#else // !WINCOMM
|
||||
static int32_t baudlist[] = { 3000000, B3000000,
|
||||
2500000, B2500000,
|
||||
2000000, B2000000,
|
||||
1500000, B1500000,
|
||||
1152000, B1152000,
|
||||
1000000, B1000000,
|
||||
921600, B921600,
|
||||
576000, B576000,
|
||||
500000, B500000,
|
||||
460800, B460800,
|
||||
230400, B230400,
|
||||
115200, B115200,
|
||||
57600, B57600,
|
||||
38400, B38400,
|
||||
19200, B19200,
|
||||
9600, B9600,
|
||||
4800, B4800,
|
||||
2400, B2400,
|
||||
1200, B1200,
|
||||
-1, -1 };
|
||||
#endif // !WINCOMM
|
||||
int32_t *p = baudlist;
|
||||
int32_t r;
|
||||
@@ -412,7 +463,8 @@ static int32_t devbaud (int32_t rate)
|
||||
// open/initialize serial port
|
||||
//
|
||||
void devinit (char *port,
|
||||
int32_t speed)
|
||||
int32_t speed,
|
||||
int32_t stop)
|
||||
{
|
||||
#ifdef WINCOMM
|
||||
|
||||
@@ -462,7 +514,7 @@ void devinit (char *port,
|
||||
dcb.fAbortOnError = FALSE;
|
||||
dcb.ByteSize = 8;
|
||||
dcb.Parity = NOPARITY;
|
||||
dcb.StopBits = ONESTOPBIT;
|
||||
dcb.StopBits = (stop == 2) ? TWOSTOPBITS : ONESTOPBIT;
|
||||
|
||||
// timing/read param
|
||||
cto.ReadIntervalTimeout = MAXDWORD;
|
||||
@@ -497,12 +549,6 @@ void devinit (char *port,
|
||||
// copy current parameters
|
||||
line = lineSave;
|
||||
|
||||
// set baud rate
|
||||
if (devbaud(speed) == -1)
|
||||
error("illegal serial speed %d., ignoring", speed);
|
||||
else
|
||||
line.c_ospeed = line.c_ispeed = devbaud(speed);
|
||||
|
||||
// input param
|
||||
line.c_iflag &= ~( IGNBRK | BRKINT | IMAXBEL | INPCK | ISTRIP |
|
||||
INLCR | IGNCR | ICRNL | IXON | IXOFF |
|
||||
@@ -518,7 +564,10 @@ void devinit (char *port,
|
||||
// control param
|
||||
line.c_cflag &= ~( CBAUD | CSIZE | CSTOPB | PARENB | PARODD |
|
||||
HUPCL | CRTSCTS | CLOCAL | CREAD );
|
||||
line.c_cflag |= ( CLOCAL | CREAD | CS8 );
|
||||
line.c_cflag |= ( CLOCAL | CREAD | CS8 );
|
||||
|
||||
// set two stop bits if requested, else default to one
|
||||
if (stop == 2) line.c_cflag |= CSTOPB;
|
||||
|
||||
// local param
|
||||
line.c_lflag &= ~( ISIG | ICANON | ECHO | ECHOE | ECHOK |
|
||||
@@ -530,8 +579,18 @@ void devinit (char *port,
|
||||
line.c_cc[VMIN] = 1; // return a min of 1 chars
|
||||
line.c_cc[VTIME] = 0; // no timer
|
||||
|
||||
// ok, set new param
|
||||
// flush all existing input data
|
||||
tcflush(device, TCIFLUSH);
|
||||
|
||||
// set baud rate, if it is legal
|
||||
if (devbaud(speed) == -1) {
|
||||
error("illegal serial speed %d., ignoring", speed);
|
||||
} else {
|
||||
cfsetispeed(&line, devbaud(speed));
|
||||
cfsetospeed(&line, devbaud(speed));
|
||||
}
|
||||
|
||||
// set new device parameters
|
||||
tcsetattr(device, TCSANOW, &line);
|
||||
|
||||
// and non-blocking also
|
||||
@@ -575,6 +634,9 @@ void coninit (void)
|
||||
{
|
||||
struct termios cons;
|
||||
|
||||
// background mode, don't do anything
|
||||
if (background) return;
|
||||
|
||||
// get current console parameters
|
||||
if (tcgetattr(fileno(stdin), &consSave))
|
||||
fatal("stdin not a serial device");
|
||||
@@ -603,6 +665,10 @@ void coninit (void)
|
||||
//
|
||||
void conrestore (void)
|
||||
{
|
||||
// background mode, don't do anything
|
||||
if (background) return;
|
||||
|
||||
// restore console mode to saved
|
||||
tcsetattr(fileno(stdin), TCSANOW, &consSave);
|
||||
return;
|
||||
}
|
||||
@@ -617,6 +683,9 @@ int32_t conget (void)
|
||||
char buf[1];
|
||||
int32_t s;
|
||||
|
||||
// background mode, don't return anything
|
||||
if (background) return -1;
|
||||
|
||||
// try to read at most one char (may be none)
|
||||
s = read(fileno(stdin), buf, sizeof(buf));
|
||||
|
||||
|
||||
32
tu58.h
32
tu58.h
@@ -2,12 +2,40 @@
|
||||
// tu58 - Emulate a TU58 over a serial line
|
||||
//
|
||||
// Original (C) 1984 Dan Ts'o <Rockefeller Univ. Dept. of Neurobiology>
|
||||
// Update (C) 2005-2012 Don North <ak6dn_at_mindspring_dot_com>
|
||||
// Update (C) 2005-2016 Donald N North <ak6dn_at_mindspring_dot_com>
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// o Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// o Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// o Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is the TU58 emulation program written at Rockefeller Univ., Dept. of
|
||||
// Neurobiology. We copyright (C) it and permit its use provided it is not
|
||||
// sold to others. Originally written by Dan Ts'o circa 1984 or so.
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
69
tu58drive.c
69
tu58drive.c
@@ -2,18 +2,49 @@
|
||||
// tu58 - Emulate a TU58 over a serial line
|
||||
//
|
||||
// Original (C) 1984 Dan Ts'o <Rockefeller Univ. Dept. of Neurobiology>
|
||||
// Update (C) 2005-2012 Don North <ak6dn_at_mindspring_dot_com>
|
||||
// Update (C) 2005-2016 Donald N North <ak6dn_at_mindspring_dot_com>
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// o Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// o Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// o Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is the TU58 emulation program written at Rockefeller Univ., Dept. of
|
||||
// Neurobiology. We copyright (C) it and permit its use provided it is not
|
||||
// sold to others. Originally written by Dan Ts'o circa 1984 or so.
|
||||
//
|
||||
|
||||
|
||||
|
||||
//
|
||||
// TU58 Drive Emulator Machine
|
||||
//
|
||||
|
||||
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <pthread.h>
|
||||
@@ -156,12 +187,15 @@ static void dumppacket (tu_packet *pkt, char *name)
|
||||
int32_t count = 0;
|
||||
uint8_t *ptr = (uint8_t *)pkt;
|
||||
|
||||
fprintf(stderr, "info: %s()\n", name);
|
||||
while (count++ < pkt->cmd.length+2) {
|
||||
if (count == 3 || ((count-4)%32 == 31)) fprintf(stderr, "\n");
|
||||
fprintf(stderr, " %02X", *ptr++);
|
||||
// formatted packet dump, but skip it in background mode
|
||||
if (!background) {
|
||||
fprintf(stderr, "info: %s()\n", name);
|
||||
while (count++ < pkt->cmd.length+2) {
|
||||
if (count == 3 || ((count-4)%32 == 31)) fprintf(stderr, "\n");
|
||||
fprintf(stderr, " %02X", *ptr++);
|
||||
}
|
||||
fprintf(stderr, "\n %02X %02X\n", ptr[0], ptr[1]);
|
||||
}
|
||||
fprintf(stderr, "\n %02X %02X\n", ptr[0], ptr[1]);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -536,7 +570,7 @@ static void command (int8_t flag)
|
||||
char *name= "none";
|
||||
uint8_t mode = 0;
|
||||
|
||||
// Avoid uninitialized variable warnings
|
||||
// avoid uninitialized variable warnings
|
||||
time_start.tv_sec = 0;
|
||||
time_start.tv_nsec = 0;
|
||||
time_end.tv_sec = 0;
|
||||
@@ -702,14 +736,17 @@ static void* run (void* none)
|
||||
|
||||
// loop while no characters are available
|
||||
while (devrxavail() == 0) {
|
||||
// send INITs if still required
|
||||
if (doinit) {
|
||||
if (debug) fprintf(stderr, ".");
|
||||
devtxput(TUF_INIT);
|
||||
devtxflush();
|
||||
delay_ms(75);
|
||||
// delays and printout only if not VAX
|
||||
if (!vax) {
|
||||
// send INITs if still required
|
||||
if (doinit) {
|
||||
if (debug) fprintf(stderr, ".");
|
||||
devtxput(TUF_INIT);
|
||||
devtxflush();
|
||||
delay_ms(75);
|
||||
}
|
||||
delay_ms(25);
|
||||
}
|
||||
delay_ms(25);
|
||||
}
|
||||
doinit = 0; // quit sending init flags
|
||||
|
||||
@@ -730,7 +767,7 @@ static void* run (void* none)
|
||||
if (debug) info("<INIT> seen");
|
||||
if (last == TUF_INIT) {
|
||||
// two in a row is special
|
||||
delay_ms(tudelay[timing].init);
|
||||
if (!vax) delay_ms(tudelay[timing].init); // no delay for VAX
|
||||
devtxput(TUF_CONT); // send 'continue'
|
||||
devtxflush(); // send immediate
|
||||
flag = -1; // undefined
|
||||
|
||||
BIN
tu58em.exe
BIN
tu58em.exe
Binary file not shown.
BIN
tu58ew.exe
BIN
tu58ew.exe
Binary file not shown.
Reference in New Issue
Block a user