Wed, 25 Dec 2019 13:05:46 +0800

master
大蒟蒻 6 years ago
parent e0d879476e
commit 23761cde36

1
.gitignore vendored

@ -497,3 +497,4 @@ fabric.properties
# Android studio 3.1+ serialized cache file # Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser .idea/caches/build_file_checksums.ser
*.lnk

@ -0,0 +1,40 @@
.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%d%d",0
strPrintfFmt db "%d",0
.code
_main proc
var1=-4
var2=-8
var3=-12
mov ebp, esp
sub esp, 12
lea edx, dword ptr [ebp+var3]
push edx
lea edx, dword ptr [ebp+var2]
push edx
lea edx, dword ptr [ebp+var1]
push edx
push offset strScanfFmt
call _scanf
add esp, 16
imul eax, dword ptr var1[ebp], 5
mov ecx, dword ptr var2[ebp]
sub ecx, dword ptr var3[ebp]
xor edx, edx
div ecx
push eax
push offset strPrintfFmt
call _printf
add esp, 8
push 0
call ExitProcess
_main endp
end _main

@ -0,0 +1,44 @@
.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%d%d",0
strPrintfFmt db "%d",0
.code
_main proc
var1=-4
var2=-8
var3=-12
mov ebp, esp
sub esp, 12
lea edx, dword ptr [ebp+var3]
push edx
lea edx, dword ptr [ebp+var2]
push edx
lea edx, dword ptr [ebp+var1]
push edx
push offset strScanfFmt
call _scanf
add esp, 16
imul ecx, dword ptr var1[ebp], -5
mov eax, dword ptr var2[ebp]
neg eax
cdq
idiv dword ptr var3[ebp]
mov ebx, edx
mov eax, ecx
cdq
idiv ebx
push eax
push offset strPrintfFmt
call _printf
add esp, 8
push 0
call ExitProcess
_main endp
end _main

@ -0,0 +1,41 @@
.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

@ -0,0 +1,62 @@
.686p
.model flat
include kernel32.inc
includelib kernel32.lib
includelib msvcrt.lib
extern _printf:proc
extern _scanf:proc
extern _strlen:proc
_BSS SEGMENT
a dd 100000 dup(?)
_BSS ENDS
.data
strScanfFmt db "%d",0
strPrintfFmt db "%lld",0
.code
_main proc
n=-4
sub esp, 4
lea edx, dword ptr n[ebp]
push edx
push offset strScanfFmt
call _scanf
add esp, 8
mov ecx, dword ptr n[ebp]
xor ebx, ebx
loop1@start:
cmp ebx, ecx
je loop1@end
push ecx
lea edx, dword ptr a[ebx*4]
push edx
push offset strScanfFmt
call _scanf
add esp, 8
pop ecx
inc ebx
jmp loop1@start
loop1@end:
xor esi, esi
xor edi, edi
xor ebx, ebx
loop2@start:
cmp ebx, ecx
je loop2@end
mov eax, dword ptr a[ebx*4]
cdq
add eax, esi
adc edx, edi
mov esi, eax
mov edi, edx
inc ebx
jmp loop2@start
loop2@end:
push edi
push esi
push offset strPrintfFmt
call _printf
add esp, 12
push 0
call ExitProcess
_main endp
end _main
Loading…
Cancel
Save