// Remap sectors for Amstrad 1512 with ST225 drive. No error handling #include #include int main() { unsigned char b1[512*17]; unsigned char b2[512*17]; // Shift should be second number in reported interleave //Interleave (not checked): 0 3 6 9 12 15 1 4 7 10 13 16 2 5 8 11 14 int shift = 3; int rc; int i; while (1) { rc = read(STDIN_FILENO, b1, sizeof(b1)); if (rc < sizeof(b1)) { break; } for (i = 0; i < 17; i++) { memcpy(&b2[i*512], &b1[((i + shift) % 17)*512], 512); } write(STDOUT_FILENO, b2, sizeof(b2)); } }