An Equate is a string substitution for scalar (a numeric value) in any code unit (instruction operand or data). For example, consider the instruction below:
MOV R2, $0xb
The scalar $0xb can be replaced with the string BATTERY_FLAG_CRITICAL. This will yield the following:
MOV R2, BATTERY_FLAG_CRITICAL
The substitution of "BATTERY_FLAG_CRITICAL" for $0xb is called an equate. That is, $0xb is equated to "BATTERY_FLAG_CRITICAL". Note that the default choice for the new equate application is your current location. "BATTERY_FLAG_CRITICAL" will replace the scalar value $0xb only at the current cursor location unless you choose a different option. However, when replacing another scalar of the same value, a list of previously declared Equates for that scalar value is presented.
Scalars can only be equated to strings. The string can be of any length and may contain spaces and special characters. Duplicate equate names are not allowed.
It should be noted that for the purposes of this document, "scalars" refers to scalar values contained in code units. A code unit is an instruction operand or other data element.
There are several operations that are associated with Equates. They are:
The Set Equate action will create one or more Equates in the Listing.
To set an Equate:
The list of strings shown in the Set Equate dialog are generated from two sources. The first source is all the currently assigned equates to the given value. The other source is all the Enum datatypes that exist in all the open datatype archives. If an Enum datatype exists that has a member value equal to the given equate value, then that string will be included.
The open data type archives contain valid enums and "fake" enums. The fake enums are created from #define values (parsed from .h files), specifically so that they will be available in the Set Equate dialog.
Each entry in the dialog is color-coded based upon how it is being used as an equate.
- Blue: Blue entries are existing user-defined string equates that are being used for that scalar.
- Black: Black entries are existing enum field equates being used for that scalar.
- Gray: Gray entries are suggested enum fields that have the same value as the scalar. These entries are only suggestions, and have not yet been made equates.
The Rename Equate action will rename one or more instances of a named Equate in the Listing.
To rename an Equate:
The Remove Equate action will remove an Equate(s) from a listing; effectively returning the operand to its original scalar value.
To remove references to an Equate via the context popup menu:
To remove all references of an Equate via the Equates Table window:
The Apply Enum action (only available when there is a selection), will apply enum member names to scalars in the current selection if any of the enum values match those scalars.
To apply an enum to the selection:
Once the data type is selected, the scalars in the selection will have equates applied to them as shown below.
The Display Equates Table action displays a window which lists all of the Equates and their references in a tabular format.
![]() |
The left panel, Equates, lists name, value, and number of references for all Equates. The right panel, References, lists the address and operand index of each location that references the Equate selected in the left panel. Selecting an address on the References panel will cause the Code Browser to go to that address in the listing. The Equates panel and the References panel can each be sorted by any column. The ascending and descending indicator displays the sort order of the information.
To view the Equates Table select the Code Browser menu option Window
Equates Table to bring up the Equates Table window.
You can re-order the columns in the Equates table by dragging the header to another position in the table. Sort the columns by double-clicking on the header. By default, equates are sort alphabetically. You can re-order the References table and sort by the operand index, Op Index. By default, the references are sorted by reference address in ascending order.
You can also rename the equate by double clicking in the name field and entering a new name. If the equate is based off of an enum, then an enum editor dialog will appear. Changing the matching field name will also change the equate name.
Each equate is color-coded based upon how it is being used.
- Blue: Blue equates are existing user-defined string equates that are being used for that scalar.
- Black: Black equates are existing enum field equates being used for that scalar.
- Red: Red entries are bad equates. A bad equate could either mean that the enum that this equate is based off of was deleted, the field inside the enum was deleted, or the field's value was changed.
The various convert actions are used to change the number format display of scalars
displayed in the code browser. These actions are available whenever the cursor is on a number
in the operand field, or the value field of a data item (byte, word, dword, qword). Note that
these actions and equates are not currently supported for composite and array data.
For instruction operands, the scalar number is converted visually by replacing the number with an
appropriately named equate. Such a conversion can be cleared by removing the equate
from the operand. For data value fields, a combination of data format settings and signed/unsigned
data type alteration is used to reflect a conversion. The available formats are as follows.
Signed Decimal
The existing scalar value will be displayed as a signed decimal number. This action is only available if the value can be interpreted as a negative value.
Unsigned Decimal
The existing scalar value will be displayed as an unsigned decimal number. If the value would be positive even if the signed decimal format was selected, the action will simply be name Decimal instead of Unsigned Decimal.
Unsigned Octal
The existing scalar value will be displayed as an unsigned octal number.
Signed Hex
The existing scalar value will be displayed as a signed hexadecimal number. This action is only available if the value can be interpreted as a negative value, and is only supported on instruction operands since the data hex format currently supports unsigned rendering only.
Unsigned Hex
The existing scalar value will be displayed as an unsigned hexadecimal number.
Char / Char Sequence
The existing scalar value will be displayed as either a single ASCII character or a sequence of ASCII characters, whichever is more appropriate. Invalid and non-printable ASCII characters will be rendered in hex (e.g., \x20).
Unsigned Binary
The existing scalar value will be displayed as an unsigned binary number.
Float
The existing scalar value will be displayed as a IEEE 754 single precision floating point number. The floating point size is processor specific and will match the size of the Float data type. This action is only supported on instruction operands.
Double
The existing scalar value will be displayed as a IEEE 754 double precision floating point number. The floating point size is processor specific and will match the size of the Double data type. This action is only supported on instruction operands.
The convert actions also work on an instruction selection. Just make a selection then choose an operand scalar value to convert. All matching instruction scalar values in the selection will be converted.
Based upon how an instruction is implemented by its' associated language module, a hexadecimal operand which appears to be negative may in fact be a positive scalar with negative sign '-' character prepended. In such cases, the convert action may not produce the expected result.
The presence of a primary reference on an operand may prevent rendering of the converted scalar value since reference markup takes precedence over equates and data formatting.
Provided By: EquatePlugin and EquateTablePlugin