2020FZU汇编语言学习---实验(四)
程序员文章站
2022-06-07 08:21:08
...
4-1
include Irvine32.inc
.data
buf word 12AFh
mas byte 4 dup(?)
.code
main proc
push offset buf
push offset mas
call decbin
exit
main endp
decbin proc
push ebp
mov ebp,esp
push esi
push eax
push ebx
push ecx
push edx
xor esi,esi
mov ecx,4
mov ebx,[ebp+12] ;取出buf偏移地址
mov edi,[ebp+8] ;取出mas首地址
again:
mov dx,word ptr [ebx]
rol dx,4
mov word ptr[ebx],dx
and dl ,0fh ;0fh=(1111)B,取dl低四位
cmp dl,0ah ;<0ah,该位为数字,dl=dl+30h
jb num
add dl,7 ;字母的Ascii码为dl=dl+7h
num:
add dl,30h
mov byte ptr [edi+esi],dl ;存入mas
movzx eax,dl
call writeint
call crlf
inc esi
loop again
pop edx
pop ecx
pop ebx
pop eax
pop esi
ret
decbin endp
end main
上一篇: CTFhubweb技能树复现