right is from vb, what i need is

suppose the string "Mark"

dec : 77 97 114 107

the i get the last number of each char in reverse order so it starts with k = 7 r = 4 a = 7 M=7

so it'll be 7477.

if anyone can help i'd be very glad :-)

Mark
Posted on 2001-11-30 20:33:19 by Mark-
Post the vb using Right() for the above and I'll convert it to asm. :)
MASM has no Right(), but you could code the algorithm in asm, of course.

Posted on 2001-11-30 20:45:15 by bitRAKE
There's several hll type string manipulation functions in masm32.lib. "szRight" may be what you're looking for. I'm not sure if it reverses the bytes in the string for you (and I'm not going to code a test app to try it), but you may want to check out those functions. If I had to, I'd guess that it just strips a variable number of chars off of the end (right side) of a string. If nothing else, you can put it in a loop to get what you want.
Posted on 2001-11-30 22:24:32 by Will
People are so lazy. Think. Work it out yourself. Or find something
else to do.
Posted on 2001-11-30 22:41:11 by f0dder
The question doesn't seem to match the example, or rather Right() is a miniscule part of the algorithm. That is why I'd like to see his algorithm using Right(). :grin:
Posted on 2001-12-01 00:28:44 by bitRAKE
What you are after can be done but its not as simple as you think, convert each character to a decimal representation of the characters byte value, get the right side number string from each decimal number and concantenate them back into a single string.

The procedures are in MASM32 library to do it if its not critical code otherwise you can code an algo to do the same.

Regards,

hutch@movsd.com
Posted on 2001-12-01 04:53:05 by hutch--
BitRake, your posting counter seems to be stuck on 666 posts. Spooky :alright:
Posted on 2001-12-01 21:08:35 by sluggy
Mark, you could test something like this. (sorry i havent tested it)

Right proc
LOCAL pointer:DWORD
LOCAL ssize:DWORD
LOCAL array[10]:DWORD
LOCAL longitud:DWORD

mov eax,3d
mov longitud,eax
push string
pop pointer
mov eax,pointer
mov dl,
.WHILE dl !=0
inc pointer
mov eax,pointer
mov dl,
inc ssize
.ENDW
mov eax, ssize
mov ebx, longitud
sub eax,ebx
mov ssize, eax
mov longitud, ebx
push string
pop pointer
mov eax,pointer
mov dl,

mov eax,pointer
mov ebx, ssize
mov pointer,eax
mov ssize,ebx

mov ecx,longitud
mov ebx, offset string
mov esi,00000000
cycle:
mov al,cl
xlat
mov array,al
inc esi
loop cycle
Right endp
end start
Posted on 2001-12-02 08:44:37 by CodeLover
special_right proc sr_char:BYTE

xor eax, eax
mov al, sr_char ;'k' = 107
mov edx, 10
div edx ;eax = 10 QUO, edx = 7 REM
mov eax, edx ;return remainder
ret

special_right endp

process each char in string, then reverse results

farrier
Posted on 2001-12-02 15:58:27 by farrier
Heres what I came up with at 9.30 (thats when I get up), so it may be wrong, but simple tests show it to be OK.

mov ecx, eax
xor edx, edx

push esi
mov esi, offset myString
; If this is a function, change to -
; lea esi, myString

@@:
xor eax, eax
mov al, [esi + ecx - 1]
aam

lea edx, [edx + edx*4]
shl edx, 1

and eax, 0Fh