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
