aboutsummaryrefslogtreecommitdiffstats
path: root/emulators
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2002-05-25 19:02:21 +0800
committerkris <kris@FreeBSD.org>2002-05-25 19:02:21 +0800
commite159b35eb58841bd429117c8ffdf96acdba00625 (patch)
tree5adcc4e99f755888cb178d533f9e6c96c95d6f5d /emulators
parent68a823eb4aae7666bd178a35c50efac8d93d11ab (diff)
downloadfreebsd-ports-gnome-e159b35eb58841bd429117c8ffdf96acdba00625.tar.gz
freebsd-ports-gnome-e159b35eb58841bd429117c8ffdf96acdba00625.tar.zst
freebsd-ports-gnome-e159b35eb58841bd429117c8ffdf96acdba00625.zip
Add hercules-2.15
Hercules is an open source software implementation of the mainframe System/370 and ESA/390 architectures, in addition to the new 64-bit z/Architecture. Submitted by: Miguel Mendez <flynn@energyhq.homeip.net> PR: ports/34488
Diffstat (limited to 'emulators')
-rw-r--r--emulators/Makefile1
-rw-r--r--emulators/hercules/Makefile40
-rw-r--r--emulators/hercules/distinfo1
-rw-r--r--emulators/hercules/files/patch-tapecopy.c363
-rw-r--r--emulators/hercules/files/patch-tapedev.c224
-rw-r--r--emulators/hercules/pkg-comment1
-rw-r--r--emulators/hercules/pkg-descr12
-rw-r--r--emulators/hercules/pkg-message10
-rw-r--r--emulators/hercules/pkg-plist31
9 files changed, 683 insertions, 0 deletions
diff --git a/emulators/Makefile b/emulators/Makefile
index 7b43b7df7586..5675c4655117 100644
--- a/emulators/Makefile
+++ b/emulators/Makefile
@@ -22,6 +22,7 @@
SUBDIR += gngb
SUBDIR += gnuboy
SUBDIR += gsnes9x
+ SUBDIR += hercules
SUBDIR += hfs
SUBDIR += hfsutils
SUBDIR += ia64sim
diff --git a/emulators/hercules/Makefile b/emulators/hercules/Makefile
new file mode 100644
index 000000000000..852587cc9367
--- /dev/null
+++ b/emulators/hercules/Makefile
@@ -0,0 +1,40 @@
+# New ports collection makefile for: dice
+# Date created: Thu Jan 31 12:07:01 CET 2002
+# Whom: Miguel Mendez <flynn@energyhq.homeip.net>
+#
+# $FreeBSD$
+#
+
+PORTNAME= hercules
+PORTVERSION= 2.15
+CATEGORIES= emulators
+MASTER_SITES= http://www.conmicro.cx/hercules/
+
+MAINTAINER= flynn@energyhq.homeip.net
+
+GNU_CONFIGURE= yes
+
+post-patch:
+
+ @${PERL} -pi -e 's@lpthread@pthread@g' ${WRKSRC}/configure
+
+do-install:
+
+ @for i in hercules dasdinit dasdisup dasdload dasdls dasdpdsu \
+ tapecopy tapemap tapesplt cckd2ckd cckdcdsk ckd2cckd \
+ cckdcomp cckdswap hetget hetinit hetmap hetupd dmap2hrc; \
+ do \
+ ${INSTALL_PROGRAM} ${WRKSRC}/$$i ${PREFIX}/bin; \
+ done
+
+.if !defined(NOPORTDOCS)
+ @${MKDIR} ${PREFIX}/share/doc/hercules
+ @${RM} -f ${WRKSRC}/html/Makefile*
+ @for i in ${WRKSRC}/hercules.cnf ${WRKSRC}/html/* ; \
+ do \
+ ${INSTALL_DATA} $$i ${PREFIX}/share/doc/hercules; \
+ done
+.endif
+ @${CAT} pkg-message
+
+.include <bsd.port.mk>
diff --git a/emulators/hercules/distinfo b/emulators/hercules/distinfo
new file mode 100644
index 000000000000..96b7f70fb944
--- /dev/null
+++ b/emulators/hercules/distinfo
@@ -0,0 +1 @@
+MD5 (hercules-2.15.tar.gz) = 8eb98b2b5663607fda075fc57f019172
diff --git a/emulators/hercules/files/patch-tapecopy.c b/emulators/hercules/files/patch-tapecopy.c
new file mode 100644
index 000000000000..a1c42c2fdaef
--- /dev/null
+++ b/emulators/hercules/files/patch-tapecopy.c
@@ -0,0 +1,363 @@
+--- tapecopy.c.orig Thu Nov 29 13:53:46 2001
++++ tapecopy.c Thu Jan 31 13:26:01 2002
+@@ -8,357 +8,18 @@
+ /* prints a summary of the tape files and blocksizes. */
+ /*-------------------------------------------------------------------*/
+
+-#include "hercules.h"
+-
+-/*-------------------------------------------------------------------*/
+-/* Structure definition for AWSTAPE block header */
+-/*-------------------------------------------------------------------*/
+-typedef struct _AWSTAPE_BLKHDR {
+- HWORD curblkl; /* Length of this block */
+- HWORD prvblkl; /* Length of previous block */
+- BYTE flags1; /* Flags byte 1 */
+- BYTE flags2; /* Flags byte 2 */
+- } AWSTAPE_BLKHDR;
+-
+-/* Definitions for AWSTAPE_BLKHDR flags byte 1 */
+-#define AWSTAPE_FLAG1_NEWREC 0x80 /* Start of new record */
+-#define AWSTAPE_FLAG1_TAPEMARK 0x40 /* Tape mark */
+-#define AWSTAPE_FLAG1_ENDREC 0x20 /* End of record */
+-
+-/*-------------------------------------------------------------------*/
+-/* Static data areas */
+-/*-------------------------------------------------------------------*/
+-static BYTE vollbl[] = "\xE5\xD6\xD3"; /* EBCDIC characters "VOL" */
+-static BYTE hdrlbl[] = "\xC8\xC4\xD9"; /* EBCDIC characters "HDR" */
+-static BYTE eoflbl[] = "\xC5\xD6\xC6"; /* EBCDIC characters "EOF" */
+-static BYTE eovlbl[] = "\xC5\xD6\xE5"; /* EBCDIC characters "EOV" */
+-static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO;
+-static struct mt_tape_info densinfo[] = {
+- {0x01, "NRZI (800 bpi)"},
+- {0x02, "PE (1600 bpi)"},
+- {0x03, "GCR (6250 bpi)"},
+- {0x05, "QIC-45/60 (GCR, 8000 bpi)"},
+- {0x06, "PE (3200 bpi)"},
+- {0x07, "IMFM (6400 bpi)"},
+- {0x08, "GCR (8000 bpi)"},
+- {0x09, "GCR /37871 bpi)"},
+- {0x0A, "MFM (6667 bpi)"},
+- {0x0B, "PE (1600 bpi)"},
+- {0x0C, "GCR (12960 bpi)"},
+- {0x0D, "GCR (25380 bpi)"},
+- {0x0F, "QIC-120 (GCR 10000 bpi)"},
+- {0x10, "QIC-150/250 (GCR 10000 bpi)"},
+- {0x11, "QIC-320/525 (GCR 16000 bpi)"},
+- {0x12, "QIC-1350 (RLL 51667 bpi)"},
+- {0x13, "DDS (61000 bpi)"},
+- {0x14, "EXB-8200 (RLL 43245 bpi)"},
+- {0x15, "EXB-8500 (RLL 45434 bpi)"},
+- {0x16, "MFM 10000 bpi"},
+- {0x17, "MFM 42500 bpi"},
+- {0x24, "DDS-2"},
+- {0x8C, "EXB-8505 compressed"},
+- {0x90, "EXB-8205 compressed"},
+- {0, NULL}};
+-static BYTE buf[65500];
+-
+-/*-------------------------------------------------------------------*/
+-/* ASCII to EBCDIC translate tables */
+-/*-------------------------------------------------------------------*/
+-#include "codeconv.h"
+-
+-/*-------------------------------------------------------------------*/
+-/* Subroutine to print tape status */
+-/*-------------------------------------------------------------------*/
+-static void print_status (BYTE *devname, long stat)
+-{
+- printf ("%s status: %8.8lX", devname, stat);
+- if (GMT_EOF(stat)) printf (" EOF");
+- if (GMT_BOT(stat)) printf (" BOT");
+- if (GMT_EOT(stat)) printf (" EOT");
+- if (GMT_SM(stat)) printf (" SETMARK");
+- if (GMT_EOD(stat)) printf (" EOD");
+- if (GMT_WR_PROT(stat)) printf (" WRPROT");
+- if (GMT_ONLINE(stat)) printf (" ONLINE");
+- if (GMT_D_6250(stat)) printf (" 6250");
+- if (GMT_D_1600(stat)) printf (" 1600");
+- if (GMT_D_800(stat)) printf (" 800");
+- if (GMT_DR_OPEN(stat)) printf (" NOTAPE");
+- printf ("\n");
+-
+-} /* end function print_status */
+-
+-/*-------------------------------------------------------------------*/
+-/* Subroutine to obtain and print tape status */
+-/* Return value: 0=normal, 1=end of tape, -1=error */
+-/*-------------------------------------------------------------------*/
+-static int obtain_status (BYTE *devname, int devfd)
+-{
+-int rc; /* Return code */
+-struct mtget stblk; /* Area for MTIOCGET ioctl */
+-
+- rc = ioctl (devfd, MTIOCGET, (char*)&stblk);
+- if (rc < 0)
+- {
+- printf ("tapecopy: Error reading status of %s: %s\n",
+- devname, strerror(errno));
+- return -1;
+- }
+-
+- print_status (devname, stblk.mt_gstat);
+-
+- if (GMT_EOD(stblk.mt_gstat)) return 1;
+- if (GMT_EOT(stblk.mt_gstat)) return 1;
+-
+- return 0;
+-} /* end function print_status */
+
+ /*-------------------------------------------------------------------*/
+ /* TAPECOPY main entry point */
+ /*-------------------------------------------------------------------*/
+ int main (int argc, char *argv[])
+ {
+-int rc; /* Return code */
+-int i; /* Array subscript */
+-int len; /* Block length */
+-int prevlen; /* Previous block length */
+-BYTE *devname; /* -> Tape device name */
+-BYTE *filename; /* -> Output file name */
+-int devfd; /* Tape file descriptor */
+-int outfd = -1; /* Output file descriptor */
+-int fileno; /* Tape file number */
+-int blkcount; /* Block count */
+-int minblksz; /* Minimum block size */
+-int maxblksz; /* Maximum block size */
+-struct mtop opblk; /* Area for MTIOCTOP ioctl */
+-struct mtget stblk; /* Area for MTIOCGET ioctl */
+-long density; /* Tape density code */
+-BYTE labelrec[81]; /* Standard label (ASCIIZ) */
+-AWSTAPE_BLKHDR awshdr; /* AWSTAPE block header */
+-
+- /* Display the program identification message */
+- display_version (stderr, "Hercules tape copy program ");
+-
+- /* The first argument is the tape device name */
+- if (argc > 1 && argv[1] != NULL && strlen(argv[1]) > 5
+- && memcmp (argv[1], "/dev/", 5) == 0)
+- {
+- devname = argv[1];
+- }
+- else
+- {
+- printf ("Usage: tapecopy /dev/st0 [outfile]\n");
+- exit (1);
+- }
+-
+- /* The second argument is the output file name */
+- if (argc > 2 && argv[2] != NULL)
+- filename = argv[2];
+- else
+- filename = NULL;
+-
+- /* Open the tape device */
+- devfd = open (devname, O_RDONLY|O_BINARY);
+- if (devfd < 0)
+- {
+- printf ("tapecopy: Error opening %s: %s\n",
+- devname, strerror(errno));
+- exit (3);
+- }
+
+- /* Obtain the tape status */
+- rc = ioctl (devfd, MTIOCGET, (char*)&stblk);
+- if (rc < 0)
+- {
+- printf ("tapecopy: Error reading status of %s: %s\n",
+- devname, strerror(errno));
+- exit (7);
+- }
+
+- /* Display tape status information */
+- for (i = 0; tapeinfo[i].t_type != 0
+- && tapeinfo[i].t_type != stblk.mt_type; i++);
+-
+- if (tapeinfo[i].t_name != NULL)
+- printf ("%s device type: %s\n", devname, tapeinfo[i].t_name);
+- else
+- printf ("%s device type: 0x%lX\n", devname, stblk.mt_type);
+-
+- density = (stblk.mt_dsreg & MT_ST_DENSITY_MASK)
+- >> MT_ST_DENSITY_SHIFT;
+-
+- for (i = 0; densinfo[i].t_type != 0
+- && densinfo[i].t_type != density; i++);
+-
+- if (densinfo[i].t_name != NULL)
+- printf ("%s tape density: %s\n", devname, densinfo[i].t_name);
+- else
+- printf ("%s tape density code: 0x%lX\n", devname, density);
+-
+- if (stblk.mt_gstat != 0)
+- {
+- print_status (devname, stblk.mt_gstat);
+- }
+-
+- /* Set the tape device to process variable length blocks */
+- opblk.mt_op = MTSETBLK;
+- opblk.mt_count = 0;
+- rc = ioctl (devfd, MTIOCTOP, (char*)&opblk);
+- if (rc < 0)
+- {
+- printf ("tapecopy: Error setting attributes for %s: %s\n",
+- devname, strerror(errno));
+- exit (5);
+- }
+-
+- /* Rewind the tape to the beginning */
+- opblk.mt_op = MTREW;
+- opblk.mt_count = 1;
+- rc = ioctl (devfd, MTIOCTOP, (char*)&opblk);
+- if (rc < 0)
+- {
+- printf ("tapecopy: Error rewinding %s: %s\n",
+- devname, strerror(errno));
+- exit (6);
+- }
+-
+- /* Open the output file */
+- if (filename != NULL)
+- {
+- outfd = open (filename, O_WRONLY | O_CREAT | O_BINARY,
+- S_IRUSR | S_IWUSR | S_IRGRP);
+- if (outfd < 0)
+- {
+- printf ("tapecopy: Error opening %s: %s\n",
+- filename, strerror(errno));
+- exit (4);
+- }
+- }
+-
+- /* Copy blocks from tape to the output file */
+- fileno = 1;
+- blkcount = 0;
+- minblksz = 0;
+- maxblksz = 0;
+- len = 0;
+-
+- while (1)
+- {
+- /* Save previous block length */
+- prevlen = len;
+-
+- /* Read a block from the tape */
+- len = read (devfd, buf, sizeof(buf));
+- if (len < 0)
+- {
+- printf ("tapecopy: Error reading %s: %s\n",
+- devname, strerror(errno));
+- obtain_status (devname, devfd);
+- exit (8);
+- }
+-
+- /* Check for tape mark */
+- if (len == 0)
+- {
+- /* Print summary of current file */
+- printf ("File %u: Blocks=%u, block size min=%u, max=%u\n",
+- fileno, blkcount, minblksz, maxblksz);
+-
+- /* Write tape mark to output file */
+- if (outfd >= 0)
+- {
+- /* Build block header for tape mark */
+- awshdr.curblkl[0] = 0;
+- awshdr.curblkl[1] = 0;
+- awshdr.prvblkl[0] = prevlen & 0xFF;
+- awshdr.prvblkl[1] = (prevlen >> 8) & 0xFF;
+- awshdr.flags1 = AWSTAPE_FLAG1_TAPEMARK;
+- awshdr.flags2 = 0;
+-
+- /* Write block header to output file */
+- rc = write (outfd, &awshdr, sizeof(AWSTAPE_BLKHDR));
+- if (rc < sizeof(AWSTAPE_BLKHDR))
+- {
+- printf ("tapecopy: Error writing %s: %s\n",
+- filename, strerror(errno));
+- exit (9);
+- } /* end if(rc) */
+-
+- } /* end if(outfd) */
+-
+- /* Reset counters for next file */
+- fileno++;
+- minblksz = 0;
+- maxblksz = 0;
+- blkcount = 0;
+-
+- /* Determine whether end of tape has been read */
+- rc = obtain_status (devname, devfd);
+- if (rc == 0) continue;
+- if (rc > 0) printf ("End of tape\n");
+- break;
+-
+- } /* end if(tapemark) */
+-
+- /* Count blocks and block sizes */
+- blkcount++;
+- if (len > maxblksz) maxblksz = len;
+- if (minblksz == 0 || len < minblksz) minblksz = len;
+-
+- /* Print standard labels */
+- if (len == 80 && blkcount < 4
+- && (memcmp(buf, vollbl, 3) == 0
+- || memcmp(buf, hdrlbl, 3) == 0
+- || memcmp(buf, eoflbl, 3) == 0
+- || memcmp(buf, eovlbl, 3) == 0))
+- {
+- for (i=0; i < 80; i++)
+- labelrec[i] = ebcdic_to_ascii[buf[i]];
+- labelrec[i] = '\0';
+- printf ("%s\n", labelrec);
+- }
+- else
+- {
+- printf ("File %u: Block %u\r", fileno, blkcount);
+- }
+-
+- /* Write block to output file */
+- if (outfd >= 0)
+- {
+- /* Build the block header */
+- awshdr.curblkl[0] = len & 0xFF;
+- awshdr.curblkl[1] = (len >> 8) & 0xFF;
+- awshdr.prvblkl[0] = prevlen & 0xFF;
+- awshdr.prvblkl[1] = (prevlen >> 8) & 0xFF;
+- awshdr.flags1 = AWSTAPE_FLAG1_NEWREC
+- | AWSTAPE_FLAG1_ENDREC;
+- awshdr.flags2 = 0;
+-
+- /* Write block header to output file */
+- rc = write (outfd, &awshdr, sizeof(AWSTAPE_BLKHDR));
+- if (rc < sizeof(AWSTAPE_BLKHDR))
+- {
+- printf ("tapecopy: Error writing %s: %s\n",
+- filename, strerror(errno));
+- exit (10);
+- } /* end if(rc) */
+-
+- /* Write data block to output file */
+- rc = write (outfd, buf, len);
+- if (rc < len)
+- {
+- printf ("tapecopy: Error writing %s: %s\n",
+- filename, strerror(errno));
+- exit (11);
+- } /* end if(rc) */
+-
+- } /* end if(outfd) */
+-
+- } /* end while */
+-
+- /* Close files and exit */
+- close (devfd);
+- if (filename != NULL) close (outfd);
++ /* Display the program identification message */
++
+
++ printf("Tape copy is broken, sorry\n");
+ return 0;
+
+ } /* end function main */
diff --git a/emulators/hercules/files/patch-tapedev.c b/emulators/hercules/files/patch-tapedev.c
new file mode 100644
index 000000000000..9b3bff653e48
--- /dev/null
+++ b/emulators/hercules/files/patch-tapedev.c
@@ -0,0 +1,224 @@
+--- tapedev.c.orig Tue Nov 20 23:39:47 2001
++++ tapedev.c Thu Jan 31 13:06:43 2002
+@@ -131,6 +131,11 @@
+ #define TAPEDEVT_SCSITAPE 3 /* Physical SCSI tape */
+ #define TAPEDEVT_HET 4 /* HET format disk file */
+
++/* Can you say totally b0rken? */
++#define MT_ST_DENSITY_MASK 1
++#define MT_TAPE_INFO 2
++#define MTSETBLK 3
++#define MT_ST_DENSITY_SHIFT 4
+ /*-------------------------------------------------------------------*/
+ /* Structure definition for tape block headers */
+ /*-------------------------------------------------------------------*/
+@@ -194,7 +199,10 @@
+ /*-------------------------------------------------------------------*/
+ /* Static data areas */
+ /*-------------------------------------------------------------------*/
+-static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO;
++
++
++/* static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO;
++
+ static struct mt_tape_info densinfo[] = {
+ {0x01, "NRZI (800 bpi)"},
+ {0x02, "PE (1600 bpi)"},
+@@ -221,7 +229,7 @@
+ {0x8C, "EXB-8505 compressed"},
+ {0x90, "EXB-8205 compressed"},
+ {0, NULL}};
+-
++*/
+ static PARSER ptab[] =
+ {
+ { "awstape", NULL },
+@@ -1151,6 +1159,7 @@
+ if (dev->fd < 0) return 0;
+
+ /* Obtain tape status */
++/*
+ rc = ioctl (dev->fd, MTIOCGET, (char*)&stblk);
+ if (rc < 0)
+ {
+@@ -1159,8 +1168,9 @@
+ return 0;
+ }
+ stat = stblk.mt_gstat;
+-
++*/
+ /* Display tape status */
++/*
+ if (dev->ccwtrace || dev->ccwstep)
+ {
+ sprintf (buf, "%s status: %8.8X", dev->filename, stat);
+@@ -1177,10 +1187,11 @@
+ if (GMT_DR_OPEN(stat)) strcat (buf, " NOTAPE");
+ logmsg ("HHC215I %s\n", buf);
+ }
+-
++*/
+ /* If tape has been ejected, then close the file because
+ the driver will not recognize that a new tape volume
+ has been mounted until the file is re-opened */
++/*
+ if (GMT_DR_OPEN(stat))
+ {
+ close (dev->fd);
+@@ -1190,8 +1201,10 @@
+ dev->prvblkpos = -1;
+ dev->blockid = 0;
+ }
+-
++*/
+ /* Return tape status */
++
++ fprintf(stderr,"Sorry, tape support is broken.\n");
+ return stat;
+
+ } /* end function status_scsitape */
+@@ -1249,6 +1262,7 @@
+ }
+
+ /* Intervention required if no tape is mounted */
++/*
+ if (GMT_DR_OPEN(stblk.mt_gstat))
+ {
+ dev->sense[0] = SENSE_IR;
+@@ -1256,8 +1270,9 @@
+ *unitstat = CSW_CE | CSW_DE | CSW_UC;
+ return -1;
+ }
+-
++*/
+ /* Display tape status information */
++/*
+ for (i = 0; tapeinfo[i].t_type != 0
+ && tapeinfo[i].t_type != stblk.mt_type; i++);
+
+@@ -1280,8 +1295,9 @@
+ else
+ logmsg ("HHC221I %s tape density code: 0x%lX\n",
+ dev->filename, density);
+-
++*/
+ /* Set the tape device to process variable length blocks */
++ /*
+ opblk.mt_op = MTSETBLK;
+ opblk.mt_count = 0;
+ rc = ioctl (dev->fd, MTIOCTOP, (char*)&opblk);
+@@ -1294,8 +1310,9 @@
+ *unitstat = CSW_CE | CSW_DE | CSW_UC;
+ return -1;
+ }
+-
++*/
+ /* Rewind the tape to the beginning */
++/*
+ opblk.mt_op = MTREW;
+ opblk.mt_count = 1;
+ rc = ioctl (dev->fd, MTIOCTOP, (char*)&opblk);
+@@ -1308,7 +1325,7 @@
+ *unitstat = CSW_CE | CSW_DE | CSW_UC;
+ return -1;
+ }
+-
++*/
+ return 0;
+
+ } /* end function open_scsitape */
+@@ -1436,13 +1453,14 @@
+
+ /* If I/O error and status indicates EOF, then a tapemark
+ was detected, so increment the file number and return 0 */
++/*
+ if (rc < 0 && fsrerrno == EIO && GMT_EOF(stat))
+ {
+ dev->curfilen++;
+ dev->blockid++;
+ return 0;
+ }
+-
++*/
+ /* Handle MTFSR error condition */
+ if (rc < 0)
+ {
+@@ -1481,6 +1499,7 @@
+ stat = status_scsitape (dev);
+
+ /* Unit check if already at start of tape */
++/*
+ if (GMT_BOT(stat))
+ {
+ dev->sense[0] = 0;
+@@ -1488,7 +1507,7 @@
+ *unitstat = CSW_CE | CSW_DE | CSW_UC;
+ return -1;
+ }
+-
++*/
+ /* Backspace block on SCSI tape */
+ opblk.mt_op = MTBSR;
+ opblk.mt_count = 1;
+@@ -2703,12 +2722,15 @@
+ U32 stat; /* SCSI tape status bits */
+
+ /* Indicate intervention required if no file */
++/*
+ if (!strcmp (dev->filename, TAPE_UNLOADED))
+ dev->sense[0] |= SENSE_IR;
+
+ if (!(dev->fd < 0))
+ {
++ */
+ /* Set load point indicator if tape is at load point */
++/*
+ dev->sense[1] &= ~SENSE1_TAPE_LOADPT;
+ switch (dev->tapedevt)
+ {
+@@ -2732,41 +2754,14 @@
+ if (dev->nxtblkpos == 0 && dev->curfilen == 1)
+ dev->sense[1] |= SENSE1_TAPE_LOADPT;
+ break;
+- } /* end switch(dev->tapedevt) */
+- } /* !(fd < 0) */
++ }
++ */
++ /* end switch(dev->tapedevt) */
++
+
+ /* Indicate Drive online to control unit */
+- dev->sense[1] |= SENSE1_TAPE_TUA;
+
+- /* Set file protect indicator if read-only file */
+- if (dev->readonly)
+- dev->sense[1] |= SENSE1_TAPE_FP;
+- else
+- dev->sense[1] &= ~SENSE1_TAPE_FP;
+
+- /* Set Error Recovery Action Code */
+- if (dev->sense[0] & SENSE_IR)
+- dev->sense[3] = 0x43;
+- else if (dev->sense[0] & SENSE_CR)
+- dev->sense[3] = 0x27;
+- else if (dev->sense[1] & SENSE1_TAPE_FP)
+- dev->sense[3] = 0x30;
+- else
+- dev->sense[3] = 0x29;
+-
+- /* Set sense bytes for 3420 */
+- if (dev->devtype != 0x3480)
+- {
+-// dev->sense[4] |= 0x20;
+- dev->sense[5] |= 0xC0;
+- dev->sense[6] |= 0x03;
+- dev->sense[13] = 0x80;
+- dev->sense[14] = 0x01;
+- dev->sense[15] = 0x00;
+- dev->sense[16] = 0x01;
+- dev->sense[19] = 0xFF;
+- dev->sense[20] = 0xFF;
+- }
+
+ } /* end function build_sense */
+
diff --git a/emulators/hercules/pkg-comment b/emulators/hercules/pkg-comment
new file mode 100644
index 000000000000..e302b0543a42
--- /dev/null
+++ b/emulators/hercules/pkg-comment
@@ -0,0 +1 @@
+The Hercules System/370, ESA/390, and z/Architecture Emulator
diff --git a/emulators/hercules/pkg-descr b/emulators/hercules/pkg-descr
new file mode 100644
index 000000000000..773d2abe6fd6
--- /dev/null
+++ b/emulators/hercules/pkg-descr
@@ -0,0 +1,12 @@
+Hercules is an open source software implementation of the mainframe System/370
+and ESA/390 architectures, in addition to the new 64-bit z/Architecture.
+Hercules runs under Linux, Windows 98, Windows NT, and Windows 2000.
+
+Hercules was created by Roger Bowler and is maintained by Jay Maynard. Jan
+Jaeger designed and implemented many of the advanced features of Hercules,
+including dynamic reconfiguration, integrated console, interpretive execution
+and z/Architecture support.
+
+WWW: http://www.conmicro.cx/hercules/
+
+- Miguel Mendez <flynn@energyhq.homeip.net>
diff --git a/emulators/hercules/pkg-message b/emulators/hercules/pkg-message
new file mode 100644
index 000000000000..3354373cc808
--- /dev/null
+++ b/emulators/hercules/pkg-message
@@ -0,0 +1,10 @@
+######################################################################
+
+ IMPORTANT
+ Tape operations and tapecopy are broken in this port (contain Linux
+specific code that has not yet been adapted).
+
+ Be sure to have a look at the docs and edit the hercules.cnf file to
+your needs (The sample is in ${PREFIX}/share/doc/hercules)
+
+######################################################################
diff --git a/emulators/hercules/pkg-plist b/emulators/hercules/pkg-plist
new file mode 100644
index 000000000000..740a041b60f3
--- /dev/null
+++ b/emulators/hercules/pkg-plist
@@ -0,0 +1,31 @@
+bin/cckd2ckd
+bin/cckdcdsk
+bin/cckdcomp
+bin/cckdswap
+bin/ckd2cckd
+bin/dasdinit
+bin/dasdisup
+bin/dasdload
+bin/dasdls
+bin/dasdpdsu
+bin/dmap2hrc
+bin/hercules
+bin/hetget
+bin/hetinit
+bin/hetmap
+bin/hetupd
+bin/tapecopy
+bin/tapemap
+bin/tapesplt
+share/doc/hercules/cckddasd.html
+share/doc/hercules/hercconf.html
+share/doc/hercules/hercfaq.html
+share/doc/hercules/hercinst.html
+share/doc/hercules/herclic.html
+share/doc/hercules/hercload.html
+share/doc/hercules/hercnew.html
+share/doc/hercules/herctcp.html
+share/doc/hercules/hercules.cnf
+share/doc/hercules/hercules.css
+share/doc/hercules/index.html
+@dirrm share/doc/hercules