0% found this document useful (0 votes)
15 views21 pages

Adobe Scan Dec 06, 2023

This document provides a detailed overview of assembly language programming concepts, including operations on numbers, logical instructions, and control flow mechanisms. It includes examples of various instructions such as addition, subtraction, multiplication, and conditional jumps, demonstrating how to manipulate data in registers and memory. The document also discusses the handling of carry bits and the implementation of loops and conditional statements in assembly language.

Uploaded by

dhruv agarwal
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)
15 views21 pages

Adobe Scan Dec 06, 2023

This document provides a detailed overview of assembly language programming concepts, including operations on numbers, logical instructions, and control flow mechanisms. It includes examples of various instructions such as addition, subtraction, multiplication, and conditional jumps, demonstrating how to manipulate data in registers and memory. The document also discusses the handling of carry bits and the implementation of loops and conditional statements in assembly language.

Uploaded by

dhruv agarwal
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
You are on page 1/ 21

UNIT IV PART- 2

Lnstyuetreg set : Aei thnnatie operatre nt ano pgHOm,


ano call enctuctiog
Turop
Legieal
po9xame , input /owtput progo me , sengle Bik instu
an ano prggomt
tomt
Axith nat e Instrrc trona
olato
numbee asee definecl
Hepreeent alato.
all the bit to
7gatrve gn.
ket aile f the potr tive
bitt 0oH
cpoan can be bet wecn
The eons that the
or - bit olata.
FE H to sS- deci gal)
qumber lo soS1 , en ondee
folol trcn of censj9nee the
to ae gumbee tgetheADD igstwcheg
ty vebwe o. The fn ef
A DD A,

ec! en segicteu Ro an
ator
feample 1 Twr 9eambee preeater than
RI
Vawty thein
9
move
Aol Aeceqo/ qumbet
ADD A, RI
Cy=/
Megge
Nezt
mov , #'y' ; f Cy=/ , move
thvough P
meccoge y
; Aenc the
Neet : NOP ado gothi9
END
Ezomple 9 ’ feume that RA
to
valuee

of the value c. 94 the eno! of


tra the
Aoutol eogtan
the lod
the
Valeel hex .
RY the high byte A!
(r»)
41 (EB)

43 = (se)

Loao pointe
Scl
; Loas eougtex
R2, 5

cIR
cle2r RY
A
acl the byte pontor
AEAIN ADD
A, RO RO
A don t accumwate

JNC
Net casy
: Keep
tnccement inter
Dor
RO
Neet :
een til R2
nepeat

Insteretion > elineet , Ret


unp f got
DTNZ
byte
dineet by te ano
clecenent iHeck
(6) ADbC ono 16 -bit Numb
>echen ooeitpg
16-bil dot a operand heeo to be éoree
the prorgatreg f o cay from the loie
-necl ADDe (oco
byte to the highe byte 75é tnstweton
tce o on such oecauion . Fr exomple,
eorth cery)

3 E7
38 &D

79 7Y / E 8 0 =74, Cy=)

the f t by te hghex byte, ofeh


wheg the
ie popagateof
to

The cay
xeseut

Eeomple ’ wnie prsga me


qumbeu , the Fumboee
Qdd twD I6-bit
RAm Locotio n
atexe
39-6i qumbeu
make ly=0
Sel
CLR C
load the Lo byte igto A
gev A, #4H
2o the
Low bytee
3/ , Cy=/
ADD A, # OEC H Nei
the
of

Coaa the hygh byte


A, 02H
hrgh kyte wry
ADDC A, # OFC H oo the
hygh yte of xec
the
fiqaly ane/

be
39- bi num beee
6) Let the
014S38 CO H

RAm Locatrons -
them be ctone
arl Let
olato
adlet sek Data
FFH
coH
384
C7H
S3H
ssH
43

will be at leat cu hytes


The eLelt e adolitien oefau)
bant o by
n¡ RI (f atencle theve e no
Pornte to the to
ued aUarlcble to
Othet *epites ewil!
be necescay to
9recelt ence the
Chaewe hrue
9

the
the
seeonof giter bok
RO of
banke
auiteseo
cleae
CLR the rumber
ep to R2
eoch qumbex
of bytes y
Dointe the lc eyte
404:R
0v Re , ## fint gembex
of
; R! point to the loo
numbee
byte ef econ
SET B Psl- 3 sciteh to bank 1

22
Ro of bonkseecult
porntee to the

Hetwtn to bonko
CLR PSw. 3

byte of the
oge
number ento 9
fiat
ef the
ADDC A,e RI to it
Aecono

eneee ment kD
INC RO
neeenent Rr
/NC RI
sutteh to bank12
SETB PLw-3
to Ro of bank 1
move la7
gov RO , A of bank
enorement R0
RO o
eetwen to ban k
CLR Pcw.g all fout
epeat untlf
R2, BACk ; been
DJNZ Aytee
atoref
of the ado tfon
The et ult
Qdof nees det
BE H
60H
61H
62H
634
the povile of to
alol: tion) ey<treretrnn

num becc
epetot
:/B7= 4 etono gcD
ngov 6, # tH bpran

ADD A. 8 ; Hex adoli troq fA/: 6cH


DA A adyut for 8eD acreition
[a]=72H

ccerce -Cy
gUBB
/aubtrack
SUBg enstuetron
gU BB , Gawe
SUB pet ef
coi th binseoue). To mate
the
make ey =0 pox
Case UBB oith Cy =0 suttact
eomplemet methoof fo
o's
The

CLR
A, # 9F H
R3,# 23H

SUBB
sol
H = 3E
R3 3

ecmplemen)
(2'e
1tI toI

CE =0

Floge will be

Ac =

ey=/
SUBB

CLR C

SUBB , #63 4

take /'k complem


i4 cy =/ then
CPL
ncc ment to
Qoo/
eompliment

Sol,
6E'
22

Cy=l
eomplime nt
, muttiptfeatroq. of niggeo qembore
multplicat0n
The Auppot byte-by- yte
yotox
toy eecdl
place I6 bet

the opurane
guttiplirateg ; oqe of peran/
lo by te -by hy te anol the
be en tegitey A
Aftes mulhpieatron, the
be egeitee 8 an
A anol epper byte
Atorceco en
Louer By te ef eeclt
<toneol 8:

mov B, # 6SH
65H = E99 ehese
SH *
A8

Qeimbee
of up9neol
diviole by 8
DIV AB

Numese ator =

deFcm enatoY = B
Suotient
Lemanalee =B
Nou
AB (emandes )
B= 0s

Compare Inetuetion

EAND enstruero' det= degt


detinatron > AND
ANL Solotee

oitl pefo rn the aec trgatron


operanale
ne pae the the aecurnelatoe
olectrFation i pemaly
The
Exomple ’
A, #35 H

ANL
Aimitoy
oR instretion

Ayntar ORL dectnate7:

xOR enethureon
leetrnahon , ADeree
kyrtox
teet P! to
ohethe
to P
&ample Reao seno 994
value
the leave/ -
atayt
Aolutton. enput
tOFH make
port
; [Rs]

A,R3
XRL hau value
if
EX/T ; Tump
than
pther
&P eomplegert Aeeugulato

Ayntox CPL

instrue hon ) 4elative odo'sece


cINE deetpaton
syotor Trmpg
aetrone
of compatpg calleol cINE compare
the
n to
kingle nstauchog
combin eo/
qot eg cwal)
A, 6YH , NExT
Ezample CJNE
compaxec egectex oitf value

Thi enstueon alrecc


NEXT

ano Tumpe to taget than t7H:


value othe

gtimbue
Erample Ten Hex rite
enwarole. biggest 9umbee
cetThe
Loeatron4
gumber t the
the
bggut be caweq/
to
Lowwo fihally Ro the pointer
RO,#SDH data
Se lutren
#/0
RI

A,R0 gove

CINE A,8 Lorp


to Locp?
( x8 Jnp
Loop
gove t to B

tnereonnent pbintee

epeat trotil tke cotnter o


DINZ RI, BRCK

A, B : tronefe brg pet numbes to9


Iransfe the 2eceelt to
loeation 6o4

END

Jemp anoeal!
instsueto
the
actron by

DINZ eg, Labe!


deeteamen
the sgiutese ie
instuetb the taget roo'tece
thic tD

not
the
label
sefoeol to by AGAN
DÊNZ
eample 2 0 then
enment R2; ef
o/th eremer
deese
tnfeveFrog
t0
eill
feomple ite to loao/the seluny
the vallue eomplemert the
- telatoH
Q0cumelato 76

eqclesec
solutr any
700
negider) tor
capoer ty cf
ke count
to hol
retee Coop
the
R3 , #/0 coUnt
loop
the eFno

complement 9
A GAIA/, CPL
R2, AGAIN
DINK
DINZ R3 AEXT

the
to keep
thi
the
enctueton. ano
Corn theougi
be conl
efeeret on fcec
coferewe exe ceteal: hel en
NEX Count 70
R3 the
loaa/ R2
the cPU to Coop
state
the
loop becomec
untfl R3
continee
jinicheal.
O
ther
JZ(Jump
Jup
kyotox
LABEL
Syotor to LABEL

T9p (Logg Tump)


3- byte
¢he
op Lole , ang taxget locaton
kyte i the
of the
Xeptecent 16- bil- a t e ce Tump to any
allow
bytel aoolsecl
The teo0 hyte tas get to FFFF H.
Locattorn fom

( shoxt Jump) the fret byte


e,sTMP enetseueion selative
tco hyte the
thet n
Secon/ byte otosece
the Heletve
the opode loeatro The
the ento
Qolo/>ce ce of lviolec/
-/28
to +127 byte
of that the
hackwato Jmpt of
to the
Helatve
of mernory
ave ialso chotyump
4n eondithonal ump
Note qr
Qclofeee
caleulation of ahent Jeump
the li
while the of num ber betren
Value
prsitive
- plotenme nt
zhe

value of o to -/28
the oleeplaeme nt nc9ative
fee , veufy the gump
Euample Using the fotlo eing dt
frweral caleelatioF.
Mnemonre opearol
-opeode
Lioe
G000
mov RO
78 00

74
C3 NEXT

60 (03
/NC RO

top 6
AGAIN

NEXT: ADD
77
oo9) oVER

F8
moy RI,A
R9A
13
mov R3,A
FB

ADD A, R3
28 oVER :

bo13
SJMP HERE
FE HERE

END

|8

Hore Qno TNC encteenetront both Tump


folution

label

NEXT 03+06= 09 H

oVER
JNC
STmp HERE

Label dolseete
the

FE H= / H
the eey
/YH
HERE
cALL inetueto? >
thi S- byte cntwctrtn,
epcooe anol the
the
of the
tke fonet Ayyte the odrecc
thiwe ece to
tayget bytee
subroutiFe7hëxefre, LcALL zhe

Sebetrnce
Locateo agyohee
call
the goSI:
of the calleof
that affesc to ,
To make to eone bak
the
the the stock
the ocee C0H auto maically below 2cALe-
emmealiaely
enetuekrog
the back to
odosece ef coptro/ trontfe
If RET (netusn) xecuheol,
staek,sfoneo n
trea/ly
autornatreally

.
byte cnstxuetion , cohee ax
3
enctureon
betoen gcaLL
eoentee the sfaek
the
of RET
fnetron of Zhe
the
the taspet
The enly offoeqee
be oryhocr ohey mect be
d t e cC far CALL
Lohile the taget
Tnput/output pggromi
otput. 76
can be ceLeof for enput
and cectps
0f potO both input
the pnt
to
each pin muet be cognceteel eetenally
the foet that
/ckJ pull-lo ecictoK olue

PO an oen Vee

PO.0
Po"!

pO2
PO3

Po.

Po

oill
eogtntouley end out
value 0f sH ana AA H
to pot 0 the altegatO

P0,

jov
Po ,
gov
Symp BBEk
Pext O a ciput to make it on rput
po mut be progomn
(recrsfeee already cogeeted) . the
to all the
eo ky
Erample Gqet o kyte fom p0

pl
gake po og npu
al! 1s to it

get lata from po


BACK : mov A, PO
to

SJmp 8ACK Keep


pot.
ele tnput (e cetput
loe not Feeo ony
Can be
thiu pa
lo co tact
tecis feee aleeaoy
pull-tip
HeLIS tese

teggle
4, #sH
gov p., A

SJmp BAek

weecl to provide oeay.


D Note AcALL con be
fac been eofqeea
make - inpulr post
qgacn , i mut pogcommed
bit

Ceample

ngtv
make p!
to

olata fom
nev RY,A
Jiut
enput (o) output.
be
can
qeeol any pull-ep
pot 2 doe qot
Uke
ha pul?-p
ih alsce Qaly to port 2 alterqaieY
Eeorple sega
A
to caele
8ACK: gov
DELAY
9cALL

SJmp 8ACK

nput Rema pot

qov # OFFH erpel- pol


P2 a
meke
data fom p2
A.P2 9et
can he inpuk a) output pt:
qot neco pull-tup
ony pull-p tet, Tuet
tereteey

eogtgur eel a on inpul- po


the
thiu qot
aderton fugtreq of pDVIog
ccmmonly inteLpt
eztxemely mprtant 4ignale
RXD

Keial communieatbn signale

e Siogle B- inetwehont

Fuqetion
Iosteuetionc = )
Set the bit ( bèt
SETB bit
dee the

CLR bik complemert the bit


CPL
to taget if Bik =/
Jurnfp
JB bu taget
Jump to
JNB biu teyget to
Bit =/ , then
cleer Bil
Tump
JBC taget Bis- ae'secea6le
oil! clear the
SETB 8 43H 34 Bt
Eeample RAm Locaten 34

SETB set

orll elear bil- g of


CLR tu.

You might also like