atari: moved the target to use tinyheap, and various cleanups

git-svn-id: trunk@37827 -
This commit is contained in:
Károly Balogh 2017-12-27 02:57:25 +00:00
parent ad1742373a
commit 5cbdf4d30c

View File

@ -16,20 +16,19 @@
**********************************************************************} **********************************************************************}
unit System; unit System;
{--------------------------------------------------------------------}
{ LEFT TO DO: }
{--------------------------------------------------------------------}
{ o SBrk }
{ o Implement truncate }
{ o Implement paramstr(0) }
{--------------------------------------------------------------------}
interface interface
{$define FPC_HAS_ANSI_TEXTFILEREC} {$define FPC_HAS_ANSI_TEXTFILEREC}
{$define FPC_ATARI_USE_TINYHEAP}
{$I systemh.inc} {$ifdef FPC_ATARI_USE_TINYHEAP}
{$define HAS_MEMORYMANAGER}
{$endif FPC_ATARI_USE_TINYHEAP}
{$i systemh.inc}
{$ifdef FPC_ATARI_USE_TINYHEAP}
{$i tnyheaph.inc}
{$endif FPC_ATARI_USE_TINYHEAP}
{Platform specific information} {Platform specific information}
const const
@ -97,12 +96,16 @@ var
{$endif defined(FPUSOFT)} {$endif defined(FPUSOFT)}
{$I system.inc} {$i system.inc}
{$I syspara.inc} {$ifdef FPC_ATARI_USE_TINYHEAP}
{$i tinyheap.inc}
{$endif FPC_ATARI_USE_TINYHEAP}
{$i syspara.inc}
var var
basepage: PPD; external name '__base'; basepage: PPD; external name '__base';
function GetProcessID:SizeUInt; function GetProcessID:SizeUInt;
begin begin
{$WARNING To be checked by platform maintainer} {$WARNING To be checked by platform maintainer}
@ -110,24 +113,6 @@ begin
end; end;
{$S-}
(* procedure Stack_Check; assembler;
{ Check for local variable allocation }
{ On Entry -> d0 : size of local stack we are trying to allocate }
asm
XDEF STACKCHECK
move.l sp,d1 { get value of stack pointer }
sub.l d0,d1 { sp - stack_size }
sub.l #2048,d1
cmp.l __BREAK,d1
bgt @st1nosweat
move.l #202,d0
jsr HALT_ERROR
@st1nosweat:
end;*)
procedure SysInitParamsAndEnv; procedure SysInitParamsAndEnv;
begin begin
// [0] index contains the args length... // [0] index contains the args length...
@ -135,15 +120,6 @@ end;
GenerateArgs; GenerateArgs;
end; end;
{ This routine is used to grow the heap. }
{ But here we do a trick, we say that the }
{ heap cannot be regrown! }
function sbrk( size: longint): pointer;
{ on exit nil = if fails. }
Begin
sbrk:=nil;
end;
procedure randomize; procedure randomize;
begin begin
@ -183,8 +159,10 @@ begin
StackLength := CheckInitialStkLen (InitialStkLen); StackLength := CheckInitialStkLen (InitialStkLen);
{ Initialize ExitProc } { Initialize ExitProc }
ExitProc:=Nil; ExitProc:=Nil;
{$ifndef FPC_ATARI_USE_TINYHEAP}
{ Setup heap } { Setup heap }
InitHeap; InitHeap;
{$endif FPC_ATARI_USE_TINYHEAP}
SysInitExceptions; SysInitExceptions;
InitUnicodeStringManager; InitUnicodeStringManager;
{ Setup stdin, stdout and stderr } { Setup stdin, stdout and stderr }