outil_d_analyse_des_fichiers_de_configuration_nr3.dat
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| outil_d_analyse_des_fichiers_de_configuration_nr3.dat [2025/03/17 15:04] – created fool-duplex | outil_d_analyse_des_fichiers_de_configuration_nr3.dat [2025/03/19 14:22] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | Cet outil décode | + | ==== Outil d' |
| + | Cet outil décode | ||
| Exemple d' | Exemple d' | ||
| < | < | ||
| - | $ nr3datview | + | $ nrdatview |
| NRDATView, version 1.0 | NRDATView, version 1.0 | ||
| Line 48: | Line 49: | ||
| #include < | #include < | ||
| - | // Undefine this for Unix-like systems | + | # |
| - | # | + | |
| - | int gExtract | + | FILE *gSource |
| - | FILE *gSource = NULL; | + | unsigned char gBuffer[NRDATSIZE]; |
| - | unsigned char *gBuffer | + | |
| - | char *gFilename = NULL; | + | |
| - | long gSize = 0; | + | |
| - | char gIdentifier[9] = {0}; | ||
| - | unsigned char gFileType = 0; | ||
| - | void TargetApp(unsigned char xByte) | + | unsigned |
| { | { | ||
| - | | + | |
| - | { | + | } |
| - | case 0: | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | case 1: | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | case 2: | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | case 3: | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | default: | + | |
| - | printf(" | + | |
| - | } | + | |
| + | void GetSystemAppName(char* xBuffer, char* xOutput) | ||
| + | { | ||
| + | xOutput[0] = '/' | ||
| + | xOutput[1] = ':'; | ||
| + | memcpy(xOutput+2, | ||
| + | xOutput[10] = 0; | ||
| } | } | ||
| - | void TargetComputer(unsigned char xByte) | + | unsigned |
| { | { | ||
| - | | + | return xBuffer[11+(xIndex& |
| - | { | + | |
| - | case 0: | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | case 1: | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | case 2: | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | default: | + | |
| - | printf(" | + | |
| - | } | + | |
| } | } | ||
| - | void PageSwitch(unsigned char xPage) | + | unsigned |
| { | { | ||
| - | switch (xPage) | + | return xBuffer[25]; |
| - | { | + | } |
| - | case 0: | + | |
| - | printf(" | + | |
| - | | + | |
| - | case 0x40: | + | unsigned int GetListingHeader(char *xBuffer) |
| - | case 0x41: | + | { |
| - | case 0x42: | + | |
| - | case 0x43: | + | |
| - | case 0x44: | + | |
| - | case 0x45: | + | |
| - | printf(" | + | |
| - | | + | |
| - | + | ||
| - | case 0x80: | + | |
| - | case 0x81: | + | |
| - | case 0x82: | + | |
| - | case 0x83: | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | + | ||
| - | case 0xff: | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | + | ||
| - | default: | + | |
| - | printf(" | + | |
| - | } | + | |
| - | printf(" | + | |
| } | } | ||
| - | void AnalyseBinExt(unsigned char *xpBuffer) | + | unsigned |
| { | { | ||
| - | | + | |
| - | unsigned int lSection = 1, lSize = 0, lAddress = 0; | + | |
| - | char lBuffer[33] = {0}; | + | |
| - | char *lFilename = NULL; | + | |
| - | unsigned char lPage = 0; | + | |
| - | FILE *lDump = NULL; | + | |
| - | + | ||
| - | printf(" | + | |
| - | TargetComputer(xpBuffer[1]); | + | |
| - | printf(" | + | |
| - | + | ||
| - | printf(" | + | |
| - | TargetApp(xpBuffer[2]); | + | |
| - | printf(" | + | |
| - | + | ||
| - | printf(" | + | |
| - | if (xpBuffer[3]& | + | |
| - | { | + | |
| - | printf(" | + | |
| - | } | + | |
| - | if (xpBuffer[3]& | + | |
| - | { | + | |
| - | if (xpBuffer[3]& | + | |
| - | { | + | |
| - | printf(", | + | |
| - | } | + | |
| - | printf(" | + | |
| - | } | + | |
| - | printf(" | + | |
| - | + | ||
| - | strncpy(lBuffer, | + | |
| - | printf(" | + | |
| - | + | ||
| - | while (xpBuffer[lOffset]!=3) | + | |
| - | { | + | |
| - | printf(" | + | |
| - | lSize = xpBuffer[lOffset+1]*256+xpBuffer[lOffset+2]; | + | |
| - | lPage = xpBuffer[lOffset+5]; | + | |
| - | printf(" | + | |
| - | lAddress = xpBuffer[lOffset+3]*256+xpBuffer[lOffset+4]; | + | |
| - | printf(" | + | |
| - | + | ||
| - | PageSwitch(lPage); | + | |
| - | printf(" | + | |
| - | + | ||
| - | if (gExtract) | + | |
| - | { | + | |
| - | lFilename = (char*)malloc(strlen(gFilename+11)); | + | |
| - | sprintf(lFilename," | + | |
| - | lDump = fopen(lFilename," | + | |
| - | fwrite(xpBuffer+lOffset+6, | + | |
| - | fclose(lDump); | + | |
| - | printf(" | + | |
| - | free(lFilename); | + | |
| - | } | + | |
| - | + | ||
| - | lOffset += 6+lSize; | + | |
| - | + | ||
| - | lSection++; | + | |
| - | } | + | |
| - | + | ||
| - | lPage = xpBuffer[lOffset+5]; | + | |
| - | printf(" | + | |
| - | PageSwitch(lPage); | + | |
| } | } | ||
| - | void AnalyseBinSimple(unsigned char *xpBuffer) | + | unsigned |
| { | { | ||
| - | | + | |
| - | unsigned int lSection = 1, lSize = 0, lAddress = 0; | + | |
| - | char *lFilename = NULL; | + | |
| - | FILE *lDump = NULL; | + | |
| - | + | ||
| - | while (xpBuffer[lOffset]==0) | + | |
| - | { | + | |
| - | printf(" | + | |
| - | lSize = xpBuffer[lOffset+1]*256+xpBuffer[lOffset+2]; | + | |
| - | printf(" | + | |
| - | lAddress = xpBuffer[lOffset+3]*256+xpBuffer[lOffset+4]; | + | |
| - | printf(" | + | |
| - | printf(" | + | |
| - | + | ||
| - | if (gExtract) | + | |
| - | { | + | |
| - | lFilename = (char*)malloc(strlen(gFilename+11)); | + | |
| - | sprintf(lFilename," | + | |
| - | lDump = fopen(lFilename," | + | |
| - | fwrite(xpBuffer+lOffset+6, | + | |
| - | fclose(lDump); | + | |
| - | printf(" | + | |
| - | free(lFilename); | + | |
| - | } | + | |
| - | + | ||
| - | lOffset += 5+lSize; | + | |
| - | lSection++; | + | |
| - | } | + | |
| - | + | ||
| - | printf(" | + | |
| } | } | ||
| - | void AnalyseBin(unsigned char *xpBuffer) | + | void GetSignature(char *xBuffer, |
| { | { | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | printf("extended\n"); | + | |
| - | | + | } |
| - | } else | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | } | + | |
| } | } | ||
| - | void ExtractFilename(char *xSrcStr, char **xStrDst) | + | void GetBootApplicationFilename(char *xBuffer, unsigned int xIndex, char* xOutput) |
| { | { | ||
| - | | + | |
| - | #ifdef PATH_WINDOWS | + | |
| - | ' | + | |
| - | #else | + | |
| - | '/' | + | |
| - | #endif // PATH_WINDOWS | + | |
| - | ); | + | |
| - | | + | |
| - | | + | |
| - | *xStrDst | + | |
| - | strcpy(*xStrDst, | + | while ((xBuffer[xIndex*44+61+i]!=' |
| - | | + | |
| - | | + | |
| - | | + | |
| - | *xStrDst = (char*) malloc(strlen(lPtr)); | + | |
| - | | + | |
| - | | + | |
| } | } | ||
| + | |||
| void usage() | void usage() | ||
| { | { | ||
| - | printf(" | + | printf(" |
| } | } | ||
| int main(int argc, char *argv[]) | int main(int argc, char *argv[]) | ||
| { | { | ||
| - | | + | |
| + | char lTmpStr[65]; | ||
| - | printf(" | + | printf(" |
| - | if ((argc!=2)&& | + | if ((argc!=2)) |
| { | { | ||
| usage(); | usage(); | ||
| Line 289: | Line 137: | ||
| } | } | ||
| - | | + | gSource = fopen(argv[1]," |
| - | { | + | |
| - | if (argc!=3) | + | |
| - | { | + | |
| - | | + | |
| - | | + | |
| - | } | + | |
| - | if (argv[1][1] == ' | + | |
| - | { | + | |
| - | gExtract = 1; | + | |
| - | } | + | |
| - | else | + | |
| - | { | + | |
| - | | + | |
| - | | + | |
| - | } | + | |
| - | } else if (argc!=2) | + | |
| - | { | + | |
| - | | + | |
| - | | + | |
| - | } | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | if (gExtract) | + | |
| - | { | + | |
| - | ExtractFilename(argv[2],& | + | |
| - | gSource = fopen(argv[2]," | + | |
| - | } else | + | |
| - | { | + | |
| - | ExtractFilename(argv[1],& | + | |
| - | | + | |
| - | } | + | |
| if (gSource == NULL) | if (gSource == NULL) | ||
| { | { | ||
| printf(" | printf(" | ||
| - | free(gFilename); | ||
| return -2; | return -2; | ||
| } | } | ||
| - | | + | |
| - | gSize = ftell(gSource); | + | |
| - | | + | |
| - | + | | |
| - | | + | if ((lTmpuInt!=0x0301)&& |
| - | if (gBuffer | + | |
| { | { | ||
| - | printf(" | + | printf(" |
| - | free(gFilename); | + | |
| - | fclose(gSource); | + | |
| return -3; | return -3; | ||
| } | } | ||
| - | memset(gBuffer, | ||
| - | | + | |
| - | fclose(gSource); | + | |
| - | | + | |
| - | | + | printf(" |
| - | | + | |
| - | free(gBuffer); | + | |
| - | free(gFilename); | + | |
| - | return -4; | + | |
| - | } | + | |
| - | | + | |
| - | printf(" | + | |
| - | + | ||
| - | strncpy(gIdentifier, | + | |
| - | printf(" | + | |
| - | if (strncmp(gIdentifier," | + | |
| { | { | ||
| - | printf(" | + | printf(" |
| } | } | ||
| - | printf(" | ||
| - | | + | printf(" |
| - | | + | |
| - | switch | + | printf(" |
| - | { | + | printf(" |
| - | case 0: | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | | + | |
| - | printf("BASIC data"); | + | |
| - | break; | + | |
| - | | + | |
| - | | + | |
| - | break; | + | |
| - | case 3: | + | |
| - | printf("source code"); | + | |
| - | break; | + | |
| - | case 5: | + | |
| - | printf("indexed data" | + | |
| - | break; | + | |
| - | default: | + | |
| - | printf("unknown"); | + | |
| - | } | + | |
| - | printf(" | + | |
| - | | + | printf(" |
| - | switch (gBuffer[18]) | + | |
| - | { | + | |
| - | case 0: | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | case 0xff: | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | default: | + | |
| - | printf(" | + | |
| - | } | + | |
| - | | + | |
| - | | + | |
| - | switch (gBuffer[23]) | + | |
| - | { | + | printf(" |
| - | case 0: | + | if (lTmpuInt) { |
| - | printf(" | + | printf(" |
| - | break; | + | } else |
| - | case 0xff: | + | |
| - | printf(" | + | |
| - | | + | |
| - | default: | + | |
| - | printf(" | + | |
| - | } | + | |
| - | printf(" | + | |
| - | + | ||
| - | printf(" | + | |
| - | + | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | } | + | |
| - | else | + | |
| - | { | + | |
| - | | + | |
| - | } | + | |
| - | printf(" | + | |
| - | + | ||
| - | printf(" | + | |
| - | TargetComputer(gBuffer[32]); | + | |
| - | printf(" | + | |
| - | + | ||
| - | printf(" | + | |
| - | TargetApp(gBuffer[33]); | + | |
| - | printf(" | + | |
| - | + | ||
| - | printf(" | + | |
| - | for (i=80; | + | |
| - | { | + | |
| - | | + | |
| - | | + | |
| - | for (i=96; | + | |
| - | { | + | |
| - | if (i%16==0) | + | |
| { | { | ||
| - | printf(" | + | printf(" |
| } | } | ||
| - | printf(" | ||
| - | |||
| } | } | ||
| - | printf(" | ||
| - | | + | |
| + | printf(" | ||
| + | for (i=0; | ||
| { | { | ||
| - | | + | |
| + | printf(" | ||
| + | GetBootApplicationFilename(gBuffer, | ||
| + | printf(" | ||
| } | } | ||
| - | free(gBuffer); | ||
| - | free(gFilename); | ||
| return 0; | return 0; | ||
| } | } | ||
| - | |||
| </ | </ | ||
outil_d_analyse_des_fichiers_de_configuration_nr3.dat.1742220295.txt.gz · Last modified: (external edit)
