programb29

# programb29 - Microprocessors &amp; Applications (UPTU)...

This preview shows pages 1–2. Sign up to view the full content.

Appendix B ØØ Explanation : We have a number. Let this number be stored in register AX. We have to find 1’s complement of this number. One’s complement of number means to invert each bit of that number. So our task is to complement each bit of number. We will rotate the number by 1 bit position to the left along with carry. Counter = 16 as we will have to rotate 16 times, as number of bits = 16. Then we will complement the bit in carry. Decrement counter and continue till all bits are complemented. The final complemented bit is in carry when CX = 0, as we are rotating with carry. So when CX = 0, the MSB = initial carry bit. We do not require the initial carry, we want the complemented bit, and so we rotate once again. Now, the result in AX = 1’s complement of the number. Display the result. eg. : AX = 1234 H. 000 1 001 0 001 1 010 0 1’s complement = 111 0 110 1 110 0 101 1 = EDCB ØØ Algorithm : Step I : Initialize the data memory. Step II

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## programb29 - Microprocessors &amp; Applications (UPTU)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online