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

Recommended Answers

All 2 Replies

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

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.