मराठी
महाराष्ट्र राज्य शिक्षण मंडळएचएससी विज्ञान (संगणक विज्ञान) इयत्ता १२ वी

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. - Computer Science 2

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
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2022-2023 (March) Official
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×