diff options
Diffstat (limited to 'jindroush/acvt')
| -rw-r--r-- | jindroush/acvt/Makefile | 52 | ||||
| -rw-r--r-- | jindroush/acvt/acvt.cpp | 216 | ||||
| -rw-r--r-- | jindroush/acvt/pub.def | 31 | ||||
| -rw-r--r-- | jindroush/acvt/readme.txt | 152 | ||||
| -rw-r--r-- | jindroush/acvt/switches.def | 64 | 
5 files changed, 515 insertions, 0 deletions
| diff --git a/jindroush/acvt/Makefile b/jindroush/acvt/Makefile new file mode 100644 index 0000000..498e2fc --- /dev/null +++ b/jindroush/acvt/Makefile @@ -0,0 +1,52 @@ +#===================================================================== +PRGNAME		= acvt + +DESTDIR= +PREFIX=/usr + +LDLIBS=-L../lib -ljindroush +INCPATH=-I../include + +all: release + +release: +	@$(MAKE) $(PRGNAME) CFLAGS="-c -O2 -Wall -D__CDISK_SAVE__" LDFLAGS="" +	@echo RELEASE: Compiled. + +rel_strip: release +	@strip $(PRGNAME) + +install: rel_strip +	cp $(PRGNAME) $(DESTDIR)/$(PREFIX)/bin/ +	@echo RELEASE: Installed. + +debug: +	@$(MAKE) $(PRGNAME) CFLAGS="-c -g -Wall -D_DEBUG -D__CDISK_SAVE__" LDFLAGS="-g" +	@echo DEBUG: Compiled. + +clean: +	rm -rf *.o $(PRGNAME) $(PRGNAME).exe switches.cpp +	@echo DEBUG: Cleaned. + + +OBJECTS = acvt.o + +#===================================================================== +CXX		= g++ +LD		= g++ +CPPFLAGS=$(COPT) +COPT=-O2 + +#===================================================================== + +$(PRGNAME) : $(OBJECTS) +	$(LD) $(LDFLAGS) $(OBJECTS) $(LDLIBS) -o $(PRGNAME) + +%.o : %.cpp switches.cpp +	$(CXX) $(INCPATH) $(CPPFLAGS) $(CFLAGS) $< -o $@ + +%.o : %.cpp +	$(CXX) $(INCPATH) $(CPPFLAGS) $(CFLAGS) $< -o $@ + +switches.cpp : switches.def ../switches.pl +	perl ../switches.pl $< $@ diff --git a/jindroush/acvt/acvt.cpp b/jindroush/acvt/acvt.cpp new file mode 100644 index 0000000..857da5b --- /dev/null +++ b/jindroush/acvt/acvt.cpp @@ -0,0 +1,216 @@ +//    This program is free software; you can redistribute it and/or modify +//    it under the terms of the GNU General Public License as published by +//    the Free Software Foundation; either version 2 of the License, or +//    any later version. +// +//    This program is distributed in the hope that it will be useful, +//    but WITHOUT ANY WARRANTY; without even the implied warranty of +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +//    GNU General Public License for more details. +// +//    You should have received a copy of the GNU General Public License +//    along with this program; if not, write to the Free Software +//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// + +#include "pub.def" +#include "jintypes.h" +#include "autil.h" +#include "adsk.h" + +BOOL Convert( char* szInFile, char* szOutFile ); + +DISK_TYPE g_dtypeIn = DISK_AUTO; +DISK_TYPE g_dtypeOut = DISK_ATR; + +BOOL g_bVerbose = FALSE; +BOOL g_bBatchMode = FALSE; +BOOL g_bRepairAuto = FALSE; +BOOL g_bRepair = TRUE; +BOOL g_bFirstErrStop = FALSE; +BOOL g_bOverWrite = FALSE; +BOOL g_bTestOnly = FALSE; +BOOL g_bForceClassic = FALSE; + +#define SHEADER PRG_NAME " v" PRG_VERSION " (c) " PRG_COPYRIGHT " " PRG_AUTHOR "\n" + +#define HEADER SHEADER \ +   PRG_DESC "\n" \ +	"  Latest version can be found at " PRG_URL "\n" \ +	"  Published under GPL. See GPL.TXT.\n\n" + +#define USAGE HEADER "Usage:  " PRG_NAME " " PRG_USAGE + +#include "switches.cpp" + +int main(int argc,char *argv[]) +{ +	setbuf( stdout, NULL ); +	setbuf( stderr, NULL ); + +	if ( !SWITCHES_Init( &argc, argv ) ) +		return 1; + +	if ( argc < 2 ) +	{ +		SWFN_HELP( USAGE ); +		return 1; +	} + +	fprintf( stderr, SHEADER ); + +	BOOL bRet = FALSE; + +	char szOutFile[ 255 ]; + +	if ( g_bBatchMode ) +	{ +		argc--; +		argv++; + +		while( argc-- ) +		{ +			char* szInFile = *(argv++); +			GuessBestFnameFromPC( szOutFile, szInFile, GetDiskTypeExt( g_dtypeOut ) ); +			bRet = Convert( szInFile, szOutFile ); +			printf( "\n" ); + +			if ( !bRet && g_bFirstErrStop ) +				break; +		} + +	} +	else +	{ +		char* szInFile = argv[ 1 ]; + +		if ( argc >= 3 ) +		{ +			strcpy( szOutFile, argv[ 2 ] ); +		} +		else +		{ +			GuessBestFnameFromPC( szOutFile, szInFile, GetDiskTypeExt( g_dtypeOut ) ); +		} + +		bRet = Convert( szInFile, szOutFile ); +	} + +	if ( bRet && !g_bTestOnly ) +		printf ( "Done.\n" ); + +	return bRet ? 0 : 1; +} + +BOOL Convert( char* szInFile, char* szOutFile ) +{ +	ADisk* pDiskIn = NULL; +	ADisk* pDiskOut = NULL; + +	DISKINIT_RETCODE ret; + +	g_dtypeIn = DISK_ATR; +	if ( DI_RET_CONTINUE == ( ret = InitializeDisk( &pDiskIn, DISK_ATR, szInFile, FALSE, g_bRepair, g_bRepairAuto ) ) ) +	{ +		g_dtypeIn = DISK_DI; +		if ( DI_RET_CONTINUE == ( ret = InitializeDisk( &pDiskIn, DISK_DI, szInFile, FALSE, g_bRepair, g_bRepairAuto ) ) ) +		{ +			g_dtypeIn = DISK_DCM; +			if ( DI_RET_CONTINUE == ( ret = InitializeDisk( &pDiskIn, DISK_DCM, szInFile, FALSE, g_bRepair, g_bRepairAuto ) ) ) +			{ +				g_dtypeIn = DISK_SCP; +				if ( DI_RET_CONTINUE == ( ret = InitializeDisk( &pDiskIn, DISK_SCP, szInFile, FALSE, g_bRepair, g_bRepairAuto ) ) ) +				{ +					g_dtypeIn = DISK_XFD; +					if ( DI_RET_CONTINUE == ( ret = InitializeDisk( &pDiskIn, DISK_XFD, szInFile, FALSE, g_bRepair, g_bRepairAuto ) ) ) +					{ +						printf( "Unable to determine format of disk image '%s'!\n", szInFile ); +						return FALSE; +					} +				} +			} +		} +	} + +	if ( ret == DI_RET_CANT_CONTINUE ) +		return FALSE; + +	printf( "Input file '%s' (%s)\n", szInFile, GetDiskTypeName( g_dtypeIn ) ); + +	if ( g_bVerbose ) +	{ +		DISK_GEOMETRY* pgeo = pDiskIn->GetGeometry(); +		printf( "Sides: %d\n", pgeo->iSides ); +		printf( "Tracks: %d\n", pgeo->iTracks ); +		printf( "SecPerTrack: %d\n", pgeo->iSectorsPerTrack ); +		printf( "BytesPerSec: %d\n", pgeo->iBytesPerSector ); +		printf( "Sectors: %d\n", pgeo->iSectors ); +	} + +	if ( g_bTestOnly ) +	{ +		printf( "File loaded OK.\n" ); +		delete pDiskIn; +		return TRUE; +	} + +	switch( g_dtypeOut ) +	{ +		case DISK_ATR: +			pDiskOut = new CAtr(); +			break; + +		case DISK_XFD: +			pDiskOut = new CXfd(); +			break; + +		case DISK_DI: +			pDiskOut = new CDi(); +			break; + +		case DISK_SCP: +			pDiskOut = new CScp(); +			break; + +		case DISK_DCM: +			pDiskOut = new CDcm(); +			break; + +		default: +			break; +	} + +	if ( !pDiskOut ) +	{ +		fprintf( stderr, "Can't create such image!\n" ); +		return FALSE; +	} + +	DISK_GEOMETRY* pgeo = pDiskIn->GetGeometry(); +	DISK_GEOMETRY forced; + +	memcpy( &forced, pgeo, sizeof( DISK_GEOMETRY ) ); + +	if ( g_bForceClassic ) +		ForceClassicSize( &forced ); + +	//duplicating the image +	pDiskOut->Duplicate( pDiskIn, &forced ); + +	printf( "Output file '%s' (%s)\n", szOutFile, GetDiskTypeName( g_dtypeOut ) ); + +	//and save it in new format +	if ( !pDiskOut->Save( szOutFile, g_bOverWrite ) ) +	{ +		printf( "Error! %s\n", pDiskOut->GetLastError() ); +		delete pDiskIn; +		delete pDiskOut; +		return FALSE; +	} + +	delete pDiskIn; +	delete pDiskOut; + +	return TRUE; +} + diff --git a/jindroush/acvt/pub.def b/jindroush/acvt/pub.def new file mode 100644 index 0000000..5068092 --- /dev/null +++ b/jindroush/acvt/pub.def @@ -0,0 +1,31 @@ +//    This program is free software; you can redistribute it and/or modify +//    it under the terms of the GNU General Public License as published by +//    the Free Software Foundation; either version 2 of the License, or +//    any later version. +// +//    This program is distributed in the hope that it will be useful, +//    but WITHOUT ANY WARRANTY; without even the implied warranty of +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +//    GNU General Public License for more details. +// +//    You should have received a copy of the GNU General Public License +//    along with this program; if not, write to the Free Software +//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// + +#define PRG_NAME	"acvt"	 +#define PRG_VERSION	"1.07" +#define PRG_COPYRIGHT	"2000-2001" +#define PRG_UNDERGPL	"1" +#define PRG_AUTHOR	"Jindrich Kubec <kubecj@asw.cz>" + +#define PRG_URL 	"http://www.asw.cz/~kubecj" + +#define PRG_DESC	"Converts between XFD-SCP-ATR-DCM-DI formats." +#define PRG_USAGE	"[options] sourcefile [destfile]" + +#define PRG_ARCH	"PC" +#define PRG_TOOLS	"PERL" + +#define PRG_SRCS "!GENERATED!" +#define PRG_BINS "rel/acvt.exe" diff --git a/jindroush/acvt/readme.txt b/jindroush/acvt/readme.txt new file mode 100644 index 0000000..e2b41d5 --- /dev/null +++ b/jindroush/acvt/readme.txt @@ -0,0 +1,152 @@ +Acvt v1.07 (c) 2000-2001 Jindrich Kubec <kubecj@asw.cz> +Latest version can be found at http://www.asw.cz/~kubecj + +This program is provided 'as is', no warranty will be taken +for any damage caused by it or by any use of it. + +The whole package is placed under the GNU Public License, for further +information on redistribution see the included file "GPL.TXT". + + +Description: +------------ +Converts between XFD-SCP-ATR-DCM-DI formats. +ATR - SIO2PC images +XFD - XFormer images +DCM - DiskCommunicator images +SCP - SpartaDos SCOPY images +DI  - XL/ST link / XLDJ disk images + +It's replacement for DOS version of Steven Tucker's Imagic. +It's in fact better because: +1) It's free. +2) It comes with source. +3) Therefore it could be ported to another architectures. +4) Contains less bugs. (Hope so.) +5) Can repair some invalid images. +6) Now also supports DI file format. + +Thanks go to: +Ernest Schreurs for his DiskCommunicator dissection and paper about DCM format. +Chad Wagner for DCMtoATR utility (DCM driver is still loosely based on his +	code). +Burian brothers for lots of DI files. + + +Usage: +------ +Acvt [options] sourcefile [destfile] + +sourcefile is Atari disk image (ATR,XFD,SCP,DCM,DI). + +destfile is output disk image. If omitted, output filename is created + automatically. + +-xfd -atr -scp -dcm -di options are output type modes. Default is -atr. + +-batchmode: turns on multi file processing mode. Only input files are specified + on command-line (Unix-like compatible regexp expressions are allowed when + compiled under DJGPP). Output filenames are created automatically. + +-autorepair: automatically determines the best repair method. + +-norepair: doesn't ask for repair options and considers input file invalid. + +-errstop: in batch mode ends on first error encountered. + +-over: overwrites existing files. Otherwise returns an error. + +-test: only loads input images and displays their state. + +-classic: forces to create 'classic' Atari disk sizes. + + +History: +-------- +Date, Author, Version +5/22/1999, kubecj, 0.10 +First version + +5/25/1999, kubecj, 0.15 +SCP save added + +5/29/1999, kubecj, 0.20 +DCM save added, decompression corrected + +5/30/1999, kubecj, 0.30 +Code cleanup + +6/1/1999, kubecj, 0.35 +Invalid DD ATR repair added + +6/2/1999, kubecj, 0.40 +Invalid DD XFD repair added +Invalid ATR length repair added +Added cached read for DCM decompression + +6/3/1999, kubecj, 0.42 +Code cleanup + +6/4/1999, kubecj, 0.43 +Added checks for DCM decompression +Check for multi-arc + +6/5/1999, kubecj, 1.00 +First public version + +6/10/1999, kubecj, 1.01 +Compatibility macros & valid archive :) + +6/11/1999, kubecj, 1.02 +Repaired repairing ;) + +6/13/1999, kubecj, 1.03 +Changed switches processing + +10/10/1999, kubecj, 1.04 +Only changed generation of archive, new version to avoid version checking +problems. + +6/6/2000, kubecj, 1.05 +Minor bugfix concerning repairing. +Added -classic commandline switch to force to create 'classic' disk sizes. + +2/26/2001, kubecj, 1.06 +Added DI file format. Its support is just a beta! + +3/8/2001, kubecj, 1.07 +Handling of double sided diskettes in DI format. + + +To Do: +------ +Maybe check pass count in DCM images? +Better handling of DI files. + + +Known Bugs: +----------- +DCM record 0x42 is not decompressed, code is present, but commented out and  + untested. I need some sample first. + +DI files are really an educated guess. There are many 'white places' for me. +I need the description of the disk format. + +Function for actual conversion is stupid. In fact in order to convert ATR to + XFD there is created Atr object, loaded in, and same Xfd object is created and  + all the data are duplicated. With 16MB SpartaDOS Atr images it's simply too  + much. + + +Compiling Tools: +---------------- +For scripts: Perl. +URL: http://www.perl.com + +For PC executables: DJGPP. +Sources were written/tested on GCC/Intel only. There should be only +minor problems to port it to different architectures/environments. +Makefile should need only minor changes. +URL: http://www.delorie.com + + diff --git a/jindroush/acvt/switches.def b/jindroush/acvt/switches.def new file mode 100644 index 0000000..763907b --- /dev/null +++ b/jindroush/acvt/switches.def @@ -0,0 +1,64 @@ +v +verbose output +=g_bVerbose = TRUE; += + +atr, a +output is ATR +=g_dtypeOut = DISK_ATR; += + +di +output is DI +=g_dtypeOut = DISK_DI; += + +xfd, x +output is XFD +=g_dtypeOut = DISK_XFD; += + +scp, s +output is SCP +=g_dtypeOut = DISK_SCP; += + +dcm, d +output is DCM +=g_dtypeOut = DISK_DCM; += + +batch, batchmode, b +batch mode +=g_bBatchMode = TRUE; += + +errstop +in batchmode stop on first error +=g_bFirstErrStop = TRUE; += + +over, overwrite +turns on file overwriting +=g_bOverWrite = TRUE; += + +autorepair +auto repair mode +=g_bRepairAuto = TRUE; += + +norepair +don't repair +=g_bRepair = FALSE; += + +test +only test input files +=g_bTestOnly = TRUE; += + +classic +force to create 'classic' disk formats +=g_bForceClassic = TRUE; += | 
