Re: Formatting in assembly



"James Daughtry" <mordock32@xxxxxxxxxxx> écrivait
news:1143764835.713649.236330@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:

atoi:
mov esi,D$esp+4 | mov ecx,D$esp+8
mov eax,0

L0: jecxz L1>
; Convert from ASCII, add to LSD
movzx ebx,B$esi | sub ebx,'0'
mov edx,10 | mul edx | add eax,ebx

inc esi | dec ecx
jmp L0<
L1:
ret


* "atoi" is not an acceptable name.

* All Local Labels should by in Row 1

----------------------------------------------------
Proc AsciiToEax:
Arguments @Buffer, @NumberOfChars
Uses esi, ebx, ecx, edx

mov esi D@Buffer, ecx D@NumberOfChars
mov eax 0, ebx 0, edx 10

While ecx > 0
mul edx
mov bl B$esi | sub bl '0' | add eax ebx
inc esi | dec ecx
End_While
EndP
----------------------------------------------------


Betov.

< http://rosasm.org >





.



Relevant Pages