Featured

    Featured Posts

Q.2.(b) solution of microprocessor and interfacing sample paper


In this solution of the problem based on operations on memory locations in the microprocessor, we try to make you understand that how memory operations are performed in the machine languages. With the help of flow chart its easy to understand the operations performed with the memory locations.

Q.2.(b) Subtract the 16 bit number in memory location 2002H and 2003H from the 16 bit number in memory locations 2000H and 2001H.  The most significant eight bits of the two numbers are in memory locations 2001H and 2003H.  Store the result in memory location 2004H and 2005H with the most significant byte in memory location 2005H.

Ans.  Statement of the problem
(2000H) = 19H
(2001H) = 6AH
(2002H) = 15H
(2003H) = 5cm
Result = 6A 19H - 5C 15H = OE04H
(2004H) = 04H
(2005H) = OEH



Program :

LHLD 2000H -> Get first 16 bit number in HL.
XCHG -> Save first 16 bit number in DE.
LHLD 2002H -> Get second 16 bit number.
MOV A, E -> Get lower byte of the first number.
SUB L -> Subtract lower byte of the second number.
MOV L,A -> Store result in L register.
MOV A, D -> Get higher byte of the first number.
SUB H -> Subtract higher byte of second number with borrow.
MOV H, A -> Store 16 bit result in memory locations 2004H and 2005H.
Shld 2004 -> Store 16 bit result in memory locations 2004H and 2005H.
HLT -> Terminate program execution.

Post a Comment

www.CodeNirvana.in

www.posthatke.com. Powered by Blogger.

Google+ Followers

Copyright © www.posthatke.com | Blogger Templates | Designed By posthatke.com