MODIFIED CS2 IMP PROG 2025
MODIFIED CS2 IMP PROG 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
(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
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
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
(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
(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
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
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
(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
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
(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
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
(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