Im writing a function. One of the parametrs is a byte. If im giving the byte "0a", i need to turn eax into "0a0a0a0a". If im giving "08", i need to turn eax into "08080808". How do i do this? If i didnt explain myself enough, please let me know.
Posted on 2001-08-31 00:59:45 by ChimpFace9000
yay something i can help with.

func proc byteval:BYTE
xor eax,eax
mov al, byteval
shl eax, 8
mov al, byteval
shl eax, 8
mov al, byteval
shl eax, 8
mov al, byteval
shl eax, 8
func endp

Hope that helps (and works).
Posted on 2001-08-31 01:08:15 by vcv
its not tested yet, but i believe it will be works well.. like this,


MyFunc proc recvchar:byte

push ecx
xor eax,eax
mov ecx,4
shl eax,8
mov al,recvchar
loop @b
pop ecx

ret ;// return value == eax //
MyFunc endp

Posted on 2001-08-31 01:13:41 by c][obo
Another solution in MMX :

ByteProc :
movd MM1, [esp+4]
punpcklbw MM1, MM1
punpcklbw MM1, MM1
movd eax, MM1
ret 4

Strange but it's slower than the other versions.

Or :

ByteProc :
mov eax, [esp+4]
push ebx
mov ah, al
mov ebx, eax
bswap eax
mov ax, bx
pop ebx
ret 4
Posted on 2001-08-31 03:14:04 by Dr. Manhattan
this what you want?

whatever proc byteval:BYTE
mov al, byteval
mov ah, byteval
push ax
push ax
pop eax
whatever endp

bitRake: what are you talking about? ;)... hehe, the magic of editing a message lol. thanks d00d. :alright:

dr phil :)
Posted on 2001-08-31 03:38:59 by phil
phil, why do you need that xor eax,eax?
Posted on 2001-08-31 07:48:39 by bitRAKE
what about this:

movsx eax,al

dunno exactly if it works, but should. :tongue:

Posted on 2001-08-31 10:31:07 by NOP-erator
A funny way:

mov eax 08h
mov ecx 01010101h
mul ecx ; >>> eax = 08080808h

Posted on 2001-08-31 11:19:04 by Betov
yeah, that's l33t! :alright:

Posted on 2001-08-31 11:26:39 by NOP-erator
wow, maybe this could turn into a compo or something.
Posted on 2001-08-31 11:26:54 by ChimpFace9000