0% found this document useful (0 votes)
4 views

MP Lab 3

Uploaded by

kavi20053878
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)
4 views

MP Lab 3

Uploaded by

kavi20053878
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/ 9

EXPERIMENT-3) PRIYANSHU K.

SC22 B134

AIM:
1) Wite an ALP te a t an anay of fu velus in
2 Wit an ALP te Aet an

duswiny erder.

uyit faiw DE anl HL


4Wit an ALP to caleulte he 4 umbes

'Conileel a Auhreutine
5Wte an tLP to ad tue emhes, Call a
and subtnact dh tus nmle Aukrautine

PRoceURE:
Commom te all sub
To wite
RESET’ EXAM MEM’ NEXT ’
To exeute
RESET ’ G0
To vexity
Memory loutn i REseT-EX AM MEM ’

Kegiste : RESET EXAM REG ’ NEXT


ant 2)
Numbe to
ascending
ee sarted stord at locatns &500-8 504.

Satel Valus to be sted eack at 8500 - 9504.

flowchat:
START

INTERNAL COUNTER(Ic)
D=4EXTERNAL
COUNTER (EC)
Point HL
o 8500 soURCE PoINTER
Move HLþoided
contnt to A

Move HL þointed
contents B

Yes No Yes
No
A<B? duwudnor A<B
scendig
Yes No excange
Cantents
Hhe two loathon
C=C-1 ( DecremetIC]

No C= o ?
(Zere 1?)

JYes
Move Dtoc END

Deeremedc(Ic)) Yea
No
deevement D(Ec) eo-|
ru)> Asending
Ixarami dtustiy alsPooo. L(2)> pu andiry

ofudu Memonic Duoiston


AF XRA A acuylate content wit
df to set 0.
MVIC, 04 load inmdiate value o4 H
Bo02
ite ugister C.
o4 [TNTERNAL CoUNTER1
l6 MVI D, 04 Load inmmediate valee o4H
8o04
into uyitu D.
o4 [EXTERNAL coUNTERI
goo5 LXIH, 8500 oad immediate vale Bost
8500 H
into HL maister faia.
85
[SouRcE porNTER
MoVA, M |Move contus of lociton poste by
HL to Qcuulato.
23 LNX H Snomeut he alds
hy HL
46 Mov Bo M Moive contuts
HL to B.
f loctin þoitd sy
B8 CMP B Camfune Bwith A.(
) DA)D2 4) Jc &o1 3 4) Jumpto loutom &o13 H if
13 (2) JNC g013
| ) Jump olotim oI3H if
no cay fly i set.
Move content of atwmulador to
BooF Mov Mo A locatin þointed by HL.
28 DCx H HL
70 MoV M, B Move antentsf
þointed by <B to es cattin
&o2 23 INX H
o13 Decs Lhe vale stedin
8o14 JNZ eoo8
Jum to lucatin &o08H
o5

Meve contens of Dto C.


Mov C,
DeR C Devement C.
15 DeremeN D.
JN Z o 05 Jum to latin 8oo5 H f
05

DE RST 3 Retwn Contel to monitoy,


RESULT: onfat values 07, FE, DD, E6, 85 at
8500-&504
Qutfut: o7, 85, DD, E6, FF8500at- 8504
[tontud in asanliy dun .
values 07, F, DD, E6, 85 at
8500-&504

Quthuti FF, E6, D, 85, 07 at


8560- 8504
CBortd in kesenling onda].
data ing stack memory
To exchange vales 1234H and st78H Ated

flowehati
STAKT

/HL =1234/
DE 5672/
Poit SP to STACK Po)NTER
FFFF

|Push contend
of HL ostac
Push corteds

Pob condtet
fstack to HL

|Po contends
f stack to DE

END
Starting adbus &oo0.
Memeny ofude Mnemonic Duoitin
LXI HL, 1234 Load immehis valu
1234H inoto HL gister
8vo| 34
&vo2 |2

11 LXI DE, 5678 oad immeliste value 5678H


78
56

8006 31 LXI SP, FFFF Losd mmelite value FFFF


FF
into the stack fointer SP.
8b07
FF
Push the Contents of HL into
E5 PuSH H he stack þointd 'bt Sf.
PuSH Push the Cqntents fE into
he staek pointed by SP.
E1 Pop H Pop t cante nts of the stack

D1 Pet the contents of he stack


into E.
RST 3 Retwn cntol to moniter.
KesvLT:
Jnfut values 4234 Hin HL bais and 5678 Hin DE
H’12 3 L’341
5678 H in HL bain jj 1234 Hin DE pais
H’ 56 D» 12
E’ 34
Additen eing gubroutine huagammóng
To add valus ol, o2,o3 and o4 sterd in
nagistu ty B, Cand D xesfeckvey, wuing a subautin
with
sttig alls 8500H:
flouchat:
STAKL
Roint SP
locationoSTACK
FFFF potN TER

E-27

A= A+8|
CALL Sul routine
|A= A+
Keturn

(END

ice addition hasto be


in this tLP, cutiny a 'sutnautine beneil,
as itt can
Ca be called 'anytine and t any loution
Furheme, it Aelhe cut lown on ae memey
the man pram.
Main ALP - 6taxtng addes ooo.

Memoryfude Memonie
31 LXI SP, FFFF oad immediate vaue FFFF
ito stack hointe sSP.
FF
8u02 FF

3E MVI A, 01 Load im mediate olue 01 H


into yiste A(acumalt).
Soo5 06 MVI B 02 Loal immediate vae 02 H
8D06 02 into agisten B.
MVI C, o3 wad immediate value 03H
8D08 03 into ugitu C.
MVID 04 Load immediste value o4 H
o4 ino egiten D.
&ooB CALL 8500 Cal the subrowkine sted
&ooc O0
at &5O0 H.

85

SooE DF RST 3 Retwn Contol to meniter.


Bubroutihe for additin - Btanting adhs &500.
Memy fde Mnemoic
8500 80 Add tae Value stolin B
e valu steedin A.
501 8( A»D C Add thevlu shrd inC tthe
velue sted in A.
8502 82 vae stered in A.
8503 c9 RET Return he value obtained to the
main ALP.

ResULT Snfut velaes 0l, 02, 03, o4 @ A, B, C, Dxuftiely.


subouine
fnduciny a duay
To add he vales o9H aud oc H staud in
ayists A26, inducea delay uxing a lucf- like
subsoutine (a down- caunte)vals.
and len penfm
btracton of he same
of the
flo wchat
STARTD

/A=9/
B=6

JA= A+8

CALL Sulroutinek

D=FE/

|D=)-1k
No
A=A-B
3s D=o
END
Yes Retun

The Subrouhine actk as a deliheute delay- indue


Counting down fom
down fon FF to 00. tlis ü efu
iw situations" when an feution eds to take flace
Some time þost the fier ofontin,
to llob/ in casforate
av ot
but tke softae- indud
cane "of ardume
take cae
Main ALP- tartng adles ooo.
Mnemoie
(Memey opude 3E MVI A, 09 Lual immediate value 09H
into he acumulaty (A).
09
o6 MVI B, 06 Load immediate velue 0bH
gu03 into suyiter B.
0 App B Add the value stored in Bto t
Value stred inhe accumulato
&005 CA LL 8500 L the uboutine stered
00
at location &500 H.
85 [DELAY1
3E MVI A, 09 load immediate vale 09H
inte the acumulatoy A).
MVI B D6 Coal immeliate value 06 H
&oo B indo igisten B.
SOB B bybtrat the vale
RST3 Return conto to moitr.

Bukoutine for inducing dulay (down -ceunten)- Atanting atdaus


8500.

Memey ohcode Mnemanic


8500 MVI D, FF Coad immediste value Ff
8501 FF into nugiton P.
8502 (5 Decemet the vale steed in
Hegister J.
8503 C2 JNZ &502 Jump to oation &s02 H
8504 02

8505 85
8506 RET Retun to he main ALP.
RESULT: Qutfut o3 @A (aceumuleden)
yolds o3] subtatin

You might also like