www.pudn.com > fd.zip > CONVERT.ASM
.386 .model flat,STDCALL include win32.asi ; some 32-bit constants and structures include win32.ase .data numbuf db 15 dup (0) .code public IntToString, StringToInt IntToString PROC push ebx push ecx push edx lea edi,[numbuf] push edi or eax,eax jns notneg mov byte ptr [edi],'-' inc edi neg eax notneg: mov ebx,10 sub ecx,ecx lp0: inc ecx sub edx,edx div ebx or dl,'0' push edx or eax,eax jnz lp0 lp1: pop eax stosb loop lp1 sub al,al stosb pop edi pop edx pop ecx pop ebx ret IntToString ENDP StringToInt PROC push ebx push edx push esi sub ebx,ebx sub edx,edx sub eax,eax cmp byte ptr [edi],'-' jnz sinotneg inc edi inc ebx sinotneg: cmp byte ptr [edi],'+' jnz notplus inc edi notplus: lodsb or al,al jz sid sub al,'0' imul edx,edx,10 sub al,'0' add edx,eax jmp notplus sid: mov eax,edx pop esi pop edx pop ebx ret StringToInt ENDP end