Sei sulla pagina 1di 2

EXPERIMENT 4(b)

OBJECTIVE: Write a program for Subtraction of two 8 Bit numbers with


borrow.

DESCRIPTION: The program takes the content of memory location 2051,subtract


it to the content of 2050 and stores the result back at 2052.

APPARATUS: 8085 Microprocessor kit, Power Supply (+5v)

PROCEDURE:
1. Draw the flow chart.
2. Write the op-codes for the Mnemonics instructions.
3. Feed the op-codes in the Microprocessor 8085 kit.
4. Execute the entered program.

ALGORITHM:
1. Load 2050 in H-L reg. pair
2. Move 1st number to accumulator from memory location 2050.
3. Increment H-L register pair data.
4. Subtract the numbers of memory from accumulator (Result is stored in
Accumulator)
5. Jump to 2012 if carry is not generated otherwise take 2’s complement.
6. Move the result to memory locations 2052 and 2053.

PRECAUTIONS:
1. Check for proper connections of power supply.
2. Enter the codes in the Microprocessor kit properly.
3. Always remember the exact address location where you had started.

RESULT :
Two 8 bit numbers have been subtracted & the result can be verified at 2052 & 2053.

QUESTIONS:
1. In the instruction INR or DCR carry flag gets affected while in INX or DCX
carry flag does not get affected ,why.
2. If flags are individual FFs, can they be observed on an oscilloscope.
3. If program counter is always one count ahead of memory location from which
the machine code is being fetched , how does the microprocessor change the
sequence of program execution .
PROGRAM

ADDRESS MNEMONICS REMARKS


2000 LXI H,2050 2050→HL
2003 MOV A,M HL→A
2004 INX H HL→HL+1
2005 SUB M A-HL→A
2006 JNC 2012 JUMP TO 2012 If no carry
2009 CMA }
200A ADI ,01 }2’S COMPLIMENT
200C STA 2053
200F JMP 2015 to interrupt program otherwise
2012 STA 2052 it will store same result in
2015 RST 5 accumulator
2016 END

Potrebbero piacerti anche