21,459
社区成员
发帖
与我相关
我的任务
分享
IFNDEF _GLOBE_INC_
INCLUDE Globe.inc
ENDIF;// !_GLOBE_INC_
COMMENT */////////////////////////////////////////////////////////////////////////////////////////////
//======================================================================================================
// [value]::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// 0 1 2 3 4 5 6 7 8 9
// 0000|0000 0000|0001 0000|0010 0000|0011 0000|0100 0000|0101 0000|0110 0000|0111 0000|1000 0000|1001
// A B C D E F
// 0000|1010 0000|1011 0000|1100 0000|1101 0000|1110 0000|1111
// [string]:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// 0 1 2 3 4 5 6 7 8 9
// 0011|0000 0011|0001 0011|0010 0011|0011 0011|0100 0011|0101 0011|0110 0011|0111 0011|1000 0011|1001
// A B C D E F
// 0100|0001 0100|0010 0100|0011 0100|0100 0100|0101 0100|0110
//======================================================================================================*
.CODE
HexBufferA PROC STDCALL \
USES esi edi edx ebx
pbSource EQU <esi>
pbDest EQU <edi>
dwLength EQU <ecx>
temp EQU <ebx>
ALIGN AlignSize
shr dwLength,2
HexBuffer_LOOP_DWORD:
mov eax,DWORD PTR[pbSource]
mov edx,eax
and eax,00F0F0F0Fh
and edx,0F0F0F0F0h
shr edx,4
;// 各字节加30h
or eax,030303030h
or edx,030303030h
;// 矫正eax各字节的数值
mov temp,eax
sub temp,00A0A0A0Ah
and temp,010101010h
add eax,temp
shr temp,4
sub eax,temp
shl temp,3
xor eax,temp
;// 矫正edx各字节的数值
mov temp,edx
sub temp,00A0A0A0Ah
and temp,010101010h
add edx,temp
shr temp,4
sub edx,temp
shl temp,3
xor edx,temp
;// 矫正各字节的位置
;// eax:7531
;// ebx:6420
ror eax,10h
;// eax:3175
xchg ax,dx
;// eax:3120
;// ebx:6475
ror eax,8
rol edx,8
;// eax:0312
;// ebx:4756
xchg ah,al
xchg dh,dl
;// eax:0321
;// ebx:4765
rol eax,8
rol edx,8
;// eax:3210
;// ebx:7654
mov [pbDest],eax
mov [pbDest+4],edx
add pbSource,TYPE DWORD
add pbDest,(TYPE DWORD*2)
loop HexBuffer_LOOP_DWORD
RET
HexBufferA ENDP
END