.386
.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD
INCLUDE io.h
cr EQU 0dh
Lf EQU 0ah
.STACK 4096
.DATA
x DWORD ?
y DWORD ?
voroodi BYTE 40 DUP(?)
p BYTE cr,lf,"Enter number:",0
p1 BYTE cr,lf,"2Z, The sum is :"
sum BYTE 11 DUP (?)
BYTE cr,lf,0
p2 BYTE cr,lf,"2F, The mul is :"
mul1 BYTE 11 DUP (?)
BYTE cr,lf,0
p3 BYTE cr,lf,"1Z -1F , The sub is :"
sub1 BYTE 11 DUP (?)
BYTE cr,lf,0
.CODE
_start:
output p
input voroodi,40
atod voroodi
mov x,eax
output p
input voroodi,40
atod voroodi
mov y,eax
;check first number
mov eax,x
mov ebx,02h
cdq
idiv ebx
cmp edx,0
je firstNumberIsZ
jne firstNumberIsF
;check second number
firstNumberIsZ:
mov eax,y
mov ebx,02h
cdq
idiv ebx
cmp edx,0
je twoZ
jne oneZoneF
firstNumberIsF:
mov eax,y
mov ebx,02h
cdq
idiv ebx
cmp edx,0
je oneZoneF
jne twoF
twoZ:
mov eax,x
add eax,y
dtoa sum,eax
output p1
jmp endOfProgram
twoF:
mov eax,x
imul eax,y
dtoa mul1,eax
output p2
jmp endOfProgram
oneZoneF:
mov eax,x
sub eax,y
dtoa sub1,eax
output p3
endOfProgram:
INVOKE ExitProcess, 0
PUBLIC _start
END