Hi, I rx a drive from Gujrat (beautiful state in India btw) from a a starter DR guy. It was a WD PURZ with MOD 01 erased. I tried to load various other available 01s in RAM to access the SA however very less portion of the SA alligned with the address pointer loaded in the RAM (ie donor 01). So it was decided to take a track dump from primary heads 0 and 1. DFL has an option to do Tracks to Mods however it apparently first locates 01 in the track files and then using the same as reference manages to extract other modules while also performing the checksum on them (can save mods with err in checksum aswell).
So I wrote a little C program to find all ROYL headers in the loaded track file, display its offset and display the mod name associated with the header... Here it is, hope you enjoy. Also, last step needs to be programmed where it perform this program over and over for all track files. I may have included extra header files. One can also load up ROM code to localize mods.
#include<stdio.h> #include<conio.h> #include<stdlib.h> #include<stddef.h> #include <string.h> int main(void) { FILE *file; unsigned char *buffer; unsigned long fileLen; unsigned char roylheader[4] = {0x52,0x4F,0x59,0x4C}; file = fopen("C:\\rom.bin","rb"); //Get file length fseek(file, 0, SEEK_END); fileLen=ftell(file); fseek(file, 0, SEEK_SET); //Allocate memory buffer=(unsigned char *)malloc(fileLen+1); if (!buffer) { fprintf(stderr, "Memory error!"); fclose(file); return 0 ; } //Read file contents into buffer fread(buffer, fileLen, 1, file); fclose(file); //Do what ever with buffer int i=0; while ( i <fileLen) { int j = i; //printf("%X ", buffer[i]); // if ((i+1)%16 == 0) printf("\n"); if(buffer[j] == roylheader[0] && buffer[j+1] == roylheader[1] && buffer[j+2] == roylheader[2] && buffer[j+3] == roylheader[3] ) { char hex[5]; sprintf(hex, "%x", j); printf("Royl header with modname %x%x found at offset\t", buffer[i+8] , buffer[i+9]); puts(hex); j=0; //set current location j to zero so that it aligns with i later on// } i++; } }
|