NEG in Assembly Language


¢NEG X
X := –X


NEG in Assembly Language


TITLE NEG Command in Assembly Language
.MODEL small
.STACK 1000H

.DATA
V1 DW 7
V2 DW 2

.CODE
;LOAD DATA
MOV AX,@DATA
MOV DS,AX

;V1 = V1 + (-V2)
mov BX,V2
NEG BX
ADD V1,BX

;PRINT V1
MOV DX,V1
ADD DX,48
MOV AH,2H
INT 21H

;RETURN CONTROL
mov ah,4ch
int 21h
END

No comments:

Post a Comment