Subject: Re: Converting .tap files to real tapes

From: Andreas Holz <[email-masked]>
Date: Wed Jun 18 10:38:00 2003

Christopher,

some questions to your program:

what does the statement do:

read(infile,&reclen,4); ?

this syntax does not conform to UNIX (POSIX) read (e.g. HP/UX):

ssize_t  read(int filedes, void *buf, size_t nbyte);

Are these ".tap" files some kind of a standard format?

Background: I got some files which are claiming to be in a ".tap" format 
and I would like to write the to tape!

Andreas

Christopher McNabb wrote:

>I've hacked together a 2.11 BSD C program (nothing special, should work
>on other *nixen) that takes a .tap tape file and spits it onto a real
>tape.  I've tested it with both a TK50 and a TS05 tape drive.  It even
>successfully wrote a bootable TK50 format XXDP 2.5 tape.  I'm going to
>be cleaning up the code and posting it on the web, but for those who
>can't wait, here is the raw code.  It is left as an exercise to the
>reader to figure out where my MUA breaks the source code lines.
>
>------------  Cut Here --------------------
>/* detap.c - 2003 by Christopher L McNabb */
>
>#include <stdio.h>
>#include <strings.h>
>#include <stdlib.h>
>#include <fcntl.h>
>#include <sys/file.h>
>#include <sys/inode.h>
>#include <sys/ioctl.h>
>#include <sys/mtio.h>
>
>main(argc, argv)
>int argc;
>char *argv[];
>{
>	int infile,outfile,ctr;
>	long int offset;
>	long int records=1;
>	long int filecnt=1;
>	long int reclen;
>	long int reclen2;
>	void* buffer;
>	struct mtop tapeeof,taperew;
>
>	ctr = 0;
>	taperew.mt_op = MTREW;
>	taperew.mt_count = 1;
>	tapeeof.mt_op = MTWEOF;
>	tapeeof.mt_count = 1;
>	if(argc < 3)
>	{
>		printf("Usage: %s infile outdev\n",argv[0]);
>		exit(-1);
>	}
>	infile=open(argv[1],O_RDONLY);
>	if(infile < 0)
>	{
>		printf("Could not open %s\n",argv[1]);
>		exit(-1);
>	}
>	outfile=open(argv[2],O_CREAT | O_RDWR | O_TRUNC,IREAD | IWRITE);
>	if(outfile < 0)
>	{	
>		printf("Could not open %s\n",argv[2]);
>		exit(-1);
>	}
>	printf("Rewinding Tape\n");
>	if( 0 > ioctl(outfile,MTIOCTOP,&taperew))
>	{
>		printf("\nMTIOCOP REW ERROR\n");
>		exit(-1);
>	}
>	offset = 0;
>	read(infile,&reclen,4);
>	while(1)
>	{
>		ctr ++;
>		if(reclen == 0)
>		{
>			filecnt++;
>			if(0 > ioctl(outfile,MTIOCTOP,&tapeeof))
>			{
>				printf("\nMTIOCTOP EOF ERR\n");
>				exit(-1);
>			}
>			read(infile,&reclen,4);
>			if(reclen == 0)
>			{
>				printf("\nEnd of Tape\n");
>				close(outfile);
>				ioctl(outfile,MTIOCTOP,&taperew);
>				break;
>			}
>			records=1;
>			continue;
>		}
>		buffer = malloc(reclen);
>		read(infile,buffer,reclen);
>		read(infile,&reclen2,4);
>		if(reclen != reclen2)
>		{
>			lseek(infile,-3,L_INCR);
>			read(infile,&reclen2,4);
>			if(reclen != reclen2)
>			{
>				printf("\nHdr1 and Hdr2 do not match\n");
>				exit(-1);
>			}
>		}
>		write(outfile,buffer,reclen);
>		fprintf(stdout,"Total Records: %6d  File: %6ld  Record: %6ld Record
>Length: %6u\r",ctr,filecnt,records,reclen); 
>		fflush(stdout);
>		free(buffer);
>		records++;
>		read(infile,&reclen,4);
>	}
>	close(infile);
>	close(outfile);
>}
>
>------------------- SNIP --------------------------

---

From: Ethan Dicks <[email-masked]>
Date: Wed Jun 18 10:53:00 2003

> ssize_t  read(int filedes, void *buf, size_t nbyte);

I'm not Christopher, but I do have an answer: 2BSD is older
than POSIX.  It's also older than ANSI C.  If I had to guess
(not having 2BSD sources in front of me), I'd expect the
prototype for read() to be:

 int read(int filedes, char *buf, int nbyte); **

Back in the K&R days, people were loose with I/O buffer declaration,
pointer casting, etc.  What he's doing there is telling read() to fill
his int 'reclen' with four bytes from the input stream.  I'm sure it works
for him in his environment, but I wouldn't call it a portable solution.

> Are these ".tap" files some kind of a standard format?

I am familiar with .tap files from the Commodore world - specifically
as input to VICE.  I wouldn't know if these .tap files are compatible
or not without some code inspection.

> and I would like to write the to tape!

Do you know what tool created them?  That might be helpful to know.

-ethan

** - According to K&R, 1st ed., section 8.2, p. 160, it simply
describes read as "n_read = read(fd, buf, n)" and goes on to
use them with n_read declared as a int, buf declared as char[],
and n defined as a constant.

---

From: Kevin Handy <[email-masked]>
Date: Wed Jun 18 12:51:01 2003

Andreas Holz wrote:

> Background: I got some files which are claiming to be in a ".tap" 
> format and I would like to write the to tape!

If these ".tap" files are those used by simh, then the format is
really fairly simple, and documented here.

    http://simh.trailing-edge.com/papers.html

or, slightly more directly

    http://simh.trailing-edge.com/docs/simh_magtape.pdf

---

From: Ethan Dicks <[email-masked]>
Date: Wed Jun 18 13:56:00 2003

In a fit of nostalgia, I was wanting to cruise around "Wolfenstein 3D"
and "Spear of Destiny" - I still have my original *purchased* copies
from 10+ years ago (on-topic!).  What I'm having problems with is
getting the sound to work.  I've tried in two different machines,
the "odder" one being my A7V motherboard with a PCI Turtle-Beach
Montego Bay II card (it has no ISA slots).  I've tried fiddling with
the "SET BLASTER" statement in the AUTOEXEC.BAT, but I can't come up
with a way to get either game to see the PCI sound card.

This is after booting direct to the underlying DOS in Windows 98,
so it's not a "DOS-in-a-Window" problem.

Are there any good sound card probe programs for DOS that could
go looking for my card and prove it can be found?  I know the IRQ,
but being a non-Creative Labs card, I can't verify the I/O setting,
nor the DMA channel, and especially not the "T"ype for the BLASTER
environment variable.

Has anyone else tried running ancient software that wants to talk
to sound cards on modern hardware?  I expect to have similar problems
with adventure games and the like, so I am looking for a general
solution.  "Try an older computer" is not a helpful suggestion.  I
am limited in how much physical space I am permitted to occupy at
my S.O.'s place.  An additional computer would cause a lot more trouble
than it's worth.

-ethan

---

From: [email-masked] (Sean 'Captain Napalm' Conner)
Date: Wed Jun 18 14:08:01 2003

> ssize_t  read(int filedes, void *buf, size_t nbyte);

  It does.  It reads in four bytes from infile and stores them in reclen (of
which a pointer is given to read() and in ANSI C, any pointer can be cast to
void *).  The bug lies in how integers are written.  If, for instance, the
data was written on a little-endian system and then you attempt to read on a
big-endian system you are not going to get consistent results.  You need to
ensure a consistent ordering of bytes.

  -spc (htonl() and ntohl() are your friends 8-)

---

From: "Rob O'Donnell" <[email-masked]>
Date: Wed Jun 18 14:10:00 2003

>with a way to get either game to see the PCI sound card.
[snip]

Most modern PC sound cards have stopped being sound-blaster (or other 
comparable hardware) compatible; as with all things, manufacturers think 
that if they provide drivers for Windows, then that's all they have to 
worry about.

I /have/ seen some on-board sound cards with a BIOS option to turn a 
compatibility mode on or off - I've also seen 'drivers' that load in 
config.sys to provide sound support for DOS.  There may be some similar 
options for yours, if you dig about in whatever software came with it.

You might be out of luck I'm afraid.

Rob

---

From: Cameron Kaiser <[email-masked]>
Date: Wed Jun 18 14:20:01 2003

> with a way to get either game to see the PCI sound card.

Were you able to find DOS drivers for this card at all? Or was it actually
advertised as being Sound Blaster compatible (specifically)?

I eventually had so much difficulty that I went and bought a real Sound
Blaster 16 (Fry's still sells them -- even for ISA!). This went in my
486DX4/133 that I reserve for old DOS games.

The Windows 98 machine around here does in fact have DOS emulation drivers
that make it look like a Sound Blaster Pro, which is sufficient for most
games to run on that, too. It's a bizarre AT&T specific card, although the
chipset doesn't look all that weird.

> nor the DMA channel, and especially not the "T"ype for the BLASTER

There was a program that Apogee used to distribute that did just that
(something like SetBlaster or something was the title). They might have
it for download, or it might be in one of their downloadable demos (I
think the Xenophage and/or Wacky Wheels games had some version of this).

-- 
---------------------------------- personal: http://www.armory.com/~spectre/ --
 Cameron Kaiser, Floodgap Systems Ltd * So. Calif., USA * [email-masked]
-- "Another day, another dangling modifier" -----------------------------------

---

From: David Holland <[email-masked]>
Date: Wed Jun 18 14:22:01 2003

:-)

Hmm, I've got some Ultima titles like that.. 

Audio hardware is a fairly typical old software/modern 
hardware problem. 

FWIW, I've never had much luck w/ non-creative cards 
being used directly by programs that expect to 
talk to creative cards.. 

However, if you've WinNT/2000/XP in the mix you
might try this:  http://ntvdm.cjb.net/

(VMware is also a EXPENSIVE possiblity - but 
its sound drivers are not 100%)

You might also try to see if someone has ported
Wolfenstein to some other platform you've access to.
(The source was release quite some time ago)

YMMV/etc, of course. 

David

(Would a discussion of emulating 10yr old audio
hardware be considered on-topic?)

---

From: "TeoZ" <[email-masked]>
Date: Wed Jun 18 14:32:01 2003

The not so modern aureal vortex sound cards (Sq1500,Sq2500,Diamond monster
mx300, etc) have pretty good soundblaster emulation in dos mode with their
standard driver setup. These cards are dirt cheap on ebay. Very few new
soundcards have DOS level drivers anymore, if any.

I like the older games too which is why I have 2 dos machines running a
Gravis Ultrasound max+ Sound blaster pro 2.0, and a gravis Ultrasound PnP
8mb ram + Sound blaster 16 PnP with Yamaha DXB50 wavetable addon.

I also have an original soundscape (reveal sc600 i think) and a Soundscape
PnP on the shelf if needed. Have to have all your bases covered and I am too
cheap to buy a Roland soundcard when the GUS emulates it ok.

---

From: "Dr. Ido" <[email-masked]>
Date: Wed Jun 18 16:00:23 2003

>its sound drivers are not 100%)

I've never used VMware.  I've have tried Virtual PC and found while it does
emulate the soundblaster the sound in most of the games that I have tried
skips.  There's a trial version of Virtual PC on the connectix site if I
remember correctly.  

There's also a DOSbox, freeware as far as I know and supposedly optimized
for running DOS games.  I haven't got around to trying it myself yet.  It
doesn't support protected mode yet, but as Wolf3D runs on a 286 that
shouldn't be a problem.

---

From: Mail List <[email-masked]>
Date: Thu Jun 19 05:11:00 2003

I've got some Sound Blasters and Sound Blaster compatibles that I'd
be willing to trade for. Some ISA or Nubus parts might do.

---

From: Ethan Dicks <[email-masked]>
Date: Thu Jun 19 10:03:00 2003

> be willing to trade for. Some ISA or Nubus parts might do.

Assuming that I could get my girlfriend to allow me to rip out her
sound card and put in a different one, there's the issue of PCI
vs ISA.  This machine has no ISA slots.  The question is and remains
how to play ancient DOS games that require sound on "modern" hardware.

On my own machine, I had to disable the SBpro emulation device under
W98 because it was causing my GUI to lock up after a random amount 
of time (minutes after reboot, not hours) - not the mouse pointer
and keyboard, just the ability to select items with the mouse.  This
is with a Turtle Beach Montego Bay II card... Windows sound works
just fine, but to keep the machine running, SBpro emulation had to go.

I have solved the immediate problem with Wolf3D by grabbing an OpenGL
implemntation of it (that uses my existing commercial maps).  It runs
just fine under W98, music and all (DirectX and what not).  It does not
solve the more abstract problem of how to play "Space Quest", etc.

-ethan

---

From: "TeoZ" <[email-masked]>
Date: Thu Jun 19 10:40:01 2003

Your Turtle beach card uses the Aureal chipset which is THE most compatible
PCI sound card for dos games that I know of. Are you using the latest
drivers for it? Is there a hardware conflict by chance?

How ancient of a dos game are you planning on playing?

The very old games wont run on new hardware period because of speed issues,
video glitches, and of course sound card problems.

Try this site for game patches and the last drivers for all aureal cards
(and generic reference drivers):

http://www.vortexofsound.com/

They have a forum you can ask hardware/game related questions in.

---

From: Mail List <[email-masked]>
Date: Thu Jun 19 11:56:01 2003

Hello Ethan,

for PCI, I'm using the Diamond Sonic Impact sound cards which I'd gotten a
couple of years ago. They have the Aureal Vortex chip. I don't have any spares
though. I'm not sure it will do what you need, but it might be a possible 
candidate.
Probably find them on eBay these days.

I'm sure glad I'd gotten a motherboard that still had a few ISA slots before
such became hard to get. Even when I get around to upgrading this system,
and the next motherboard might have to be all PCI, I'll still hang onto 
this one
for a test system with ISA.

Best Regards

---

From: Ethan Dicks <[email-masked]>
Date: Thu Jun 19 12:52:00 2003

--- TeoZ <[email-masked]> wrote:
> Your Turtle beach card uses the Aureal chipset which is THE most
> compatible PCI sound card for dos games that I know of.

Cool.

> Are you using the latest drivers for it? 

My recollection is that under DOS, there were no "DOS" sound card
drivers - you told your DOS app where the card lived (0x220, for SB
hardware, typically), what its DMA and IRQ were (which varied from
box to box), and the *app* had its own drivers.  You typically ran
a setup program for each game that you told if you had an 8-bit
card or a 16-bit card, etc.  In this case, Wolf3D is looking for
a real SoundBlaster model and uses the "BLASTER" environment variable
to find its resources.  If someone here knows differently, please
speak up.

> Is there a hardware conflict by chance?

I wouldn't expect so.  It works perfectly under Windows.

> How ancient of a dos game are you planning on playing?

1991-1994.
 
> The very old games wont run on new hardware period because of speed
> issues, video glitches, and of course sound card problems.

Video and speed aren't the problem.  The game plays perfectly except
that it can't find my sound card and it resorts to sound effects
through the PC speaker.  :-P 

Part of the Wolf3D experience is the repetitious sound track.  :-)

> http://www.vortexofsound.com/

I'll look around.  Thanks.

---

From: Ethan Dicks <[email-masked]>
Date: Thu Jun 19 13:00:01 2003

> http://www.vortexofsound.com/

The driver selection page:

  http://www.vortexofsound.com/drivers/drivers.htm

Does not have a drop-down for DOS.  As I mentioned in an earlier
message, my recollection of DOS gaming is that *each game* had its
own sound card drivers, not the OS.  I have a crate of old games:
I've had an AMD/Intel PeeCee since about 1992 and did a *lot* of
gaming on it (when I wasn't using my Amiga ;-)... It's trivial to
get this working in an ISA-equipped 486 with an ISA SB-compatible
card... the problem I'm having, to repeat myself, is with a PCI-
only motherboard, a PCI sound card under *DOS* (not any flavor of
windows).

Thanks for the tips, on track or not.

-ethan

---

From: Cameron Kaiser <[email-masked]>
Date: Thu Jun 19 13:12:00 2003

> to find its resources.  If someone here knows differently, please

There are DOS drivers for some cards that add back SB compatibility. The
"VCOS" card in my AT&T Globalyst PC is one of these.

-- 
---------------------------------- personal: http://www.armory.com/~spectre/ --
 Cameron Kaiser, Floodgap Systems Ltd * So. Calif., USA * [email-masked]
-- Get out of the road if you want to grow old -- Pink Floyd ------------------

---

From: "TeoZ" <[email-masked]>
Date: Thu Jun 19 13:45:01 2003

I pointed you to that site because of the forum they have.

Doing a 2 second search for dos I found a post linking to this:

http://www.turtlebeach.com/site/kb_ftp/5752007.asp

Montego A3DXstream: DOS - How to install the Montego for DOS only

Note: These instructions are for a DOS only installation.  If you have
Windows
      installed, please see the Montego A3DXstream User's Guide for
      installation instructions.

To install for DOS:

1) Create a directory "tbeach" on the root of drive C ("c:\tbeach").
2) Copy all of the files in the "\ms_dos\tbeach\" directory on the
   Montego A3DXstream CD to the "tbeach" directory you just created.
   (There should now be two files, "asp4dos.com" and "vortex.ini" in
   the "c:\tbeach" directory.
3) Add the following lines to the beginning of your "autoexec.bat" file:

   SET WINBOOTDIR=C:\TBEACH
   SET BLASTER=A220 I5 D3 T4
   C:\TBEACH\ASP4DOS.COM

To change resource settings:

If you need to change the resource settings for the driver,
you'll need to edit the "vortex.ini" file in the "tbeach" directory.

The following entries in the "vortex.ini" file control the resource
settings.

SBFMBASE
Sets the port address.  Valid resources are 0x220 or 0x240.
Default is 0x220

SBFMDMA
Sets the DMA channel.  Valid resources are 0x0, 0x1 or 0x3.
Default is 0x3

SBFMIRQ
Sets the IRQ.  Valid resources are 0x2, 0x5, 0x7, or 0x10.
Default is 0x5

If you change the resources you must also change the "SET BLASTER"
statement in your "autoexec.bat" file to match:

  A is the port address.
  I is the IRQ.
  D is the DMA.

(Note that these variables do not require the 0x prefix.)

Example:

  SET BLASTER=A240 I7 D1 T4

Montego A3DXstream: DOS - How to install the Montego for DOS only

You will notice you need the driver asp4dos.com which you can get from your
install cd, or from the latest drivers found on the www.vortexofsound.com
site itself under drivers.

I should also tell you that most dos games do not work if you set the irq
over 7 period.

I have been using a PC since about 1989 for gaming with a crappy new 286
packard bell as my first rig. Dont expect any card to sounf exactly like the
original soundblaster would have playing this game (for one thing you dont
get the hiss of the soundblaster pro 2 on a new soundcard).

---

From: "Clarissa Compulsion" <[email-masked]>
Date: Thu Jun 19 14:26:00 2003

Hi,

I'm looking for information about an S-100 card called M-Drive/H by
CompuPro. Does anyone have any information about it or know where to find a
manual or similar? The dip switch S1 is the most interesting thing at the
moment.

/Johan

---

From: "G Manuel" <[email-masked]>
Date: Thu Jun 19 17:49:00 2003

Have you considered just running 2 sound cards in the system. I have a
system that I use as an audio mixer for MP3's that has 2 sound cards in it.
One I use to monitor and cue music while the other is the feed to the amp
and speaker system. It is running W98 and has one SB Live and one Generic
noname card (can't think of it off hand... it is SB compatible). Just set
the cards to different I/O and IRQ's and you whould be good to go. I tried
it by loading the DOS SB drivers in a custom config.sys and autoexec.bat for
Doom and ran it in a DOS window and it worked great.

Hope this helps,
Greg Manuel

-----Original Message-----
From: [email-masked] [mailto:[email-masked]]On
Behalf Of Ethan Dicks
Sent: Wednesday, June 18, 2003 2:52 PM
To: [email-masked]
Subject: Sound for DOS games on modern hardware?

-ethan

---

From: Ethan Dicks <[email-masked]>
Date: Fri Jun 20 03:10:00 2003

--- G Manuel <[email-masked]> wrote:
> Have you considered just running 2 sound cards in the system.

Two PCI sound cards?  How does that help?

-ethan

---

From: Luis Gomez <[email-masked]>
Date: Fri Jun 20 09:44:00 2003

http://cgi.es.ebay.com/ws/eBayISAPI.dll?ViewItem&item=2737573399

---

From: Luis Gomez <[email-masked]>
Date: Fri Jun 20 09:51:00 2003

http://cgi.es.ebay.com/ws/eBayISAPI.dll?ViewItem&item=2737574468

---

From: Paul Berger <[email-masked]>
Date: Fri Jun 20 12:49:00 2003

> Two PCI sound cards?  How does that help?

Actually an ISA sound card and PCI one will usually co-exist.  The trick
is to get a non-pnp ISA one that you can set to the classic settings.

Easiest solution is to do what has been suggested, setup a separate
system just designed to play classic DOS sutff.  I have a 486DX-2 with a
good ET-4000 based video card and a SoundBlaster 2 for the sound.  I
have a couple non-PnP SoundBlaster 16's that I'm holding onto for a
higer end system I'm planning on building for later games.

Paul

---

From: "G Manuel" <[email-masked]>
Date: Fri Jun 20 17:38:01 2003

He already has one Turtle Bay card. He could add a SB card with the DOS SB
drivers and such to get it working for the game in DOS mode.

Greg Manuel

-----Original Message-----
From: [email-masked] [mailto:[email-masked]]On
Behalf Of Ethan Dicks
Sent: Friday, June 20, 2003 4:05 AM
To: [email-masked]
Subject: RE: Sound for DOS games on modern hardware?

-ethan

---

From: "Witchy" <[email-masked]>
Date: Fri Jun 20 21:36:00 2003

Please excuse any apparent rudeness, but 'bwahahahahahaha' - 150 euros?

best of luck Luis.

> Behalf Of Luis Gomez
> Sent: 20 June 2003 15:40
> To: [email-masked]
> Subject: Acorn Atom eBay
> 
>