Assembly code snippets
Details
Title | hex ASCIIZ string to dword |
---|---|
Author | The Svin |
Submitted by: | The Svin |
Date added: | 2002-03-23 11:28:55 |
Date modified: | 2002-03-23 11:30:04 |
Comments
Only capital (ABCDEF) letters allowed.
Module in format of m32lib.
in masm32.inc add:
htodwc proto :DWORD
Snippet
; #########################################################################
; --------------------------------------
; This procedure was written by Svin
; --------------------------------------
.386
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive
.code
; #########################################################################
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
htodwc proc FORCENOFRAME
push ebx
xor eax,eax
mov ebx,[esp+8]
xor edx,edx
@@: mov dl,[ebx] ;1
shl eax,4 ;0
cmp dl,41h ;1
inc ebx ;0
sbb cl,cl ;1
sub dl,'A'-0Ah ;0
and cl,7 ;1
add dl,cl ;1
cmp byte ptr [ebx],0 ;0
lea eax,[eax][edx] ;1
jne @B ;1
pop ebx
ret 4
htodwc endp
OPTION PROLOGUE:DEFAULTOPTION
OPTION EPILOGUE:DEFAULTOPTION
; #########################################################################
end
; --------------------------------------
; This procedure was written by Svin
; --------------------------------------
.386
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive
.code
; #########################################################################
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
htodwc proc FORCENOFRAME
push ebx
xor eax,eax
mov ebx,[esp+8]
xor edx,edx
@@: mov dl,[ebx] ;1
shl eax,4 ;0
cmp dl,41h ;1
inc ebx ;0
sbb cl,cl ;1
sub dl,'A'-0Ah ;0
and cl,7 ;1
add dl,cl ;1
cmp byte ptr [ebx],0 ;0
lea eax,[eax][edx] ;1
jne @B ;1
pop ebx
ret 4
htodwc endp
OPTION PROLOGUE:DEFAULTOPTION
OPTION EPILOGUE:DEFAULTOPTION
; #########################################################################
end