System information

3.4.3 The EQU Directive
The EQU (equate) statement is used to set up synonyms for particular numeric values. The EQU
statement takes the form:
label EQU expression
where the label must be present and must not label any other statement. The assembler evaluates
the expression and assigns this value to the identifier given in the label field. The identifier is
usually a name that describes the value in a more human-oriented manner. Further, this name is
used throughout the program to place parameters on certain functions. Suppose data received
from a teletype appears on a particular input port, and data is sent to the teletype through the next
output port in sequence. For example, you can use this series of equate statements to define these
ports for a particular hardware environment:
TTYBASE EQU 10H ;BASE PORT NUMBER FOR TTY
TTYIN EQU TTYBASE ;TTY DATA IN
TTYOUT EQU TTYBASE+1 ;TTY DATA OUT
At a later point in the program, the statements that access the teletype can appear as follows:
IN TTYIN ;READ TTY DATA TO REG-A
....
OUT TTYOUT ;WRITE DATA TO TTY FROM REG-A
making the program more readable than if the absolute I/O ports are used. Further, if the
hardware environment is redefined to start the teletype communications ports at 7FH instead of
10H, the first statement need only be changed to
TTYBASE EQU 7FH ;BASE PORT NUMBER FOR TTY
and the program can be reassembled without changing any other statements.
3.4 Assembler Directives CP/M Operating System Manual
3-12