Shravanij

You might also like

Download as pdf
Download as pdf
You are on page 1of 46
uctions tion abel OOPE Label IZ/LOOPNE Label label ation ty will demonstrate the use of assembly | Xecute the program. language programming tools to write ty must form a group of two students ails group will use the assembly | ie the programs language programming tools to write and s required (Additional) Instrument 7 io a JObject/Sottware | SPecification | Quantity | Remarks Nordware. ee 4 ge BW Ia: referable jSoftwote lemugoge | 47 ions to be followed le computer system and peripherals with cat dower PC properly re algorithm and draw flowel hart for given program (Use blank space provided ch more pages if needed) le clik on DOSBOX TASM 1.4 icon, ! edit filename.asm on DOS prompt and press Enter Key the program and save on disk the assembly language program is created, then type tasm filename.asm on the and prompt and press Enter Key to create /lename.obj file link filename.obj or tlink filename on command prompt and press Enter Key ate filename .exe file } \ bpe debug flename.exe ot td filename.exe on the command prompt and Enter Key to debug your program step by step. e the contents of registers, memory location used and status of flags. 33 }oard of Technical Education i XH Resources used (Additional) Hordwol 15. -14...preterable... Software ervations: \) Observe and write the contents of Register using debugger TD or Debug after the execution of program, Table 1: Contents of Registers casters Flag Register After Before e 2 Loo 4c loooe | Flag Chis 00 00 1e000 ZeroFlag ZF lo GaLdoWl GLa Sign Flag SF_[o [oF 10 loooo Overflow Flag OF Rie Wann allan’ Parity Flag PES at 10000 | 0000 | Auxiliary Cary Flag | AF [lo 0000 0000 Interrupt Flag Trealte s FFeA | 0000 Direction Flag DF lo Ss lodto 6000 > _lo400 | 0400 }—=— 103 1 0 LES 7 WiEG00 IP | 0204 2), Observe and write the contents of memory location in Data Segment afier the execution of program Table 2: Contents of memory location in Data Segment Address Contents Adare Ds:0000 tt DS:0008 —] DS:0001 0 DS:0009 | Se DS:0002 413 DSi00AT Aliee 1 DS:0003 14 DS:0008 08 DS:0004 45 RPG aaa DS:0005 00 DS:000D “| ~9 4 DS:0006 oo DS:000E [ag DS:0007 00 DS:000F BG 1 Code with comments Mode... SMa Code ends gulls (Output of the Program) oe Nihil Sion tile Alan cane L ical related Questions \ote: Below given are few sample questions for nore such questions to ensure the achievement of reference. Teachers identified CO. Note down the registers used as memory pointer and counter in "ate Boarg = of Technical Edueati ee ener ne een ee ee 215) ——— XVI Exercise (Use blank space provided fo 1. What is the condition to terminate 3. Write applications where loop instruction cant ba used? jf) 3 ? 3. Which reister is used as a counter fo store count for a LOOP in [a5 vhf TE dAhe.... test... reveals... Ahe. register vis. zero., the wooed. ACCU ED 000 4M instruction following CULT Write an ALP to find Smallest/lar, array of n numbers, Best number from an | sign’ 2 ply language programming, flags are affected after compare instructi ithe flags can be used to make decision about smaller or je ie a vill be able to use compare instruction and decision making instru lees est number ction to find stand Lal ogram Outcomes (POs) | jasic knowledge: viscipline knowledge periments and practice jovant Pr 0 4. Engineering tools Competency and Skills pevelop assembly language program using 8086” nis practical is expected to develop the following skills. itor to create assembly language program filename.asm file. Use assembler and linker to create filename.exe file. (se debugger in single step mode to, locate/trace the errors and correcting the Relevant Course Outcome(s) Develop an assembly language program using assembler. Practical Outcomes. a. Write an ALP to find smallest number from an/array of n numbers b. Write an ALP te find largest number from an array of n numbers clevant Affective Domain Related Outcomes a. Follow precautionary measures. j ; b. Demonstrate working as a leader / a team member. Follow ethical practices. linimum Theoretical Background Fay Is the set of N numbers i.e, byte or word. Hence, memory pointer and counte: ‘Wired to read or write numbers from or 10 memory location in the array, © find smallesVlargest number from the array, the numbers in the array m tbe ™pared with each other. Array may consist of 8 bit numbers i.e. byte or 16 bit Moers i.e. word, so memory pointer is requited to read numbers from the array. 50, one counter called as byte or word counter which indicates how many numbers there in the array, is required in the program to read and compare only 3 ee from the array. In $086, the CMP instruction is used to compare two numeric ‘a fields. ‘ g Mp destination, source equired (Additional) rces F yes?! —ument Liang aiceare meee | Instrument Specification S| pject/Software d compute Ai qo ftwase Te Al ne —~ sutions to be followed e her op pec indie computer system and peripherals with care. «shut down PC properly Proc gorithm and eee given program (Use ach more pages ifneeded) | Double ciik on DOSBOX TASM 14 icon |) spe edit ilename.asm on DOS prompt and press Enter Key ype the program and save on disk, ¢ Once the assembly language program is created, then type 1asm file nmand. prompt and press Enter Key to create filename. obj fille k filename. obj or tlink filename on-command prompt and filename .exe file. re ually. type debug filename.exe or td. filename exe on the command ‘ ae piss Enter Key to debug your program step by step. oe Observe the contents of registers, memory location used and ‘ene THRE 9: Resources used (Additional) i I Observations | 40 2 0 y ite Observe and write the Gon &xecution of program, eee ete eee ee I register while finding sma ap reels ps:0000 | DS-0001 07 64 2 Al = femme) 2s“ o | DS:0003 hy la ; 04 02 aa 2) Ob 1 write the contents ar memory. location and ALS By Observe and write the CON” rc program 4 execution of Table 2: Contents of memory 1 Loop 2 Original | Radiress |” Fess | Contents |? q Ds:0000 | 12 a Ds:0001 | 07 Ds:0002 | 25. | AL=02 Ds:0003 | 18 ma Ds:0004 (Output of the Program) write an Output of! pe assis f fi ‘Sed by aaa code... | Exercise (Use blank space provided for answers ofAltaldimore faved ffneede |. Show flag status after comparisons of following operands | CMP NI,N2 CF [oZFoles 5 75 we 23 Taigee to NI 1. The inslruction....used....t0 decide AS lacgest of... omallesd...1$ by * Program do. find larger. 3 : on. a i -«Model Small |.~ data dwfab.. 9x. dala dS..a% mk 6. Si.,.of4Sei omay @x. Csi] CA Beene. Si tion: ; ye ih domoneeelane use of = pacully ® the program, 6 most fOr @ BrOUp OF two roup Sila the as; h I VP , the programs. 7 ‘ ai 5 : fs i Le ¢s required (Aaaiionty | j . poses eal Instrument Specific a n i Fi ) Me ) i AD :- ! (4 necautions to be Tolle wee alle comput ystem and pe lown PC properly Procedure ty \rtcalgorithm and draw floweh rallach more pages if neede ‘wuble clik on DOSBOX TAS) j 4 a fl ‘filename.asm on DOS SEI a os ee asta ones XIIL Observations it yt and write the ry le 1) Observe Table ty Contenl® of me eT pass? || Address Original Pass # | Contents | ‘ is DS-0000 n 02 o% nt ——T4 9 ’ oF Ds.0001 0 07 i Aa pso002 | __ 28 of 12. 2 ae . 25 25 DS.0008 Ee a aoe Dso00 | 02 oa 12 of memory location after the execut 2) Observe and write the content Table 2: Contents of meme ory location in descending order (Address | Original | Pass! Pass 20) Contents | Te e | Ds:0000 | DS:0001 ( Lt ee saaults (OUEDUC of the Braet) _ Write an Output of program assigned by teacher) \ practical related Questions bea i eae Meal : i we - 4 J i Vote: Below given are few sample questions for reference. Teachers must design more such questions 10 EnSUTS the achievement of identified CO. yo mee, | 9) ee | What is the use of XCHG instruction in your program? qhis_insttackton,. COMLENA. 00? dest... 2 + Which sorting algorithm is used in your program? Il Exercise i {se blank spage provided for answers or auch more PARES if needed) a |. If numbers in an array are (0711,0211,0911,10H,06H, write the array contents in each » while arranging numbers in ascending order > Tr numbérs fi atagimmmmengts 0231.093,10H,061), 81 pass while arranginganumbers *° descending order g : the array contents in each — ais 2]. descending aides 02... > nl H.y.00H : PASS. Palnla Pass -. i! ee 1O.Hoy 0.9..Heg Pass 3, —...40..H.4 he the string oper, ations are Possible. Fo, a Tews wine FAY and Compare. With *g- 4 You hay, charg ii {3 raacter. I character ig og MEN Lis eng gf et te a mot agra String » they "the string, We Reed @ne length ¢ ; sracter [rom the string Re nvicte end of the State cha i A 1S not sg> stop reading chatacter from the string su order unter a character fy ver and length counte (0 read ste ng variable in reverse gggueis siting, then Memory source siting NGHBoDy jag charac, on of destination blank String. Perform th WEE String, ge nee string 0 of Two Sti n of (Wo strings mean, meting Of secong String in, se, Computer” and, ‘Department’ are MPuter Departmenp’ ng will becom Des Situation ‘onstrate the use of assembly language Program Programming tools tg rite "2 8TOUP Of two studentg AW tse the assembly Yanguage prog ramming toof amming tools to write and es required (Additionaly S “Tnstrument Xn. JObject/SoftWare Computer ik LE ‘cautions to be followed vin pen” 89Stem and peripherals with care. il “own PC properly Procedure tach my ote payes if needed) loa on DOSBOX TASM 14 icon. ihe _lename.aéhl &n, DOS prompt ores set "and save on disk. NUL © Once the assembly lane" nd prompt and P! the comman ord f Type tlink filename.obf to create filename .exe file Finally, type debug filenam press Enter Key to debut Observe the contents of 8! urces used (Additional) Bom iabed... SYSIUIM windows a emu 2086. Software... Observations: Table 1; Reverse of a string 2 your progr m is created, then (YP tasm filenay Enter Key 10 create filename. obj file } ‘on command prompt and press. ress ink filename c.exe OF Ul m step memory location used and status o iste z ‘Example I Example 2 Input string taken MSBTE __ HELLO Reverse string ETBSM OLLEH Table 2: Length of string Example 1 Example 2 | Anput string taken M Licroprocessor HELLO Length of string 14 = Table 3: String concatenation Example 1 ‘[Tnput string taken icroprocessor Input string 2 taken Programming Output string MictOprocessor pro Sram ming fthe Programs yytput? ut of program assigned by teacher) d Questions % en are few sample questions for refer enc ‘rions to ensure the achievement of ide uch que ters that are used as memory poi aie the role of direction flag while using: tu dufftent.. buercise (Any one from Qu jank space provided for answers ¢ ALP to perform string copy 0 an ALP to find the string is pal dvartage of using/string instruct eee Lois nit iS pee (er sane _small i Sone lon Stri OB ‘Abba’ il String DB igre oa OR ' Noi a PRoc FAR Mov Ax _,@ pata —_—_—— Moy pe 2). ee RorMCeePalind (ome "=== iy eee CH an Cau _ Palindrome— ra Mov ST See Joo PI + mov Ax [st | owe | JE 1ABEL | Sun St TMP 1o00P 4 LABEL 4 DEG et 4ecp SE | Mov DI, offSeT STRING | | Loop P2 cmp ST ,D1_ JTL _ourevt Mov _A* fesei_ | eves eee cmp Al. BL nt eee ae IMP ooh 9 OUTPUT’ =: LEA Ox, STRING Mov AH, 091 TNT 214 RET OvuTPUT o " LEA Dx, STRING 2 Mov AH , 09H TNT 21h Ret Patindrome ENDP END main —£ND \ XU Resources used (Additional) | i a Computer >" windows... ie es Seay nie a Xur Observations $ - j— ; a te he ones of Regt sn MEE TD OF Debate Sn oe Table 1: Contents of Registers Registers Flag Register After Before | £4 [go 00 | Canyrl foo 06 00 90 0000 [oo 00 eee oo [ooo ae “0. 000 | 3 0000 — a toFoo | ssi | OF00 | P 0710 OF1t see O0 00 execution o' bl program. XIV Program Code with comments Model... 9mall OO... fe : S104, 1 Oe ORB Moy an ney oe BPO cAhW..0.... tay Ores 4 Beeeeeven dw o fe dn : HI "01 odd. ay a IMP exit dn! ror ant _ODD EVEN program Pees ee ) ided or attach more pages if i ded) Saw & Doub! on DOSBOX TASM 1.4 icon. i : _ ries oon on DOS promptand press Enter Key e ‘Type the gram and save on disk & Sc i Btsebiy language program is created, then type tasm filena the command prompt and press Enter Key to create filename.obj file f Type slink filename. obj or tlink filencine on command prompt and press to create filename .exe file. Finally, type debug filename.eve or td filename.exe on the command Bs Press Enter Key to debug your program step by step. 4 h. Observe the contents of registers, memory location used and status of f emu 2026 . ) Observe and write the contents of Register using debugger TD or Debu ; execution of program Table 1: Contents of Registers Registers After Before 4C_ &c_ | 9006 Carry Flag Flag Register 0006 |qo00 Zero Flag 00 54 | 0025 Sign Flag, Overflow Flag Parity Flag Auxiliary Carry Flag Interrupt Flag Direction Flag 2 Conia of memory location in Data Se, Addres Address | ecintents DS:0000. ee = 5 | A ee _DS:00017 7 DS:0005 S:000 1 a [stooges __DS:0002 as ee alae ae DS:0003 S004 Tp. | 008 2 _DS.000 00 | Dsi000¢——20_ iC. pee Ds:0005-- 2 —__| | ~~ Ds:009¢ ——20 | ” Eas £¥ Fi p ab ov._ac. word ptt re. Ul ax Ow. ee PANTS mus, an4o eh. ndp.. 10 ‘Board of Technical Education essor (22415) Feo XVI_ Practical related Questions tions for reference. Teachers myy 2 ques Note: Below given are few sample ques 3 identified CO. ‘more such questions to ensure the achievement oh ie ific eae Which procedure have been used in your prog “Near. provediure.....19 Program, The. P before and a 1c exccutil 2. Write the content of Instruction pointer IP before and after the execution instruction, procedure 1S) Keliable..., more Lxeuction XVIT Exercise (Any one) (Use blank space provided for answers or attach more pages if needed) Write an ALP to find smallest number from the array of 10 m procedure. fi ie Write an ALP to,count number of “1’s in 8-bit number using procedi, f f f (Space for answers) Ne aero Mae Me dw... ak di hen65h.,..916h..4 Count one, proc Maharashtra State Board of Technical Education josh fhO6 mee Bits Cx 2 Shiny OATS OTD a OX... LS 4 CK uP : alee ee mp Ok ES). fMRI. coe MOY ar Kye SI nexk Pa \oo.p..Up Tei yer endp. ends end «model... 9mal\ NON AIRY «Stack... leob Lo rassplO Ba, AK FCA, MAONB EA cess i COUNT. LOOP... :Code Se a eS eee A |... Mga aeRO Gee. 2 Tz... SEUP.-10.0 | PaO mol a... eee On OX Boe OK. Skip... INC Toby. AD. came a eee EL DETR cA (dn 2, d Joop... COUM...Loap.. VOM oo gab see M00 l..8..Cl..... \ Call... coum _ones...... RET. i | Mov....Ab.,.02b. wove COUNT...O.NES.. END. Mok... Alok gaeate! END... IAIN Odd. gl uSah.... ea Oh. eee Main...end 103 1a 7 od by col MACRO [macro variables separated by colon| macro_name M+é ENDM VIE Work Situation: smbly language programming too} a. Faculty will demonstrate the use of assembly and execute the program i b. Faculty must form a group of two stude Students group will use the assembly execute the programs, wuage programming tools to ct/Software peal [ot fompier windows i@—T 3. [Gofware | emu 8024 S24 — x Precautions to be followed a. Handle computer System and peripheral with care b. Shut down PC properly XI Procedure i a. Write an algorithm and draw flowchart of given program. (Use blank spa provided or attach more pages if needed) ey Double clik on DOSBOX TASM 1.4 icon ‘Type edit filename.asm on DOS prompt and press Enter Key : |. Type the program and save on disk Once the assembly language program is cre: paos ated, then type asm filenar the command prompt and press Enter Key to create filename.obj file f. Type “link filename.obj or dlink filename on command to create filename .exe file. Finally, type debug filename. exe or td filename. press Enter Key to debug your program step by h. Observe the contents of. registers, memory locat prompt and press exe on the command step ion used and status o Resources used (Additional) ypse’ ations a observe and write the contents of Register using debugger tp execution of program, or Debug a ly Table 1: Contents of Resisters Registers : After Before fj Carry Fig] Zero Flag Sign Flag Overflow Flag Parity Flag Auxiliary Carry Flag Interrupt Flag Direction Flag | 2) Observe and swrite the contents of memory focation in Data Segment al execution of program ‘Table 2: Contents of memory location in Data Segment | Address 7 Contents” | Address Contents | Bs:0000 7 sql 77 DS:0008 14 {__Ds:0001 19 DS:0009 Tet \_Ds:0002 ga DS-000A OA |ps:0003 ao DS:0008. 06 \ ps:9904 7 (MoD. i {DS:000G Le eel, DS:0005 12 DS:000D | 4c | _s:0006 QB ca “{Ps:000F || Joo | Ds:0007 ie DS:000F XIV Program Code with comments: + made... SMalt Add.num.....MaActo. MOV... OX NA CNW. 0.0.9.9. ‘Maharashira State Board of Technical Education XV Results (Output of Program) (Note: Write an Output of program assigned by teacher) lorle., values. will. be. XVI Practical related Questions Note: Below given are few sample questions for reference. Teachers more such questions to ensure the achievement of identified CO. es and disady s using macro. se blank space provided for answers or attach more Pages if n ceded) £2 } +e" using macro to compute - Write an ALP to perform y=a?+h (Space for answers) code Main Mov... Non... TOV. Squase.. , Leh Maharashtra State Board of Technical Education Sub num macro... ML NA O%..4 MU Q...4.N2 Tog QML end ial PN UM ACEO oe Dep N ee NED cece Mov ax nd ad pent). sf Ba ae, eek. ‘State Board of Technical Education

You might also like