You are on page 1of 3

1. Write down a program to add two 8 bit numbers.

Ans. Mnemonics LXI MOV INX ADD STA HLT Operands H, 2501 H A, H H M 2503 H Comments Get address of 1st number in H-L pair. 1st number in accumulator. increment content of H-L pair. Add 1st and 2nd numbers. Store sum in 2503 H.

2. Write down a program to add two 16 bit numbers.


Ans.

Source program 1
LHLD 4000H : Get first I6-bit number XCHG : Save first I6-bit number in DE LHLD 4002H : Get second I6-bit number in HL DAD D : Add DE and HL SHLD 4004H : Store I6-bit result in memory locations 4004H and 4005H. HLT : Terminate program execution

Source program 2
LHLD 4000H XCHG LHLD 4002H MOV A, E ADD L MOV L, A MOV A, D ADC H MOV H, A SHLD 4004H HLT : Get first I6-bit number in HL : Save first I6-bit number in DE : Get second I6-bit number in HL : Get lower byte of the first number : Add lower byte of the second number : Store result in L register : Get higher byte of the first number : Add higher byte of the second number with CARRY : Store result in H register : Store I6-bit result in memory locations 4004H and 4005H. : Terminate program execution

3. Write down a program to substruct two 8 bitnumbers.


Ans. LXI H,C050 MOV A, M INX H SUB M INX H MOV M, A HLT

4. Write down a program to substruct two 16 bit numbers.


Ans.

Source program 1
LHLD NUM1 MOV A,H CMA MOV H,A MOV A,L CMA MOV L,A INX H XCHG LHLD NUM2 DAD D SHLD NUM3

Source program 2
LHLD 4000H : Get first 16-bit number in HL XCHG : Save first 16-bit number in DE LHLD 4002H : Get second 16-bit number in HL MOV A, E : Get lower byte of the first number SUB L : Subtract lower byte of the second number MOV L, A : Store the result in L register MOV A, D : Get higher byte of the first number SBB H : Subtract higher byte of second number with borrow MOV H, A : Store l6-bit result in memory locations 4004H and 4005H. SHLD 4004H : Store l6-bit result in memory locations 4004H and 4005H. HLT : Terminate program execution.

5. Write short notes on

I. II. III. IV. V. VI.


Ans.

General purpose registers. Accumulator Program Counter Stack Pointer Flags Registers

General purpose RegistersIn 8085 general purpose registers are used to hold data like any other registers. In 8085 there are six types of special registers called general purpose registers. The general purpose registers in 8085 are B, C, D, E, H and L. Each register can hold 8 bit data. Apart from above functions these registers can also be used to work in pairs to hold 16 bit data. They can work in pairs such as B-C, D-E, H-L to store 16 bit data. The H-L pair work as a memory pointer. A memory pointer holds the address of a particular memory location. They can store 16 bit address as they work in pairs.

Accumulator
The accumulator is an 8-bit register that is a part of arithmetic/logic unit (ALU). This register is used to store 8-bit data and to perform arithmetic and logical operations. The result of an operation is stored in the accumulator. The accumulator is also identified as register A.

You might also like