; This program will compare two files and display their differences in another file. ; This particular program was designed to compare the dumped contents of ; a memory range starting at address 0x2000F with each line (address) being ; incremented by 15 or 0xF. You will need a known good "dump" to be used as ; the comparison file. The program will compare each line and if it detects a ; difference it will display what the data should be vs. what was actually received ; in a separate file. proc main integer Flag = 0, Count = 131087 ;Count represents the starting address = 0x2000F in hexidecimal string sTarget, sDump, sFileDiff usermsg "Click OK to compare files." FOPEN 1 "C:\COMP.TXT" READ TEXT ;Comparison File FOPEN 2 "C:\DL.TXT" READ TEXT ;Downloaded/Dumped File FOPEN 3 "C:\RESULTS.TXT" CREATE TEXT ;Results File while not FEOF 1 ;As long as we are not at the end of the file, continue fgets 1 sTarget ;Get string in comparison file fgets 2 sDump ;Get sting in dumped file if STRCMP sTarget sDump ;Compare the same line in both files Count = Count + 15 ;If they are the same go to the next line (HEX) else Flag++ ;Set the flag indicating a file difference STRFMT sFileDiff " Ending Address %#x : Data should be %s" Count sTarget ;Display address and correct data fputs 3 sFileDiff STRFMT sFileDiff " Ending Address %#x : Received data is %s" Count sDump ;Display address and bad data fputs 3 sFileDiff sFileDiff = " " fputs 3 sFileDiff Count = Count + 15 ;Continue with next line (HEX) endif endwhile if Flag != 0 usermsg "Differences were detected - Open file C:\RESULTS.TXT to view differences" else usermsg "File comparison passed." delfile "C:\DL.TXT" ;Delete downloaded file if comparison passes delfile "C:\RESULTS.TXT" ;Delete results file which has no data endif endproc