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

Cs Paperii

The document outlines a series of assembly language programming experiments aimed at performing various operations such as addition, subtraction, finding the smallest/largest number, converting hexadecimal to ASCII, BCD addition, copying data blocks, reversing data order, counting occurrences of a specific byte, exchanging data blocks, and dividing hexadecimal numbers. Each experiment includes a specific aim, example inputs, and detailed assembly language code with memory locations and comments. The results of each experiment are also provided, indicating the outcomes of the executed programs.
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)
7 views

Cs Paperii

The document outlines a series of assembly language programming experiments aimed at performing various operations such as addition, subtraction, finding the smallest/largest number, converting hexadecimal to ASCII, BCD addition, copying data blocks, reversing data order, counting occurrences of a specific byte, exchanging data blocks, and dividing hexadecimal numbers. Each experiment includes a specific aim, example inputs, and detailed assembly language code with memory locations and comments. The results of each experiment are also provided, indicating the outcomes of the executed programs.
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/ 14
Paper-2 Store the result at memory location L002H. Experiment No.1 Aim :- Write assembly language program to add two 8-bit (hexadecimal) Numbers. The numbers are storage at memory location 1000H and 10011. Example :- i) Numbers are 09H and 014. Given data = i) 1000H ii) 1001H-O1H/ 22H iii) 1002H ~ Result ) Numbers are 11H and 22H. 09H / 11H Assembly Language Program :- Memory | Label Mnemonics [Tex | Comments location Opcode Code Operand 1003 LXI 21 | Get Address of No. in HL- H,1000H pair 1004 00 1005 10 1006 MOVAM | 7E_| Get No. in accumulator 1007 INX_H. 23,__| Increment HL pair by I 1008 ‘ADD M 86 | Add Mand 2” No. 1009 STA 1002H_ | 32 _| Store sum in 1002H 100A 2 1008. 10 100C HLT 76 _| Stop the Program Result :- After execution of program, Addition of two numbers, result is formed to be OAH in memory location in 10021 33H in memory location in 1002H - END Store the result at memory loaction L002H. Experiment No.2 Aim :- Write assembly language program to Subtract two 8-bit (hexadecimal) Numbers. The numbers are Store at memory location 1000H and 100111. Example :- i) Numbers are 09H and 01H. ) Numbers are 22H and 11H. Given data = i) 10004 — 09H ii) 1001-01 iii) 1002H — Result Assembly Language Program =~ Memory | Label Mnemonics [Tex | Comments location Opcode Code Operand 1003 LXI 21 | Get Address of No. in HL- H,1000H pair 1004 00 1005 10 1006 MOVAM | 7E_| Get No. in accumulator 1007 INX H 23, | Increment HL pair by 1 1008 SUB M 96 _| Subtract I™ No. from 2" No. 1009 STA 1002H_ | 32 _| Store Result in 1002H 100A 02. 1008. 0 100C HLT 76 __| Stop the program Result = After execution of program, subtraction of two numbers, result is formed tobe i) 08H in memory location in 10024. ii) 11H in memory location in 10021. numbers. Experiment No.3 Aim :- Write assembly language program to find smaller/greater of two Example :- i) Numbers are 84H and 99H. Given data :- i) 1000H 84H ii) 1001H - 09H iii) 1002H — Result Assembly Language Program :- Memory | Label Mnemonics [Hex | Comments location Opcode Code Operand 1003 LXI H. 1000 21 Get address of IY No.in HL-pair 1004 00 1005 10 1006 MOV AM TE Get I" No.in accumulator 1007 INX 23 Increment HL pair by 1 1008 MP M BE | Add 1% and 2" No. 1009 INC AHEAD D2__| Store sum in 1002H 100A op 1008 10 100C MOV AM 7TE___| End program 100D AHEAD: | STA 10021 32 100E 02 100F 10 1010 HLT 76 Result = After execut location 1002 HI - END n of program, greatest number 84H was found at memory res smallest of Input =~ (C000) = 0C Experiment No.4 Aim :- Write an assembly language program to convert of memory location C000 H to an ASCTI character memory location C000 contains a single hexadecimal digit. Store result at location C001 H Assembly Language Program :- Memory | Label Mnemonics [Hex | Comments location Opeode Code Operand 1000 LDA C000 3A Get DATA 1001 00 1002, co 1003 Plo FE is DATA 10OR MORE. 1004 OA 1005 JC _ASCZ DA Jump ifcany 1006 oa 1007 10 1008 ADI'A™-" C6 Yes add offer 1009 o7 100A ASCZ: [ADI‘O" C6 Add offset for ASCIT 1008 30 100C STA COOT 32 Siore ASCII result 100D Oo 100 co 100F HLT 76 Result :- If [C000] = OC then Result = [COOL] = 43 -EN D- Experiment No.5 Aim :- Write ALP to add all the BCD numbers in a block from 1000 H to 8008 H.. Store Sum at memory location 100A H. [Assume sum is 8 bit] Tnput : - 1000 H=01 1003 H=01 1006 1001 H=01 1004 H=01 1007 H=01 1002 H =01 1005 H =01 1008 H =01 100A H= RESULT Assembly Language Program :- Memory | Label Mnemonics [Hex | Comments location Opeode Code Operand 100B LXT H.L000H [21 VFL pair at starting address T00C 0 100D 10 100E MVI_C,09H OE : Register C as counter 100F # 1010 XRA_A AP |; Clear Accumulator iow up: ADD M 86 [A] + [ANIL] > Tal 1012 DAA 27 Decimal Addition 1013 INX H 23 1014 DCR C oD Decrement Loop counter by 1 101s INZUP o Go up until C= 1016 i 1017 10 1018, STA 100AH 32 Store BCD sum at memory 100A_H. 1019 Oy 101A 10 101B HLT 76 Halt Result :- BCD addition was found at location 100A H and was = 09 Experiment No. 6 Aim : -Write an ALP to copy block of four consecutive bytes storage from 1000 H to 1003 H. Transfer the entire block to new location from C004 HI. « (C004 H = result C005 H = result C006 H = result C007 H = result Assembly Language Program:- Memory | Label [Mnemonics [Hex | Comments location ‘Opeode Code Operand 1009 LXIH,1000H 21 _ | sLoad HL Register Pair 100A 00 100B 10 100c LXI_B,COO4H O1 _ | sLoad BC Register Pair 10D 04 100E. co. 100F MVI_C.O1H OE |; Set Counter as 04 1010 of 10 BACK: [MOV A.M 5 Get first number in 1E Accumulator 1012 STAXB : Store the content of A 02 to Memory 1013 INX H 3 _ |i Inerement the register * | pair 1014 INXB (03 _ | Increment the register pair 1015 DERG ; Decrement Counter by o |i 1016 INZ BACK c2__ |: Z=O the perform loop 1017 10 1018 10 HLT 76 | ;Stop the Program Result Afier execution of program the data in memory block 1000H — 1003 H. ‘was copied from 1004 H to 1007 Has follows 1000 = 11H 1001 = 22H 1002 = 33H. 1003 = 44H 1004 H=11H 1005 H =22 H 1006 H = 33H 1007 H=44H N D- Experiment No. 7 jim :- A block of data is stored in memory location from 1000H to 100411. Write an assembly language Program to shift the data contain of block in reverse order storing from memory location CO0SH. Input 1000! 1001 1002 O1H, 1003H 2H 1004H 03H Assembly Language Program:- Memory | Label Mnemonics |Hex {Comments location ‘Opeode Code Operand TOA LXI-H, 100A ai up HL pairas pointer to souree 100BH 4 100CH 10 Lo0DH LXI D, COOSH 11 | Setup DE as a pointer to destination L00EH 100FH 1O10H MVIC, 05H Set up counter C = 05 TOP: MOV A.M sGet data from memory 1013H STAX D Store it al desetination 1014 Dex H sDecrement source 2B Pointer 1O1SH INX D 13 _ | sncrement D 1016H DCR C OD _| Decrement count 1017 INZ TOP 2 | Sump is count is not zero 1018H 12 1019H 10 101AH HLT 76 | Stop Result :- Afier execution of program number are found 05, 04,03,02,01 in successive memory location COOSH - END- Experiment No. 8 Aim :- Write an ALP to count total number occurrences of data bytes 9CH in a memory block of length 10 bytes starting from 1000H. Store the count in register E. Input 1000H = 11H 1006H = 9CH 10091 = 7711 1001 1007H 1002 100811 Assembly Language Program:- Memory | Label | Mnemonics [Hex | Comments location ‘Opeode Code Operand TOOAH TXT H, 10008 a | Setup HT paras pointer to source 100BH 00 100CH 10 100DHT MVICOAH |_| iSet counter as 10 0b umber 100EH al 100FH MVIE,00H IE _| ; Initialize Eveg. as OOH 1010H oo TOM “Tnitialize A reg. as 3B loc 1012H 9cHr 113i ToP: _|CMPM Compare the content BE | of memory with content of A. 1014 INZ DOWN if Z= 1 then inerement o -nerem the content of reg. E 101sH 18 1016 10 117 INRE Ic 101sH DOWN: |INXH 33 | evement of AL veg pair 1019 DERE OD _| :Decrement the counter TOTAH INZ TOP €2_|:IFZ=0 perform loop 1O1BH 13 TICH 10 101DH HLT 76 _[:Stop the program Result := After execution of program count in register E was O41, - END- Experiment No. 9 Aim :- A block of data is stored in memory location from 1000H to 1002H. Another block is stored from 1003H to 100SH. Write an ALP to exchange these two block of data with each other. Input 10001 1001 10021 11H 1003H 9CH 1004H HH 1005H Assembly Language Program:- Memory | Label Mnemonics [Hex | Comments location ‘Opeode Code Operand 100AH LXI H, 1000H 21 | Setup HE pair as pointer to source 100BH 00, 100CH 10 100DH, LXID, 10034 11 | Setup DE pair as pointer to destination 100EH 03. 100FH 10 1010H MVIC.03H OE _ |; Set counter TOE 03 1o12H TOP: | MOV A.M 7E__|; Transfer no. in Ace. i013H MOV BA 47_ |; Copy Acc into B reg. i014 LDAXD 1a _|: Load Ace from memory (DE) 101sHT MOV M.A 77/3 Copy Ace to memory | (HL) 1016H MOV AB 78__|:Copy Reg. B toreg. A 1017 STAXD 12_| {Store the content of Ace. Into memory 1o18H INXH 24 |; Increment the HL i019 INXD 14 _ |; Increment the DE 101AH, DCRC 0D |: Decrement the C reg. T0iBH INZ TOP ©2_ |; 1 Z=0 perform loop 1o1cH 2 i01DH 10 1O1EH HLT 76 |; Stop the Program Result: After execution of program the content of two block are exchange. -END- Experiment No, 10 Aim :- Write an ALP the divide one byte Hexadecimal number, when dividend is stored in memory location 10001 and divisor is stored in memory location 1001H. Store the quotient and reminder in memory location 1002H and 1003H Input :- 1000) 1001 24H Dividend 02H Divisor Assembly Language Program:- ‘Memory | Label [Mnemonics [Hex | Comments location ‘Opcode Code Operand 100A LXI H, 1000H 31 | Setup HL pair as pointer to source 100BH 00 100CH 10 100DH. MVIC,00H OE |; SetCreg. as 00 L00EH 00 100FH MOV A.M TE _ |: Get dividend in Acc 1010H INXH 23 _|; Increment HL Reg. io1lH CMP M pe | Compare the Ace With Memory 1012 JC DOWN DA_[:1FC=0the down 1013H 1A 1014H 10 1015H SUBM 12 _|; Perform subtraction 1o16H INRC 0c _ |; Increment C Reg. 1017 IMP UP C3_[: jump to the top 101s i 1019H 10 “TOIAH DOWN: |INXH 23 _ | : Increment HL Reg. TOIBH MOV M.C Copy content of C to 71 | Memory T01CH INXH 23_ |; Increment HL Reg. 101DH MOV M.A 77 _ |i Copy content of A to Memon, 101EH HLT 76 _ |; Stop the Program Result :- Aficr execution of program the content of 1002H = 12H and 1003H = 00H. - END- Experiment No, I Aim :- Write an ALP that interchange digits of number stored at location 1000H and stores the result at 10011. Also perform the original number and the interchanged number and store the result at location 1002H. Input 10001 1001 231 = 32 HH 1002 — SSH 1H Assembly Language Program:= Memory | Label Mnemonics [Tex | Comments location Opeode Code Operand 100AH, LXI H, 1000H 31 | Setup HL pair as pointer to source 100BHL 00 100CH 10 100DEL MOV AM qe | | Copy the content of { memory to Ace. 100EH RRC OF _| ;Rotate the content LOOFH. RRC OF _| jofthe accumulator 1010 RRC OF | 4 times ion RRC OF _| sRight side 1012 INX H 23 | Increment the HL 1013H MOV M.A 77 _ | + Store interchange in 1014 DCX H 2B _|; Decrement HL 101s ADDM Perform the original 86 | number with interchanged number 1016H STA 1002H 32 _ | + Store the result at memory 1017H 02 1o18H 10 i019 HLT 76 |; Stop the Program| 101AH, Result := After execution of program the content of 1002H = SSH. -END- Experiment No. 12 Aim :- Write an ALP to count the number of odd data bytes occurring a block of data stored from location 1001h to 100411. Store the result at location 1005, Input 10001 1001 O1H 102K =04H 1003 = 06H 1005H = result Assembly Language Program:= Memory | Label | Mnemonics [Tex | Comments location Opcode Code Operand 100AH LXI H, 1000H 3, | Setup HL pairas pointer to source 100BH 00 100CH 10 100DH MVICOSH OE _ |: Set Counter as 05 100EH 0s 100FH MVIB00H 06 _ |: Initialize reg B=0 1010H 00 10H TOP, | MOVAM Get first number in 7E ‘Ace 1012 RRC op |: Rotate the conient oF ‘Ace right 1013 INC DOWN D2_ |: if C=0 then down 1014H a 1015H 10 Lo16Ht INRB if C=1 then inerement 04 | the content of reg B io17H DOWN: | INXH 33 | Inerement the HL. reg.paits 1018H DERE OD |: Decrement the ree. Lo19HL INZ TOP €2_|:18Z=0 then goto TOP TO1AH 1 TOBE 10 11CH MOV A.B 78 _ | Slore the result at 101DH STA 10051 32__ [+ the memory location 101EH 05_|: 1005 1O1FH 10 10208 ALT 76 |: Slop the Program Result 3+ After execution of program the content of 1005H = 03H. - END- Experiment No. 13 Aim :- Write an ALP to count the number of ONE’S in an 8bit hexadecimal number stored at 1000H. Store the result at location 10011 Tnput :- 98H => 10011000 03H Assembly Language Program:- Memory Label Mnemonics Hex Comments location ‘Opcode Code Operand 00AH LXIH, 1000H a | Setup HE paras pointer to source 00BH 0 100CH_ 10, 100DH_ MVIC.08H OE Set Counter as 05 100EH 08 100FH MVIB,O0H 06 Initialize reg B = 0 1010H 00, OLN MOVAM ae | Se Fiat number in Ace 1012H TOP: RRC Rotate the content of OF [Ace right 1013H JNC DOWN, D2 if C=0 then down (014 17 1015H 10, To16H TNR B oy [iP C=T then inorement the content of reg B (07H DOWN: | INXH 33 | Increment the HL reg.paire 1018H DCRC OD Decrement the reg. C 1019H. JNZ TOP c2 If Z=0 then ‘goto TOP. 101AH 12 101BH 10, 101CH MOV A,B 7 Store the result at 101DH STA 101K 32. [ithe memory fveation 101EH oO 1005 H 101FH 10, 1020H HLT 76 _ | : Stop the Program Result :- After execution of program the content of 1001H = 03H. - END-

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy