1's Compliment. 16 bit numbers. That's the main difference here. Before for 8 bit numbers, we used LDA and STA. LXI H ,2050H Loads BC pair with value 2050H H-> 20H L-> 50H Its similar to 2 MVI instruction ie MVI H,20H MVI L,50H which eventually implies..HL -> 2050H the advantage of LXI over MVI is that LXI is 3 byte and requires 10T states.Two MVI instruction is 4Byte and require 14Tstates... INX increments (and DCX decrements) the 16 bit register pairs H-L pair holds the address of the location pointed by the memory pointer M. M can be used to access the actual values of H-L pair. What I understand is that it shifts the address where the register H is pointing at to the next concurrent memory space. (This way, it can be used to access concurrent data like in an array using LXI H, INX H commands.)
OUTPUT: 2500 FF 2501 FF After execution of program: 2502 00 2503 00 'Cause compliment of the hexadecimal 0 is F. 0000 (0) <==> 1111 (F) 2's Compliment. A condition comes into play in this case. In the previous case of an 8 bit number, we increment the value after complimenting it to get the 2's compliment. But for 16 bit numbers, there are two parts: LSB, MSB. First, we compliment the LSB, then add one to it. (using ADI 01 instead of INR A, so as to affect the carrys for our jump statement to work properly) ADI affects all status flags while INR affects all status flags except the carry flag. Second, if the LSB on getting incremented by 1 yields a carry, that carry should be passed on to the MSB. If no carry is generated, then MSB should not be incremented by 1.
JNC (Jump if Not Carry) label This moves program control to the location specified by the label if there is no carry, (CY = 0). I prefer to think of it this way: If there is a carry, execute the command immediately after. Similarly for JC (JUMP if CARRY) USED usually in the opposite sense. If there is NO carry, execute the command immediately after. OUTPUT: 2500 FF 2501 FF After execution of program: 2502 01 (LSB) 2503 00 (MSB) |