7.2.3.14 Find Hexmate Option

The -find=opcode option is used to detect and log occurrences of an opcode or code sequence in the Data field of data records in the HEX file. The usage of this option is:

-find=Findcode[mMask]@Start-End[/Align][w][t"Title"]

where:

  • Findcode is the hexadecimal code sequence to search for. For example, to find a clrf instruction with the opcode 0x01F1, use 01F1 as the sequence. In the HEX file, this will appear as the byte sequence F101, for example:
    :100FE800F5007C310800F001F10120000030860096
    .
  • Mask is optional. It specifies a bit mask applied over the Findcode value to allow a less restrictive search. It is entered in little endian byte order.
  • Start and End, whose interpretations are based on the addressing value (see 7.2.3.10 Addressing Hexmate Option), are addresses that limit the address range to search.
  • Align is optional. It specifies that a code sequence can only match if it begins on an address that is a multiple of this value.
  • w, if present, will cause Hexmate to issue a warning whenever the code sequence is detected.
  • Title is optional. It allows a title to be given to this code sequence. Defining a title will make log-reports and messages more descriptive and more readable. A title will not affect the actual search results.

All numerical arguments are assumed to be hexadecimal values.

For example, the option -find=1234@0-7FFF/2w will detect the code sequence 1234h (stored in the HEX file as 34 12) when aligned on a 2 (two) byte address boundary, between 0h and 7FFFh. The w character requests that a warning be issued each time this sequence is found.

If the option was instead, -find=1234M0F00@0-7FFF/2wt"ADDXY", the code sequence being matched is masked with 000Fh, so Hexmate will search for any of the opcodes 123xh, where x is any digit. If a byte-mask is used, it must be of equal byte-width to the opcode it is applied to. Any messaging or reports generated by Hexmate will refer to this opcode by the name, ADDXY, as this was the title defined for this search.

When requested (see 7.2.3.19 Logfile Hexmate Option, a log file will contain the results of all searches. The -find option accepts whole bytes of HEX data from 1 to 8 bytes in length. Optionally, -find can be used in conjunction with replace or delete (as described separately in the following sections).