
ARCHITECTURE AND INSTRUCTIONS
String Constant
A string constant is one or two characters enclosed with apostrophes. Strings of more than two characters are permitted in res- tricted cases, but are not discussed here. An apostrophe itself may be included in a string constant by writing it as two consecutive apostrophes. Examples of string constants are 'A', 'AB', and "". The last example is the string consisting of the apostrophe character.
The value of a string constant is the ASCII code of the character(s) in the string. For example, the value of 'A' is 41 H and the value of 'AB' is 4l42H. Thus, string constants and
COMMENTS
Any sequence of characters following a semi- colon (;) up to the end of the line are com- ments. They are ignored by the assembler and should be used generously in your pro- gram to document what you are doing. While comments like
INC CX ;increment CX
Operands with numeric values are constants, or identifiers that represent constants. Some
Note that the value of an operand may be negative, but a constant is never negative. A minus sign can be written in front of a con- stant, but is never considered a part of the constant; it is an arithmetic operator.
Another component is the offset address within the segment. These two components are referred to as the segment and offset of the
convey little information, comments like
INC CX ;increment outer loop counter·
make a program more readable.
Expressions
One more building block, namely expres- sions, must be introduced before we can build statements. Expressions are built up from some of the tokens just described.
Loosely speaking, an expression is a sequence of operands and operators combined to pro- duce a value at program assembly time. How are operands and operators combined to produce the value of an expression?
OPERANDS
An operand is something that has either a numeric value or a memory address value.
Another operand is an expression itself, enclosed in parentheses, and used in some bigger expression, as in 3*(PORT_VAL+5).
OPERATORS
An operator takes the value of one or more operands and produces a new value. There are five kinds of operators in
1)arithmetic operators
2)logical operators
3)relational operators
4)analytic operators
5)synthetic operators
Arithmetic Operators
Arithmetic operators are the familiar addi- tion operator (+), subtraction operator