I have tested it here and it works. Be sure that you are actually passing the value you think, without seeing an example of what you are passing I can't comment any further. The algo works for ascii strings "0" -> "99" and "00" -> "99".
call
mov dword ptr szDec, eax
pop eax
;-------------------------------
xor eax,eax
mov al,
sub al,30h
mov dl,
or dl,dl
jz @n ; I changed jz > to jz @n
mov ecx,10
mul cl
sub dl,30h
add al,dl
@n: ;And : to @n
and eax,0FFh
xor edx,edx
mov edi,offset hextab
movzx ecx,al
shr ecx,4
mov dl,
mov ,dl
movzx ecx,al
and ecx,0fh
mov dl,
mov ,dl
;-------------------------------
mov esi, 01020304
mov eax, dword ptr
mov byte ptr , al ;Here I pass the hex into a memory position
You know a solution?