You are on page 1of 9

EXP NO:4 (A) GREATEST IN A GIVEN SERIES OF NUMBER

AIM:
To write an assembly language program to find the largest number of given array
using the microprocessor 8085.

APPARATUS REQUIRED:

Sl. No Item quantity


1 8085 Microprocessor 1
2 Power supply 1

ALGORITHM:

• Load the address of the first element of the array in HL pair.


• Copy the count to register B.
• Increment the pointer.
• Get the first data in accumulator.
• Decrement the count.
• Increment the pointer.
• Compare the content of memory addressed by HL pair with that of
Accumulator.
• If Carry = 0, go to step 10 or if Carry = 1 go to step 9.
• Copy the content of the memory addressed by HL to Accumulator.
• Decrement the count.
• Check for Zero of the count. If Zero Flag (ZF) = 0, go to step 6, or if ZF = 1 go
to next step.
• Store the largest data in memory.
• Terminate the program.
OUT PUT :

8200 05
8201
8203
INPUT
8204
8205
8206
OUTPUT 8300
PROGRAM:

MEMORY COMMENT
OP-CODE LABEL MNEMONICS
ADDRESS
8100 21, 00,82 LXI H,8200 Load the array size to the HL
pair
8103 46 MOV B,M Copy the array size to C
register
8104 23 INX H Increment memory by 1
8105 7E MOV A,M Copy the data to the
accumulator
8106 05 DCR B Decrement array size by 1
8107 23 LOOP INX H Increment memory by 1
8108 BE CMP M Compare accumulator and
memory content
8109 DA, 0D, 81 JNC SKIP Jump on carry to the label
SKIP
810C 46 MOV A,M Copy memory content to B
register
810D 05 SKIP DCR B Decrement array size by 1
810E C2, 07, 81 JNZ LOOP Jump on non-zero to the label
LOOP
8111 32,00,83 STA 8300 Store the result
8114 76 HLT Program ends

RESULT:
The largest number in the given array was find successfully
EXP NO:4 (B) MULTI-BYTE ADDITION IN BCD MODE

AIM:
To write an assembly language program to find the addition of the given multi-
byte number using the microprocessor 8085.

APPARATUS REQUIRED:

Sl. No Item quantity


1 8085 Microprocessor 1
2 Power supply 1

ALGORITHM:

• Initialize Stack Pointer


• load memory address to get byte count
• load memory content into C register and clear B register
• load first and second argument address
• load DE with second operand address
• Add memory content and carry with Acc and Decimal adjust the acc content
• Store the accumulator content into the stack
• increase b after pushing into a stack
• Increase HL and DE pair to point next address
• Decrease c to while all bytes are not exhausted
• When bytes are not considered, loop again
• when carry = 0, jump to store or push it into stack
• Store the accumulator content into the stack
• increase b after pushing into the stack and load the destination pointer
• pop AF to get back bytes from the stack
• store Acc data at the memory location pointed by HL and Increase HL pair to
point next address
• Decrease B and Goto L1 to store stack contents
• Terminate the program
OUT PUT :

8500 03
8501
8503
INPUT 8504
8505
8506
8507
8510
OUTPUT 8511
8512
PROGRAM:

MEMORY COMMENT
OP-CODE LABEL MNEMONICS
ADDRESS
8100 31,00, 20 LXI SP, Initialize Stack Pointer
2000H
8103 21,00, 85 LXI H,8500H load memory address to get
byte count
8106 4E MOV C,M load memory content into C
register
8107 06,00 MVI B,00H clear B register
8109 21,01, 85 LXI H, 8501H load first argument address
810C 11,05, 85 LXI D, 8505H load second argument address
810F 1A LOOP LDAX D load DE with second operand
address
8110 8E ADC M Add memory content and
carry with Acc
8111 27 DAA Decimal adjust the acc content
8112 F5 PUSH PSW Store the accumulator content
into the stack
8113 4 INR B increase b after pushing into a
stack
8114 23 INX H Increase HL pair to point next
address
8115 13 INX D Increase DE pair to point next
address
8116 0D DCR C Decrease c to while all bytes
are not exhausted
8117 C2,0F, 81 JNZ LOOP When bytes are not
considered, loop again
811A D2,21, 81 JNC SKIP when carry = 0, jump to store
811D 3E,01 MVIA, 01H when carry = 1, push it into
stack
811F F5 PUSH PSW Store the accumulator content
into the stack
8120 04 INR B increase b after pushing into
the stack
MEMORY COMMENT
OP-CODE LABEL MNEMONICS
ADDRESS
8121 21,F0, 85 SKIP LXIH, 85F0H load the destination pointer

8124 F1 L1 POP PSW pop AF to get back bytes


from the stack

8125 77 MOV M, A store Acc data at the memory


location pointed by HL

8126 23 INX H Increase HL pair to point next


address

8127 05 DCR B Decrease B

8128 C2,24, 81 JNZ L1 Goto L1 to store stack


contents

812B 76 HLT Terminate the program

RESULT:
The largest number in the given array was find successfully

You might also like