0% found this document useful (0 votes)
356 views3 pages

Program Control Instructions Overview

The document discusses different types of program control instructions used in microprocessors, including unconditional jump instructions like short jumps, near jumps, and far jumps. It also discusses conditional jump instructions that test flag bits and loop instructions like LOOP that decrement a counter and conditionally jump. Program control instructions allow programs to change flow by skipping sections, branching to different parts of memory, and making decisions based on tests.

Uploaded by

MANIKANDAN
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
356 views3 pages

Program Control Instructions Overview

The document discusses different types of program control instructions used in microprocessors, including unconditional jump instructions like short jumps, near jumps, and far jumps. It also discusses conditional jump instructions that test flag bits and loop instructions like LOOP that decrement a counter and conditionally jump. Program control instructions allow programs to change flow by skipping sections, branching to different parts of memory, and making decisions based on tests.

Uploaded by

MANIKANDAN
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

7/7/2015

ProgramControlInstructions

ProgrammeControlInstructions
INTRODUCTION
Theprogrammecontrolinstructionsdirecttheflowofaprogrammeandallowtheflowofthe
[Link],madewiththeCMPor
TESTinstruction,arefollowedbyaconditionaljumpinstruction.
THEJUMPGROUP
Themaintypeofprogrammecontrolinstruction,thejump(JMP),allowstheprogrammemerto
skipsectionsofaprogrammeandbranchtoanypartofthememoryforthenextinstruction.A
conditionaljumpinstructionallowstheprogrammemertomakedecisionsbaseduponnumerical
[Link],whicharethentestedby
conditionaljumpinstructions.

UnconditionalJump
Threetypesofunconditionaljumpinstructionsareavailableinthemicroprocessor'sinstruction
set:shortjump,nearjump,andfarjump.
Theshortjumpisa2byteinstructionthatallowsjumpsorbranchestomemorylocationswithin
+127and128bytesfromthememorylocationfollowingthejump.The3bytenearjumpallows
abranchorjumpwithin32Kbytes(anywhere)fromtheinstructioninthecurrentcode
[Link],the5bytefarjumpallowsajumptoanymemorylocationwithintheentire
[Link]
jumpsareoftencalledintersegmentjumps.

[Link]
[Link]
[Link],adistance,ordisplacement,[Link]
jumpdisplacementisadistancerepresentedbya1bytesignednumberwhosevalueranges
between+127and128.
OPCODE(EB)

Displacement
(+127to128)

Whenthemicroprocessorexecutesashortjump,thedisplacementsignextendsandaddsto
theinstructionpointer(IP)[Link]
shortjumpinstructionbranchestothisnewaddressforthenextinstructioninthe
programmeme.
[Link]

1/3

7/7/2015

ProgramControlInstructions

Wheneverajumpinstructionreferencesanaddress,[Link]
NEXTisanexample,[Link]
[Link]
colon(NEXT:)[Link]
label,[Link]
thelabelisusedwithajumporcallinstruction.

[Link]
jumppassescontroltoaninstructioninthecurrentcodesegmentlocatedwithin32Kbytes
fromthenearjumpinstruction.Thenearjumpisa3byteinstructionthatcontainsanopcode
[Link]
pointer(IP)[Link]
32K,anearjumpcanjumptoanymemorylocationwithinthecurrentrealmodecode
segment.
OPCODE(E9)

DISPLACEMENT

DISPLACEMENT

LowByte

HighByte

[Link].
Bytes2and3ofthis5byteinstructioncontainthenewoffsetaddressandbytes4and5
containthenewsegmentaddress,withtheLowBytefollowedbytheHighByteinbothcases.
OPCODE(EA)

IP

IP

CS

CS

LowByte

HighByte

LowByte

HighByte

ConditionalJumps
[Link]
thejumptowithin+127bytesand128bytesfromthelocationfollowingtheconditionaljump.
Theconditionaljumpinstructionstestthefollowingflagbits:sign(S),zero(Z),carry(C),parity
(P),andoverflow(0).Iftheconditionundertestistrueabranchtothelabelassociatedwiththe
[Link],thenextsequentialstepintheprogramme
executes.
Theoperationofmostconditionaljumpinstructionsisstraightforwardbecausetheyoftentest
justoneflagbit,[Link]
morecomplicatedconditionaljumpinstructionsthattestmorethanoneflagbit.
Becauseweusebothsignedandunsignednumbers,andtheorderofthesenumbersis
[Link]

2/3

7/7/2015

ProgramControlInstructions

different,therearetwosetsofmagnitudecomparisonconditionaljumpinstructions,bothsigned
andunsigned8bitnumbers.
The16and32bitnumbersfollowthesameorderasthe8bitnumbersexcepttheyarelarger.
NoticethatanFFHisabovethe00Hinthesetofunsignednumbers,butanFFH(1)isless
[Link],anunsignedFFHisabove00H,butasignedFFHis
lessthan00H.
Whenwecomparesignednumbers,weuseJG,JE,JGE,JLE,JE,[Link]
[Link],weuseJA,
JB,JAE,JBE,JE,[Link].
[Link]
[Link].

LOOP
[Link]
8086,LOOPdecrementsCXandifCXisnotequaltozero,itjumpstotheaddressindicatedby
thelabel.IfCXbecomesa0,thenextsequentialinstructionexecutes.
[Link]
LOOPE(loopwhileequal)instructionjumpsifCXisnotequaltozero,whileanequalcondition
[Link]
LOOPNE(loopwhilenotequal)instructionjumpsifCXisnotequaltozero,whileanotequal
[Link]
[Link],alternatesexistforLOOPEandLOOPNE.

[Link]

3/3

You might also like