getData PROC
push ebp
mov ebp, esp
mov esi, [ebp + 12] ; offset of buffer
mov ebx, [ebp + 8] ; where to write answer
GETNUMBERSTRING:
mov edx, esi
mov ecx, BufferSize
mov eax, 0
call ReadString
mov ecx, eax ; set size to loop counter
cld
mov edx, 0
PROCESSSTRING:
lodsb
cmp al, 30h
jl WRONG
cmp al, 39h
jg WRONG
; add digit into total edx
sub al, 30h
push eax ; multiply edx by 10
push ecx
mov eax, edx
mov ecx, 10
mul ecx
mov edx, eax
pop ecx
pop eax
push ebx ; add to the total
movsx ebx, al
add edx, ebx
pop ebx
loop PROCESSSTRING
jmp DONE
WRONG:
call Crlf
stringWriterEndl invalid
jmp GETNUMBERSTRING
DONE:
mov [ebx], edx
pop ebp
ret 8
getData ENDP
Это то, что мне нужно было сделать.