2
0
Эх сурвалжийг харах

+ allow setting the heap size for the ZX Spectrum target

git-svn-id: branches/z80@45102 -
nickysn 5 жил өмнө
parent
commit
caecdfd51d

+ 1 - 1
compiler/ngenutil.pas

@@ -1547,7 +1547,7 @@ implementation
       tcb.free;
       tcb.free;
 
 
       { allocate an initial heap on embedded systems }
       { allocate an initial heap on embedded systems }
-      if target_info.system in (systems_embedded+systems_freertos) then
+      if target_info.system in (systems_embedded+systems_freertos+[system_z80_zxspectrum]) then
         begin
         begin
           { tai_datablock cannot yet be handled via the high level typed const
           { tai_datablock cannot yet be handled via the high level typed const
             builder, because it implies the generation of a symbol, while this
             builder, because it implies the generation of a symbol, while this

+ 1 - 1
compiler/options.pas

@@ -3952,7 +3952,7 @@ begin
     end;
     end;
 
 
   { Set up default value for the heap }
   { Set up default value for the heap }
-  if target_info.system in (systems_embedded+systems_freertos) then
+  if target_info.system in (systems_embedded+systems_freertos+[system_z80_zxspectrum]) then
     begin
     begin
       case target_info.system of
       case target_info.system of
 {$ifdef AVR}
 {$ifdef AVR}

+ 5 - 4
rtl/zxspectrum/system.pp

@@ -78,6 +78,10 @@ const
   sLineBreak = LineEnding;
   sLineBreak = LineEnding;
   DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
   DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
 
 
+var
+  __heapsize: Word;external name '__heapsize';
+  __fpc_initialheap: array[0..0] of byte;external name '__fpc_initialheap';
+
 {$I system.inc}
 {$I system.inc}
 {$I tinyheap.inc}
 {$I tinyheap.inc}
 
 
@@ -256,12 +260,9 @@ end;
                          SystemUnit Initialization
                          SystemUnit Initialization
 *****************************************************************************}
 *****************************************************************************}
 
 
-var
-  ZXHeap: array [0..{1023}255] of Byte;
-
 procedure InitZXHeap;
 procedure InitZXHeap;
 begin
 begin
-  RegisterTinyHeapBlock_Simple_Prealigned(@ZXHeap[0],SizeOf(ZXHeap));
+  RegisterTinyHeapBlock_Simple_Prealigned(@__fpc_initialheap,__heapsize);
 end;
 end;
 
 
 procedure SysInitStdIO;
 procedure SysInitStdIO;