全局变量
;代码转换
include irvine32.inc
.data
tab dword 10 dup(?)
x dword 5
min dword ?
.code
main procmov min,0call inputcall findxor eax,eaxneg minmov eax,mincall writeintexit
main endpinput proc ;子程序:输入到对应数组push esipush eaxxor esi,esiha1: cmp esi,10jz haxor eax,eaxcall readintmov tab[esi*4],eaxinc esijmp ha1ha: pop eaxpop esiret
input endpfind proc ;子程序:查找大写字母并修改成小写的;通过全局变量传递参数push esipush ebxpush edxpush eaxxor esi,esistart1: cmp esi,10jz donexor ebx,ebxxor edx,edxxor eax,eaxmov ebx,tab[esi*4];获取待考察数据;同时存放于ebx eax edx中mov edx,ebxmov eax,ebxand ebx,8000h ;因为ebx以补码形式存放,所以考察其正负只需要考察符号位jz done1 ;为正数,跳转and edx,0001hjz done1 ;为偶数,跳转neg eax ;现在只剩下负奇数了cmp eax,xjng done1 ;不满足最低范围要求cmp min,0 ;min没有值的情况jnz ha3mov min,eaxjmp done1
ha3: cmp eax,minjl done1mov min,eaxdone1: inc esijmp start1done: pop eaxpop edxpop ebxpop esiret
find endpend main ;汇编结束
;jl、jg用于有符号数
;ja/jb用于无符号数
发布者:admin,转转请注明出处:http://www.yc00.com/web/1730930730a3581437.html
评论列表(0条)