Вы находитесь на странице: 1из 1

td_win32asm_851.

asm
;==============================================================================
;
Test Department's WINDOWS 32 BIT x86 ASSEMBLY example
851
;==============================================================================
.Data
table_ASCII
table_HEX
table_SHIFT

db 48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70
db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
db 28,24,20,16,12,8,4,0

.Data?
counter
counter1

dd ?
dd ?

.Code
My_HexDDtoStringHex:
;don't forget to save register (pushad/popad)
;==============================================================================
; Converts a 32 bit value in ESI into an ascii hexadecimal string to OFFSET EDI
;-----------------------------------------------------------------------------mov
counter1,0h
My_HexDDtoStringHex_Next:
mov
counter,0h
My_HexDDtoStringHex_Loop:
mov
edx,OFFSET table_HEX
add
edx,counter
mov
ebx,OFFSET table_ASCII
add
ebx,counter
mov
eax,OFFSET table_SHIFT
add
eax,counter1
mov
cl,[eax]
inc
counter
cmp
counter,11h
jae
My_HexDDtoStringHex_return
mov
eax,esi
shr
eax,cl
and
eax,15
cmp
al,[edx]
jne
My_HexDDtoStringHex_Loop
mov
dl,[ebx]
mov
[edi],dl
inc
edi
inc
counter1
cmp
counter1,8h
jne
My_HexDDtoStringHex_Next
My_HexDDtoStringHex_return:
ret
;==============================================================================

Page 1