[fpc-pascal]Var parameter passing to asm procedure
Hi, I have a problem when trying to pass some variable parameters to a procedure writen using integrated assembler. I have reduced the problem to the following code: program IncrementDemo; {$R+} {$asmmode intel} var a: dword; procedure increment(var x: dword); assembler; asm push ds { Is DS saved by default? } lds ebx, x mov eax, [ebx] { Line with the problem } inc eax mov [ebx], eax pop ds end; begin write('Enter a number: '); readln(a); increment(a); writeln('Result is: ', a, '.') end. Line with the problem is marked above. If I tried using mov eax, [bx] integrated environment would report that 16-bit references are not supported. With EBX instead of BX program reports run-time error 216. I have tried using both DOS and Win32 targets. FPC 1.0.10, Win32. Another Q: Is it necessary to save the segment registers' contents when entering an assembler procedure? Thanks, Ivan ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Var parameter passing to asm procedure
The asm block can be this way: procedure increment(var x: dword); assembler; asm inc [eax] end; You don't need to worry about segment registers, but don't mess with them! I assume that the parameter x is passed on the eax register as Delphi does. Please correct me if I'm wrong... Hi, I have a problem when trying to pass some variable parameters to a procedure writen using integrated assembler. I have reduced the problem to the following code: program IncrementDemo; {$R+} {$asmmode intel} var a: dword; procedure increment(var x: dword); assembler; asm push ds { Is DS saved by default? } lds ebx, x mov eax, [ebx] { Line with the problem } inc eax mov [ebx], eax pop ds end; begin write('Enter a number: '); readln(a); increment(a); writeln('Result is: ', a, '.') end. Line with the problem is marked above. If I tried using mov eax, [bx] integrated environment would report that 16-bit references are not supported. With EBX instead of BX program reports run-time error 216. I have tried using both DOS and Win32 targets. FPC 1.0.10, Win32. Another Q: Is it necessary to save the segment registers' contents when entering an assembler procedure? Thanks, Ivan ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Running 32bit on 64bit suse [solved]
On Wed, 4 Aug 2004 23:28:09 +0200 (CEST) [EMAIL PROTECTED] (Marco van de Voort) wrote: > > I tried running the 32bit fpc on my opteron suse 9.1 64bit, which > > should be possible, but I get linking problems: > Use > fpc -FD/path/to/32bitbinutils It turns out that the suse linker does both 32 and 64 bit and that I needed wrapper scripts for as and ld as: exec as --32 "$@" ld: exec ld -m elf_i386 "$@" Provided they are not in a directory that is in the PATH then it works fine using your solution fpc -FD/path/to/wrapperscripts Many thanks. - Richard. -- Richard Kimber http://www.psr.keele.ac.uk/ ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]SMTP and Free Pascal
I've found a Delphi compatible DLL to handle SMTP protocol and I think I can figure how to use this with fpc but are there any written for free pascal? ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Var parameter passing to asm procedure
> The asm block can be this way: > > procedure increment(var x: dword); assembler; > asm >inc [eax] > end; > > You don't need to worry about segment registers, but don't mess with them! > I assume that the parameter x is passed on the eax register as Delphi does. > Please correct me if I'm wrong... You are wrong. He is using 1.0.x, which doesn't have register parameters. That is 1.9.2 or 1.9.4+ ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]SMTP and Free Pascal
> I've found a Delphi compatible DLL to handle SMTP protocol and I think I > can figure how to use this with fpc but are there any written for free > pascal? I don't get the exact question? Is the DLL in Delphi, does a Delphi interface to the DLL exist, or do you search something similar as the DLL written in FPC? As far as socket suites go ICS is largely FPC 1.9.x/win32 compatible. (www.overbyte.be), and there is also Synapse, which supports linux and windows. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Var parameter passing to asm procedure
Ok, then this can be this way: procedure increment(var x: dword); assembler; asm mov eax, x inc [eax] end; Is this correct? If the compiler uses registers, the first line is translated to a 'mov eax, eax', otherwise it is something like 'mov eax, [esp-4]'. Regards, Nelson The asm block can be this way: procedure increment(var x: dword); assembler; asm inc [eax] end; You don't need to worry about segment registers, but don't mess with them! I assume that the parameter x is passed on the eax register as Delphi does. Please correct me if I'm wrong... You are wrong. He is using 1.0.x, which doesn't have register parameters. That is 1.9.2 or 1.9.4+ ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]SMTP and Free Pascal
On Thu, 5 Aug 2004, David G Jenkins wrote: > I've found a Delphi compatible DLL to handle SMTP protocol and I think I > can figure how to use this with fpc but are there any written for free > pascal? You can try to use synapse. It compiles in FPC and Delphi: http://www.ararat.cz/synapse/ Michael. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal