flat assembler
Message board for the users of flat assembler.
Index
> Windows > Problem with procedures |
Author |
|
LocoDelAssembly 13 Jun 2006, 15:45
Use mov edi, [outstr] since you need to get the pointer you passed to the proc
|
|||
13 Jun 2006, 15:45 |
|
||CyrUS|| 13 Jun 2006, 16:38
Hello, yes I tried mov edi,[outstr]
but the outstr doesn't get the goob value, if I use this routine in the main proc with mov edi,outstr fasm will compile it. |
|||
13 Jun 2006, 16:38 |
|
LocoDelAssembly 13 Jun 2006, 17:13
mov al,byte[instr+ecx-1] <- wrong too. You need to read the content of instr first.
Posible solution: Code: proc hextostr,outstr,instr Buf2Msg: push ebx mov ecx,16 mov edi, [outstr] mov ebx, [instr] .anotherchar: mov al, byte[ebx+ecx-1] . . . pop ebx ret endp |
|||
13 Jun 2006, 17:13 |
|
||CyrUS|| 15 Jun 2006, 19:45
hello, I have fond a solution
Code: proc hextostr Buf2Msg: mov ecx,16 mov edi,md5hash .anotherchar: mov al,byte[strhash+ecx-1] mov ah,al and ax, 0FF0h shr al,4 cmp al,10 jc .num1 add al,7+20h ;Remove +20h to get uppercase .num1: add al,30h cmp ah,10 jc .num2 add ah,7+20h ;Remove +20h to get uppercase .num2: add ah,30h mov word[edi+ecx*2-2],ax loop .anotherchar ret endp it works, but this procedure isn't generic , the name of the varibles have to be changed in the procedure. Thanks |
|||
15 Jun 2006, 19:45 |
|
LocoDelAssembly 16 Jun 2006, 00:21
This works for me
Code: include 'win32axp.inc' .data hash dq $FEDCBA9876543210 dq $0123456789ABCDEF strBuff rb 32 db 0 .code start: stdcall hextostr, strBuff, hash invoke MessageBox, 0, strBuff, "Hash MD5", 0 invoke ExitProcess, 0 proc hextostr uses ebx edi, strBuff, hash mov ecx,16 mov edi, [strBuff] mov ebx, [hash] .anotherchar: mov al,byte[ebx+ecx-1] mov ah,al and ax, 0FF0h shr al,4 cmp al,10 jc .num1 add al,7+20h ;Remove +20h to get uppercase .num1: add al,30h cmp ah,10 jc .num2 add ah,7+20h ;Remove +20h to get uppercase .num2: add ah,30h stosw loop .anotherchar ret endp .end start Regards |
|||
16 Jun 2006, 00:21 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.