1
.386
2
.model flat, stdcall
3
option casemap : none
4
includelib msvcrt.lib
5
6
printf PROTO C :dword, :vararg
7
scanf PROTO C :dword, :vararg
8
9
.data
10
outputStart byte 'input ten num', 0ah, 0
11
outputCount byte 'input the %d num', 0ah, 0
12
input byte '%d', 0
13
outputResult byte 'the max num is %d', 0ah, 0
14
iArray dword 5 dup (?)
15
16
.code
17
start proc
18
mov ebx, offset iArray
19
mov ecx, 5
20
xor esi, esi
21
startInput:
22
invoke printf, offset outputCount, esi
23
invoke scanf, offset input, ebx
24
add ebx, 4
25
inc esi
26
cmp esi, 5
27
jnz startInput
28
29
mov esi, 1
30
mov eax, dword ptr iArray
31
mov ebx, offset iArray
32
getMax:
33
cmp eax, dword ptr [ebx + esi * 4]
34
jl updateMax
35
inc esi
36
cmp esi, 5
37
jz output
38
jmp getMax
39
updateMax:
40
mov eax, dword ptr [ebx + esi * 4]
41
inc esi
42
cmp esi, 5
43
jnz getMax
44
output:
45
invoke printf, offset outputResult, eax
46
ret
47
start endp
48
end start
49
.3862
.model flat, stdcall3
option casemap : none4
includelib msvcrt.lib5

6
printf PROTO C :dword, :vararg7
scanf PROTO C :dword, :vararg8

9
.data10
outputStart byte 'input ten num', 0ah, 011
outputCount byte 'input the %d num', 0ah, 012
input byte '%d', 013
outputResult byte 'the max num is %d', 0ah, 014
iArray dword 5 dup (?) 15

16
.code17
start proc18
mov ebx, offset iArray19
mov ecx, 520
xor esi, esi21
startInput: 22
invoke printf, offset outputCount, esi23
invoke scanf, offset input, ebx24
add ebx, 425
inc esi26
cmp esi, 527
jnz startInput28
29
mov esi, 130
mov eax, dword ptr iArray31
mov ebx, offset iArray32
getMax:33
cmp eax, dword ptr [ebx + esi * 4] 34
jl updateMax35
inc esi36
cmp esi, 537
jz output38
jmp getMax39
updateMax: 40
mov eax, dword ptr [ebx + esi * 4]41
inc esi42
cmp esi, 543
jnz getMax44
output:45
invoke printf, offset outputResult, eax46
ret47
start endp48
end start49

浙公网安备 33010602011771号