You are on page 1of 34
4 eer} : " do fi _t assen bly Language _prgaesn. AO find — nea of 5 umbeas — $ored fren Y {cation S304 and oncoarelt.siore the. emery locoion addres 4100 __~ Tniialize fel pare with [- ddseos of 1" pumber. ~ DALE L0OH aia B-< pair coith |} ——____ vi Brosh dlesH notion adver. b Store count 7 Ger novia accumulator. lik a complement of ne tn ace | I AF at + | UINXH 2 adelress poinkd by Bea} [Inyx% B - increment Mel pac H] [per p Enerement B-c pair 4 | Lrement count } \. j Sve Loop Ts count rennet len cr tp _labe Joop * i fe 2p ping _ oD Es \ ‘coun isthe. aceuvtence, of the Sala ICH ing memory beck | _Starting from 4O0oH-6 400FH.. Store, the cdunt- oN a memory locaHan 4S00H j t 2 Label | Mnemonic ope 4___| SMM VLC, Lor LMI. Bs 00H Nexb NX H 1a id (e Nay 20 Comments. Nb fee ; glore. Gi ount 1Ol'tn it ‘Snilielize octurente _ | coupk tn fi | ni! ones ae Star} Ing a addrens. WM _| Ger the no. tn aces > [check whether the nag Lact. js cH __ fino 2} abel next yegisier B by Increment “H-L Pair peR Cc Decrement count NZ _loop. {is comokzero ? No-junp | 4o_label Loop. mov A.B Gek counk in occumuloty STB 45004 Store count of pceurence. 1 ak 4500H sess ALT. Stop_proceising 3) Wait ap assembly { l4o_Jo79H 2 program +0 teansfer_a rnemoiy blo & cee fyorn losoy | 40 JoS9H a nea 7 blecle atarting rm 107OH commends -Lxbel | Mnemonic 4-0 perc Sor | kn iy Hy 1 So “Toad canon (em lasp te trea! USD) 1070 toerd_conken frome loro4oP ray Mvic, of | sel commie? 04 ye —-->-=-xsX— ——— oop |mMev Ayn Move contents from memory FJ to accumulator. STAx D fore. Acc. conknls to t Nx -H Tacrement HL parr by z L INX D oO Lh —_14 The | Tncremene Se ORG | decrem L HINZ Lo jure FE ind 2200 ela G4 HIS an assemb language program toaddo “17 dlecimal numbed “det ok Reo ord losfip [ — alo the result ar | | OSA. And [oS 3H t > Lahy $0 use. DAA instruction vohile addi tion su pace. = 2 derima) numbers 28 and us ~ are added, BE —> 0O(| 1ooo d + 45 > Ol000lo| ‘ | I 23 OLIt {yoy i 45 : H DB 6 answer is prong thats hy We are ey PAA_instydiat! io pis PrQorem, i | ans 7D > OV [Loy. = . Ollo Caddoer bo NG (906 0011 tefoder - = Bye asya) a re ee ol Im ic ++ Operand. p Commenls_ or ee "| fryfolize HL pole to Tit ry acelsees |oSOH . 00 =| tiliatise vegisler to 1 nil B.20H Sjore. SB of Sum : Mov A.M 2 [Mowe to. in h iN x _H ~ | Get addres of next no. | " | Apppt Add next number + acesmoutator, i DAA; 5s pecimaladjuct Coe roulely cnc LJ —|Te cary J No, jump to fabel I INR B - Hacrement vegister B 4 fiw -|tncrement ttl xb MoV MA fore LSB of aa 4 al ypnem nr ov AB _ [Move M6B of cum 10 ace. INx —_ | tnerement HL palr by 4 Mov M.A tore MSB of sum ic} ymnemory HLT [Ret 1-0. Resfar} | Stop execution 5) We te an bb} vy to fom Tine multi plicaticntof foo B_pit Numbers cohere. stored at the memory focatiny mult plicand td [asl and 250 2H and ynulttplicr js~storef af 2503}. Th || Nok - | memosy location Van : test js pope stored af address 250} |o 250S Lock0% Mav amie)” 3 bit MmulFi plication is extended to 16 bit > We solve it Voter Cry) mbly language thee ———L multiply “Juve S-bik he See Stored jn AX IMT locations coos H_ and C006 fH. store_ the __ _ dion Wye. vesclt in Consecutive memory locatons Sterling _frem coool, CMacch 2003, 20057 Pr _flocochast 2—. \ Produch ot 2 nos 15 tound using . L J continous b s00 nN. L oY [Prdak= produc+Ne| | H | i | Suppose. I eS No=26 Producksoo \. Aecording to Howchart- I produc = produck#Wa. I = O+G | “. [Product=6 l I NieNi-l = S4leG M=4] {\ \e Ni=0>NO= continue Pn loop, \ produch = producFt No = 646 2/2 Nir 3 js Np £e pawelucl = Ny = 2 »No>_ jn 6 Mp t Niz oOo > No > conFinue in loop. 18 jpreduck 2Yy+6 = Bo. Np Zo is Nizo > yes > eFIF F7OM loop. the yoduck Stasting From Store memory locaton CoooHs COotH. * sos Pym Os) P) MalFiplcanm | = Per Memory | label [Mnemonice Comment addveis| Doon | ‘Ley, GoopH | Sek init product=g Doo lupA coos H | ser LAcc]=Ny. D006 imoy €,A | serfel= ny D0 0% Ina coogH | cet Tac] =v | Doof | Mv) D.ooy | set [0] = 00H - Dooce |}00p ipAp p | products produck#N) i Dood Ipc A N2= N2- | _DooF iNz loop | Repeat if No #0 ; Pou istic canny | stb ye pyedud- in coo and oop | | ! Dov Her | atop. | | | ao | Ci) 6N ws ae ee Se -Ableck ef dela ia_shored_in_mmemory — <—bo00!t_do_p cori Thisi_a-pangram.to_shigt —y the data conkxnit_o{_the_black in 2 —— oo => am oe sting Aim Data,’ ‘TMemor ~ (iar) 10 DOO| U = pog2 [m= DOOFH, i2— D002 [M2 =D100n it |count= loH bh | 4 [data toe] = Daatmy | | “TM = wT] | | [M2 = Man] 20° Doo | . | . 2) < O00E i 2 { 22 poss] | { POOR ! : ‘ | DoF ' a | Mi] Stop y Mis DOOF H. + source MEMOF TocaHan- Ma: ploo Wt — Bestinakon memory \ocaHon, Dota EM2]= dda my] { \t [Dioo= i | MyeMi-| = OOF-l = oon. | Mas M2d1 = [00 = loly. count= count-\ = IOHLTé in decimal] | > eount= |é1=ISE FRI. i \ cound. _ » Wo loop conlinues LOT c 4 > i oj ted Memon Data Dal a Peal DION ~ on _ “plo l= 93 SRE MT = OOF | = OOD. __ ~ Me. Meats loli = 1o2 HM count = cow af DIOBH - 16 DIOgH = 15 DIOAH — 14 Er like Hhis_ all the dafa is | Bidet = 12 hansfered from one bleck of HORN =a memory to another _blocke. | _BI2EH.10 : Counter = oH Lin hex) Bee) oe = 16 inderlmay for total 16 Nos. : Memory Lab Mnemonics’ Comment addrefs or | btlH, DOoFH, Sek up HLas poinkr source C00 - y lx D, DdooH | Sckup DE as poinkrdet¥ C003 ad | C006 > mv B,tcy | SeFUp B Fo counk 16 byte co0e loop |mMova,m get data byte from mem, leoog | [stax D [stove data by oF dese |COoA bex H clecvemen} Sousce poinke [cooB | INxX BD [increment desH nation poink | cooc | DcRB Decrement counr. | cooD TIINZ Joop | if oF zero, go back. cole | Her | Shop. | j j } tine _tengin. ot. lock is_slaied_j —Ltnleck of Nth sled ia BL ie ——0_program_ia_assembly Langu dhe “tontents af these two blocle.t ‘Tidarch nn = Suppose A “ptr ply 2 & 5 Poo lsio > Dlol>2 x D192 Dloa=> Go D102 Go. nues | Coneinvel LYLH, Dooolt ‘L¢LD, DIOIH | tov. B.m_ | Sek 7. eae cides oe courte mos Ser up. seh = a ip DE 2s indecdaz-dack - | ux HY o next Source “The M1. Ger dolabyte from st Loax b [toad databs Mov 4 A store [AL in first a Mova,.¢c copy L¢] tntoLAy STAXD. Stove LAI ot second block. Livx D poinker to next dest leat, | lper clecremenk Count lay next Repeat the Joop | HLT Stop ! 2-56 Ab ta is Stored i ivorn Boot, The — \ength ot block is Stored jo me) ! - g DoH, Alike od pgm that seaycher for first occurence [ot d SH | ck 4 °. [Hic ocruvenwe in Hel Poin. TF the QumMber is vot found + then Hel. ear showd Contain FFFEY = | programe, ~ | temo [ Tobdlvinemonics Comment address | coos LxIH DoooH Ser H-L pair to Do00H, £004 Move,M | Set count =[ Dood, | cool MMVI A,o5H Se[Ace]= 05H | c006 | Loop [INxH [increment Lpoir by L | coOF cme. [is memory locafim=05 2 “Comment. * Next uf Mem locotfen counts count-L “repect if count-Lo =z Ser HL pair to FFFF Tif ne not Fount IO S ° o I Dota foou= oc \| 1S OS = 0S Yes | HL= 004 | ‘ | at | eeemnemeent NO; 2.5.7, 0.4), The. aceemulator— vegials ® conta i. } conbains {he “lol. A+ and “65 1f. what vil] be dhe, _orkey Tn hex i1o_< alla. fe exerution of inshudions ? following instuchons ¢—____™ ANN! > XRAB TiD_ORAR, 1) A ayy Jerry =>) ANA 8: ~ > logically AND toith Accumulator.ond req B, | +e ‘we execute, jhe above instucten. The _actumulotor ¢conknis coll be o. follo.. A = ARH (o1oO 1of0 Aevlotn | AND bi non B= 55H. O10] ojo a Accumulator: AeB= 0000 0000 = 00H, ! . ij), ¥RAB > Exctusive-OR with Accumulator. and req B. The orumulator conn will be as follows | A= AAH {olo [o10 . A310 19 BOR Bg. 55H O10] oft. binary [Ae 2 AXRAB = IIIl Ti]| =FFH, di)| ORAB. | —» OR the conkols of Accarmulator and req &. The ac rv conko# will be as folloa | A= AAH [O10 101 | [22 3 = 55H Ole} 67 ol i Acc =AoRB = Til) tit) = FF | aa bt PLT me cha te logicatty and Nb Qeecemulator. q J 5 Tne accumuatoy con teols will boas fotleas. tA AAW. = Tere foro. AND ——— +AND A SY "= 000 aod -Acc = AANDSIN=_ [000 00 Som plement th Conkals oy La coumulator. the Aceamelalor conkods wii be as follows. a ee A= AA = (010 fofo- oa 2.2 for atte amples [yom 7) +0 2v)_yefer prota _huth table of AND oR Exon Not 257 G8) The accumulator af B08T contains data ua cohar ipill be ths contents atter the exectHon | ot following instctions indesendenty 7 Soma ji) Awt ogH ii inea! (8+ 2.003) 7?! Demp i : , I Complement the contto}s of accumulator | A= 43H = ©0100 oo7;).. lL "ecmp. > {oll _itoo BAH. —conko}s of = actumufator. | | | | 7 i) Ant cal 5 1 legieatly Abe: dog with conknk pf _—acerumitlarox im ediadely ________ 0100 CO) : A= 43H = | ANB ogy =_9900 (90) a Actumulaia’ = 9000. 0001 = Ol}. ii) 1NR A. i. | Gncwement tne conkoks of accumufator by 4 Az 43H = ole0 ool): : 1 + wt addi. 01g0 01090 i i yy = SAH. 1 : Pno-25F @NO-j2) @) Wrike on agsembly language, Proaram' to counk [the yumber of times the dale ADH is found | fn a block of memory locations slaxting from | 2000H. fength of bieck ts ‘stored 16 loratt en JOQFFPH. store the result jin locaton 2000H. | i oa : (March 2002) Here lengts of block is stored jn Jocattan —— 2EFFH. So we use +his memory locaton OS a pejnkr. we so\tl decrenen? Polnkr one by one when’ j9e' 9's an checking “ihe pumbes Sy an flowchart 2~ ‘Poa No — sgn tt | 1S = i> at ae dase H Bo08 M t (START) 3001 ie { L - x 3002 ADH. count 2 oo 300 ‘3 Pty- Carrey 2 . ADH | ML > ZO00H aa — Boos. TY [count =.09) | pEré] 5 a = ; | J Porat Mc peount=T | ag we r shoving | = ADH e7 jeount4\ |i |g numbers in met, 0. Dota LM ie ADH, 1 1 Wass) 1 pataflzoos} =ADY. | ud AD | No-> MUL= Sool. ptrT= 6-5 ig Pty =0-No. @ DotalmvL] =: ADH Zool = ADH Ie (2 AON NO> MUz Zo0n Pgh py = eT=ay ve Vis Per = 0-No | DaotoLM:L | 2 ADH, 3eo0r = ADH. ADH eRDH as Curt 2041 I] Now,c= 3005) PHS SATE | M.L 2 3003 1s Ptr2O-No. oe
    t maremenh MWe gy cue an wenen bly Ve ( ‘ ' ) Veriquype Pee to copenie af ai fhenrnite, eat 4 1 lorotons eas hyp haan Fur Tear to baal, 4 add | Memory fale} fdinenunier $s = LDA_Inobwedlon baa. Cita done) Comme, Operaard . Sif Heatise bp pain jy mien Aelelnen pouty Prreremneal cien. dy f : . Jneremen) ce by J. fond vires Leon 05a ~ ynemn locattan, Snovengent eee by p> Lb tool wie A ip A LPA joo | tive A | mir A Jrnermngen) Ace shyd | LDA 169% load avers Prony ose i rer: LOE Hay, = INP? A Jneenjenh ace by. _ INP A Inevernmeny ace by 1 load aces fon 1057 - ep ena mea). [ocattin _ ‘Snevemen) cices bayyg SSS aco {yon [OF mem, loco neve eo) LOAN JOO7. INP A vpn ereceded. copies conbtn poirded by addaras ove ay Muto of — 3 y i Myite an. se scarbl an suage- pregram, thar vider tive one lex numbers, where ~Aivident is stored. e manory_locatten DCOOH __— and divisoris slored 1a memory _ location —DOOt1 Hs store quctenk and rel der_im memory _— Locators: “Decay ood Doosit yespectivly, Et chy 4 r_pesforming __~ oo canbe performed using ————eertimow substation: x Mua eine. aise a A SLExd_§= store numbers 5 Fin > Deco aod Aas divisor in memory Dooly E 4 - i} | QL Z4 No - 4 Division = gz¢ : i Remainders | Mis) do label, Mnemonics ai ‘ 4 -Memary 4 ; Te Ope Gj st f Operancs. addregs [Lx HDeoct. (oom Loa Ww Cormrntn)s fete pair to didn nv COON, |_Set- quatient soo _{MovA,M ees . NX HH. jrocrement H-L poinn — fo ger_divisol cmpm Ps Ni pN2 7 Je escape. Go to escape TENS | sua m Ni= MN. LINRE {Imp Loop F=94t1-CQuchent JYmp again to a a Colo escape | INX H. Store 9. in Dory e cot | iMov Mc co 12| tnx H Shore vernainky | ‘DOO3H co 13 | MoV MA coty | HLT. Pop. | 274 4 artie_on_asermriy Janguage progrom, 4 generate the fibbongcel's Seneo foy first fore -+he series in a memory eight nun bers | plod Starting from © /00H | Cwote 2- Th | are 00, 01,01 02 03, 05.0 | the fibbonacc)'s Series by following method. can be tO firs pexanumbers of series 8, OD) C March 2004) found. default we have JF uber 00.2 By 2 "Numbersol | tt ake Then Ti nua ber = 69+} = 3 =O]. gt vo + 2 INO. Sa 5! ath Like Nex} mel cu New Ov OL DMO: q por 3 No 2 O02 t oO) this we are eu Operand | a LN\ HH, ctoon = minen!s . : ive Hel Poly wit count 06H veo D.. MVIB OOH _(Snifialize reg-B wilh 1 _ _ 1 [no- of (rbenaces Serie, Mov _™,B |Copy the t thor men. LN Lineremenk H-L pair. Mv} ¢,OlH fEniHalize req.c ohare : |no of Tihonacet Seria Movm,¢ [@opy secod no aF men: LOOP UINXH . Lineremenk Hel pour. | MovA,B ger ie. Ome. im ace | ADD C | Add af long ho eath | I dov M,A [Copy the resulh ak I t Memory locaHa rea, { t MOVvig;¢ Copy the conknk of i J { {Yeq. ¢ lo ye Mov cA ties Ee rt ! | | ace: Inthe rege, perR B decremenk COunF . | NZ Loop. Is counF zeroz No. | TH | jump ho fabel Coop, a end [Hess 8 € Ghop _proceasing > ts __| { \| i] —————Length. obit _ sr serf beg! aa 24 eceare ccna Write an AP i number {ral e_arnaltes j_of Numbers, whose ~ na SE") 2 igfored In CO00H and the sene~ Tren in memory focation — 0 in from CoolH, Shore. the ~ Morse = “T Label | Mnemanics poperancl__ Coroments. . [Ser HL pointer #0Coo9 he ~ ; CoH. ee 7 ae ea Gek Comb 10 C oh Gade mvl A,EEM ser mostes+ = FH conbLoop IX fh pee Ser} cons! cmp M ropare. with previous ne. Coog | se ahead lo, Sos én aCe S, Coot. riov AM [Yes _geH Smatl_no. nae: CogDisthead DCR decrement count Nz Loop yepeatifi count £0. COoe. } Lope? ___H Er op processing . >| Shesotors fp FEW Ae eoath Bi c=3 [move], Ly coo0 $3] oF bid @) Mb cool Linx] G coci—9 - Po [cmp M. ty 6002 —-G= ano | A SEP > Mee 5 & 6003-6 - aN [sf LAT >T MU] then both camy and zero Hog are _teich i | (A =5] Emov A) c= 8-4 =2 fe=2] iS Caunk is Zoro NO ~ (Mi Mb Hl=Coo2 CINXH] S emp M o ; NaS > Mle g Toate al coy 4 echo |. ee 4 = emcee ir place Tm. then cy =\Acawy Flag isse. - Ta theo it coi) gg to label ahead Cconhml) - —1+£—_Dee o o o ~ C=zit-t fesof L 1S__Cownb=0 Yer, L STA COSOH > Shore conkls of, ace *o_memen location 2050H, Now “A=Y the smalleaP Nove Sferd in memory locahan QosoH PNo-2357 G10)! The Leng My of jock ig ln Memon location i ZOuUoH and block jtseyf be ; L gins from i JocaHion 20H Visite an A:LP +o Fing largest elemenk in the. pi | och. + shore fhe feratk of Location 2.280, Some _prvgeeum Of Find smaller elemeny . | only @ changes 1.20N= 00H isto be | compared with all elements, (2) SVE no cary Hog is ser -jemp if Be os) Bearer) Pg ———_lLabel| Macmonic4-Operndi —__Commeni——_ aes ee 2 sua ft seh EL polaker to 2ave ~~ ll Mov 2M ‘ger count in rege. : MvLALooH. [Se largesF = oof) [peop | wx point Fo Oo Sevjeo i cmp MA Compare Me face: contenk | =jNe Ahead, [jump fo label ahead jf cy=o i Mov AM Yes, Je larget No. jn ace, bead] DOR C cleeremenr Count. | SNZ_leep. repeat -f Count +0 ll STA 22801 Store result f-e FA] = 2294 HET. Halt: getting laygest nor —@. Miike an assembly language._pragram 1o_courl—_nosber OL ever dota_biyes —octuy ng_Yn.q_block_ stored ——-bem_memory location 900] || ond onwords The. ———-leagib of lok is stored in location B000l, TS the result in location 310K," CMar.02). ~—— Plr=2900— Ob-epun> | aT ART | Tit z091 05 i) ics dota [rf] Ol-3.902. 205 = Avene No | 93-3003 MLEM AAs Sey [0% 3004, Phys ole. Ns pt¥= 0 Wo B is dela [Mt] =04 Cen, A CouM 2 Court evens Nos a Ise e | |< 2 : aunts OF) san 4 | et | | Mik = 3003 ; Pty = 03-[ 202, iso piv 2a No ! Quis dotolm J = 63 =add = NO AL= S004, piv: 02-11 Is piczo No: ig" dabo [mM o| = 02. Gog Pe Nes ab = 3005, counr=o2+] = a9 ee en \bel “Mnemoniet _|__ Comments, i LA F809 Trihalize: HL pointer to | S00 t+ aie Bool | “Inihiclize_feq B to sfore t fH] count. ire7 SM | Ger feng of blaking | LINX He | Zneremenk Hel pairby 1. Mov AM | Get no. In qetummedator IRR [check even number. tc Ahead | jump on cary he fe | [ho fs add, INR B | No~ carry "Inerementcoun}. Dene | Decrement c_by i SINZ Loop. | “Is Zero No. jampro | Loop. [ylov A,B store gunk jn ace “STA ajoosf | Shore resulF jn 3/007 HLT: Shop. = 7 US Coaypater Stone tl ‘al Awweinilily Tanginaye Moyea iy, y Vserles at numbencany toned Henenory rom fig in assembly hangiage to tnd haggent avait Jargestmmber in memory toeation DOL, my fay MY) ing, Nang nt hy hy How chants Count 0 Langest OU Mi» DOOLEL MO Uy rent ance fences | | Nem a Lake \trtmonien Comments “ rnin SOUNET pate Qo ENET Ow Wray Vargo any i NO Ata | LMR ith procions no felt po ean No banger isn Nee Goto AHEAD Foaw AHEAD Nv eee sae ie nae Mtoe ot oat memary | | . Counts Cont | HS IN Log | Repeatitcount ea i : . MA | Stor lanest no in MLD | —_— Smallest number initially set smallest = EEL i | SF INstrction | OO AV] APPR: smallest “FEN | f set mallet < IMU if smatest > IML] | Se change instruction | OXSIC AHEAD. Vex, smallest is ir SB Wate an anembiy) language program to | k | resuls IAssemhty language program, Memory Label | Mnemonics ‘Comments address cox UATH, S600]: Set pointer to Ma00iT | MOV AM 2 Take 1 no. in Ace UINXH | sTesrement 1 L contents es SUB M 7 Substract IM no. from Ino, cms JPescape escape if result is positiv b ca | Mov AM J Mfresultis negative then cosa | DCXH Substract bY, from I | amber | coe | au 2 sn the ¢ve result at memory location 3602H | OIC | escape | STA 3002 ; | coor | at {Stop computerseienee Wo Flowchart: 3) Waite a program in assembly language that multiply two 8-bit hex numbers sy in memory locations COUSH and COUGH. Store the two byte result in conse, memory locations starting from COO0H. Assembly language program : Memory | Label | Mnemonics Comments | address | D000 LXIH,0000H | ;Set initial product = 0. | D003 LDACO0S5H | ;Set [Acc] = NI | D006 “| Move, A ;Set {E] =N1 | D007 LDA CO06H | ; Set [Ace] = N2 DOOA MVID,OOH — | ;Set [D] = OOH Dooc | Loop |DADD i product = product + N1 DOOD. DCRA jN2=N2-1 | DOE JNZ Loop i Repeat, if N2# 0 D011 SHLD C000 H_| ; Store product in C000 and C001 Dowd HLT ;Stop yNeveyeer Niet ray of BOBS, at Unstiuetion Set ane Progeamimalnys Plowehart Nt tenny No- [Cunt] Botnet sa a A block of data is shift the data conte stored in memory nts of the block in D100H. from DO0OH to DOOF H. Write a program to Fsverse order, starting from memory location Assembly language program : | Memory | Label Mnemonics ‘Comments address | | Cooo LXIH, DOOF H jset up HL asa pointer to source coos LXID,DIOOH | ; setup DE 8 pointer to destination C006 MVIB,10H #8et up Bo count 16 bytes C008 | Loop =| Mov A.M get data byte from memory coos STAXD #Store data byte at destination COOA DCXH + Decrement source pointer cooB INXD Increment destination pointer Cooc DCRB ; Decrement count Coop JNZ Loop Fil not zero, go back O10 HLT iStop % block of data is stored in memory starting from memory location DOO1H length of block is stored at memory location DOOOH. Write a program in asse language to sort the content of block in ascending order. a pe ~ TS Compute Instruction Set and Propo, ua eal ‘| 8 Assembly language PRISEAM | snot PSone Memory Label | Mnen | L_aldvess | Savant *| Set ptr = 00H initially” ——~__ | aw Stat TAL, BOO : Set H-L pair to DOOOFL nn MOWAT ; Set count = [D000] ons RH sIncrement HL reg pair by 1 | ane | | ov A.M ; take first no. in acc. | On | J ocr ;count = count -1 | ans DERC S [HAL] = (H-L] +1 aw Jiesp [INN if Bite —_ Vextpat sls [Acc] > (H-L]] oun IC escape :Go to escape if [Ace.] < [(H-y} | CO0E | MOV D,M j move mem content to reg. D ur | Mow M.A il Interchange two} number if (Acc) | coro DCXH >I[H-L]] on | ;move reg. D content to mem . coz Increment HL reg pair by 1 ons 3Set ptr = 01H ons | escape zeount = count-1 core | i repeat if count +0 | ene | iptr=ptr-1 Cora + go to start, if ptr = 0 cute) Stop Note : For descendin, in above program. 9 ig order, only the change Write an assembly language is to use JNC escape in place of JC escape | where divident is stored in memory location DOOIH. Sto re quotient and D003H respectively. Assembly language program: Program that divides memory location Doo and remind two one byte Hex numbes OH and divisor is stored & ler in memory locations DO | Memory | Label Mnemonics address ‘C000 ‘LXI D000 Coos MVIC, OOH C005 MOV A.M C006 INX coor Loop cor M 272 Instruction Set and Programming of $085 g sec geiece ll : sca | | || Maasess JC Escape | #Goto Escape if NI = Na | (ol SUBM \ENTENI-ND | cons INR | #uotient = quotient + 1 core JMP Loop *Temp to again compare NI and N2 co Escape | INXH | #lMcrement HL. reg pair by 1 | cone MOVM.C |: Store ¢ FEB content ie. quotient in cou Doo | INX Ht | FIncrement HL reg pair by 1 cor? MOVM.A |. Store ace content remainder in cols | Doos tt loa Lr flowichat Stop = aacons 227 iti

You might also like