begin implementing filtering of similarities based on explanation of common instruction sequences

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-24 09:47:51 +09:30
1 parent 2829f5cda7
commit 1d1e1e8baf
2 files changed
+36 -2

No files matched your search

+25 -2
View File
@@ -93,11 +93,34 @@ int main(int argc,char **argv)
if (k>2) {
matches[k]++;
}
if (k>3) {
if (k>2) {
char similarity_name[MAX_SIZE];
snprintf(similarity_name,MAX_SIZE,"strings/");
int offset=strlen(similarity_name);
for(int b=0;b<k;b++) {
snprintf(&similarity_name[offset],MAX_SIZE-offset,"%02X",f1[i+b]);
offset+=2;
}
FILE *f=fopen(similarity_name,"r");
if (f) {
// Get explanation why this match is irrelevant
char line[1024]; line[0]=0;
fgets(line,1024,f);
while (line[0]&&line[strlen(line)-1]=='\r') line[strlen(line)-1]=0;
while (line[0]&&line[strlen(line)-1]=='\n') line[strlen(line)-1]=0;
fprintf(stderr,"Ignoring $%04X = $%04X + %d (%s)\n",
i,j,k,line);
break;
fclose(f);
}
// Display particularly long matches
printf("$%04X = $%04X :",i,j);
for(int b=0;b<k;b++) printf(" %02X",f1[i+b]);
for(int b=0;b<k;b++) {
printf(" %02X",f1[i+b]);
}
printf("\n");
}
}
+11
View File
@@ -0,0 +1,11 @@
Branch over following JSR instruction
A branch with argument $03 skips the following 3 bytes.
A JSR instruction has the initial byte value of $20.
Therefore $F0 $XX $20 is part of a
Bxx +
JSR $xxxx
*
instruction sequence.
This is a very common construction, and the logical way to
conditionally call a routines, and therefore is not copyrightable.