我开始学习汇编,现在我正在尝试一些我真正无法处理的东西。我的十六进制数字为“ nr”,我想将其数字写入文件“ test.txt”,并以“ separator”分隔。 OllyDebuger对我没有太大帮助。它在该文件中写了一些奇怪的字符。请帮助我提供一些刷新该代码的建议
segment data use32 class=data
filename db "test.txt", 0
acces_mode db "w", 0
nr dd 0ABCh
descriptor_file dd -1
separator db "/",0
digit dd "%d"
; our code starts here
segment code use32 class=code
start:
push dword acces_mode
push dword filename
call [fopen]
add esp, 4*2
mov [descriptor_file], eax
cmp eax, 0
je final
mov ecx,0
mov eax,[nr]
repetitive:
mov ebx,eax
and ebx,00000000000000000000000000001111b
mov [digit],ebx
push eax
push dword digit
push dword [descriptor_file]
call [fprintf]
add esp, 4*2
push dword separator
push dword [descriptor_file]
call [fprintf]
add esp, 4*2
pop eax
shr eax,4
mov ecx,eax
add ecx,1
loop repetitive
push dword [descriptor_file]
call [fclose]
add esp, 4