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 Share on Facebook Share Send email Mail Print Print 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 Figure: Flowchart to find smallest number in a series 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 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 memory location 421A D2 20 42 JNC AHEAD ;If no carry; i.e if no. in Acc is larger 421D C3 22 42 JMP X1 4220 00 AHEAD: nop 4221 7E MOV A, M ; to copy no. in memory to Accumulator 4222 00 X1: NOP 4223 0D DCR C ; Decrement count 4224 C2 14 42 JNZ REPT ;Repeat operation for all number 4227 76 hlt ; Stop OUTPUT Flowchart to find the largest number in a series Figure: flowchart to find largest number in a series Program to find largest number in a series Address Opcode Operands Label Mnemonic Comments 4200 C3 0B 042 jmp start ; short jump to main program 4203 0C 18 01 12 38 15 05 (7 bytes) X: db 12, 24, 1, 18, 56, 21, 5 ;Data set 420A largest: DS 1 ;Reserve 1 byte space inmemory 420B 00 start: nop 420C 0E 07 MVI C, 7 ; Set up the counter 420E 21 03 042 LXI H, X ;Point to dataset 4211 7E MOV A, M ;Mov 1st element to accumulator 4212 00 REPT: nop 4213 32 0A 042 STA largest ;Make a copy 4216 23 INX H ; Increment mem pointer 4217 BE CMP M ;Compare Acc and no. in next memory location 4218 D2 1C 42 JNC AHEAD ;If no carry; i.e if no. in Acc is larger 421B 7E MOV A, M Save larger no. in Accumulator 421C 00 AHEAD: nop 421D 0D DCR C ; Decrement count 421E C2 12 42 JNZ REPT ; Repeat operation for all number 4221 76 hlt ;stop OUTPUT Share on Facebook Share Send email Mail Print Print