* the 'count' parameter of Move and FillChar on i8086 made 16-bit unsigned,

instead of signed (BP7 compatibility)

git-svn-id: trunk@32443 -
This commit is contained in:
nickysn 2015-11-21 17:55:47 +00:00
parent 0046af39eb
commit 0f6b5161e6
3 changed files with 15 additions and 14 deletions

View File

@ -20,12 +20,11 @@ procedure fpc_cpuinit;
{$ifndef FPC_SYSTEM_HAS_FILLCHAR} {$ifndef FPC_SYSTEM_HAS_FILLCHAR}
{$define FPC_SYSTEM_HAS_FILLCHAR} {$define FPC_SYSTEM_HAS_FILLCHAR}
procedure FillChar(var x;count:SizeInt;value:byte);assembler;nostackframe; procedure FillChar(var x;count:SizeUInt;value:byte);assembler;nostackframe;
asm asm
mov bx, sp mov bx, sp
mov cx, ss:[bx + 4 + extra_param_offset] // count mov cx, ss:[bx + 4 + extra_param_offset] // count
or cx, cx jcxz @@Done
jle @@Done
{$ifdef FPC_X86_DATA_NEAR} {$ifdef FPC_X86_DATA_NEAR}
mov di, ss:[bx + 6 + extra_param_offset] // @x mov di, ss:[bx + 6 + extra_param_offset] // @x
mov ax, ds mov ax, ds
@ -112,12 +111,11 @@ end;
{$ifndef FPC_SYSTEM_HAS_MOVE} {$ifndef FPC_SYSTEM_HAS_MOVE}
{$define FPC_SYSTEM_HAS_MOVE} {$define FPC_SYSTEM_HAS_MOVE}
procedure Move(const source;var dest;count:SizeInt);[public, alias: 'FPC_MOVE'];assembler;nostackframe; procedure Move(const source;var dest;count:SizeUInt);[public, alias: 'FPC_MOVE'];assembler;nostackframe;
asm asm
mov bx, sp mov bx, sp
mov cx, ss:[bx + 2 + extra_param_offset] // count mov cx, ss:[bx + 2 + extra_param_offset] // count
or cx, cx jcxz @@Done
jle @@Done
mov ax, ds // for far data models, backup ds; for near data models, use to initialize es mov ax, ds // for far data models, backup ds; for near data models, use to initialize es
{$ifdef FPC_X86_DATA_NEAR} {$ifdef FPC_X86_DATA_NEAR}

View File

@ -272,19 +272,19 @@ function do_isdevice(handle:thandle):boolean;forward;
{$Error Can't determine processor type !} {$Error Can't determine processor type !}
{$endif} {$endif}
procedure fillchar(var x;count : SizeInt;value : boolean); procedure fillchar(var x;count : {$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};value : boolean);
begin begin
fillchar(x,count,byte(value)); fillchar(x,count,byte(value));
end; end;
procedure fillchar(var x;count : SizeInt;value : char); procedure fillchar(var x;count : {$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};value : char);
begin begin
fillchar(x,count,byte(value)); fillchar(x,count,byte(value));
end; end;
procedure FillByte (var x;count : SizeInt;value : byte ); procedure FillByte (var x;count : {$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};value : byte );
begin begin
FillChar (X,Count,VALUE); FillChar (X,Count,VALUE);
end; end;

View File

@ -153,6 +153,9 @@ Type
ValReal = Extended; ValReal = Extended;
{$endif} {$endif}
{$define MOVE_HAS_SIZEUINT_COUNT}
{$define FILLCHAR_HAS_SIZEUINT_COUNT}
{$if defined(FPC_MM_TINY)} {$if defined(FPC_MM_TINY)}
{$define FPC_X86_CODE_NEAR} {$define FPC_X86_CODE_NEAR}
{$define FPC_X86_DATA_NEAR} {$define FPC_X86_DATA_NEAR}
@ -774,11 +777,11 @@ function StackTop: Pointer;
{$endif} {$endif}
{$endif} {$endif}
Procedure Move(const source;var dest;count:SizeInt); Procedure Move(const source;var dest;count:{$ifdef MOVE_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif});
Procedure FillChar(var x;count:SizeInt;Value:Byte); Procedure FillChar(var x;count:{$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};Value:Byte);
Procedure FillChar(var x;count:SizeInt;Value:Boolean); Procedure FillChar(var x;count:{$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};Value:Boolean);
Procedure FillChar(var x;count:SizeInt;Value:Char); Procedure FillChar(var x;count:{$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};Value:Char);
procedure FillByte(var x;count:SizeInt;value:byte); procedure FillByte(var x;count:{$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};value:byte);
Procedure FillWord(var x;count:SizeInt;Value:Word); Procedure FillWord(var x;count:SizeInt;Value:Word);
procedure FillDWord(var x;count:SizeInt;value:DWord); procedure FillDWord(var x;count:SizeInt;value:DWord);
procedure FillQWord(var x;count:SizeInt;value:QWord); procedure FillQWord(var x;count:SizeInt;value:QWord);