mirror of
https://github.com/simh/simh.git
synced 2026-04-18 00:48:13 +00:00
simh tools
This commit is contained in:
committed by
Mark Pizzolato
parent
b2101ecdd4
commit
78b401acd6
108
simtools/converters/asc.c
Normal file
108
simtools/converters/asc.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/* This program converts <cr> delimited files to Windoze <cr><lf>
|
||||
|
||||
Copyright (c) 1993-2001, Robert M. Supnik
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Robert M Supnik shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from Robert M Supnik.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define LAST_ANY 0
|
||||
#define LAST_CR 1
|
||||
#define LAST_LF 2
|
||||
#define MD_WIN 0
|
||||
#define MD_UNIX 1
|
||||
#define MD_MAC 2
|
||||
|
||||
void puteol (int mode, FILE *of)
|
||||
{
|
||||
if (mode != MD_UNIX) putc ('\r', of);
|
||||
if (mode != MD_MAC) putc ('\n', of);
|
||||
return;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int i, k, mc, lastc;
|
||||
int mode;
|
||||
char *s, *ppos, oname[256];
|
||||
FILE *ifile, *ofile;
|
||||
|
||||
if ((argc < 2) || (argv[0] == NULL)) {
|
||||
printf ("Usage is: asc -muw file [file...]\n");
|
||||
exit (0); }
|
||||
|
||||
s = argv[1];
|
||||
if ((s != NULL) && (*s++ == '-')) {
|
||||
++argv; --argc;
|
||||
switch (*s) {
|
||||
case 'm': case 'M':
|
||||
mode = MD_MAC; break;
|
||||
case 'u': case 'U':
|
||||
mode = MD_UNIX; break;
|
||||
case 'w': case 'W':
|
||||
mode = MD_WIN; break;
|
||||
default:
|
||||
fprintf (stderr, "Bad option %c\n", *s);
|
||||
return 0; }
|
||||
}
|
||||
else mode = MD_WIN;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
strcpy (oname, argv[i]);
|
||||
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".new");
|
||||
else strcat (oname, ".new");
|
||||
ifile = fopen (argv[i], "rb");
|
||||
if (ifile == NULL) {
|
||||
printf ("Error opening file: %s\n", argv[i]);
|
||||
exit (0); }
|
||||
ofile = fopen (oname, "wb");
|
||||
if (ofile == NULL) {
|
||||
printf ("Error opening file: %s\n", oname);
|
||||
exit (0); }
|
||||
|
||||
printf ("Processing file %s\n", argv[i]);
|
||||
for (lastc = LAST_ANY;;) {
|
||||
k = getc (ifile);
|
||||
if (k == EOF) break;
|
||||
mc = k & 0177;
|
||||
if (mc && (mc != 0177)) {
|
||||
if (mc == 015) {
|
||||
if (lastc == LAST_CR) puteol (mode, ofile);
|
||||
lastc = LAST_CR; }
|
||||
else if (mc == 012) {
|
||||
puteol (mode, ofile);
|
||||
lastc = LAST_LF; }
|
||||
else {
|
||||
if (lastc == LAST_CR) puteol (mode, ofile);
|
||||
putc (mc, ofile);
|
||||
lastc = LAST_ANY; }
|
||||
}
|
||||
}
|
||||
if (lastc == LAST_CR) puteol (mode, ofile);
|
||||
fclose (ifile);
|
||||
fclose (ofile);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
14
simtools/converters/asc.txt
Normal file
14
simtools/converters/asc.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
ASC is a simple utility for converting text files (delimited with
|
||||
\r, \n, or \r\n) to Windows format (\r\n delimited), Unix format
|
||||
(\n delimited) or Mac format (\r delimited).
|
||||
|
||||
ASC is invoked from a DOS prompt with the command:
|
||||
|
||||
> ASC {-m|u|w} file1 file2 ...
|
||||
|
||||
The optional switch specifies Mac processing (-m), Unix processing
|
||||
(-u), or Windows processing (-w). If no switch is specified, Windows
|
||||
processing is performed.
|
||||
|
||||
Each file is processed in turn. If the file is name.ext, the converted
|
||||
file is name.new.
|
||||
68
simtools/converters/dtos8cvt.c
Normal file
68
simtools/converters/dtos8cvt.c
Normal file
@@ -0,0 +1,68 @@
|
||||
/* This program converts an OS8 DECtape image to simulator format
|
||||
|
||||
Copyright (c) 1993-2001, Robert M. Supnik
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Robert M Supnik shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from Robert M Supnik.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define BLKSIZ 129
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int i, k;
|
||||
unsigned short buf[BLKSIZ];
|
||||
char *ppos, oname[256];
|
||||
FILE *ifile, *ofile;
|
||||
|
||||
if ((argc < 2) || (argv[0] == NULL)) {
|
||||
printf ("Usage is: verb file [file...]\n");
|
||||
exit (0); }
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
strcpy (oname, argv[i]);
|
||||
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".dt8");
|
||||
else strcat (oname, ".dt8");
|
||||
ifile = fopen (argv[i], "rb");
|
||||
if (ifile == NULL) {
|
||||
printf ("Error opening file: %s\n", argv[i]);
|
||||
exit (0); }
|
||||
ofile = fopen (oname, "wb");
|
||||
if (ofile == NULL) {
|
||||
printf ("Error opening file: %s\n", oname);
|
||||
exit (0); }
|
||||
|
||||
printf ("Processing file %s\n", argv[i]);
|
||||
for (;;) {
|
||||
k = fread (buf, sizeof (short), BLKSIZ - 1, ifile);
|
||||
if (k == 0) break;
|
||||
for ( ; k < BLKSIZ; k++) buf[k] = 0;
|
||||
fwrite (buf, sizeof (short), BLKSIZ, ofile);
|
||||
}
|
||||
fclose (ifile);
|
||||
fclose (ofile);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
13
simtools/converters/dtos8cvt.txt
Normal file
13
simtools/converters/dtos8cvt.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
dtos8cvt converts a PDP-8 DECtape image from OS/8 format to simulator format.
|
||||
|
||||
OS/8 only uses 128 words out of 129 in a PDP-8 DECtape block. The simulator
|
||||
requires all 129 words, in order to simulate the actions of the hardware, and
|
||||
to deal with oddball software systems such as the PDP-8 Disk Monitor.
|
||||
|
||||
dtos8cvt is invoked by
|
||||
|
||||
dtos8cvt file1 file2 file3...
|
||||
|
||||
Each file in turn is converted from OS/8 format to simulator format. The
|
||||
input file can have any extension; the converted file will have a .dt8
|
||||
extension.
|
||||
97
simtools/converters/gt7cvt.c
Normal file
97
simtools/converters/gt7cvt.c
Normal file
@@ -0,0 +1,97 @@
|
||||
/* This program converts a gt7 magtape dump to a SIMH magtape
|
||||
|
||||
Copyright (c) 2002, Robert M. Supnik
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Robert M Supnik shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from Robert M Supnik.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define FLPSIZ 65536
|
||||
unsigned char fzero[4] = { 0 };
|
||||
|
||||
int dump_rec (FILE *of, int bc, char *buf)
|
||||
{
|
||||
unsigned char buc[4];
|
||||
|
||||
if (((bc == 1) && (buf[0] == 0xF)) ||
|
||||
((bc == 2) && (buf[0] == 0xF) && (buf[1] == 0xF))) {
|
||||
fwrite (fzero, sizeof (char), 4, of);
|
||||
return 1; }
|
||||
buc[0] = bc & 0xFF;
|
||||
buc[1] = (bc >> 8) & 0xFF;
|
||||
buc[2] = (bc >> 16) & 0xFF;
|
||||
buc[3] = (bc >> 24) & 0xFF;
|
||||
fwrite (buc, sizeof (char), 4, of);
|
||||
fwrite (buf, sizeof (char), (bc + 1) & ~1, of);
|
||||
fwrite (buc, sizeof (char), 4, of);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int i, ch, bc, rc, fc;
|
||||
unsigned char buf[FLPSIZ];
|
||||
char *ppos, oname[256];
|
||||
FILE *ifile, *ofile;
|
||||
|
||||
if ((argc < 2) || (argv[0] == NULL)) {
|
||||
printf ("Usage is: verb file [file...]\n");
|
||||
exit (0); }
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
strcpy (oname, argv[i]);
|
||||
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".tap");
|
||||
else strcat (oname, ".tap");
|
||||
ifile = fopen (argv[i], "rb");
|
||||
if (ifile == NULL) {
|
||||
printf ("Error opening file: %s\n", argv[i]);
|
||||
exit (0); }
|
||||
ofile = fopen (oname, "wb");
|
||||
if (ofile == NULL) {
|
||||
printf ("Error opening file: %s\n", oname);
|
||||
exit (0); }
|
||||
|
||||
printf ("Processing file %s\n", argv[i]);
|
||||
for (bc = rc = fc = 0;;) {
|
||||
ch = fgetc (ifile);
|
||||
if (ch == EOF) break;
|
||||
if (ch & 0x80) {
|
||||
if (bc) {
|
||||
if (dump_rec (ofile, bc, buf))
|
||||
printf ("End of file %d\n", ++fc);
|
||||
else printf ("Record %d size %d\n", ++rc, bc);
|
||||
}
|
||||
bc = 0; }
|
||||
buf[bc++] = ch & 0x3F;
|
||||
}
|
||||
fclose (ifile);
|
||||
if (bc) dump_rec (ofile, bc, buf);
|
||||
fwrite (fzero, sizeof (char), 4, ofile);
|
||||
printf ("End of file %d\n", ++fc);
|
||||
fclose (ofile);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
69
simtools/converters/littcvt.c
Normal file
69
simtools/converters/littcvt.c
Normal file
@@ -0,0 +1,69 @@
|
||||
/* This program removes the 4 header bytes from a Litt tape
|
||||
|
||||
Copyright (c) 1993-1999, Robert M. Supnik, Compaq Computer Corporation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
ROBERT M SUPNIK, OR COMPAQ COMPUTER CORPORATION, BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Robert M Supnik, or Compaq
|
||||
Computer Corporation, shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without prior
|
||||
written authorization from both the author and Compaq Computer Corporation.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define FLPSIZ 65536
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int i, k, bc;
|
||||
unsigned char buf[FLPSIZ];
|
||||
char *ppos, oname[256];
|
||||
FILE *ifile, *ofile;
|
||||
|
||||
if ((argc < 2) || (argv[0] == NULL)) {
|
||||
printf ("Usage is: verb file [file...]\n");
|
||||
exit (0); }
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
strcpy (oname, argv[i]);
|
||||
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".new");
|
||||
else strcat (oname, ".new");
|
||||
ifile = fopen (argv[i], "rb");
|
||||
if (ifile == NULL) {
|
||||
printf ("Error opening file: %s\n", argv[i]);
|
||||
exit (0); }
|
||||
ofile = fopen (oname, "wb");
|
||||
if (ofile == NULL) {
|
||||
printf ("Error opening file: %s\n", oname);
|
||||
exit (0); }
|
||||
|
||||
printf ("Processing file %s\n", argv[i]);
|
||||
fread (&bc, sizeof (int), 1, ifile);
|
||||
for (;;) {
|
||||
k = fread (buf, sizeof (char), FLPSIZ, ifile);
|
||||
if (k == 0) break;
|
||||
fwrite (buf, sizeof (char), k, ofile); }
|
||||
fclose (ifile);
|
||||
fclose (ofile);
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
94
simtools/converters/mtcvtfix.c
Normal file
94
simtools/converters/mtcvtfix.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* This program fixes a SIMH magtape containing a misread EOF
|
||||
|
||||
Copyright (c) 2003, Robert M. Supnik
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Robert M Supnik shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from Robert M Supnik.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define FLPSIZ 65536
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int i, fc, rc;
|
||||
unsigned int k, tbc;
|
||||
unsigned char bc[4] = { 0 };
|
||||
unsigned char bceof[4] = { 0 };
|
||||
unsigned char buf[FLPSIZ];
|
||||
char *ppos, oname[256];
|
||||
FILE *ifile, *ofile;
|
||||
|
||||
if ((argc < 2) || (argv[0] == NULL)) {
|
||||
printf ("Usage is: verb file [file...]\n");
|
||||
exit (0); }
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
strcpy (oname, argv[i]);
|
||||
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".new");
|
||||
else strcat (oname, ".new");
|
||||
ifile = fopen (argv[i], "rb");
|
||||
if (ifile == NULL) {
|
||||
printf ("Error opening file: %s\n", argv[i]);
|
||||
exit (0); }
|
||||
ofile = fopen (oname, "wb");
|
||||
if (ofile == NULL) {
|
||||
printf ("Error opening file: %s\n", oname);
|
||||
exit (0); }
|
||||
|
||||
printf ("Processing file %s\n", argv[i]);
|
||||
fc = 1; rc = 0;
|
||||
for (;;) {
|
||||
k = fread (bc, sizeof (char), 4, ifile);
|
||||
if (k == 0) break;
|
||||
tbc = ((unsigned int) bc[3] << 24) | ((unsigned int) bc[2] << 16) |
|
||||
((unsigned int) bc[1] << 8) | (unsigned int) bc[0];
|
||||
if (tbc) {
|
||||
printf ("Record size = %d\n", tbc);
|
||||
if (tbc > FLPSIZ) {
|
||||
printf ("Record too big\n");
|
||||
return 0; }
|
||||
k = fread (buf, sizeof (char), tbc, ifile);
|
||||
for ( ; k < tbc; k++) buf[k] = 0;
|
||||
fread (bc, sizeof (char), 4, ifile);
|
||||
if (tbc > 1) {
|
||||
fwrite (bc, sizeof (char), 4, ofile);
|
||||
fwrite (buf, sizeof (char), tbc, ofile);
|
||||
fwrite (bc, sizeof (char), 4, ofile);
|
||||
rc++; }
|
||||
else {
|
||||
printf ("Record length = 1, ignored\n");
|
||||
} }
|
||||
else {
|
||||
fwrite (bceof, sizeof (char), 4, ofile);
|
||||
if (rc) printf ("End of file %d, record count = %d\n", fc, rc);
|
||||
else printf ("End of tape\n");
|
||||
fc++;
|
||||
rc = 0; }
|
||||
}
|
||||
fclose (ifile);
|
||||
fclose (ofile);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
87
simtools/converters/mtcvtodd.c
Normal file
87
simtools/converters/mtcvtodd.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/* This program converts an E11 magtape (with odd record sizes) to SIMH
|
||||
|
||||
Copyright (c) 1993-2001, Robert M. Supnik
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Robert M Supnik shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from Robert M Supnik.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define FLPSIZ 65536
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int i, k, tbc, ebc, fc, rc;
|
||||
unsigned char bc[4] = { 0 };
|
||||
unsigned char buf[FLPSIZ];
|
||||
char *ppos, oname[256];
|
||||
FILE *ifile, *ofile;
|
||||
|
||||
if ((argc < 2) || (argv[0] == NULL)) {
|
||||
printf ("Usage is: verb file [file...]\n");
|
||||
exit (0); }
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
strcpy (oname, argv[i]);
|
||||
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".new");
|
||||
else strcat (oname, ".new");
|
||||
ifile = fopen (argv[i], "rb");
|
||||
if (ifile == NULL) {
|
||||
printf ("Error opening file: %s\n", argv[i]);
|
||||
exit (0); }
|
||||
ofile = fopen (oname, "wb");
|
||||
if (ofile == NULL) {
|
||||
printf ("Error opening file: %s\n", oname);
|
||||
exit (0); }
|
||||
|
||||
printf ("Processing file %s\n", argv[i]);
|
||||
fc = 1; rc = 0;
|
||||
for (;;) {
|
||||
k = fread (bc, sizeof (char), 4, ifile);
|
||||
if (k == 0) break;
|
||||
tbc = ((unsigned int) bc[3] << 24) | ((unsigned int) bc[2] << 16) |
|
||||
((unsigned int) bc[1] << 8) | (unsigned int) bc[0];
|
||||
ebc = (tbc + 1) & ~1;
|
||||
fwrite (bc, sizeof (char), 4, ofile);
|
||||
if (tbc) {
|
||||
printf ("Record size = %d\n", tbc);
|
||||
if (tbc > FLPSIZ) {
|
||||
printf ("Record too big\n");
|
||||
return 0; }
|
||||
k = fread (buf, sizeof (char), tbc, ifile);
|
||||
for ( ; k < ebc; k++) buf[k] = 0;
|
||||
fread (bc, sizeof (char), 4, ifile);
|
||||
fwrite (buf, sizeof (char), ebc, ofile);
|
||||
fwrite (bc, sizeof (char), 4, ofile);
|
||||
rc++; }
|
||||
else { if (rc) printf ("End of file %d, record count = %d\n", fc, rc);
|
||||
else printf ("End of tape\n");
|
||||
fc++;
|
||||
rc = 0; }
|
||||
}
|
||||
fclose (ifile);
|
||||
fclose (ofile);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
81
simtools/converters/mtcvtv23.c
Normal file
81
simtools/converters/mtcvtv23.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/* This program converts a pre V2.3 simulated magtape to a V2.3 magtape
|
||||
|
||||
Copyright (c) 1993-1999, Robert M. Supnik
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Robert M Supnik shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from Robert M Supnik.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define FLPSIZ 65536
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int i, k, wc, fc, rc;
|
||||
unsigned char bc[4] = { 0 };
|
||||
unsigned char buf[FLPSIZ];
|
||||
char *ppos, oname[256];
|
||||
FILE *ifile, *ofile;
|
||||
|
||||
if ((argc < 2) || (argv[0] == NULL)) {
|
||||
printf ("Usage is: verb file [file...]\n");
|
||||
exit (0); }
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
strcpy (oname, argv[i]);
|
||||
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".tap");
|
||||
else strcat (oname, ".tap");
|
||||
ifile = fopen (argv[i], "rb");
|
||||
if (ifile == NULL) {
|
||||
printf ("Error opening file: %s\n", argv[i]);
|
||||
exit (0); }
|
||||
ofile = fopen (oname, "wb");
|
||||
if (ofile == NULL) {
|
||||
printf ("Error opening file: %s\n", oname);
|
||||
exit (0); }
|
||||
|
||||
printf ("Processing file %s\n", argv[i]);
|
||||
fc = 1; rc = 0;
|
||||
for (;;) {
|
||||
k = fread (bc, sizeof (char), 2, ifile);
|
||||
if (k == 0) break;
|
||||
wc = ((unsigned int) bc[1] << 8) | (unsigned int) bc[0];
|
||||
wc = (wc + 1) & ~1;
|
||||
fwrite (bc, sizeof (char), 4, ofile);
|
||||
if (wc) {
|
||||
k = fread (buf, sizeof (char), wc, ifile);
|
||||
for ( ; k < wc; k++) buf[k] =0;
|
||||
fwrite (buf, sizeof (char), wc, ofile);
|
||||
fwrite (bc, sizeof (char), 4, ofile);
|
||||
rc++; }
|
||||
else { if (rc) printf ("End of file %d, record count = %d\n", fc, rc);
|
||||
else printf ("End of tape\n");
|
||||
fc++;
|
||||
rc = 0; }
|
||||
}
|
||||
fclose (ifile);
|
||||
fclose (ofile);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
35
simtools/converters/mtcvtv23.txt
Normal file
35
simtools/converters/mtcvtv23.txt
Normal file
@@ -0,0 +1,35 @@
|
||||
mtcvtv23 converts a tape images in .tpc format to .tap format.
|
||||
|
||||
.tpc format tape images have the format
|
||||
|
||||
2 byte record length 1
|
||||
record 1
|
||||
2 byte record length 2
|
||||
record 2
|
||||
:
|
||||
2 bytes = 0000 for end of file
|
||||
|
||||
and so on. This is the format produced by various UNIX utilities
|
||||
for dumping tape images.
|
||||
|
||||
.tap format tape images have the format
|
||||
|
||||
4 byte record length 1
|
||||
record 1
|
||||
repeat of 4 byte record length 1
|
||||
4 byte record length 2
|
||||
record 2
|
||||
repeat of 4 byte record length 2
|
||||
:
|
||||
4 bytes = 00000000 for end of file
|
||||
|
||||
and so on. This is the tape format expected by simh, Tim Stark's TS10,
|
||||
and John Wilson's E11.
|
||||
|
||||
mtcvtv23 is invoked by
|
||||
|
||||
mtcvtv23 file1 file2 file3...
|
||||
|
||||
Each file in turn is converted from .tpc format to .tap format. The
|
||||
input file can have any extension; the converted file will have a .tap
|
||||
extension.
|
||||
116
simtools/converters/sfmtcvt.c
Normal file
116
simtools/converters/sfmtcvt.c
Normal file
@@ -0,0 +1,116 @@
|
||||
/* This program converts a Motorola S format PROM dump to a binary file
|
||||
|
||||
Copyright (c) 1993-2003, Robert M. Supnik
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Robert M Supnik shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from Robert M Supnik.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define HEX(a) ((a) >= 'A'? (a) - 'A' + 10: (a) - '0')
|
||||
#define MAXA (2 << 14)
|
||||
#define MAXR 4
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int i, d, d1, j, k, astrt, dstrt, addr, maxaddr[MAXR];
|
||||
int numr, numf;
|
||||
unsigned char data[MAXR][MAXA];
|
||||
char *s, *ppos, *cptr, line[256], oname[256];
|
||||
FILE *ifile, *ofile;
|
||||
|
||||
if ((argc < 2) || (argv[0] == NULL)) {
|
||||
printf ("Usage is: verb file [file...]\n");
|
||||
exit (0); }
|
||||
|
||||
s = argv[1];
|
||||
if ((s != NULL) && (*s++ == '-')) {
|
||||
++argv; --argc;
|
||||
switch (*s) {
|
||||
case '1':
|
||||
numr = 1; break;
|
||||
case '2':
|
||||
numr = 2; break;
|
||||
case '4':
|
||||
numr = 4; break;
|
||||
default:
|
||||
fprintf (stderr, "Bad option %c\n", *s);
|
||||
return 0; }
|
||||
}
|
||||
else numr = 1;
|
||||
|
||||
for (i = 1, numf = 0; i < argc; i++) {
|
||||
ifile = fopen (argv[i], "r");
|
||||
if (ifile == NULL) {
|
||||
printf ("Error opening file: %s\n", argv[i]);
|
||||
exit (0); }
|
||||
|
||||
printf ("Processing file %s\n", argv[i]);
|
||||
astrt = 4;
|
||||
maxaddr[numf] = 0;
|
||||
for (;;) {
|
||||
cptr = fgets (line, 256, ifile);
|
||||
if (cptr == NULL) break;
|
||||
if (line[0] != 'S') continue;
|
||||
if (line[1] == '1') dstrt = 8;
|
||||
else if (line[1] == '2') dstrt = 10;
|
||||
else continue;
|
||||
for (k = astrt, addr = 0; k < dstrt; k++) {
|
||||
d = HEX (line[k]);
|
||||
addr = (addr << 4) + d; }
|
||||
if (addr >= MAXA) {
|
||||
printf ("Address %o out of range\n", addr);
|
||||
break; }
|
||||
for (k = dstrt; k < (dstrt + 32); k = k + 2, addr++) {
|
||||
d = HEX (line[k]);
|
||||
d1 = HEX (line[k+1]);
|
||||
data[numf][addr] = (d << 4) + d1; }
|
||||
if (addr > maxaddr[numf]) maxaddr[numf] = addr;
|
||||
}
|
||||
fclose (ifile);
|
||||
numf++;
|
||||
if (numf >= numr) {
|
||||
for (k = 0; k < numr; k++) {
|
||||
if (maxaddr[k] != maxaddr[0]) {
|
||||
printf ("Rom lengths don't match, file 1 = %d, file %d = %d\n",
|
||||
maxaddr[0], k, maxaddr[k]);
|
||||
return 0; } }
|
||||
strcpy (oname, argv[i]);
|
||||
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".bin");
|
||||
else strcat (oname, ".bin");
|
||||
ofile = fopen (oname, "wb");
|
||||
if (ofile == NULL) {
|
||||
printf ("Error opening file: %s\n", oname);
|
||||
exit (0); }
|
||||
printf ("Output file: %s, ROM size is %d\n", oname, maxaddr[0]);
|
||||
for (k = 0; k < maxaddr[0]; k++) {
|
||||
for (j = numr - 1; j >= 0; j--) {
|
||||
fwrite (&data[j][k], 1, 1, ofile); } }
|
||||
fclose (ofile);
|
||||
numf = 0;
|
||||
}
|
||||
}
|
||||
if (numf) printf ("Unprocessed files\n");
|
||||
return 0;
|
||||
}
|
||||
76
simtools/converters/tp512cvt.c
Normal file
76
simtools/converters/tp512cvt.c
Normal file
@@ -0,0 +1,76 @@
|
||||
/* This program converts a tp data file to a simulated 512B blocked magtape
|
||||
|
||||
Copyright (c) 1993-2003, Robert M. Supnik
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Robert M Supnik shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from Robert M Supnik.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define BLKSIZ 512
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int i, k;
|
||||
unsigned char buf[BLKSIZ];
|
||||
unsigned char tef[4] = { 0, 0, 0, 0 };
|
||||
unsigned char twc[4] = { 0, 2, 0, 0 };
|
||||
char *ppos, oname[256];
|
||||
FILE *ifile, *ofile;
|
||||
|
||||
if ((argc < 2) || (argv[0] == NULL)) {
|
||||
printf ("Usage is: verb file [file...]\n");
|
||||
exit (0); }
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
strcpy (oname, argv[i]);
|
||||
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".tap");
|
||||
else strcat (oname, ".tap");
|
||||
ifile = fopen (argv[i], "rb");
|
||||
if (ifile == NULL) {
|
||||
printf ("Error opening file: %s\n", argv[i]);
|
||||
exit (0); }
|
||||
ofile = fopen (oname, "wb");
|
||||
if (ofile == NULL) {
|
||||
printf ("Error opening file: %s\n", oname);
|
||||
exit (0); }
|
||||
|
||||
printf ("Processing file %s\n", argv[i]);
|
||||
for (;;) {
|
||||
k = fread (buf, sizeof (char), BLKSIZ, ifile);
|
||||
if (k == 0) break;
|
||||
if (k != BLKSIZ) {
|
||||
printf ("Short block, size = %d\n", k);
|
||||
for ( ; k < BLKSIZ; k++) buf[k] = 0; }
|
||||
fwrite (twc, sizeof (char), 4, ofile);
|
||||
fwrite (buf, sizeof (char), BLKSIZ, ofile);
|
||||
fwrite (twc, sizeof (char), 4, ofile);
|
||||
}
|
||||
fwrite (tef, sizeof (char), 4, ofile);
|
||||
fwrite (tef, sizeof (char), 4, ofile);
|
||||
fclose (ifile);
|
||||
fclose (ofile);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user