Вы можете вызывать эту функцию напрямую из C ++, но вам может потребоваться сохранить некоторые регистры, в зависимости от компилятора. Получайте удовольствие от перевода на C ++.
;number to convert in [esp+4]
;pointer to string in [esp+8]
itoh: mov edi, [esp+8] ;pointer to c string
bsr ecx, eax ;calculate highest set bit
and cl, $fc ;round down to nearest multiple of 4
loop: mov eax, [esp+4]
shr eax, cl ;mov hex digit to lowest 4 bit
and eax, $f ;mask hex digit
cmp eax, 10 ;test if digit is in A..F
jlt numdgt
add eax, 'A'-'0'-10 ;it is
numdgt: add eax, '0' ;ascii converted digit
mov [edi], al ;store to string
inc edi ;and increment pointer
sub cl,4 ;decrement loop counter
jnc loop
mov byte[edi], 0 ;terminate string
ret