0% found this document useful (0 votes)
72 views39 pages

Microprocessor Lab Report

The document outlines a series of experiments involving programming with the 8086 microprocessor to perform operations such as adding and multiplying hexadecimal numbers, finding the greatest number from a set, and calculating factorials. Each experiment includes specific machine code instructions, memory locations, and detailed steps on how to execute the tasks. The results of the operations, including the final stored values, are also provided along with comments explaining the instructions used.

Uploaded by

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

Microprocessor Lab Report

The document outlines a series of experiments involving programming with the 8086 microprocessor to perform operations such as adding and multiplying hexadecimal numbers, finding the greatest number from a set, and calculating factorials. Each experiment includes specific machine code instructions, memory locations, and detailed steps on how to execute the tasks. The results of the operations, including the final stored values, are also provided along with comments explaining the instructions used.

Uploaded by

iqrakaleem7054
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 39
- el Experiment : 4 Object : Waite a progam to add two 16 bit hexa- decimal numbers without cary. Thetsiument Required + 9086 Microprocessor THaliner kit. Progstam rf A ; octal 0206 BEOoo2 Mou ST, 0200H 02.04 R04 Mov Bx, FS¥y | 0208 46 ING SE 020c 46 INC Se 20D. OBic Mov By, Fsty 020P 03c3 r ADD Ax. Ax o2t4 BPOdo2 | Mov. DT. 0204 H [o214 8906 Mov COT). A Lorie Pa HLT Disestiption + ‘ To Solve the Fven objective , we haue taken two, hexadecimal numbeys In the memory ct ©200H and ©202H and added them and Stored the sesatt tn the memory — jocation 0204H. }To Solve the given objective , we ha : ' ve fallowing dee! taken the 4. Move the souxice the index Heqistey (ST) pointer to +h. locotion of the fixst numbey, g. store the firgt number tn the Ax Register using st. 3. Double increment the ST pointer to point 4o +he Memory jocaHon of the second number. 4 Store the second number in the Bx Register using S¥x 5S. Now Apply ADD opexation +o add ‘the numbers in the Megister AX and BX and store the Nesult in Ax. Move the destination index (DI) pointer to point +o the memory location where the Hesult is to be stored. A. finally move the wesult fsiom the Ax se ister +0 the destination le DI 8. HUT +o Holt ox End the Proguam. Input value Results + The addition of the two hexadecimal numbers SAICH and = 92B1cH fielded 6. SCH Comments + 4. MOV SI, 0200H: 16 bit data can be moved using immediate addvessing . 0200 is moved To Sounce index. % ADD AX, BX: Contents in the accumulator and the base segister ane added. 3. INC ST: Te contents Of a specified -bit oy 46-bit Megistey oy Mom, locations ts) is imetall ~mented by oe by this insisuctions , 4- HUT? This instsauction Stops execution - The psiocessor stop fetching and erecting Instxuchons. Flow chant + [initialize st to point to the = memory — Locatien| of = the fixst number eu Store the number in the fecumulatoy Store second number in the 9x Register using the SI pointer a Ax= AX+ Bx Initialize DI to point To the memory lo cochion — uheye the mesult ic to be stored Move athe siesalt from Ax to the Destination Pointed to By or 7 Expestiment no: 2 1] Object: Waite a —proptiam 4o add two 416 bit hexaded- ~mal numbers — with comny.. Instuument Required : 8086 Microprocessoy Txainer kit. Pragsiam « ni . ha ee ee ee 10209 Bi 00 Mov CLpoH 020 BE No 0 Mov ST, 02004 1020) AB 04 Mow Ax, £ 0208. 46 TNC SES 1.0240 46 INC ST | one QB ic Mov 8x, fst) 1 0913 0363 ADD Ax: Bx 0246 3307 Nc 11 ona PE Ct INc 4) 02149 BF O04 02 Li: Mou 4H o2ic 905 Mow _CDT1, Ax O21E 43 INc Di one 4a TNC DI ona | 89 001 mow | foes 0229. £4 HLT | Disexiption a solve the given objective , we have taken, two hexadecimal numbers in the memory locations of 0200H and 0203H and added +hem and Storied the nesult in the memory locati of 0204H , We have also stored the casuuj in the memary location O206H. 4. Initialize 2 Move the Source index egistey (ST) pointer to the Jocation of = the_— fist dhe counter segistey cL to 0. numbey . 3. Stoe athe fivst number in the Ax segister using SI- 4. Double incstement the SI pointey to point to the Memoyy locations of the second numbey. S. Stone the Second numbey in +the ex vegister usin SFY. A & Now apply AnD operation +o add the number in athe seq fey AX and ®&XxX and stove the Nesult (Oey. Aas. peed instsiction ig used that incuements the Countey if theve is No cay else incsements the Costu counter. @. Move the destination index (DI) pointer to point 40 the memory locettion where athe sesult fs to be Stored. 9. Move the swesultk fxm the Ax vegistey +o the destination using pr. Jo, Finally incvement she DI +0 point +o-+he location +o stoHe the casuuy bit and move the cosa bit to the destination before hating ‘Input value. 1 4 Memory Locortion Value, 02001 Fe ee ee p f ee ration value. 0204 H 00 0 206 4 00 HE O 906H 00 © 2094 00 : Output = 0204 H Pe fies D206 4 ee 0206 OL aa eh or wal A Result = “The addition of the 400 hexadecimal Numbeys FRPPH and ePrrh Yleld PPPER as -the sum and 0061 as the COsULY , Comments: 4. MOV ST, 0200H: 46 bit data can be mov. led usin. imme. ~ diate cages + 0200 is moved +o SOUuxce Index. 2 ADD AX, BX: Contents in the accumulato ‘YY and the base Segistey aie added. 3, ING ST! The content of A Specified 8- bit O¥ 16-bit sMegistey or EME loccrtion, Laie tq incvemented by ome by this ingtswetion 4. HLT? Te instsuiction stops Processor stops fetching Program execetion , Te and execut 2g Instswiction. n ee Initialize St +o point to the memorgf location of the Plat Hexadecimol no. THale DI to point to the memory Location ad the Heswt isto Be Move the Sesulk fsiem AXTO the Pestination pointed-to by py Expentiment no. 3 Object : Wuite a progam to find the gueatest numbey fiom an. Onvouy of 40 numbers, Instyument Required : 8086 Micropxtocessoy Taine kit. Progam 8 | Memory location! Machine code | opcode __| opeand.——y - L.0208 8109 Mov Lod rn ls 0200 Bfno 02 Mov S. 02410 -QA_p4 _}| Mov — AL, fst) 0249. 46 _| bas TN st 243 3A! 04. ene Ar.fst1 N 0215. A307 IN@ L? 0213 ala _o4 Mov AL. fst1 oid eels Pee ages | ws ofc opig. {| 75 5 IN2/4 o21p + | BE OA 02 MoV _OF Gs 0220 Qa 05 Mov £ i 0222 F4 HLT DisenipHon 2— 4 oS To solve the given objective , we have taken ten hexadecimal number in the memory locations fyem 0200H and 0209H. In ordeyY to find ithe greatest num ber amongst then We need to compare each numbey with the other. The greatest number wily be stored in the memory location Oo20AH, Te solve the given objective , we haue taken followin steps: 3 Following J. Move the sowice index Megistevy (ST) pointey to -the location of the fivst number. 2. Store SE. Steps: the fivst number in the ax Megistey using Double incsiement the SY memory — focation. of the 4. Stove she fivat Pointer to point to the next number. Number in the Bx negister using ST. 5. Now SPPly MUL operation +o mudtiply the numbers in the stegister ay onde 8a" and) stove the siesurt in ax ‘Move the destination index (pr) Pointer tO). Pging ton. aie Memory location wheye the Mesut tae ay be Stoved. 6. Move the Hesulf tuom the Ax Hegistey +o +the destination using pr. 4. Move = the destination the memory bit — numbey index (D1) pointer +o Point location where the emaining 46 is to be stored. Finally move the Mesut from -th the — destlhation using DT and Halt. Input volue{ | nemoxy locaticn | 8. 02004 a ie eae ss Ot H : ai Fi 204 1 O20 6H [ Memory location 020 AH £6 Result - “Me gheatest of the 40 hexa decimal numbers IS E6H , which gets stored in the memory lodation 020AH. comments :_ 4. ING SI; he content of a Specifled 6 bit or 46-bit segistey Ov memory Location (5) is increment by one by this instruction. 2. cme AL, Cst}} he compave instruction compayes 400 specified opevands, for compasiison one opeHand is Subtyuacted fiom the other, 3. INC: St causes the pro. tam. execection the lobel given y to jump sto in the Instruction, 4 HLT: “Fhe instuction SHOPS program execution , Hie Processoy stops fetching and executing instsuctions. TnirHallze sy to point +o the memory location of the first Hexadecimal Eom PAE FHL numbey Indicated b st with that in Accumulator Bassiow move th number Pointed +o By ST cto AL ST=ST+4 = Clth DE to point tothe memory where cthe Sesult isto be Destination esinted +0 8 Expestiment no- + Object « WHite a Proguam to calculate the factorial of a number. Instrument Required : 9086 microprocessor THainer kit. Puogsam > | Machine, cade. | BE 00 62 QB 04. 98 pa 48 elke 48 a5 08 BPO? O2 a9 DS pe Discxiption + To Solve she given objective we have taken a hexadecimal number in the 0200H and multiplied she = factorial. Memory location of it Successively to obtain To Solve the given following Steps: objective we haus taken the Move the soure jndex Hegister (ST) pointer to the Location of the number, 2, Store the number jn she Ax Hegister using ST. Input value: Result The factorial i ister to act Move the same number In the Bx negis lov as a counter. be DecHement Bx to get the next number to multiplied. i, i e Multiply the number in @x and Ax slecusively decsiement. 6x Simultan eously to get the factorial eventually. Move the desti notion to the memory ‘Sto (be Stoved. Finally move the — sies to the destination. index (DT) pointer to point location where the sesult ult from the Ax Index sregiste using OT and uxalt. Memoyvy location Value 020241, —0.2074 H 39 00 of the hexadect mal ©005H comes out to be as which gets stored jn number OO78H, the memory Comments: 4. Mov sr, 0200H + 46 bit data can b inome diate, addHessin, € moved using J+ 0200 Is moved to Source index. PMUE Gx: his \nstuuction, is Used foy the rnultiple ~catim. of 9 Unsigned numbers, St routtiptes the Content of 8X with Ax and Stoyes in ay, S. Dec By; “This instswetion decsterments Specified 4¢- bit Hegistey by one. 4. IN2: 44 CaMEeS the PYOg9Ham. Gxgeution, ta dump ty the label given in +the instruct S. HLT: “This instyuction. Stops “The processoy Stops instructisns. Progam. execution, ‘fetching and executing flow chont*— Inthalize ST to point to the memory location of the number whose Store this number in the aecumulatey AX copy this number In] the Box segister ax = AX* BX Fnfialize DT to point +o the memovy location where the result \s to-stored move the sHesuik forom Ax-+to} 2 Destinatisn Pointed to 8 pd Expestiment no- 5 a Obuece Ac: byect + Wuite 0 progam to multiply two 16-bit Numbers, Resi should be greater thon. 16 bits. Instyument Requived: 086 Micvoprocessor THainer kit. Proguam : + Memon Lata achine cade} OPcone OPRAND | 6208 BE Oo 02 Mov _ ST.02004 |-O208 AB 04 Mov. Ax. fst} 0200 | AG. ING | o20€ 46 INC. |_ 0206 ga ic Mov gx. fst} 0211 e2 £3 Mut Bx one Bf 04 02 Mow OL. 02044 ae ag_o Mov oT fax 43 44 A915 Pa Disesi prions + f “To solve ithe given objective we have taken +wo hexadecinnal numbers in the memory Locations of +=0200H ~=and 0202H and muttipited them and Stored +he sesulk in the memory location Of 0204H and the sernaining numbey in xhe Ox Megister which is then transfeyeg top he memory location of O206H, \ Hey ck to g 1. Initially we iniHalize she counter Negi ae b a the number of — compartisons with = wi Number would be 9, In athey wards , Jt cCompoxe 9 times, 2% Move the source index wegistey (ST) pointer +o the location of the fixst number. Store the = fingt number in the Ar Hegistee osiad ft. 4. Initiate a loop and compaHe each element with dn@ element sinyed in. an while simultaneously decxementing counter cl. 5. 4 she Number jg queatey than that Stored the we store that number in AL not chapge the value in ar. & The above mentioned PHocess because 2ev0 , at the Numbey in the in AL else we do eS on until cL Point we haue the geieatest AL Hegistey, a. Move the destination the memory Stored. index (DI) pointer to Point +o Location. where the Hesutt 's to be 8. Finally move the the destination, Hesult — fyom the ar veqister to using OT and Hate. Input value; Memory lecation — Outpat value: | 0204 H. 7 0205H. 0 209H 004 Result: “The multiplication of the two numbers o Gnd+ O008H yields 0020H as the sesutt Qnd 0000H as she Hemaining bits. Comments: 1. MOV SP, Q200H: 46 bit data can be moved using immediate addxessing 0200 is moved to Souxice index, 2. MUL Bx: “His instrucHon. is used for the Mult pliaat-t 7G of yg Unsigned Numbers. gt Multi plies the content of Bx with AX and Stores in ax. 3. INC OI: he content of a Specified @ bit ov 46. bit Hegister oy Memory location ts) Is inevemented by one by this instyuction . 4 HLT: This instruction stops The processoy instyuctions. PrOgHamM, execution, Stops fetching and Xe cuuting flow chaxit ‘~ Cott a Tnitialize $i to point tothe m Location of the fivgt Hexadecimal or ie [Stove “this number in the Areumulator 6) sr = st +2 Sfore Second numbey in the Bx Register using the st pei Jilalize DT to point to the memory Location where ate Hesutt istobe move the cas from Dx +he Destination pointed +o DT rove the cau from Dx to the gestinaticn pointed +o Bocpsr’ ont no-6. Bbject : huite a progam. to input 5 number and enapaa. then in descending onder. Instxument Required : 8086 Micro processor Twainer kit.) Progsam : ; : isenipti i jective we have taken five Discniption: To solve she given. obje : hexadecimal numbers in the memory oor °f 0302H tp o306H and used bubble sorting to sor them up, [Te solve the given objective we have taken she following Steps ; . ri locati 1. Move the souwsice index Hegister (SI) pointer to the lo 4 where the otal number of given number to be Sorte: is given. 2. stove the number pointer by SI in the 8x Heqisten 3. Decrement the value, the value Pointed decement js in Bx and simultaneously Stove by Sr in another Hegister cx and aS well. 4. Move the fixst Dumber 5. Incherent sI so next number. 6 CompaHe the two number and dump is queatey than ane equal the wo number. a. Repeat the above process until aul asanged in. descending ordey seduce to 2ev0 In the Ax siegister using ar, as to enable it to pointy it +o the if the one number to the ether else exchanga the numbey axe the counters hae been and them finally halt. Input values Memory. Location. Malue 03004 oS cS oo 0300 H. = 2 0303 H Ee O04 oy 2g re 415 Lage one ba aa Output value : ; ror }__Memovy location is 9300 H. o301H 0309 H 0303M / o04H 0305 H 0306 H oF Result: he sorting is in the decreasing Gxdev as above using bubble sorting. Comment:- 4. Mov $1, 0300H + 16 bit data can be moved using immedi ~ate adduessing .0300 is moved +o sowice Index. Dec 8x: these instruction decnerments Specified 46-bit Segistey by one. . JAE. Jt causes the progyam execution to gump +o the label given in the instvuction. . Loop: “Me instwction toop is used to xepeat a sequ of instructions for the specified Number of times. » MCHWy AL, CSI): his instruction exchan: the content of an 6 bit oy bit specified negistey with the Content of an @ bit oY 36 bit specified segistey oy memory tocations ¢s) - HUT: This instruction. Stops proguam execution . “ie, Processoy stops fetching and executing instruction Flow chastt + Gtort _) location of :the first Hexadeci number Thivialize Aes the Pointed By ST ima iniHalize ST to point tothe a Thitialize cX cwith the valus| Pointed by ST _ intialize er to point te the memory Location whee sthe fiat ehtment ef the atuiay is Stoxed- | TniHalize AL with the | value pointed by ST [sean | . Campout thi number indicated by 6T | (ith that in Accumulator AL | 7 on | | J is eee y Exchange the value q ] < Abo err Yes Jae and dhat aes | *, T Res | ve-tha Vatu of Alto ation pointed bu Sy Expestiment no- 9 Object : Wuite a pwoqam to convert the sting dota sto qe +00 = complernent faxm. Instrument Required: @086 Microprocessor TMainer Kit Progsiam:, |Memoyy, location | Machine. code | opcode 0200 | BF no 03 Mp \eee | 0203. BE 00 04 Mou 0206 84 0A 00 Mov 0209 Ac Lopse O20 £6 09 NE Gy 0206, AA STosB o20c Aa TOSB 0200 026 | tone Ap | 0208 | ea HLT Disctiption: Te solve she given objectiie we have taken Ten hexadecimal numbers in she memory locations of 0300H ANd 0309H and -then individually taken +heiy +w00'S complement | and stove the sesutt in the memory location from o400H to O40gH, To Solve the given SHepS + J, Move ithe Sousice index siegictey (sT) poimtey -to the locertion of the first objective we have taken +the follocoi numbey +o be comple memted, g. Move the destination index (DT) pointer to the. of the first memoyy Location ,

You might also like