SCSI Tape to TAP utility

Al Kossow aek at bitsavers.org
Sun Aug 9 10:08:11 CDT 2015


On 8/8/15 9:16 PM, Chuck Guzis wrote:
> On 08/08/2015 08:14 PM, Jay Jaeger wrote:
>> If anyone is interested, I have code for a Linux SCSI tape to
>> AWSTAPE program, and a program that translates aws format to a raw
>> byte stream. Not sure if I have one that translates to the SimH .tap
>> format, though. GNU C.
>
> I've got a Linux utility to translate SIMH .tap to raw binary, if that's interesting to anyone.  I would have thought that such utilities existed already.
>
> --Chuck
>
>

this bursts a tape into raw sequentially numbered files


#include <stdio.h>
FILE *fp;
main()
{
unsigned int len, len2;
unsigned int i;
unsigned int filenum = 0;

char fname[20];

	sprintf(fname,"%05d",filenum++);
	fp = fopen(fname,"w");
	do{

		len = getchar();
		if(feof(stdin)) exit(1);
		len = len | (getchar()<<8);
		len = len | (getchar()<<16);
		len = len | (getchar()<<24);
		if(len == -1){
		 fprintf(stderr,"65535 byte record in file %d\n",filenum);
		 getchar();getchar();getchar();getchar();
		 continue;
		}
		if(len == 0){
	 	 fprintf(stderr,"Tape Mark\n");
		 fclose(fp);
		 sprintf(fname,"%05d",filenum++);
		 fp = fopen(fname,"w");
	 	 continue;
		}

		for(i = len; i; i--)
	 	 fputc(getchar(), fp);

		len2	=	getchar();
		len2	= len2  | (getchar()<<8);
		len2	= len2  | (getchar()<<16);
		len2	= len2  | (getchar()<<24);

		if(len != len2){
	 	 fprintf(stderr, "front and back lengths differ!\n");
	 	 exit(1);
		}
	} while(!feof(stdin));
}




More information about the cctech mailing list