Re: [fpc-pascal] Interface with NASM

2010-09-16 Thread Felipe Monteiro de Carvalho
Strange, I took a look and no idea why it doesn't work with the linked .o file =) Maybe disassembling what nasm produces could show something, but I don't know which GNU tool could be used for that... The following program works for me: program driver; uses asmio; {$ASMMODE att} procedure

[fpc-pascal] Re: Interface with NASM

2010-09-16 Thread leledumbo
It crashes inside printc apparently when getting the parameter That's it! That's exactly what happened. Maybe disassembling what nasm produces could show something, but I don't know which GNU tool could be used for that... ndisasm from nasm package, or objdump can also do that. The

[fpc-pascal] Error: Impossible operator overload ...why?

2010-09-16 Thread Graeme Geldenhuys
Hi, I'm using FPC 2.4.3 Why is the following operator overload not allowed? Sometimes TfpgColor can be a RRGGBB value (eg: clRed), and sometimes it is an index to a color palette (eg: clWindowBackground). So I want to do comparisons between two such colors. The compiler error I get:

Re: [fpc-pascal] Error: Impossible operator overload ...why?

2010-09-16 Thread Jonas Maebe
On 16 Sep 2010, at 11:26, Graeme Geldenhuys wrote: type TfpgColor = type longword; [snip] operator = (const AColor1, AColor2: TfpgColor) b: Boolean; You cannot overload (or rather change the meaning of) operators for operator/type combinations that are natively handled by the compiler.

Re: [fpc-pascal] Re: Interface with NASM

2010-09-16 Thread Felipe Monteiro de Carvalho
On Thu, Sep 16, 2010 at 11:10 AM, leledumbo leledumbo_c...@yahoo.co.id wrote: Just by changing to ATT syntax? Weird... No, I removed the function header: push ebp mov ebp,esp And function footer: leave ret Because FPC automatically adds them, putting another header was the cause of the

Re: [fpc-pascal] Interface with NASM

2010-09-16 Thread Jonas Maebe
On 14 Sep 2010, at 08:35, leledumbo wrote: segment .text global tes tes: push ebp mov ebp,esp push 65 Check that this puts a 32 bit value on the stack rather than an 8 bit or 16 bit one. You may need push dword 65 or something like that. Jonas

Re: [fpc-pascal] Error: Impossible operator overload ...why?

2010-09-16 Thread Graeme Geldenhuys
On 16 September 2010 11:31, Jonas Maebe wrote: You cannot overload (or rather change the meaning of) operators for operator/type combinations that are natively handled by the compiler. type longword is handled the same as a regular longword by the compiler as far as all operators are

Re: [fpc-pascal] Error: Impossible operator overload ...why?

2010-09-16 Thread Jonas Maebe
On 16 Sep 2010, at 11:44, Graeme Geldenhuys wrote: Is there any way to tell the compiler to treat TfpgColor as a new type? Declare it as a record with a single longint field. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Interface with NASM

2010-09-16 Thread Felipe Monteiro de Carvalho
On Thu, Sep 16, 2010 at 11:44 AM, Jonas Maebe jonas.ma...@elis.ugent.be wrote: Check that this puts a 32 bit value on the stack rather than an 8 bit or 16 bit one. You may need push dword 65 or something like that. I can add that my gdb said that the stack was missaligned, so this has a high

Re: [fpc-pascal] Interface with NASM

2010-09-16 Thread Jeppe Johansen
Pushes/pops on x86/x86_64 are always word sized Den 16-09-2010 11:44, Jonas Maebe skrev: On 14 Sep 2010, at 08:35, leledumbo wrote: segment .text global tes tes: push ebp mov ebp,esp push 65 Check that this puts a 32 bit value on the stack rather than an 8 bit or 16 bit one. You may

Re: [fpc-pascal] Interface with NASM

2010-09-16 Thread Jonas Maebe
On 16 Sep 2010, at 13:26, Jeppe Johansen wrote: Pushes/pops on x86/x86_64 are always word sized push/pop can at least also be 16 bit in 32 bit mode (or 32 bit in 16 bit mode). Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Interface with NASM

2010-09-16 Thread Jonas Maebe
On 14 Sep 2010, at 08:35, leledumbo wrote: build command: nasm -f coff test.asm fpc asmio.pas fpc -o test driver.pas As you can see, I didn't use any optimizations because AFAIR FPC would change parameter passing mechanism when a certain optimizations are performed. That's not the case. The

Re: [fpc-pascal] Interface with NASM

2010-09-16 Thread Felipe Monteiro de Carvalho
On Thu, Sep 16, 2010 at 3:19 PM, Jonas Maebe jonas.ma...@elis.ugent.be wrote: It works fine under linux (if you replace the -f coff with -f elf). For me it doesn't work in Mac OS X using -f macho -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist

Re: [fpc-pascal] Interface with NASM

2010-09-16 Thread Jonas Maebe
On 16 Sep 2010, at 15:22, Felipe Monteiro de Carvalho wrote: On Thu, Sep 16, 2010 at 3:19 PM, Jonas Maebe jonas.ma...@elis.ugent.be wrote: It works fine under linux (if you replace the -f coff with -f elf). For me it doesn't work in Mac OS X using -f macho That is normal, Mac OS X/i386

Re: [fpc-pascal] Basics of profiling -- some comments on fpprofiler bugs

2010-09-16 Thread Darius Blaszyk
On Mon, 2010-09-06 at 16:58 +0300, Žilvinas Ledas wrote: On 2010-09-06 15:48, Darius Blaszyk wrote: On Mon, 2010-09-06 at 13:01 +0200, Graeme Geldenhuys wrote: Recently I took a look at Darius's old project 'fpprofiler. Links below. It was over 2 years since anybody worked on it, and