FPU support added

This commit is contained in:
Владислав Джавадов 2020-06-22 00:42:17 +03:00
parent fcc3c349b8
commit 733019e96b

View File

@ -149,6 +149,13 @@ procedure _Halt0;
procedure _HandleFinally; procedure _HandleFinally;
procedure _StartExe(InitTable: PPackageInfo); procedure _StartExe(InitTable: PPackageInfo);
var
Default8087CW: Word = $1332; // for Extended type
procedure InitFPU;
function Get8087CW: Word;
procedure Set8087CW(Value: Word);
function UpCase(Ch: KolibriChar): KolibriChar; function UpCase(Ch: KolibriChar): KolibriChar;
implementation implementation
@ -217,6 +224,29 @@ begin
end; end;
end; end;
procedure InitFPU;
asm
FNINIT
FWAIT
FLDCW Default8087CW
end;
function Get8087CW: Word;
asm
PUSH 0
FNSTCW [ESP].Word
POP EAX
end;
procedure Set8087CW(Value: Word);
begin
Default8087CW := Value;
asm
FNCLEX
FLDCW Default8087CW
end;
end;
function UpCase(Ch: KolibriChar): KolibriChar; function UpCase(Ch: KolibriChar): KolibriChar;
begin begin
if Ch in ['a'..'z'] then if Ch in ['a'..'z'] then