Program Field of 8086 microprocessor

Опубликовано: 20 Октябрь 2024
на канале: MD HASANUZZAMAN
40
0

The Label Field
Labels mark places in a program which other instructions and directives reference
Labels in the code segment always end with a colon
Labels in the data segment never end with a colon
Labels can be from 1 to 31 characters long and may consist of letters, digits, and the special characters ? . @ _ $ %
If a period is used, it must be the first character
Labels must not begin with a digit
The assembler is case insensitive
Legal and Illegal Labels
Examples of legal names
COUNTER1
@character
SUM_OF_DIGITS
$1000
DONE?
.TEST
Examples of illegal names
TWO WORDS contains a blank
2abc begins with a digit
A45.28 . not first character
YOU&ME contains an illegal character
The Mnemonic Field
For an instruction, the operation field contains a symbolic operation code (opcode)
The assembler translates a symbolic opcode into a machine language opcode
Examples are: ADD, MOV, SUB
In an assembler directive, the operation field contains a directive (pseudo-op)
Pseudo-ops are not translated into machine code; they tell the assembler to do something
The Operand Field
For an instruction, the operand field specifies the data that are to be acted on by the instruction. May have zero, one, or two operands
NOP ;no operands -- does nothing
INC AX ;one operand -- adds 1 to the contents of AX
ADD WORD1,2 ;two operands -- adds 2 to the contents
; of memory word WORD1
In a two-operand instruction, the first operand is the destination operand. The second operand is the source operand.
For an assembler directive, the operand field usually contains more information about the directive.
The Comment Field
A semicolon marks the beginning of a comment field
The assembler ignores anything typed after the semicolon on that line
It is almost impossible to understand an assembly language program without good comments
Good programming practice dictates a comment on almost every line.