Skip to content

Instantly share code, notes, and snippets.

@shattered
Created June 21, 2018 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shattered/6d38371216ee5bbb8df29df11307656d to your computer and use it in GitHub Desktop.
Save shattered/6d38371216ee5bbb8df29df11307656d to your computer and use it in GitHub Desktop.
experimental patch to HxC's experimental GCR encoder
Index: libhxcfe/trunk/sources/tracks/gcr_track.c
===================================================================
--- libhxcfe/trunk/sources/tracks/gcr_track.c (revision 1565)
+++ libhxcfe/trunk/sources/tracks/gcr_track.c (working copy)
@@ -111,10 +111,10 @@
nongcrcode=nongcrpart[l];
- if(!((nongcrcode>>shift)&0xF))
+ if(!((nongcrcode>>(4-shift))&0xF))
{
- gcrcode=gcrencodingtable[(byte>>shift)&0xF];
+ gcrcode=gcrencodingtable[(byte>>(4-shift))&0xF];
for(j=0;j<5;j++)
{
@@ -139,7 +139,7 @@
}
else
{//non gcr - direct copy
- quartet=(byte>>shift)&0xF;
+ quartet=(byte>>(4-shift))&0xF;
for(j=0;j<4;j++)
{
@@ -253,7 +253,7 @@
j++;
tempdata[j]=l; // Sector
j++;
- tempdata[j]=tracknumber; // Track
+ tempdata[j]=tracknumber + 1; // Track
j++;
tempdata[j]=0xA1; // Format ID byte #2
j++;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment