Tuesday 7 January 2014

Addition of two numbers with carry(carry propagation)

Logic:If the addition of two numbers produces a carry then CX is set to '1'  else '0'.

code:

        .A  <start address>     (intialisation)
        MOV AX,@3000       (move content at 3000 to AX register)
        MOV BX,@3002       (move content at 3002 to BX register)
        MOV CX,0                (move 0 to CX register)  
        ADD AX,BX              (ADD BX with content of AX)
        JNB here:                    (if no-byte(no-carry) jump here:)
        MOV cx,1                 (if there is a carry move 1 to CX register)
here: INT 03                      (termination)

No comments:

Post a Comment