Assembly Language Week 4
Assembly Language Week 4
Presenter
WEEK ONE
1
Objectives – week four
Identifies the different address instructions
Write programs using different address instructions
Identifies the different addressing mode
The program in assembly language that evaluates X = (A + B) * (C + D) is shown below, together with
comments that explain the register transfer operation of each instruction.
Using the syntax of the three address notation
<operation><source-1 operand>, <source-2 operand>, <destination>, we have the expression as:
ADD A,B, R1 R1→M[A]+M[B]
ADD C,D, R2 R2→M[C]+M[D]
MUL R1,R2, X M[X] →R1*R2
An example of a commercial computer that uses three-address instructions is the Cyber 170.
Memory Address
The following effective addressing modes specify that the operand is in memory and provide the specific
address of the operand.
Address Register Indirect - The address of the operand is in the address register specified by the register field.
Notation: (An)
Examples:
MOVE #5,(A5) ;Move value 5 to word whose address is contained in A5.
SUB.L (A1),D0 ;Subtract from D0 the value in the long word whose address is contained in A1.
Address Register Indirect with Post-increment - The address of the operand is in the address register specified
by the register field.
After the operand address is used, it is incremented by one, two, or four, depending upon whether the size of the
operand is byte (.B), word (.W), or long (.L).
Notation: (An)+
Examples:
MOVE.B (A2)+,D2 ;Move byte whose address is in A2 to low order byte of D2; increment A2 by 1.
MOVE.L (A4)+,D3 ;Move long word whose address is in A4 to D3; increment A4 by 4.
Address Register Indirect with Pre-decrement - The address of the operand is in the address register specified
by the register field.
Before the operand address is used, it is decremented by one, two, or four, depending upon whether the operand
size is byte (.B), word (.W), or long (.L).
Notation: -(An)
Examples:
CLR -(A2); Subtract 2 from A2; clear word whose address is now in A2.
CMP.L -(A0),D0 ;Subtract 4 from A0; compare long word whose address is now in A0 with contents of
D0.
Basic Concepts
Addresses and addressing
of computer
mode–
system
csc
– csc
223 223 16
Number of addresses
Absolute Short Address - The 16-bit address of the operand is sign extended before it is used. Therefore, the
useful address range is 0 through $7FFF and $FFFF8000 through $FFFFFFFF.
Notation: XXX
Example: JMP $400;Jump to hex address 400
Absolute Long Address - The address of the operand is the 32-bit value specified.
Notation: XXX
Example: JMP $12000 ;Jump to hex address 12000
THANK YOU
FOR
LISTENING
THE END