0% found this document useful (0 votes)
12 views9 pages

MODIFIED CS2 IMP PROG 2025

The document contains a series of assembly language programs for various tasks, including multiplication, memory exchange, BCD summation, and data manipulation. Each program is detailed with labels, opcodes, operands, and comments explaining the functionality. The programs are designed for an 8085 microprocessor and cover a range of operations on memory locations and data processing.

Uploaded by

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

MODIFIED CS2 IMP PROG 2025

The document contains a series of assembly language programs for various tasks, including multiplication, memory exchange, BCD summation, and data manipulation. Each program is detailed with labels, opcodes, operands, and comments explaining the functionality. The programs are designed for an 8085 microprocessor and cover a range of operations on memory locations and data processing.

Uploaded by

sagaechounde5521
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

CS-2 IMP PROGRAMS 2025

1)Write an assembly language program to multiply two 1-byte data stored at memory locations C600 H
and C601 H respectively. Store the 16-bit result at locations C602 H and C603 H beginning with lower order
byte of the result. : 2024

Label Opcode Operand Comments


START LXIH,0000H CLEAR HL CONTENT TO 0000
LDA C600H LOAD ACC WITH FIRST NO
MVI D,00H CLEAR D REGISTER
MOV E,A MOVE ACC FIRST NO IN E REG
LDA C601H LOAD ACC WITH 2ND NO
ABOVE DAD D ADD HL AND DE CONTENT AND ANSWER IS IN HL
DCR A DECREMENT THE COUNT OFF ACC
JNZ ABOVE REPEAT IF ACC NOT EQUAL TO 00
SHLD C602H STORE THE ANSWER IN C602H AND C603H
HLT STOP

(2) Consider a block of memory locations from C300 H to C30F H, another block from C400 H to C40F H.
Write an assembly language program to exchange contents of these two blocks.: 2024

Label Opcode Operand Comments


START LXIH, C300H SET HL PAIR TO C300H LOCATION
LXID, C400H SET DE PAIR TO C400H LOCATION
MVI C,0FH MOVE COUNT TO C REG
UP: MOV B,M MOV THE DATA POINTED BY HL TP B REG
LDAX D LOAD ACC WITH CONTENT OF DATA POINTED BY DE REG
MOV M,A MOV ACC CONTENT IN TO MEMORY POINTED BY HL
MOV A,B B REG CONTENT IS MOVED TO ACC
STAX D ACC CONTENT IS STORED DE PAIR
INX H INCREMENT HL CONTENT BY 1
INX D INCREMENT DE CONTENT BY 1
DCR C DECREMENT THE COUNT
JNZ UP REPEAT THE LOOP
HLT STOP

3) Write an assembly language program to get Binary Coded Decimal (BCD) sum of series of 1-byte
numbers stored at locations beginning 2600 H. Length of series is at 25FF H. Store the 1-byte result in
2700 Η.: 2024

Label Opcode Operand Comments


START LXI H ,25FFH INITIALIZE HL PAIR TP 25FFH
MOV C,M MOVE CONTENT OF HL MEMORY TO CREG
MVI A,00H CLEAR ACC
ABOVE INX H INCREMENT HL PAIR BY 1
ADD M ADD MEMORY POINTED BY HL TO ACC
DAA DECIMAL ADJUST ACC FPT GETTING BCD ANSWER
DCR C DECREMENT COUNT
JNZ ABOVE JUMP IF COUNT NOT ZERO TO LOOP ABOVE
STA 2700H STORE ACC CONTENT IN 2700LOCATION
HLT STOP

1
(4) A series of 1-byte hexadecimal data is stored at memory locations from D600 H to D60A H. Write an
assembly language program to replace each odd number in the series with data 00H.:
2024

Label Opcode Operand Comments


START LXIH D600H INITIALIZE HL PAIR TO POINT TO D600H
MVI C,0AH MOV OA COUNT TO C REG
ABOVE MOV A,M MOVE MEMORY CONTENT POINTED BY HL TO ACC
RRC ROTATE ACC CONTENT TO RIGHT ONE TIME TO FIND NO IS ODD
OR NOT
JNC DOWN IF NO CARRY NO IS EVEN JUMP TO LABEL DOWN
MOV M,00H IF CARRY IS 1 MOVE 00 TO MEMORY POINTED BY HL
DOWN INX H INCREMENT HL BY ONE
DCR C DECREMENT COUNT BY 1
JNZ ABOVE IF COUNT IS NOT ZERO REPEAT THE LOOP
HLT STOP

(5) Consider a block of memory locations beginning D600 H to D60F H. Write an assembly language
program to find first occurrence of data byte A2 H, in this block. Store the address of its first occurrence in
HL pair. If not found, HL pair must contain 0000H. : 2024

Label Opcode Operand Comments


START MVI C,0FH MOVE COUNT INTO C REG
LXIH ,D600H INTIALIZE HL TO D600H
UP MOV A,M MOV MEMORY CONTENT TO ACC
CPI A2H COMPARE ACC WITH A2H CONTENT
JZ DOWN IF BOTH DATA ARE SAME STOP THE PROG AND ASN IS IN HL
INX H IF BOTH ANS ARE DIFFERENT THE INCREMENT HL BY 1
DCR C DECREMENT C REG BY ONE
JNZ UP IF C CONTENT IS NOT ZERO REPEAT THE LOOP
LXIH ,0000H IF A2H IS NOT FOUNT MOVE 0000 TO HL REG PAIR
DOWN HLT STOP

(6) A block of fifteen memory locations begins D200 H. Write an assembly language program to convert
each data in the block into its l's complement. Store the result at locations beginning D300 H.:
2024

Label Opcode Operand Comments


START LXIH,D200H INITIALISE HL PAIR TO ADDRESS TO D200H
LXID,D300H INITIALISE DE PAIR TO ADDRESS TO D300H
MVI C,0FH MOVE COUNT 15 TO C REG
ABOVE MOV A,M MOVE CONTENT OF MEMORY TO ACC
CMA COMPLIMENT THE CONTENT OF ACC
STAX D STORE ACC CONTENT TO MEMORY POINTED BY DE
INX H INCREMENT HL CONTENT BY ONE
INX D INCREMENT DE CONTENT BY ONE
DCR C DECREMENT COUNT BY ONE
JNZ ABOVE JUMP IF NOT ZERO TO LOOP ABOVE
HLT HALT

2
7) Write an Assembly Language Program to count number of zeros in a number stored at memory location
2600H. Store the count at 2601H. 2023
Label Opcode Operand Comments
START LDA 2600H LOAD ACC BY OPERAND
MVI C,08H INITIALIZE COUNT BY 08H
MVI E,00H INITIALIZE COUNTER E BY 00H
UP RRC CHECK FOR ZERO
JC SKIP IS DIGIT ONE THEN SKIP WITHOUT INCREMENT E REG
INR E INCREMENT E REG
SKIP DCR C DECREMENT C REG
JNZ UP IS NOT ZERO REPEAT THE LOOP
MOV A,E Move the content of count E in acc
STA 2601H Store acc content in 2601H
HLT STOP

8) Write an Assembly Language Program to find the largest number in a block of memory locations begins
from 2400H, block length is stored at 23 FFH. Store the largest number after the end of the block.
2023
Label Opcode Operand Comments
START LXIH 23FFH INITIALIZE HL PAIR TO 23FFH
MOV C,M MOVE COUNT TO C REG
MVI A,00H CLEAR ACC
LOOP INX H INCREMENT HL BY ONE
CMP M COMPARE ACC WITH MEMORY CONTENT
JNC DOWN IF NUM IS NOT LARGER IN MEMORY JUMP TO DOWN LOOP
MOV A,M MOVE MEMORY TO ACC
DOWN DCR C DECREMENT THE C REG BY ONE
JNZ LOOP REPEAT IF COUNT IS NOT EQUAL TO ZERO
INX H INCREMENT HL BY ONE
MOV M,A MOVE LARGEST TO MEMORY
HLT STOP

(9) Write an Assembly Language Program to find absolute difference of two hex numbers stored in
memory locations 2500 H and 2501 H. Store the result at 2502H.
2023
Label Opcode Operand Comments
START LXIH 2500H INITIALIZE HL TO 2500H
MOV A,M MOVE MEMORY CONTENT TO ACC
INX H INREMENT HL BY 0NE
SUB M SUBSTRACT M FROM ACC
JNC LABEL JUMP IF NO CARRY TO LABEL
CMA COMPLIMENT ACC
INR A INCREMENT ACC
LABEL INX H INCREMENT HL BY ONE
MOV M,A MOVE ACC TO MEMORY
HLT STOP

3
(10) Write an Assembly Language Program to exchange the digits(nibbles) of a number in C200H, the digits
of a number stored in C201H and add it to the original number. Store the result at C202H. 2023
Label Opcode Operand Comments
START LXIH,C200H LOAD HL WITH C200H
MOV A,M MOVE MEMORY CONTENT TO ACC
MOV B,A MOVE ACC CONTENT TO B REG
RRC ROTATE 4 TIMES TO EXCHANGE NIBBLE OF GIVEN NUMBER
RRC
RRC
RRC
INX H INCREMENT HL BY ONE
MOV M,A STORE EXCHANGED NUM IN C201H
ADD B ADD ACC AND B REG
INX H INCREMENT HL BY ONE
MOV M,A MOVE ACC CONTENT TO MEMORY
HLT STOP

11) A block of data is stored from memory location D001H. Length of block is stored at D000H. Write a
program to find occurrences of data 02H in given block. Store the number of occurrences at Memory
Location D100H. 2020

(11) Write an Assembly Language Program to count number of times data D9H present in a memory block
begins from C400H. The length of the block is stored at C3FFH. Store the result after end of the block.
2023
Label Opcode Operand Comments
START LXIH,C3FFH POINT HL TO LOCATION C3FFH
MOV C,M MOVE COUNT FRM MEMORY TO C REG
MVI B,00H CLEAR B REG
MVI A,D9H MOVE D9H DATA TO ACC
UP INX H INCREMENT HL PAIR
CMP M COMPARE MEMORY AND ACC
JNZ DOWN IF CONTENT ARE NOT SAME THEN JUMP TO DOWN
INR E INCREMENT E REG BY ONE
DOWN DCR C DECREMENT COUNTER
JNZ UP JUMP UP UNTIL COUNT =0
INX H INCREMENT HL PAIR BY 1
MOV M,E MOVE E REG CONTENT TO MEMORY POINTED BY HL
HLT STOP

(12) A block of data is stored in memory locations from C200H to C20FH. Write an Assembly Language
Program to transfer the block in reverse order to memory locations C300H and onwards. 2023

Label Opcode Operand Comments


START LXI H , C20FH SET UP HL TO POINT TO SOURCE
LXID, C300H SET UP DE TO POINT TO DESTINATION
MVI B,10H SET B REG AS COUNTER
ABOVE MOV A,M MOVE MEMORY TO ACC
STAX D STORE DATA AT DESTINATION
DCX H DECREMENT SOURCE POINTER

4
INX D INCREMENT DESTINATION POINTER
DCR B DECREMENT COUNT
JNZ ABOVE IF NOT ZERO GO BACK
HLT STOP

(13) Write an Assembly Language Program to find the product of two numbers stored in memory location
C005H and C006H. Store the result in C000H and C001H 2022
(a) Write an Assembly Language Program to multiply a number stored at location 1050 with a number at
location 1051. Result is 2-byte. Store result at locations 1052 and 1053. 2016
(a) Write ALP to multiply number stored at 8085H by 09H and store result at 8086H and 8087H, with lower
byte at 8086H. 2015

Label Opcode Operand Comments


START LXI H,0000H SET INITIAL PRODUCT TO 0000H
LDA C005H SET ACC TO N1
MOV E,A MOV E=N1
LDA C006H SET ACC TO N2
MVI D,00H SET D=00H
LOOP DAD D PRODUCT=PRODUCT+N1
DCR A N2=N2-1;
JNZ LOOP REPEAT IF N2!=0

SHLD C000H STORE PRODUCT IN C000H AND C001H


HLT STOP

(14) Write an Assembly Language Program to add two BCD number stored at location 2500H and 2501H.
Place the BCD result in location 2502H and onward starting with LSB. 2022
(b) Write an Assembly Language Program to add two 8-bits BCD numbers stored at memory location 4500
H and 4501 H. Store the two byte BCD result from memory location 4502 H onwards. 2017
(a) Write an Assembly Language Program to add 2 decimal numbers stored at 1050 H and 1051 H. Store
result at 1052 H and 1053 H.
2016

Label Opcode Operand Comments


START LXI H ,2500H INITIALIZE HL PAIR WITH ADDRESS OF FIRST NUMBER
MVI C,00H INITIALIZE C REG TO 00H
MOV A,M GET FIRST NUMBER TO ACC
INX H INCREMENT HL REG PAIR BY ONE
ADD M ADD TWO NUMBERS
DAA DECIMAL ADJUST ACC
JNC LOOP JUMP IF NO CARRY TO LABEL L1
INR C IF CARRY =1 INCREMENT C REG
LOOP STA 2502H STORE LSB OF SUM IN 2502H LOCATION
MOV A,C GET MSB IN ACC
STA 2503H STORE THE MSB OF SUM IN LOCATION 2503H
HLT STOP

5
(15) Write a subroutine to fill the memory location 2501H to 25FF H with Hex number 01H to FFH
2022
Label Opcode Operand Comments
START LXI D ,2501H SET MEMORY TO START ADDRESS 2501H
XRA A CLEAR ACC
MVI B,FFH SET B=FFH
LOOP STAX D STORE THE DATA OF ACC IN MEMORY POINTED BY DE REG PAIR
INR A INCREMENTACC CONTENT BY ONE
INR E INCREMENT E LOCATION BY ONE
DCR B DECREMENT COUNT BY 1
JNZ LOOP JUMP NO ZERO TO LOOP
HLT STOP

(16) Write an ALP to count the number of odd data byte occurring in a block. starting from memory
location 2501H to 25FFH. Store the result at the memory location 2600H.
2022

Label Opcode Operand Comments


MVI C,FFH PLACE THE COUNT IM C REG
XRA A CLEAR ACC
MOV B,A AND CLEAR B REG
LXIH, 2501H INILIATLIZE HL PAIR BY 2501H
ABOVE MOV A,M MOV CONTENT OF MEMORY TO ACC
RRC ROTATE THE ACC TO RIGHT
JNC LOOP IF NUMBER IS EVEN JUMP TO LOOP
INR B IF ODD INCREMENT B REG BY ONE
LOOP INX H INCREMENT HL BY ONE
DCR C CEGERMENT THE COUNT OF C REG
JNZ ABOVE IF COUNT IS NOT ZERO THE GO TO LABEL ABOVE
MOV A,B MOVE B CONTENT TO ACC
STA 2600H STORE ACC CONTENT TO 2600H
HLT STOP

(17) Write a Assembly Language Program to copy a block of data having starting address 4500 H to new
location starting from 4600 H. The length of block is stored at memory location 44FF H. 2017
(17) Write an Assembly Language program to transfer a block of memory starting from 1050H to 1059H to
a new location starting from 1070H to 1079H. 2016
(17) A block of data is stored from memory location D001H to D005H. Copy the contents of block to
another block starting from 2501H. 2020

Label Opcode Operand Comments


LXI H,D001H INITIALIZE HL PAIR WITH D001
LXI B,2501H INITIALIZE BC TO 2501H
MVI D,05H COPY COUNT IN D REG
INX H INCREMENT HL REG PAIR BY 0NE
LOOP MOV A,M TRANSFER THE MEMORY CONTENT TO ACC
STAX B STORE THE ACC CONTENT TO NEW LOCATION
INX H INCREMENT HL PAIR
INX B INCREMENT BC PAIR
DCR D DECREMENT COUNT BY 0NE
JNZ LOOP JUMP IF NO ZERO TO LABEL LOOP
HLT STOP

6
18) A block of data is stored in memory location from 3330H. Length of block is stored at 2FFFH. write a
program to find 2's compliment of each data in a block and store the result from memory location 4100H.
2020
Label Opcode Operand Comments
LDA 2FFFH MOVE THE COUNT TO ACC
MOV D,A MOVE ACC CONTENT TO D REG
LXI H,3330H INITIALIZE HL PAIR 3330H
LXI B,4100H INTIALIZE BC TO 4100H
LOOP MOV A,M MOVE CONTENT OF MEMORY TO ACC
CMA COMPLIMENT ACC CONTENT
INR A INCREMENT ACC CONTENT TO TALE 2’S COMPLIMENT
STAX B STORE IT IN B REG
INX H INCREMENT HL PAIR BY ONE
INX B INCREMENT BC PAIR BY ONE
DCR D DECREMENT D REG CONTENT BY 0NE
JNZ LOOP IF COUNT IS NOT ZERO THE GO TO LOOP
HLT STOP

(19) A block of data is stored from memory location C001H and length is stored in C000H. Write a program
to find the sum of series and store the sum in CO50H and CO51H. 2020

Label Opcode Operand Comments


MVI A,00H CLEAR ACC CONTENT
MVI B,00H CLEAR B REG
LXIH,C000H LOAD HL WITH C000H
MOV C,M MOVE MEMORY CONTENT TO C REG
UP INX H INCREMENT HL REG BY ONE CONTENT
ADD M ADD CONTENT OF MEMORY TO ACC
JNC DOWN IF CY=0 THEN GO TO LABEL DOWN
INR B INCREMENT B REG BY ONE
DOWN DCR C DECREMENT C REG BY ONE
JNZ UP IF COUNT IS NOT ZERO GO TO LABEL UP
STA C050H STORE ACC CONTENT TO C050H
MOV A,C MOVE C REG CONTENT TO ACC
STA C501H STORE ACC CONTENT TO C50H
HLT STOP

(20) Write an assembly program to divide a hexadecimal number stored in a memory location 8000h by a hexadecimal
number stored in memory location 8001h ,store the quotient at 8002H and remainder at 8003h.
Label Opcode Operand Comments
LXIH ,8000H Intialize HL pair with dividend address
MVI C,00H INTIALIZE QUOTIENT TO 00H IN REG C
MOV A,M GET DIVIDENT IN ACC
INX H INCREMENT HL BY ONE
LOOP CMP M COMPARE IS DIVIDEND <=DIVISOR
JC DOWN IF YES GO TO LABEL DOWN
SUB M IF NO SUBTRACT DIVISOR FROM DIVIDEND
INR C INCREMENT QUOTIENT BY 1
JMP LOOP JUMP TP LOOP
DOWN INX H INCREMENT HL PAIR BY 1
MOV M,C MOVE QUOTIENT IN 8002H
INX H INCREMENT HL PAIR
MOV M,A STORE REMAINDER IN 8003H
HLT STOP

7
(21) Write ALP to find 2's complement of a 16 bit number stored in DE Pair. Store result in HL Pair. 2015
Label Opcode Operand Comments
MOV A,E MOVE E CONTENT TO ACC
CMA COMPLIMENT ACC CONTENT
MOV E,A MOVE ACC CONTENT TO E REG
MOV A,D MOVE D REG CONTENT TO ACC
CMA COMPLIMENT ACC
MOV D,A MOVE ACC CONTENT TO D REG
INX D INCREMENT D REG
XCHG EXCHANGE DE CONTENT WITH HL
HLT STOP

(22) Locate smallest number in a block from 2050H to 2060H and store it in memory location 2061H.
2015
Label Opcode Operand Comments
LXI H, 2050H INITIALIZE HL TO 2050 LOCATION
MVI C,10H REG C AS COUNTER
MOV A,M MOVE CONTENT OF MEMORY TO ACC
UP INX H INCREMENT HL BY ONE
CMP M COMPARE ACC AND MEMORY
JC DOWN CHECK ACC IS SMALL IF YES THE JUMP DOWN
MOV A,M ELSE MOVE MEMORY CONTENT TO ACC
DOWN DCR C DECREMENT COUNT
JNZ UP IF COUNT IS NOT ZERO THEN JUMP TP LABEL UP
INX H INCREMENT HL PAIR BY ONE
MOV M,A MOVE ACC CONTENT TO 2061H
HLT STOP

(23) Write ALP to store data BCH in 20 contiguous memory locations starting from 8081H. 2015
Label Opcode Comments
Operand
LXI H,8081H SET HL PAIR AT 8081H LOCATION
MVI C,14H MOVE COUNT TO REG C
UP: MVI M,BCH MOVE DATA BC TO MEMORY
INX H INCREMENT HL REG BY ONE
DCR C DECREMENT CREG CONTENT
JNZ UP JUMP UP UNTIL COUNTER IS ZERO
HLT STOP

(24) Accumulator contents of 8085 are B7H and register B contents are A5 H. What will be the effect of
following instructions on the contents of Accumulator, when executed independently? 2016

(i) ADI 05
(ii) CMP B
(iii) CMA
(iv) XRA B
(v) ORA B

8
9

You might also like