Advertisement Remove all ads

Write ALP to clear Register ,B, if number at memory location 20F9H is Palindrome; otherwise store FFH in Register B. - Computer Science 2

Advertisement Remove all ads
Advertisement Remove all ads
Advertisement Remove all ads

Write ALP to clear Register ,B, if number at memory location 20F9H is Palindrome; otherwise store FFH in Register B.

[Palindrome No. Ex. FF, 22, AA]

Advertisement Remove all ads

Solution

Mnemonics Comment
Opcode Operand
                LIX H, 20F9H ; Store 20F9 in HL pair
                MOV A, M ; Copy memory data to Acc
                ANI OF ; Logically And Acc. with 0F
                MOV B, A ; Copy Acc. to B Reg
                MOV A, M ; Copy memory content to Acc
                ANI F0 ; Logically And Acc. with F0
                RRC ; Rotate digits
                RRC ; Rotate digits
                RRC ; Rotate digits
                RRC ; Rotate digits
                CMP B ; Compare Acc. with B reg
                JNZ : NEXT ; If A ? B; go to next
                MVI B, 00 ; Store 00 in B reg.
                RST 1.0 ; Restart.
     NEXT : MVI B, FF ; Store FF in B reg.
                RST 1.0 ; Restart.
Concept: Instruction Set and Programming of 8085
  Is there an error in this question or solution?

APPEARS IN

Advertisement Remove all ads
Share
Notifications

View all notifications


      Forgot password?
View in app×