ckoba Posted April 1, 2016 Share Posted April 1, 2016 (edited) As reported at http://atariage.com/forums/topic/243766-bin-repository-images-for-burning-cartridges/?view=findpost&p=3433677 and http://atariage.com/forums/topic/243766-bin-repository-images-for-burning-cartridges/?view=findpost&p=3480657 ... ... there's a bug in the HxC floppy image conversion program that prevents conversion from .hfe back to .dsk for 80-track DSSD disk images. In my opinion, the geometry selection logic is flawed -- it decides what the disk image format is based on disk size, and there's a size overlap between 80-track DSSD FM-encoded images and 40-track DSDD MFM-encoded images. I posted a rough patch last night in another thread, have worked out a cleaner solution this morning, and have opened a ticket with the upstream developer on GitHub. I believe that the geometry should be parsed from sector 0 of the .hfe (trying FM first as it's most common, then falling through to MFM) but that involves more code churn than is necessary to fix this particular use case. With luck the patch will be accepted and integrated into a near-future release of the software. In the meantime, the patch to libhxcfe is at the end of this post. I've posted this in the main discussion area, rather than development, because this issue affects non-coding end-users. For those who need binaries for any platform except Windows, please PM me or post here and I'll compile it for you. Cheers. diff --git a/sources/loaders/ti99v9t9_loader/ti99v9t9_writer.c b/sources/loaders/ti99v9t9_loader/ti99v9t9_writer.c index ba0d0e4..4a206f7 100644 --- a/sources/loaders/ti99v9t9_loader/ti99v9t9_writer.c +++ b/sources/loaders/ti99v9t9_loader/ti99v9t9_writer.c @@ -55,6 +55,7 @@ int TI99V9T9_libWrite_DiskFile(HXCFE_IMGLDR* imgldr_ctx,HXCFE_FLOPPY * floppy,ch int32_t sectorsize; unsigned char * diskimage; int error; + int fm_fallback = 0; HXCFE_SECTORACCESS* ss; HXCFE_SECTCFG* sc; @@ -129,6 +130,7 @@ int TI99V9T9_libWrite_DiskFile(HXCFE_IMGLDR* imgldr_ctx,HXCFE_FLOPPY * floppy,ch bitrate=250000; density=ISOIBM_MFM_ENCODING; interleave=5; + fm_fallback=1; break; case 2*80*18*256: @@ -167,6 +169,20 @@ int TI99V9T9_libWrite_DiskFile(HXCFE_IMGLDR* imgldr_ctx,HXCFE_FLOPPY * floppy,ch ss = hxcfe_initSectorAccess(imgldr_ctx->hxcfe,floppy); if(ss) { + if (fm_fallback) { + sc = hxcfe_searchSector(ss,0,0,0,density); + if (!sc){ + imgldr_ctx->hxcfe->hxc_printf(MSG_INFO_1,"DSDD MFM probe failed, trying DSSD FM."); + numberoftrack = 80; + numberofsector = 9; + density = ISOIBM_FM_ENCODING; + imagesize = numberofsector * numberoftrack * numberofside * sectorsize; + diskimage = realloc(diskimage, imagesize); + if (!diskimage) + return HXCFE_INTERNALERROR; + memset(diskimage,0xF6, imagesize); + } + } for(i=0;i<numberofside;i++) { for(j=0;j<numberoftrack;j++) Edited April 1, 2016 by ckoba Quote Link to comment Share on other sites More sharing options...
ckoba Posted April 1, 2016 Author Share Posted April 1, 2016 Update: the author has committed the patch to the repository, and this fix will be in the next release. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.