What's the easyest way to move ASCII char's
into a register, like:
41 42 43 44 ..............................ABCD
then move "ABCD" to register:
EAX==0000ABCD
regards,
>>>The SharK<<<
I can make a proc to do it, but maybe
you have some nice and more effective (smaller)
solution for it :)
into a register, like:
41 42 43 44 ..............................ABCD
then move "ABCD" to register:
EAX==0000ABCD
regards,
>>>The SharK<<<
I can make a proc to do it, but maybe
you have some nice and more effective (smaller)
solution for it :)
then move "ABCD" to register:
EAX==0000ABCD ??????
should'nt be like this?:
eax=041424344h
or this at least....
eax=044434241h
dynamic chars or static?
or do you want to convert ASCII chars hexadecimal values representations to a value number into a register?
if that is what you want i think U need a proc ...
EAX==0000ABCD ??????
should'nt be like this?:
eax=041424344h
or this at least....
eax=044434241h
dynamic chars or static?
or do you want to convert ASCII chars hexadecimal values representations to a value number into a register?
if that is what you want i think U need a proc ...
Hi mauricioprado
NO, I wan't the char's for the ASCII values
moved to a register :)
regards,
>>>The SharK<<<
NO, I wan't the char's for the ASCII values
moved to a register :)
regards,
>>>The SharK<<<
use masm.lib
htodw
htodw proc uses ebx ecx edi edx esi String:DWORD
Description
htodw receives as its parameter, the address of a zero terminated string containing hex characters and returns the value as a DWORD in eax.
Parameter
1. String The address of the zero terminated string to be converted.
Return Value
The DWORD value is returned in eax.
Comments
It is the users responsibility to ensure that there are no non-hexadecimal characters in the string of numbers.
htodw proc uses ebx ecx edi edx esi String:DWORD
Description
htodw receives as its parameter, the address of a zero terminated string containing hex characters and returns the value as a DWORD in eax.
Parameter
1. String The address of the zero terminated string to be converted.
Return Value
The DWORD value is returned in eax.
Comments
It is the users responsibility to ensure that there are no non-hexadecimal characters in the string of numbers.
Thanks diablo2oo2 :)
regards,
>>>The SharK<<<
regards,
>>>The SharK<<<
You don't have to use masm.lib, or manually loop through (or inline) the string to copy doing "mov al,041h", or whatever. You can do "mov al,'A''" and it'll get assembled exactly the same way.
Here's an example taking a static string and looping through char by char moving each char into the dynamic string buffer. The same technique can be used with 2 dynamic buffers, 2 static strings, etc, etc. It's all just different byte arrays being manipulated.
Here's an example taking a static string and looping through char by char moving each char into the dynamic string buffer. The same technique can be used with 2 dynamic buffers, 2 static strings, etc, etc. It's all just different byte arrays being manipulated.
.data
lpStaticString db "testing, testing, 1, 2, 3",0
lpDynamicString db 28 dup(0)
.....
......
.code
start:
lea esi,lpStaticString
lea edi,lpDynamicString
xor ecx,ecx
@@:
;you don't have to test for the length of the 1st string either.
;you can test for the byte ptr[esi/edi/whatever] for a null byte
;assuming that it's a zero terminated string.
cmp ecx,25
je @F
;depending on the type of addressing that you want to use
;you could also do mov al,byte ptr[esi + ecx]
;mov byte ptr[edi + ecx],al
mov al,byte ptr[esi]
mov byte ptr[edi],al
inc esi
inc edi
inc ecx
jmp @B
@@:
invoke MessageBox,0,addr lpDynamicString,0,0
I can make a proc to do it, but maybe
you have some nice
you have some nice
like this? :|
.data
hex db 'AaBbCc09' ;; ['a'..'f','A'..'F','0'..'9']
.code
mov edx,offset hex
mov al,[edx+3]
mov cl,[edx+2]
mov ah,[edx+1]
mov ch,[edx+0]
shl eax,16
push ebx
shl ecx,16
mov al,[edx+7]
mov cl,[edx+6]
mov ah,[edx+5]
mov ch,[edx+4]
and eax,not 00110000001100000011000000110000b
and ecx,not 00110000001100000011000000110000b
mov ebx,eax
mov edx,ecx
and eax,01000000010000000100000001000000b
and ecx,01000000010000000100000001000000b
and ebx,not 01000000010000000100000001000000b
shr eax,6
and edx,not 01000000010000000100000001000000b
shr ecx,6
add ebx,eax
add edx,ecx
lea eax,[eax*8+ebx]
lea ecx,[ecx*8+edx]
pop ebx
shl ecx,4
or eax,ecx; eax = 0AABBCC09h