Results 1 to 10 of 19

Thread: Converting ASM to Pascal

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    This just looks like an inefficient string copy routine, it copies string onto stack then calls some other function, i'm guessing it is stdcall, not sure what Adr is or doing in the called function. Note that is aligns memory on 4 bytes for speed copy of dword's but i don't see it writing any left over bytes. Also what is _EAX, _EDX, _ECX ? you need to post all variables used so i can convert it.

    Is RegCall a param? can you post the function declaration?

    Code:
    procedure YourProc(StkAdr: PAnsiChar; StkUsage: LongWord);
    var
    	stkDest: array of AnsiChar;
    	nLen: LongWord;
    begin
    	SetLength(stkDest, stkUsage);
    	StrLCopy(@stkDest[0], stkAdr, StkUsage);
    
    	if RegCall = True then begin
    		//_EAX, _EDX etc ???
    
    		Adr( _EAX, _EDX, _ECX);
    	end else 
    		Adr( ....    // this does not make sense what your function is doing, no params? if so this needs to be cdecl and this function needs to correct the stack.
    end;
    Also if RegCall is false, then your stack is going to become corrupt. Since stdcall requires you pass the params that it expects, you could get away with this with cdecl but not stdcall.
    Last edited by Colin; 18-03-2013 at 05:07 PM.
    Download the Ziron Assembler
    Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •