You are on page 1of 3

.

386

.model flat,stdcall

.stack 4096

ExitProcess proto,dwExitCode:dword

.data

.code

main proc

; A = (A+B) - (C+D)

;Assign integer values to the EAX, EBX, ECX, and EDX registers.

mov eax , 12

mov ebx , 34

mov ecx , 11

mov edx , 20

; Add First pair of variables(A+B)

add eax , ebx

; Add second pair of variables (C+D)

add ecx , edx

; Subtracting both sides (A+B)-(C+D)

sub eax , ecx

; Results 15 = (46)-(31)
invoke ExitProcess,0

main endp

end main

.386

.model flat,stdcall

.stack 4096

ExitProcess proto,dwExitCode:dword

.data

aVal SDWORD 12

bVal SDWORD 34

cVal SDWORD 11

dVal SDWORD 20

.code

main proc

; (A+B) - (C+D)

;Assign integer values to the EAX, EBX, ECX, and EDX registers.

; Moving values of variables to register

mov eax , aVal

mov ebx, bVal

mov ecx, cVal

mov edx, dVal


; Adding eax and ebx(A+B)

add eax , ebx

; Adding ecx and edx(C+D)

add ecx , edx

; Subtracting both pairs (A+B)-(C+D)

sub eax , ecx

; Results 15 = (46)-(20)

invoke ExitProcess,0

main endp

end main

You might also like