Professional Documents
Culture Documents
Lecture-6 Addressing Modes Branching & Bit Manipulation
Lecture-6 Addressing Modes Branching & Bit Manipulation
Base + Index
mov ax,[bx+si]
Addressing Modes
mov ax,[bx+si+num1]
Addressing Modes
mov ax,[num1] ; (o) - Offset
Instruction Opcode
mov ax,[cs:bx] 2E9B07
mov ax,[es:bx] 268B07
mov ax,[ss:bx] 368B07
mov ax,[bx] 8B07
Bubble Sort
Iteration 1:
60 55 45 58
Bubble Sort
Iteration 1:
55 60 45 58
Bubble Sort
Iteration 1:
55 45 60 58
Bubble Sort
Iteration 1:
55 45 58 60
Bubble Sort
Iteration 2:
55 45 58 60
Bubble Sort
Iteration 2:
45 55 58 60
Bubble Sort
Iteration 2:
45 55 58 60
Bubble Sort
Iteration 2:
45 55 58 60
Bubble Sort
Iteration 3:
45 55 58 60
Bubble Sort
Iteration 3:
45 55 58 60
Bubble Sort
Iteration 3:
45 55 58 60
Bubble Sort
Iteration 3:
45 55 58 60
Signed / Unsigned Numbers
Number Representation
2 0x0002
-2 0xFFFE
; two’s
compliment of ;
decimal 65534
Signed / Unsigned Numbers
Example
; same representation
; different interpretation
Signed / Unsigned Numbers
Order and Range (16 – Bit)
Unsigned Numbers:
0<1<2<3<4 <………<65535
Signed Numbers:
-32768<-32767<…..<0<……<32767
Multiplication
1 1 0 1 1 3
x 0 1 0 1 x 5
1 1 0 1
0 0 0 0 x
1 1 0 1 x x
0 0 0 0 x x x
1 0 0 0 0 0 0 1 6 5
Shift Instructions
0
CF
1 0 1 0 1 0 1 0 1
shl
0
CF
1 1 0 1 0 1 0 1 0
sal
0
CF
1 1 0 1 0 1 0 1 0
sar
0
CF
1 0 1 0 1 0 1 0 1
1
CF
1 0 1 0 1 0 1 1 1
ror
CF
1 0 1 0 1 0 1 0 0
rol
CF
1 1 0 1 0 1 0 1 0
rcr
CF
1 0 1 0 1 0 1 0 0
rcl
CF
1 1 0 1 0 1 0 1 0