/************************************************************************
IDEFile to Disk Copy 4.2 image converter
------------------------------------------------------------------------
Filename : IDEFileToDC42.c
Version : 1.1
Author(s) : Natalia Portillo
Component : Main program loop.
--[ Description ]-------------------------------------------------------
Converts an IDEFile disk image to Disk Copy 4.2 format.
--[ License ] ----------------------------------------------------------
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 3 of the License, or
(at your option) 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, see .
------------------------------------------------------------------------
Copyright (C) 2011 Natalia Portillo
*************************************************************************/
#include
#include
#include
#include
#include
#include "libdc42.h"
//#define DEBUG 1
void usage()
{
printf("IDEFile to Disk Copy 4.2 image converter, version 1.1.\n"
"(C) 2011 Natalia Portillo, All Rights Reserved.\n"
"libdc32 (C) 2011 Ray Arachelian, All Rights Reserved.\n"
"Under GPL license.\n\n"
"Usage: IDEFileToDC42 IDEFile_Image.bin\n\n"
"This utility will take an IDEFile image and convert it to a Disk Copy 4.2\n"
"image suitable to be use on emulators.\n"
"Filename will be \"idefile.dc42\".\n"
);
}
long get_idefile_offset(int sector)
{
int offset_delta[] = {0,4,8,12,0,4,8,-4,0,4,-8,-4,0,-12,-8,-4};
return (sector + offset_delta[(sector % 16)]);
}
int main(int argc, char *argv[])
{
int i;
int dc42_errno;
int fd;
uint sectors;
struct stat file_stat;
DC42ImageType f_dc42;
FILE* f_idefile;
char *image=NULL;
uint8 *data, *tags;
uint32 datasize, tagsize;
char processed_idefile = 1;
for (i=1; i