#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
   int tableStart  = 0xF500;
   int tableLength = 256;
   int tableEnd    = tableStart + tableLength - 1;

   FILE *input = fopen(argv[1], "r");
   char  record[128];
   while (fgets(record, sizeof(record), input)) {
      //S113FD6001ADD6A609C7FE08A601ADCD86F7A60348
      if (strncmp(record, "S1", 2) != 0)
         printf("non-data %s", record);
      else { // We only care to ignore data records.
         // Copy out the four characters comprising the address.
         char sNum[5];
         strncpy(sNum, record+4, 4);
         sNum[4] = '\0';
         // Convert from a hex string into an integer.
         int nNum = strtol(sNum, NULL, 16);
         if (nNum >= tableStart && nNum <= tableEnd) {
            printf("ignoring %s = 0x%04x (%d)\n", sNum, nNum, nNum);
         }
         else {
            printf("keeping %s", record);
         }
      }
   }
   fclose(input);
}

