;代码转换
include irvine32.inc
.data
tab dword 10 dup(?)
x dword 5
min dword ?
.code
main proc
mov min,0
call input
call find
xor eax,eax
neg min
mov eax,min
call writeint
exit
main endp
input proc ;子程序:输入到对应数组
push esi
push eax
xor esi,esi
ha1: cmp esi,10
jz ha
xor eax,eax
call readint
mov tab[esi*4],eax
inc esi
jmp ha1
ha: pop eax
pop esi
ret
input endp
find proc ;子程序:查找大写字母并修改成小写的
;通过全局变量传递参数
push esi
push ebx
push edx
push eax
xor esi,esi
start1: cmp esi,10
jz done
xor ebx,ebx
xor edx,edx
xor eax,eax
mov ebx,tab[esi*4];获取待考察数据
;同时存放于ebx eax edx中
mov edx,ebx
mov eax,ebx
and ebx,8000h ;因为ebx以补码形式存放,所以考察其正负只需要考察符号位
jz done1 ;为正数,跳转
and edx,0001h
jz done1 ;为偶数,跳转
neg eax ;现在只剩下负奇数了
cmp eax,x
jng done1 ;不满足最低范围要求
cmp min,0 ;min没有值的情况
jnz ha3
mov min,eax
jmp done1
ha3: cmp eax,min
jl done1
mov min,eax
done1: inc esi
jmp start1
done: pop eax
pop edx
pop ebx
pop esi
ret
find endp
end main ;汇编结束
;jl、jg用于有符号数
;ja/jb用于无符号数