Instruction Set
Instruction Set
• Arithmetic Instructions
• Logical lnstnictions
• Branching Instructions
• Control Instructions
• If one of the operands isa memory location, its location is • The contents of the source are not altered.
specified by the contents of the HL ~gisters.
• Example: LDA 2034H
• Exmnple: MOV 8, C or MOV 8, M
• The 8-bit data is stored in the destination register or • The c:ontents of the design.1ted register pair point to a mL·mory
location.
memory.
• This instruction l'opil'S the contents of that memory Joc.1tion
mto the acn1mul.1tor.
• If the operand is a memory location, its location is
specified by the contents of the H-L registers. • TI1e contents of either the n.-gister pair or the memory location
are not .:ilten:d.
• Example: MVI B, 57H or MVI M, 57H • Ex.ample: LOA)( B
Data Transfer Instructions Data Transfer Instructions
■·+++;;;;;;;;;:a I le ...... r1pllon
l h.. M t ipliun
()Cl ltr8, pair, 1(.-bir 1,0,Mf N"gliitttpalr imnwdi.l t•
dat,1
STA 16-bit add.- Sforu«:1,m1ul.i1ordiffct
• This instruction loads 16-bit data in the register pair. • The contents of accumulator are copied into the
memory location specified by the operand .
• Example: LXI H. 2034 H
• Example: STA 2500 H
~Jtnurr.a - - .~ t . a a . 1 1
13-14 / 81 ..•••• SPHL Non,. Copy H- L p.tir to rhfl St.-ck Pointtt (SP)
• The contents of register H are stored into the next • Example: SPHL
memory location.
• The contents of registers Hand Lare copied into the • The contents of top of stack a~ copied into register pair.
program counter (PC).
• The contents of location pointed out by SP are copied to
• The contents of H are placed as the high-order byte the low-order register (C, E, L, Flags).
and the contents of Las the low-order byte.
• SP is incremented and the contents of location are copied
• Example: PCHL to the high-order ~gister (B, D, H, A).
• Example: POP H
Arithmetic Instructions
MIMI- Arithmetic Instructions
ADD R Add ttgilttor or mMuory to .io:umul.Jtor
M
AOI 8•hilddl• Add immrdi.ltc- to ol«'\111111l•ror
• The content s of registe r or memory arc add~>d to the cont en ts of
accumulato r.
• The 8-bit data is added to the contents of accumulator.
• The result is stored in accu mulato r.
• If the opera nd is memory location, its address is specified by H-L pair. • The result is stored in accumulator.
• All nags are modil1ed to ren ect the result of the add ition . • All flags are modified to reflect the result of the
addition.
• Example:ADD BorADD M
• Example: ADI 45 H
• The 8-bit data and the Carry Flag (CY) are added to the • The contents of the: rc:gistc:ror memory loca tion arc subtracted from
the conte nts of the accum ulator.
contents of accumulator.
• The result is stored in accumula tor.
• The result is stored in accumulator.
• If the operand is memory locatio n, its add ress is specified by H-L pair.
• All flags are modified to reflect the result of the addition. • All fla gs are modified to renect lhc result of subtract ion.
• The 16-bit contents of the register pair are added to the • The cont e nt s of the register or memory loca ti on a nd Borrow Flag (i.e.
contents of H-L pair. CY) a re subtracted from the contents of the accumulator.
• If the result is larger than 16 bits, then CY is set. • If the o perand is memory loca tio n, its add ress is specified by H-L pa ir.
• The 8-bit data and the Borrow Flag (i.e. CY) is subtracted
• The contents of register pair are increment ed by 1.
from the contents of the accumulator.
• The result is stored in accumulator. • The result is stored in the same place.
• All flags are modified to reflect the result of subtraction. • Example: INX H
• Example: SBI 45 H
• The contents of register or memory location are • The logical operations are:
decremented by 1. • AND
• The result is stored in the same place. • OR
• XOR
• lf the operand is a memory location, its address is specified
by the contents of H-L pair. • Rotate
• Compare
• Enmple: OCR 8 or OCR M • Complcm cn~..,_. ,_..n+!
____
• G J'f' dtf'rTl1-111
• l,c,s5 Than
• The 8-bit data is compared with the contents of • The content s of th e accumulat or are logically ANDed wi th the co ntent s
accumulator. of n -gister or me mory.
• The result is placed in the accumulat or.
• The values being compared remain unchanged. • If the opera nd is a memory loca tio n, its address is specified by the
co nten ts o f H- L pa ir.
• The result of the comparison is shown by setting the • S, Z, P arc modi fi ed to re llcc:t the result o f the opera tion.
flags of the PSW as follows: • CY is reset .-ind AC is ,-el.
• Example: ANA B o r ANA M.
Downloetl s - : _ _, _ , ~ , -
__
the contl!nts of H-L p.1ir.
• CY •nd .-.c •re rt>se< . • S, z, P arc mod ified to reflect the result of the operation.
• 1•:umple: O KA Ror O RA M . • CY and AC are reset .
• Example: XRA B or XRA M. , ___.___...,_
~it d.tt•
I l)C"'-C rlrlm11
• The contents of the accumulator are logically ORed with • The contents of the accumulator a re XO Red with the
the 8-bit data .
8-bit data.
• The result is pla~d in the accumulator. • The result is placed in the accumulator.
• S, Z, P a1·e modified to reflect the result. • S, Z, Pare modified to reflect the result.
• CY and AC are reset. • CY and AC are reset.
• Example: ORI 86H. • Example: XRIDo86H.
_ _ , _ _ __......,._
• Each binary bit of the accumulator is rotated left by one • Each binary bi t of the accumulator is rotated left by one
position.
position through the Carry flag.
• Bit D] is placed in the position of Do as well as in the Carry
flag.
• Bit D7 is placed in the Carry flag, and the Carry flag is
placed in the least significant position Do.
• CY is modified according to bit Cry.
• CY is modified according to bit D].
• S, Z, P, AC are not affected.
• S, Z, P, AC a re not a ffected.
• Example: RLC.
• Example: RAL.
Download $cN#ce : WWW,,., JW-:GM
N-l:lii
O.tA
l,iYbi:hM Complen~nt .Jcnunul.Jlor
iii&A-J\wllf' STC Noor Srf carry
• The Carry flag is comple mented . • These instruc tions alter either uncon ditiona lly or
conditi onally.
• No other flags are affected.
• Example: CMC.
Branching Instructions
C>p,o<lr ' 'r••r,,n,I I 1,.,...... ,ipl ion
Branching Inst ruct ions CALL 16•bil addrN, C.lll tm<'ouditioawlly
O p co d ~
1
C>pt•r,i:uul
Jx 16•bil ddd'"• Jwnp ronditlotw Uy • The program sequenc e is transfer red to the memor y
location specifie d by the 16-bit address given in the
operand .
• The program sequence is transferred to the memory • Before the transfer, the address of the next instruct ion after
location specified by the 16-bit address given in the CALL ( the content s of the program counter ) is pushed onto
operand based on the specified flag of the PSW. the stack.
• The program sequence is transferred to the memory • The program sequence is transferred from the
location specified by the 16-bit address given in the subroutine to the calling program.
operand based on the specified flag of the PSW. • The two bytes from the top of the stack are copied into
• Before the transfer, the address of the next instruction the program counter, and program execution begins at
after the call (the contents of the program counter) is the new address.
pushed onto the stack.
• Example: RET.
• Example: CZ 2034 H.
DoMllold Sci,.-a : - .....~ -
DownloMI , - : --lldlll~-
Branching Instructions
Call Conditionally
cc C.ill ifC,ury
',tallls I la it•
CY• I
•·••
Rx Milt' Call coodit!on,11ly
CNC C.,11 if No Carry CY•o • The program sequence is transfe rred from the
CP Call If Po,;it i\°' S•o subroutine to the calling program based on the
specified flag of the PSW.
CM C.iJI if Minus
C.7.. C.ill ifZtt<> • The two bytes from the top of the stack are copied into
Z=o
the program counter, and program execution begins at
CN7 CallifNouro
the new address.
CPF. Call if Parity b~.ll p •I
--=
---~. . RST5 0028H
RST6 1>030 H
RST7 00)8 H
~ ScNrce : - .191N/.blagapol... ...
Branching Instructions
Opu,J ,, Op,•1,11ul l)l•,l1 i pt ic111
RST o-; ~.ut (Software l1ttl'rn1pls )
Control Instructions
• The RST instruction jumps the control to one of eight • The control instructions control the ope ration of
memory locations depending upon the number. microprocessor.
• These are used as software instructions in a program to
transfer program execution to one of the eight
locations.
• Example: RST 3.
Control Instructions
Control Instructions •·•--11@01111+ Nol"N' Diwbk- i.u1m,1p1
llL'""'lr t pt 1on
DI
oru><I•· ll1wr.11u l I lll-,u1r 1111n
Nonr Noopttation
NOP
• The interrupt enable flip-flop is reset and all the
interrupts except the TRAP are disabled.
• No operation is performed.
• No flags are affected.
• The instruction is fetched and decoded but no
• Example: DI
operation is executed.
• Example: NOP
DtllWfllOl#I ScNwce : _ _l9dl,I......,__
Control Instructions
Op,ml l"
Control Instructions
I Op,•1,111<1 11<", ni pl io n
•·••-;;;;;;;;;:+
El Nor~ Eu,tblr iJllC'flllpl
• This is a multipurpose instruction used to read the • This is a multipurpos e instruction and used to
status of interrupts 7.5, 6.5, 5.5 and read serial data implement the 8o85 interrupts 7.5, 6.5, 5.5, and serial
input bit. data output.
• The instruction loads eight bits in the accumulator • The instruction interprets the accumulato r contents as
with the following interpretations. follows.
• Example: RIM • Example: SIM
RIM Instruction
SIM Instruction
D1 D~ D, D, Di D1 D1 D0
Serial input
dalll bit
LInterruptif
masked
IJSODJl JSE I Mrs I M~.sI Mrs I
s~ I XXXI Rr I M
lnterrupcs
pcadina ,r
bit • I
j bit = I
Interrupt enable
mp-nop ••..,
if bit = I
Serial outpul data
,
Scnal dm enable
I - Enable
0 • Di.sable
Rctel
. R7•S
1r D, • I
Muk Kt
enable ir
D, • t
,i
Mu ks interrupts
if bih - I