mirror of
https://github.com/jfdelnero/HxCFloppyEmulator.git
synced 2026-07-28 04:06:36 +00:00
Infos option : extract the number of bad sectors.
This commit is contained in:
@@ -656,7 +656,7 @@ int infofile(HXCFE* hxcfe,char * infile)
|
||||
int loaderid;
|
||||
int ret;
|
||||
HXCFE_FLOPPY * floppydisk;
|
||||
int ifmode,nbofsector;
|
||||
int ifmode,nbofsector,nbofbadsector;
|
||||
HXCFE_IMGLDR * imgldr_ctx;
|
||||
|
||||
printf("---------------------------------------------------------------------------\n");
|
||||
@@ -699,8 +699,9 @@ int infofile(HXCFE* hxcfe,char * infile)
|
||||
printf("Floppy interface mode : %s - %s\n",hxcfe_getFloppyInterfaceModeName(hxcfe,ifmode),hxcfe_getFloppyInterfaceModeDesc(hxcfe,ifmode));
|
||||
printf("Number of Track : %d\n",hxcfe_getNumberOfTrack(hxcfe,floppydisk) );
|
||||
printf("Number of Side : %d\n",hxcfe_getNumberOfSide(hxcfe,floppydisk) );
|
||||
printf("Total Size : %d Bytes, ",hxcfe_getFloppySize (hxcfe,floppydisk,&nbofsector));
|
||||
printf("Number of sectors : %d",nbofsector);
|
||||
printf("Total Size : %d Bytes, ",hxcfe_getFloppySize (hxcfe,floppydisk,&nbofsector,&nbofbadsector));
|
||||
printf("Number of sectors : %d, ",nbofsector);
|
||||
printf("Number of bad sectors : %d\n",nbofbadsector);
|
||||
|
||||
ifmode = hxcfe_floppyGetInterfaceMode(hxcfe,floppydisk);
|
||||
|
||||
@@ -781,7 +782,7 @@ int imagedir(HXCFE* hxcfe,char * infile)
|
||||
int loaderid;
|
||||
int ret;
|
||||
HXCFE_FLOPPY * floppydisk;
|
||||
int ifmode,nbofsector;
|
||||
int ifmode,nbofsector,nbofbadsector;
|
||||
HXCFE_FSMNG * fsmng;
|
||||
HXCFE_IMGLDR * imgldr_ctx;
|
||||
|
||||
@@ -825,8 +826,9 @@ int imagedir(HXCFE* hxcfe,char * infile)
|
||||
printf("Floppy interface mode : %s - %s\n",hxcfe_getFloppyInterfaceModeName(hxcfe,ifmode),hxcfe_getFloppyInterfaceModeDesc(hxcfe,ifmode));
|
||||
printf("Number of Track : %d\n",hxcfe_getNumberOfTrack(hxcfe,floppydisk) );
|
||||
printf("Number of Side : %d\n",hxcfe_getNumberOfSide(hxcfe,floppydisk) );
|
||||
printf("Total Size : %d Bytes, ",hxcfe_getFloppySize (hxcfe,floppydisk,&nbofsector));
|
||||
printf("Number of sectors : %d\n",nbofsector);
|
||||
printf("Total Size : %d Bytes, ",hxcfe_getFloppySize (hxcfe,floppydisk,&nbofsector,&nbofbadsector));
|
||||
printf("Number of sectors : %d, ",nbofsector);
|
||||
printf("Number of bad sectors : %d\n",nbofbadsector);
|
||||
|
||||
ifmode = hxcfe_floppyGetInterfaceMode(hxcfe,floppydisk);
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ HXCFE_FLOPPY* hxcfe_getFloppy ( HXCFE_FLPGEN* fb_ctx );
|
||||
int32_t hxcfe_setDiskFlags( HXCFE_FLPGEN* fb_ctx, int32_t flags );
|
||||
int32_t hxcfe_generateDisk( HXCFE_FLPGEN* fb_ctx, HXCFE_FLOPPY* floppy, void * f, uint8_t * diskdata, int32_t buffersize );
|
||||
|
||||
int32_t hxcfe_getFloppySize( HXCFE* floppycontext, HXCFE_FLOPPY *fp, int32_t * nbsector );
|
||||
int32_t hxcfe_getFloppySize( HXCFE* floppycontext, HXCFE_FLOPPY *fp, int32_t * nbsector, int32_t * nbbadsector );
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// XML based Raw File loader //
|
||||
|
||||
@@ -59,7 +59,7 @@ int TI99V9T9_libWrite_DiskFile(HXCFE_IMGLDR* imgldr_ctx,HXCFE_FLOPPY * floppy,ch
|
||||
|
||||
imgldr_ctx->hxcfe->hxc_printf(MSG_INFO_1,"Write TI99 V9T9 file %s...",filename);
|
||||
|
||||
imagesize=hxcfe_getFloppySize(imgldr_ctx->hxcfe,floppy,&nbsector);
|
||||
imagesize=hxcfe_getFloppySize(imgldr_ctx->hxcfe,floppy,&nbsector,NULL);
|
||||
|
||||
imgldr_ctx->hxcfe->hxc_printf(MSG_INFO_1,"Disk size : %d Bytes %d Sectors",imagesize,nbsector);
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ int XML_libWrite_DiskFile(HXCFE_IMGLDR* imgldr_ctx,HXCFE_FLOPPY * floppy,char *
|
||||
xmlfile=hxc_fopen(filename,"w+");
|
||||
if(xmlfile)
|
||||
{
|
||||
imagesize = hxcfe_getFloppySize(imgldr_ctx->hxcfe,floppy,0);
|
||||
imagesize = hxcfe_getFloppySize(imgldr_ctx->hxcfe,floppy,0,0);
|
||||
|
||||
ss=hxcfe_initSectorAccess(imgldr_ctx->hxcfe,floppy);
|
||||
if(ss)
|
||||
|
||||
@@ -599,44 +599,46 @@ uint8_t * hxcfe_getSectorData(HXCFE_SECTORACCESS* ss_ctx,HXCFE_SECTCFG* sc)
|
||||
return sc->input_data;
|
||||
}
|
||||
|
||||
int32_t hxcfe_getFloppySize( HXCFE* floppycontext, HXCFE_FLOPPY *fp, int32_t * nbsector )
|
||||
int32_t hxcfe_getFloppySize( HXCFE* floppycontext, HXCFE_FLOPPY *fp, int32_t * nbsector, int32_t * nbbadsector )
|
||||
{
|
||||
HXCFE_SECTORACCESS* ss_ctx;
|
||||
HXCFE_SECTCFG* sc;
|
||||
int floppysize;
|
||||
int nbofsector;
|
||||
int nbofbadsectors;
|
||||
int track;
|
||||
int side;
|
||||
int i,type,secfound,t;
|
||||
int typetab[16];
|
||||
|
||||
floppysize=0;
|
||||
nbofsector=0;
|
||||
floppysize = 0;
|
||||
nbofsector = 0;
|
||||
nbofbadsectors = 0;
|
||||
|
||||
type=0;
|
||||
secfound=0;
|
||||
type = 0;
|
||||
secfound = 0;
|
||||
|
||||
i=0;
|
||||
typetab[i++]=ISOIBM_MFM_ENCODING;
|
||||
typetab[i++]=AMIGA_MFM_ENCODING;
|
||||
typetab[i++]=ISOIBM_FM_ENCODING;
|
||||
typetab[i++]=TYCOM_FM_ENCODING;
|
||||
typetab[i++]=MEMBRAIN_MFM_ENCODING;
|
||||
typetab[i++]=EMU_FM_ENCODING;
|
||||
typetab[i++]=APPLEII_GCR1_ENCODING;
|
||||
typetab[i++]=APPLEII_GCR2_ENCODING;
|
||||
typetab[i++]=APPLEMAC_GCR_ENCODING;
|
||||
typetab[i++]=-1;
|
||||
i = 0;
|
||||
typetab[i++] = ISOIBM_MFM_ENCODING;
|
||||
typetab[i++] = AMIGA_MFM_ENCODING;
|
||||
typetab[i++] = ISOIBM_FM_ENCODING;
|
||||
typetab[i++] = TYCOM_FM_ENCODING;
|
||||
typetab[i++] = MEMBRAIN_MFM_ENCODING;
|
||||
typetab[i++] = EMU_FM_ENCODING;
|
||||
typetab[i++] = APPLEII_GCR1_ENCODING;
|
||||
typetab[i++] = APPLEII_GCR2_ENCODING;
|
||||
typetab[i++] = APPLEMAC_GCR_ENCODING;
|
||||
typetab[i++] = -1;
|
||||
|
||||
ss_ctx=hxcfe_initSectorAccess(floppycontext,fp);
|
||||
ss_ctx = hxcfe_initSectorAccess(floppycontext,fp);
|
||||
if(ss_ctx)
|
||||
{
|
||||
for(track=0;track<fp->floppyNumberOfTrack;track++)
|
||||
{
|
||||
for(side=0;side<fp->floppyNumberOfSide;side++)
|
||||
{
|
||||
secfound=0;
|
||||
type=0;
|
||||
secfound = 0;
|
||||
type = 0;
|
||||
|
||||
while(typetab[type]!=-1 && !secfound)
|
||||
{
|
||||
@@ -648,7 +650,20 @@ int32_t hxcfe_getFloppySize( HXCFE* floppycontext, HXCFE_FLOPPY *fp, int32_t * n
|
||||
{
|
||||
floppysize=floppysize+sc->sectorsize;
|
||||
nbofsector++;
|
||||
secfound=1;
|
||||
|
||||
if( sc->use_alternate_data_crc == 0x1 )
|
||||
{
|
||||
nbofbadsectors++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!sc->input_data)
|
||||
{
|
||||
nbofbadsectors++;
|
||||
}
|
||||
}
|
||||
|
||||
secfound = 1;
|
||||
|
||||
hxcfe_freeSectorConfig(ss_ctx,sc);
|
||||
}
|
||||
@@ -665,20 +680,22 @@ int32_t hxcfe_getFloppySize( HXCFE* floppycontext, HXCFE_FLOPPY *fp, int32_t * n
|
||||
|
||||
if(secfound)
|
||||
{
|
||||
t=typetab[0];
|
||||
typetab[0]=typetab[type];
|
||||
typetab[type]=t;
|
||||
t = typetab[0];
|
||||
typetab[0] = typetab[type];
|
||||
typetab[type] = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(nbsector)
|
||||
*nbsector=nbofsector;
|
||||
*nbsector = nbofsector;
|
||||
|
||||
if(nbbadsector)
|
||||
*nbbadsector = nbofbadsectors;
|
||||
|
||||
hxcfe_deinitSectorAccess(ss_ctx);
|
||||
return floppysize;
|
||||
|
||||
}
|
||||
|
||||
int32_t hxcfe_readSectorData( HXCFE_SECTORACCESS* ss_ctx, int32_t track, int32_t side, int32_t sector, int32_t numberofsector, int32_t sectorsize, int32_t type, uint8_t * buffer, int32_t * fdcstatus )
|
||||
|
||||
Reference in New Issue
Block a user