Information Technology Reference
In-Depth Information
LD X
\ Load X in AC
ST N
\ Store AC (X original value) in N
LOOP
LD N
\ AC N
BZ EXIT
\ Go to EXIT if AC ΒΌ 0 (N reached 0)
\ AC 1
LD ONE
\ DR AC
MOVAC
LD N
\ AC N
SUB
\ subtract 1 from N
ST N
\ store decrements N
LD Y
\ AC Y
MOVAC
\ DR AC
LD Z
\ AC Z (partial product)
ADD
\ Add Y to Z
ST Z
\ store the new value of Z
BRA LOOP
EXIT
STOP
X
W
5
\ reserve a word initialized to 5
Y
W
15
\ reserve a word initialized to 15
Z
W
0
\ reserve a word initialized to 0
ONE
W
1
\ reserve a word initialized to 1
N
W
0
\ reserve a word initialized to 0
3.3. ASSEMBLER DIRECTIVES AND COMMANDS
In the previous section, we introduced the reader to assembly and machine languages.
We provided several assembly code segments written using our simple machine
model. In writing assembly language programs for a specific architecture, a number
of practical issues need to be considered. Among these issues are the following:
. Assembler directives
. Use of symbols
. Use of synthetic operations
. Assembler syntax
. Interaction with the operating system
The use of assembler directives, also called pseudo-operations, is an important issue
in writing assembly language programs. Assembler directives are commands that
are understood by the assembler and do not correspond to actual machine instruc-
tions. Assembler directives affect the way the assembler performs the conversion
of assembly code to machine code. For example, special assembler directives can
be used to instruct the assembler to place data items such that they have proper align-
ment. Alignment of data in memory is required for efficient implementation of archi-
tectures. For proper alignment of data, data of n-bytes width must be stored at an
Search WWH ::




Custom Search