diff options
-rw-r--r-- | unprotbas.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/unprotbas.c b/unprotbas.c index bf1fb7e..6dd263c 100644 --- a/unprotbas.c +++ b/unprotbas.c @@ -235,11 +235,17 @@ int fixcode(void) { if(verbose) fprintf(stderr, "End program pos $%04x/%d\n", pos, pos); if(filelen > pos) { - if(verbose) fprintf(stderr, "trailing garbage at EOF, %d bytes, %s\n", - filelen - pos, (keepgarbage ? "keeping" : "removing")); + int i, nonzero = 0; + for(i = pos; i < filelen; i++) + if(data[i]) nonzero = 1; + if(verbose) { + fprintf(stderr, "trailing garbage at EOF, %d bytes, %s, %s\n", + filelen - pos, + nonzero ? "maybe valid data" : "all zeroes", + (keepgarbage ? "keeping" : "removing")); + } if(!keepgarbage) filelen = pos; } - return result; } |