हिंदी

Write an assembly Language program to separate nibbles of a number stored in memory location 7503H and store the separated nibbles in memory location 7504H and 7505H.

Advertisements
Advertisements

प्रश्न

Write an assembly Language program to separate nibbles of a number stored in memory location 7503H and store the separated nibbles in memory location 7504H and 7505H.

कोड लेखन
Advertisements

उत्तर

LDA 7503H   ; Load the 8-bit number into Accumulator
MOV B, A    ; Save a copy in Register B
ANI 0FH     ; Mask the upper nibble (AND with 0000 1111)
STA 7505H   ; Store the lower nibble at 7505H

MOV A, B    ; Get the original number back from B
ANI F0H     ; Mask the lower nibble (AND with 1111 0000)
RRC         ; Rotate Right 4 times
RRC         ; to move high nibble
RRC         ; to the lower 4 bits
RRC         ; (D3-D0)
STA 7504H   ; Store the separated high nibble at 7504H
HLT         ; Terminate
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2025-2026 (March) Official Board Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×