You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
589 B
NASM
41 lines
589 B
NASM
.686p
|
|
.model flat
|
|
include kernel32.inc
|
|
includelib kernel32.lib
|
|
includelib msvcrt.lib
|
|
extern _printf:proc
|
|
extern _scanf:proc
|
|
extern _strlen:proc
|
|
.data
|
|
strScanfFmt db "%d",0
|
|
strPrintfFmt db "%d",0
|
|
.code
|
|
sgn proc
|
|
xor eax, eax
|
|
mov ebx, -1
|
|
mov ecx, 1
|
|
cmp dword ptr [esp+4], 0
|
|
cmovl eax, ebx
|
|
cmovg eax, ecx
|
|
ret
|
|
sgn endp
|
|
_main proc
|
|
var1=-4
|
|
mov ebp, esp
|
|
sub esp, 4
|
|
lea edx, dword ptr var1[ebp]
|
|
push edx
|
|
push offset strScanfFmt
|
|
call _scanf
|
|
add esp, 8
|
|
push dword ptr var1[ebp]
|
|
call sgn
|
|
add esp, 4
|
|
push eax
|
|
push offset strPrintfFmt
|
|
call _printf
|
|
add esp, 8
|
|
push 0
|
|
call ExitProcess
|
|
_main endp
|
|
end _main |