Browse Source

+ allow setting the heap size for the ZX Spectrum target

git-svn-id: branches/z80@45102 -
nickysn 5 năm trước cách đây
mục cha
commit
caecdfd51d
3 tập tin đã thay đổi với 7 bổ sung6 xóa
  1. 1 1
      compiler/ngenutil.pas
  2. 1 1
      compiler/options.pas
  3. 5 4
      rtl/zxspectrum/system.pp

+ 1 - 1
compiler/ngenutil.pas

@@ -1547,7 +1547,7 @@ implementation
       tcb.free;
 
       { 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
           { tai_datablock cannot yet be handled via the high level typed const
             builder, because it implies the generation of a symbol, while this

+ 1 - 1
compiler/options.pas

@@ -3952,7 +3952,7 @@ begin
     end;
 
   { 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
       case target_info.system of
 {$ifdef AVR}

+ 5 - 4
rtl/zxspectrum/system.pp

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