English

Write an Assembly Language Program to exchange the digits of a number the digits of a number stored in C200H and add it to the original number Store the result at C201H. - Computer Science 2

Advertisements
Advertisements

Question

Write an Assembly Language Program to exchange the digits of a number the digits of a number stored in C200H and add it to the original number Store the result at C201H.

Code Writing
Advertisements

Solution

Label       Mnemonics and Operand          Comments

      LXI H, C200H     ; Set HL with C200H
      MOV A, M         ; Copy memory content to accumulator

      RRC              ; Rotate right (1st time)
      RRC              ; Rotate right (2nd time)
      RRC              ; Rotate right (3rd time)
      RRC              ; Rotate right (4th time) → Exchange nibbles

      ADD M            ; Add original memory content with accumulator
      STA C201H        ; Store result at C201H
      HLT              ; Stop execution
shaalaa.com
  Is there an error in this question or solution?
2022-2023 (March) Official
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×