New version can be called in the same way
invoke htodw,addr HexString

it 13 bytes shorter and runs ~ 30-35% faster.
Based of ideas of previous roy+Svin version.
But stack frame optimized + someting else


.386
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive

.code

; #########################################################################
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE

htodw proc FORCENOFRAME
ptHexString equ [esp+4]
mov ecx,ptHexString
xor edx,edx
ALIGN 4
htodw_loop:
mov al,[ecx]
inc ecx
sub al,"0"
js htodw_endloop
shl edx,4
cmp al,9
jbe htodw_addnumber
sub al,"a" - "0" - 10
jns htodw_addnumber
add al,20h
htodw_addnumber:
xor dl,al
jmp htodw_loop

htodw_endloop: mov eax,edx
ret 4
htodw endp

OPTION PROLOGUE:DEFAULTOPTION
OPTION EPILOGUE:DEFAULTOPTION

; #########################################################################

end
Posted on 2001-08-17 02:14:26 by The Svin
nice work svin !
in fact i found usefull to do that :
rename your htodw to hztodw
and make a htodw that accept a length parameter (it might always be usefull)
Posted on 2001-08-17 05:39:37 by roy