Machine Independent
Machine Independent
The assembler features that are not closely related to machine architecture
are ,
1. Literals
3. Expressions
4. Program blocks
5. Control section
1. LITERALS
Definition of literals:
*=C’EOF’
*=X’05’
*=X’F1’
Examples are:
LDA = C’EOF’
TD = X’05’
TD=X’F1’
0033
0059 *=X’3’
LITERAL POOL:
All the operands used in the program are gathered together into one or more
literal pools.
Normally literals are placed into a pool at the end of the program
Literals placed by LTORG will not be repeated at the pool at the end of the
program .The duplicated literals are recognized by comparing the generated value
of the constant operands
LDA = X’454F46’
: object code
*=C’454F46’ 454F46
• Literals can be used to refer to the current value of the location counter
(address of the memory location)
Eg : base *
LDB =*
• The above instructions are used to specify the operand with value as current
value of location counter.
2. SYMBOL DEFINING STATEMENT:
Memory location is allocated for the symbols which are defined using
RESW or RESB directives.
During pass1, the address of the memory location is stored as value in the
symbol table.
SYMTAB
RETADR
0030
MAXLEN 1000
SYMBOL DEFINED USING EQU DIRECTIVE:
• Memory location is not allocated for the symbol defined using EQU
defined symbol
• During pass1, the name of the symbol and the value assigned to the symbol
are stored in the symbol table.
0 A EQU 0
1 X EQU 1
2 L EQU 2
ORG:
Format:
ORG value
In this table, the SYMBOL field contains a 6 byte user defined symbol. VALUE is
a one word representation of the value assigned to the symbol. FLAGS is a 2 byte
field that specifies symbol type and other information.
The fields SYMBOL, VALUE, FLAGS are defined individually with the help of
EQU statement.
SYMBOL EQU STAB
ORG STAB
SYMBOL RESB 6
FLAGS RESB 2
ORG STAB+1100
The descriptions of the EQU and ORG statements contain restrictions that
are common to all symbol defining assembler directives. In the case of
EQU, all symbols used on the right hand side of the statement must have
been defined previously in the program. Thus the sequence,
ALPHA RESW 1
3. EXPRESSIONS:
Constant
Special terms
by *) . This term represents the value of the next unsigned memory location.
For example ,
BUFEND EQU *
gives BUFEND a value that is the address of the next byte after the buffer area.
TYPES OF EXPRESSION
• Absolute expression
• Relative expression
ABSOLUTE EXPRESSION
Value of the expression is independent of the beginning address of the
program.
Absolute expression may contain only absolute terms or relative terms but it
must produce the absolute value
Eg: absolute expression that contains the relative terms { relative term represent
some location within the program}
Relative format
But produce the absolute value 1000 which is the length of buffer
RELATIVE EXPRESSION:
It may contains relative terms or absolute terms but it must produce the
value which is relative to the starting address of the program
The values of the expression is 1006 which is some memory location within
the program and also relative to the beginning address of the program.