1
.3862
.model flat, stdcall3
option casemap : none4
includelib msvcrt.lib 5
printf PROTO C :dword, :vararg6
scanf PROTO C :dword, :vararg7

8
.data9
strInputInfo byte 'input two num: ', 0ah, 010
strInput byte '%d%d', 011
strEnd byte 'end', 0ah, 012
strResult byte 'the %d and %d id logNUm', 0ah, 013

14
.data?15
min dword ?16
max dword ?17

18
.code19
start proc20
push eax21
push ebx22
push ecx23
push edx24
push esi25
push edi26
27
invoke printf, offset strInputInfo28
invoke scanf, offset strInput, offset min, offset max29
mov esi, min30
mov edi, max31

32
;如果esi > edi交换2数33
cmp esi, edi34
ja changNum 35
a10:36
mov ebx, esi37
a20:38
cmp ebx, edi39
jz endSearch40
mov ecx, 141
;eax = ebx + ecx * ecx42
a30:43
mov eax, ecx44
mul eax45
add eax, ebx46
cmp eax, edi47
ja icreEbx48
add eax, ebx49
push ecx50
push eax51
mov ecx, 152
a50:53
mov eax, ecx54
mul eax55
pop edx56
cmp eax, edx57
jz printResult58
ja a4059
inc ecx60
push61
edx62
jmp a5063

64
icreEbx: ;exb++进入下次循环65
inc ebx66
jmp a2067

68
changNum:69
xchg esi, edi70
jmp a1071
printResult:72
sub edx, ebx73
invoke printf, offset strResult, ebx, edx74
a40:75
pop ecx76
inc ecx77
jmp a3078
endSearch:79
invoke printf, offset strEnd80
pop edi81
pop esi82
pop edx83
pop ecx84
pop ebx85
pop eax86
ret87
start endp88
end start89

浙公网安备 33010602011771号