St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP COMPUTER ARCHITECTURE LAB CONTENTS E XPT N O N AME OF THE E XPERIMENT P AGE N O 1 Write an 8085 program to swap two 8 - bit numbers. 2 a. Write a program to find the largest of two numbers. b. Write an 8085 program to find smallest of two numbers. 3 Write an 8085 program to find whether an 8 - bit number is positive, negative or zero. If positive display EE, if negative display FF, if zero display DD. 4 Write an 8085 program to check whether 4 th bit of a number is zero or one. If 4 th bit is 0 display DD. 5 Write an 8085 program to calculate the sum of first ten natural numbers. 6 Write an assembly language program in 8085 microprocessors to find the sum of digits of an 8 - bit number. 7 Write an 8085 program to find the reverse of an 8 - bit number. 8 Write an 8085 program to check whether 1 - byte number is a palindrome or not. If it is a palindrome display FF otherwise display DD. 9 Write an 8085 program to check whether a number is ODD and EVEN. If Even no display DD, if Odd no display FF. 10 Write an 8085 program to count a number of ones in the given 8 - bit number. St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP PART A PROGRAMS ( 1 - 10 PROGRAMS) 1. Write an 8085 program to swap two 8 - bit numbers. LDA 8500H MOV B,A LDA 8501H STA 8500H MOV A,B STA 8501H HLT OUTPUT: St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP 2. a)Write a program to find the largest of two numbers. LXI H,8000H MOV B,M INX H MOV A,M CMP B JNC STORE MOV A,B STORE: STA 8050H HLT OUTPUT: St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP 2. b)Write an 8085 program to find smallest of two numbers. LXI H,8000H MOV B,M INX H MOV A,M CMP B JC STORE MOV A,B STORE: STA 8003H HLT OUTPUT: St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP 3) Write an 8085 program to find whether an 8 - bit number is positive, negative or zero. If positive display EE, if negative display FF, if zero display DD. LXI H,8200H ; Use 0 FBH As A Input For Negative Number And Any Number To Check For Positivitiy MOV A,M ANI 0FFH JZ ZERO JM NEG JP POS ZERO: MVI A,00H JMP LOOP NEG: MVI A,0FFH JMP LOOP POS: MVI A,01H LOOP: STA 8201H HLT OUTPUT: St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP 4) Write an 8085 program to check whether 4 th bit of a number is zero or one. If 4 th bit is 0 display DD. MOV A, M LXI H,8000H ANI 08H JNZ NONZ MVI M, 00H JMP END NONZ: MVI M, 0FFH END: HLT OUTPUT: St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP 5) Write an 8085 program to calculate the sum of first ten natural numbers. LXI H,8000h MOV C,M XRA A MOV B,A LOOP: ADD C JNC SKIP INR B SKIP: DCR C JNZ LOOP LXI H,8003H MOV M,A INX H MOV M,B HLT St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP OUTPUT: St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP 6) Write an assembly language program in 8085 microprocessors to find the sum of digits of an 8 - bit number. LDA 2050H MOV B,A ANI 0FH MOV C,A MOV A,B RRC RRC RRC RRC ANI 0FH ADD C STA 2070H HLT OUTPUT: St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP 7) Write an 8085 program to find the reverse of an 8 - bit number. LDA 8500 RRC RRC RRC RRC STA 8501 HLT St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP OUTPUT: St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP 8) Write an 8085 program to check whether 1 - byte number is a palindrome or not. If it is a palindrome display FF otherwise display DD. LDA 8000H MOV H,A MVI C,08H LOOP: MOV A,H RLC MOV H,A MOV A,D RAR MOV D,A DCR C JNZ LOOP MOV A,H CMP D JZ TRUE MVI A,0DDH JMP EXIT TRUE: MVI A,0FFH EXIT: STA 8003H HLT OUTPUT: St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP 9) Write an 8085 program to check whether a number is ODD and EVEN. If Even no display DD, if Odd no display FF. LDA 8000H ANI 01 JZ EVEN MVI A,0FFH JMP STORE EVEN: MVI A,0DDH STORE: STA 8003H HLT St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP OUTPUT: St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP 10) rite an 8085 program to count a number of ones in the given 8 - bit number. MVI B,0FH STC CMC MOV A,B MVI C,08H MVI B,00H LOOP: RRC JNC SKIP INR B SKIP: DCR C JNZ LOOP MOV A,B STA 8003H HLT OUTPUT: St. Francis de Sales College (Autonomous) Computer Architecture Lab Manual BCA 1 st Sem SEP