Microprocessors, Programming P, G G & Interfacing: DR Anita Agrawal Dr. Anita Agrawal
Microprocessors, Programming P, G G & Interfacing: DR Anita Agrawal Dr. Anita Agrawal
& Interfacing
(ES C263)
BITS PILANI K.K. BIRLA GOA CAMPUS
L 13 Lecture 13
Dr Anita Agrawal Dr. Anita Agrawal
UnconditionalJumpgroupofinstructions
Unconditionaljump
Intrasegment Jump
Relativejump
Shortjump(128to+127)
Near jump (32768 to 32767) Nearjump(32768to32767)
Indirectjump
IntersegmentJump
Directjump
Indirectjump
Indirectindirect (double indirect) Indirectindirect(doubleindirect)
2
(Intersegment)DirectProgrammemory
I t ti
Offset
Instruction
(CS) Seg Offset (CS) Seg.
(IP)
P.S.R/Mcontentscanbeaccessedusingany
of the addressing modes except immediate
3
oftheaddressingmodesexceptimmediate
mode
Mic.Prog.& Interfacing
Intersegment(FAR)contd
J MP address
Segment
Address
+
Effective branch address
Offset
+
Address
O Off(L) Off(H) S (L) S (H)
EA 00 00 00 10
Op Off(L) Off(H) Seg(L) Seg(H)
4 Mic.Prog.& Interfacing Dr.Anita Agrawal
Intersegment(FAR)indirect
1 1 1 1 1 1 1 1
M OD
1 0 1 R/M
Example Example
J MP dword ptr 2000h[bx]
Dr.Anita Agrawal Mic.Prog.& Interfacing 5
Relative(intrasegment)
Relative to the instruction pointer Relativetotheinstructionpointer
Ex:JMP[2]
1-byte
8-bit/16 bit signed disp.(+/-)
y
8 bit/16 bit signed disp.( / )
1byte:short jumps
2byte:nearjumpsandcalls
It is anywhere within the current code segment
6
Itisanywherewithinthecurrentcodesegment
IftheDisp.(16bits)istoofar,thensome
assemblersusethedirect jump.
8 bit di h t b t 8bit disp: short range between
+127 to 128 bytes from the next y
instruction.
b d f kb 16bitdisp:near rangeof32kbytes
7 Mic.Prog.& Interfacing Dr.Anita Agrawal
Indirectmode(Intrasegment)
Usesany16bitregister:
AX,BX,CX,DX,SP,BP,DI,SI;(near)
Relativeregister :
[BP],[BX],[SI],[DI]
Indirectindirectordoubleindirect
Relativeregisterwithadisplacement
8 Mic.Prog.& Interfacing Dr.Anita Agrawal
IntrasegmentIndirectnearjump
1 1 1 1 1 1 1 1
M OD
1 0 0 R/M
Dr.Anita Agrawal Mic.Prog.& Interfacing 9
Ex:1. JMP BX; BX contains offset address
(near current code segment) (near, current code segment)
it is near jump it is near jump
Ex:2. JMP [BX]; contents of BX point to the
M L h h dd i il bl M.L. where the address is available
(intrasegment)
it is near jump
10
Ex:3.JMP[BX+2];
Dr.Anita Agrawal Mic.Prog.& Interfacing 11