Experiment 8: Write an ALP for 8085 to find sum of series of n consecutive numbers 8085 MPI Lab by Ravinder Nath Rajotiya - June 4, 2021June 4, 20210 AIM Write an ALP for 8085 to find sum of series of n consecutive numbers Objective: To learn and understand the assembly instructions To draw flow chart for addition of a series of numbers To develop an 8085 assembly language program to add series of number Flowchart Program to add series of numbers Address OP-CODE Label Mnemonic Comments 4200 C3 10 42 JMP start 4203 0A N: DB 10 ;Number of bytes 4204 19 2D 43 57 44 4A 2C 4E 56 27 X: DB 25,45,67,87,68,74,44,78,86,39 420E 00 00 y: DB 00,00 ;result ;code 4210 00 start: nop 4211 21 03 042 LXI H,N ;Pointer to number of bytes 4214 4E MOV C,M ; NO.OF DIGITS SET AS COUNT 4215 AF XRA A ;Clear Accumulator 4216 06 00 MVI B,00 ;Clear B to save carry 4218 23 INX H Pointing in data (numbers) 4219 86 LOOP1: ADD M 421A D2 1E 42 JNC SKIP Jump if no carry 421D 04 INR B 421E 23 SKIP: INX H 421F 0D DCR C ;Decrement counter 4220 C2 JNZ LOOP1 ;Jump to LOOP1 if all numbers not been added 4223 77 MOV M,A ;Save result 4224 23 INX H 4225 70 MOV M,B ;Save carry 4226 76 HLT ; Stop OUTPUT
Experiment 7: 8085 program to find to find the smallest and largest number from the given series 8085 MPI Lab by Ravinder Nath Rajotiya - June 3, 2021June 4, 20210 Aim: Write a program to find to find the smallest and largest number from the given series Objectives: To learn assembly instructions To develop an assembly language program to find the smallest and lrgest number in a series Flowchart to find the smallest number in a series of numbers Program Address Opcode Operands Label mnemonic Comments 4200 C3 0D 042 JMP start ; short jump to main program 4203 0C 18 12 38 15 05 0F 02 08 (9 bytes) X: db 12, 24, 18, 56, 21, 5,15, 2,8 ;Data set 420C <1 bytes> small: DS 1 ;Reserve 1 byte space inmemory 420D 00 start: nop 420E 0E 09 MVI C, 9 ; Set up the counter 4210 21 03 042 LXI H, X ;Point to dataset 4213 7E MOV A, M ;Mov 1st element to accumulator 4214 00 REPT: nop 4215 32 0C 042 STA small ;Make a copy 4218 23 INX H ; Increment mem pointer 4219 BE CMP M ;Compare Acc and no. in next
Experiment-6: 8085 ALP to multiply two 8-bit numbers 8085 MPI Lab by Ravinder Nath Rajotiya - May 19, 2021June 3, 20210 6.1 Write a program to perform Multiplication of two 8 bit numbers. Objective: To understand the multiplication using repeated addition To develop flowchart for multiplication using addition process To develop 8085 assembly program for multiplication of two 8-bit numbers To analyse and debug the assembly program Algorithm Load multiplicand in one register say Register B Load multiplier in register C Clear accumulator Add accumulator and register B decrement count (multiplier value) go to step-4 and repeat if count not zero stop Program for multiplying two 8-bit numbers Addr Opcode Operands Label mnemonic Remarks 4200 C3 06 042 jmp start ;data 4203 multiplicand: db 12 4204 08 (1 bytes) multiplier: db 8 4205 <1 bytes> product: ds 1 ;code 4206 00 start: nop 4207 3A 03 042 LDA multiplicand 420A 47 MOV B, A Save multiplicand in B 420B 3A 04 042 LDA multiplier 420E 4F MOV C, A ; save multiplier in C 420F AF XRA A ; clear Acc 4210 00 again: nop 4211 80 ADD B ; A= A+B 4212 0D DCR C ;decrement count/multiplier 4213 C2 10 42 JNZ again ; repeat if not
Experiment-5: 8085 ALP to find 2‘s complement of an 8 bit number 8085 MPI Lab by Ravinder Nath Rajotiya - March 23, 2021June 3, 20210 AIM: Write a program to find 2‘s complement of an 8 bit number. Objective: To understand the complement process To write algorithm for 1’s complement To develop the assembly language program to find 2’s complement To analyse the result and interpret errors if any Requirement: Operating System- Windos, Linux 8085 simulator Theory 2’s complement of a number is found in following ways: Do the 1’s complement of the given number Add ‘1’ to this 1’s complement Example: Find the 2’s complement of 59h Number 59h = 01011001 1’s complement = 10100110 Adding ‘1’ = 10100110 + 1 = 10100111 So, 2’s complement of 59h = A7h Algorithm: Get a number in the accumulator Complement using CMA Add ‘1’ to this to get 2’s complement Save the result Assembly language
Experiment-4: 8085 ALP program to find 1‘s complement of an 8 bit number 8085 MPI Lab by Ravinder Nath Rajotiya - March 13, 2021June 3, 20210 Experiment-4: Write a program to find 1‘s complement of an 8 bit number. Objective: To understand the complement process To write the algorithm for 1’s complement To develop the assembly program To analyze the program and interpret errors and result Requirement: Operating System – Windows, Linux 8085 Simulator Theory: 1’s complement of a number is found in the following ways: By complementing each bit of the number OR By subtracting the number from all 1’s Eg. 1’s complement of binary number 10101100 is 01010011 OR 1’s complement of binary number 10101100 1 11 11 111 -10101100 ------------------ 01010011 Algorithm: Input the number into the accumulator Complement using instruction CMA, Result in accumulator Save the result Program: Address OP-CODE Label Mnemonic Comments C9 05 042 JMP start 4203 45H X: 4204 00 Y 4205 start: NOP 4206 21,03,42 LXI H, X 4209 7E MOV A,M 421A 2F CMA 421B 76 HLT Viva Questions