[fpc-pascal]1st post

Marcel Martin mm10 at ellipsa.net
Wed Jun 16 00:31:28 CEST 2004


Hello,

At first, thanks and congratulations for Free Pascal.

I am trying to convert all my libraries (big integers, big floats, 
etc) from Delphi 5 to Free Pascal 1.9.4. As a total newbie with Free 
Pascal, I have some questions.

1) In an assembler routine, is the direction flag managed like in
Delphi, i.e., should a routine always restore DF=0?

2) " end [ {$IFNDEF REGCALL} 'eax','ecx', {$ENDIF} 'edi']; "
Is the previous line meaningful? (See the routine below)

3) When P is a PUI32 (PUI32 = ^Longword), I use Inc(P,Count) to 
increment P by Count (Count > 1). It compiles fine but there is the 
message "Conversion between ordinals and pointers are not not 
portable". What does it mean? Portable towards what? (I am compiling 
with {$MODE OBJFPC})

4) "Internal error 200310221". Let's say I have one program (set as 
primary file) and one unit. The only way to compile (and to build) 
both of them is to activate the unit window and to "build" from 
there. In all other cases, "compile" and "build" stop with this 
internal error. I suppose I didn't correctly configure something (?)
(Windows 98, AMD 2600+)

Thanks in advance for your time.
-- 
mm
http://www.ellipsa.net/


type
  TUI32 = Longword;
  PUI32 = ^TUI32;

//==============================================================================
// Fill P^ with Count 32-bit words equal to Value
// Require: Count >= 0
//==============================================================================
{$IFDEF NX_NOASMCODE}
procedure nx_fill(P: PUI32; Count: Longint; Value: TUI32);
  var i : Longint;
begin
  Assert(Count >= 0);

  for i := 1 to Count do
  begin
    P^ := Value;
    Inc(P);
  end;
end;
{$ELSE} // NX_NOASMCODE
{$IFDEF NX_DEBUG}
procedure nx_fill_debug(P: PUI32; Count: Longint; Value: TUI32);
{$ELSE}
procedure nx_fill(P: PUI32; Count: Longint; Value: TUI32);
{$ENDIF}
assembler;
asm
{$IFNDEF REGCALL}
      mov   edi, P
      mov   eax, Value
      mov   ecx, Count
{$ELSE}
      // re-ordering the procedure parameters could avoid 2 "mov" but
      // f(Value,P,Count) is less 'coherent' than f(P,Count,Value)
      mov   edi, eax
      mov   eax, ecx
      mov   ecx, edx
{$ENDIF}
      rep   stosd
end [ {$IFNDEF REGCALL} 'eax','ecx', {$ENDIF} 'edi'];
{$IFDEF NX_DEBUG}
procedure nx_fill(P: PUI32; Count: Longint; Value: TUI32);
begin
  Assert(Count >= 0);

  nx_fill_debug(P,Count,Value);
end;
{$ENDIF}
{$ENDIF} // NX_NOASMCODE




More information about the fpc-pascal mailing list