Results 1 to 10 of 19

Thread: Converting ASM to Pascal

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Ok, thanks, but I have no clue what you are talking about. The complete code is not by me but by someone else, I just wanted the program to compile with 64 bit Freepascal ...
    Best regards,
    Cybermonkey

  2. #2
    if the functions that are called by "CallFunction" are 32-bit libraries functions etc, then you should not have a problem to compile this on 64-bit pascal, but if you re-compile the libs it calls into 64-bit then you will have a-lot of work ahead.

    What i would suggest is to rename this function to CallFunctionX86(... and make sure all pointers and variables used are 32-bit standard, e.g. pointer should be 32-bit pointer (i don't use freepascal dunno which you will need to use)

    then you can create a new function CallFunctionX64(

    This would be similar but using 64-bit variables and registers.
    Last edited by Colin; 18-03-2013 at 05:51 PM.
    Download the Ziron Assembler
    Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.

  3. #3
    Ok, but I learned that "mov EAX" etc. isn't available on 64 bit processors, is it?
    Best regards,
    Cybermonkey

  4. #4
    it is, eax is 32-bit part of RAX, maybe TASM or pascal assembler does not support mov with 32-bit regs (eax, ecx etc) in 64-bit mode (if so that is flawed)

    so if mov eax, _EAX does not work try either:

    movd eax, _EAX

    or

    mov rax, dword _EAX
    Last edited by Colin; 18-03-2013 at 06:12 PM.
    Download the Ziron Assembler
    Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.

  5. #5
    It is even worse, "push esi" isn't known either. I added the compiler directive {$asmmode intel}. Now the problems are:
    Chip.pas(2041,13) Error: Asm: [push reg32] invalid combination of opcode and operands
    Chip.pas(2042,13) Error: Asm: [push reg32] invalid combination of opcode and operands
    Chip.pas(2066,12) Error: Asm: [pop reg32] invalid combination of opcode and operands
    Chip.pas(2067,12) Error: Asm: [pop reg32] invalid combination of opcode and operands
    Another problem causes this piece of code (it's obviously Pascal, but i don't know to solve it either):
    Code:
          args.outVal.n.sbuf:=basicstring(resvalue);
          basicstring(resvalue):=''
    Error:
    Chip.pas(2076,27) Error: Illegal type conversion: "LongInt" to "AnsiString"
    Chip.pas(2077,7) Error: Illegal type conversion: "LongInt" to "AnsiString"
    With a 32 bit FPC it compiles ... BTW, the complete source of Chip.pas can be found on: http://xmojmr.ohmygod.cz/software/Chip/Chip.pas.htm
    Best regards,
    Cybermonkey

  6. #6
    I guess the assembler does some checking for stack alignment to prevent problems with other 64-bit libs, this is an issue with the assembler unless it has an override option, maybe try

    Code:
    [32BIT]
    push edi
    push .. etc
    as for the other code, does basicstring return a pchar/pointer? if so try

    Code:
    basicstring(resvalue)^ := ''
    better still:

    Code:
    var
      p: PAnsiChar;
    Code:
    p := basicstring(resvalue);
    args.outVal.n.sbuf := p;
    p^ := ''
    Last edited by Colin; 18-03-2013 at 08:02 PM.
    Download the Ziron Assembler
    Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.

  7. #7
    PGD Staff / News Reporter phibermon's Avatar
    Join Date
    Sep 2009
    Location
    England
    Posts
    524
    I'm glad you're here, I got as far as "ahh, it's pushing params onto the stack for the routine that's called", I'd worked out we'd need to see more of the code to understand the context, the function that's called etc meanwhile you've already sorted it
    When the moon hits your eye like a big pizza pie - that's an extinction level impact event.

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
  •