here is code whhat is wrong, any will be appreciated

; ******************************************************************
;  Convert integer to ASCII/Binary string.
;    Note, no error checking required on integer.

; -----
;  Arguments:
;    1) integer, value
;    2) string, address
; -----
;  Returns:
;    ASCII/Binary string (NULL terminated)

global    cvtIntToASCIIBinary
cvtIntToASCIIBinary:


;    YOUR CODE GOES HERE
push    ebp
mov    ebp, esp
push    eax
push    ebx
push    ecx
push    edx
push    esi
push    edi

mov eax,dword[ebp+8] ;get value of the number
mov ebx,dword[ebp+12], get the address of the string
mov ecx,8

convert:
mov edx,0
div dword[two]
mov byte[ebx],dl       ;save value 
inc ebx
loop convert

mov byte[ebx],NULL






pop    edi
pop    esi
pop    edx
pop    ecx
pop    ebx
pop    eax
mov    esp, ebp
pop    ebp


ret

thanks

Edited 4 Years Ago by Ezzaral: Code formatting.

In what parts are you comparing the value with "AND"?
Maybe this is a new technique.

Edited 4 Years Ago by thines01: typo

this is my new code something wrong
dont know
what

push    ebp
mov ebp, esp
push    eax
push    ecx
push    edx
push    edi


mov eax, dword[ebp+12]      ; string
mov ebx, dword[ebp+8]       ; integer value
mov ecx,ebx
convert:    
shl eax,1
and dl,1
adc dl,0

mov byte[edi+(ecx-1)],dl

loop convert
mov dword[edi+8],NULL


pop edi
pop edx
pop ecx
pop eax
pop ebp

Edited 4 Years Ago by Ezzaral: Code formatting.

This article has been dead for over six months. Start a new discussion instead.