Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

2's compliment in assembly

can u help me modify this format?i want this thing to perform 2's compliment when the user enters negative numbers (i have a calculator that doesn't perform operation with negative nos.)..thanks in advance
[code]CONVERT_ASSCII PROC NEAR

MOV AH , BYTE PTR RESULT ;MOVE FIRST TWO BYTE OF RESULT TO AX
MOV AL , BYTE PTR RESULT + 1

;AT FIRST CHECK IF AX IS POSITIVE OR NEGETIVE
TEST EAX , 8000H ;CHECK THE LAST BIT . IF THATS 1 THEN AX IS NEG , OTHERWISE THATS POSITIVE
MOV EDI , 0 ;AT FIRST SET OUR FLAG TO ZERO
JZ EAX_POSITIVE ;AX IS POSITIVE
NEG EAX ;CALCULATE NEGETIVE OF AX
MOV EDI , 1 ;DI INDICATES THAT AX IS NEG[/code]
Sign In or Register to comment.