.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
mov eax,x
mov ebx,02h
cdq
idiv ebx
cmp edx,0
je firstNumberIsZ
jne firstNumberIsF
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