Advertisements
Advertisements
Question
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]
Advertisements
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. | |
shaalaa.com
Is there an error in this question or solution?
