Computer Organization: Lec # 6: Addressing Bnar Mustafa
Computer Organization: Lec # 6: Addressing Bnar Mustafa
Lec # 6: Addressing
Bnar Mustafa
Spring 2022
Video Links
Part 1: https://www.youtube.com/watch?v=3A2Y4NOZXlM&t=3s
Part 2: https://www.youtube.com/watch?v=VOJU9S8EXUM&t=5s
Part 3: https://www.youtube.com/watch?v=hZPKENWoeuA&t=17s
Most of arithmetic and logical operation
used in assembly language
Operation function
ADD adding two integer operands
FADD adding two floating point operands
SUB subtracting two integer operands
FSUB subtracting two floating point operands
MUL multiplying two integer operands
FMUL multiplying two floating point operands
DIV dividing two integer operands
FDIV dividing two floating point operands
AC= 00000010
POP Destination
NOT Destination
− POP BX − NOT BX
− POP DS − NOT BYTE PTR[BX]
− POP TABLE[BX]
− PUSHA AND Destination, Source
− POPA − AND BH, CL
− AND CX, [SI]
− AND BX, 00FFH
− AND DX, BX
Computer Organization - Bnar Mustafa
OR Destination, Source
XOR Destination, Source
− OR BH, CL − XOR BH, CL
− OR CX, [SI] − XOR BP, DI
− OR BX, 00FFH − XOR DX, BX
− OR DX, BX
Operation Function
LOAD Register [M]
1-Unconditional Branching :-
This type of branching will change the program counter PC to new
location of branching without checking any condition;
The form of this instruction was:
BR X or JMP X
, Where X was the location or a label that need to jump to it.
Note :
L2 is the label of address
Can be letter , letter number, symbol, symbol number .
Illegal to begin by number ex. 2L
2-Conditional Branching
Changing the program counter in the case of jumping to location
or label depending on conditions of the flags;
Sample of jumping :
JP X ; or BRP X (jump if positive)
JN X ; or BRN X (jump if negative)
JZ X ; or BRZ X (jump if zero)
JO X ; or BRO X (jump if overflow)
MOV X , 5 MOV X , 50
MOV Y , 5 MOV Y , 50
MUL X, Y MUL X, Y
JO LLO JO LLO
END END
LLO: MOV X, Y LLO: MOV X, Y
END END
0 0 0 1 1 0 0 1
1001 1 1 0 0 0 1 0 0
Example:
Check the branching of the following instruction and find PC
values?
203 BRZ 211
Sol. :
If the condition occur (last ALU result before branching equal
zero)
Then PC=211
Else if the condition is false (no zero)
Then PC=PC+1
=204
Computer Organization - Bnar Mustafa
Generating Memory Address
Generating the address of the memory location is either directly or
indirectly by register, so direct addressing must be done using
direct number in square brackets for example:
MOV [2000h], R1
In this instruction R1 is moved to memory location 2000h, so the
location was fixed.