Page 404 - FUNDAMENTALS OF COMPUTER
P. 404
NPP
404 Fundamentals of Computers NPP
ZF can be used for conditional branch H$ÝS>reZc ~«mÝM BÝñQ´>ŠeZ Ho$ {cE Cn`moJ {H$`m Om
instruction. In conditional jump instructions gH$Vm h¡& H$ÝS>reZc Oån BÝñQ´>ŠeÝg _| `o nm±M âcoJ
these five flag bits gives rise to ten different
instructions as described below. But remember {~Q²>g Xg {^ÝZ BÝñQ´>ŠeÝg ~ZmVo h¢, O¡gm ZrMo dU©Z
that AF is not available to programmer. {H$`m J`m h¡& {H$ÝVw `mX aI| {H$ AF àmoJ«m_a Ho$ {cE
CncãY Zht h¡&
Note: In all conditional branch instruc- {Q>ßnUr: g^r H$ÝS>reZc ~«mÝM BÝñQ´>ŠeÝg _| Am°naoÝS>
tions, the operand is an 8-bit signed displace- EH$ 8 {~Q> gmBÝS> {S>gßcog_oÝQ> (d ) h¡& `h {S>gßcog_oÝQ>
ment (d ). This displacement is added to 8
8
contents of IP and the result is placed in IP: IP Ho$ H$ÝQ>oÝQ²>g _| Omo‹S>m OmVm h¡ VWm n[aUm_ H$mo IP _|
aIm OmVm h¡:
(IP) (IP) + d 8
There IP points to some other instruction dhm± IP Cgr H$moS> goJ_oÝQ> _| Hw$N> AÝ` BÝQ´>ŠeZ H$mo
in the same code segment because CS remains B§{JV H$aVm h¡ Š`m|{H$ CS An[ad{V©V ahVm h¡& Bg{cE
unchanged. Therefore all the conditional branch
instructions are Intrasegment SHORT type. g^r H$ÝS>reZc ~«m§M BÝñQ´>ŠeÝg BÝQ´>mgoJ_oÝQ> SHORT
The address of instruction calculated with the Q>mBn h¢& CS VWm IP H$s ghm`Vm go JUZm {H$`o J`o
help of CS and IP is called branch address or BÝñQ´>ŠeZ H$m ES´>og ~«mÝM ES´>og `m Q>mJ}Q> ES´>og H$hcmVm
target address. It can be within -128 to +127 of h¡& `h dV©_mZ ES´>og -128 go +127 Ho$ AÝXa hmo
the current address. gH$Vm h¡&
Conditional Jump Instructions used with CMP BÝñQ´>ŠeZ Ho$ gmW Cn`moJ {H$`o OmZo dmco
CMP Instruction: Conditional branch H$ÝS>reZc Oån BÝñQ´>ŠeÝg: H$ÝS>reZc ~«mÝM BÝñQ´>ŠeÝg
instructions can be used just after CMP
instruction. Program control will jump to Ho$ CMP BÝñQ´>ŠeZ Ho$ R>rH$ ~mX Cn`moJ {H$`m Om gH$Vm
specified location for a specific value of h¡& àmoJ«m_ H$ÊQ´>moc H$ÝS>reZc âco½g Ho$ {deof ‘mZ na EH$