06-02-2013, 04:10 PM
8085 Programs
8085 Programs.pdf (Size: 107.26 KB / Downloads: 204)
Explanation:
This program finds the square of an 8-bit number stored in memory location 3000H.
The square of a number is found by multiplying it by itself.
Therefore, the number is added with itself and is also used as counter.
Let us assume that the operands stored at memory location 3000H is 03H.
Then, by using successive addition method, we get 03H + 03H + 03H = 09H.
Initially, H-L pair is loaded with the address of the operand.
The operand is moved to register B from memory location 3000H and then it is copied to
register C.
Accumulator is initialized to 00H.
Register B is added with accumulator and the result is stored in accumulator.
Register C (counter) is decremented by 1.
Then, counter is checked for zero. If it hasn’t become zero yet, then register B is again added
with accumulator, and counter is again checked for zero.
If counter becomes zero, then H-L pair is incremented and the result is moved from
accumulator to memory location 3001H.