Advertisements
Advertisements
प्रश्न
Write, an Assembly Language Program to find absolute difference of two hex numbers stored in memory locations 2500 H and 2501 H. Store the result at 2502H.
कोड लेखन
Advertisements
उत्तर
Label Mnemonics Comments
LXI H, 2500H ; Set H-L pointer to 2500H
MOV A, M ; Move 1st number into Accumulator
INX H ; Increment H-L pair
SUB M ; Subtract 2nd number from 1st number
JP GO ; If result is positive, jump to GO
MOV A, M ; Move 2nd number into Accumulator
DCX H ; Decrement H-L pair
SUB M ; Subtract 1st number from 2nd number
GO: STA 2502H ; Store result at 2502H
HLT ; Stop execution
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
