summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-04-26 14:58:47 +0000
committernickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-04-26 14:58:47 +0000
commita50cd07756a7a58dd567665986b90454dc97e62e (patch)
treeb960b75dfd1500f296b24406872abf4125e920f7
parent0a4d7661131bda8f27809ab2ddc3997c94115f84 (diff)
downloadfpc-a50cd07756a7a58dd567665986b90454dc97e62e.tar.gz
+ allow setting the heap size for the ZX Spectrum target
git-svn-id: https://svn.freepascal.org/svn/fpc/branches/z80@45102 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--compiler/ngenutil.pas2
-rw-r--r--compiler/options.pas2
-rw-r--r--rtl/zxspectrum/system.pp9
3 files changed, 7 insertions, 6 deletions
diff --git a/compiler/ngenutil.pas b/compiler/ngenutil.pas
index 9d49b106f8..7e6f225c00 100644
--- a/compiler/ngenutil.pas
+++ b/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
diff --git a/compiler/options.pas b/compiler/options.pas
index 76b1c533d2..a8b85539cc 100644
--- a/compiler/options.pas
+++ b/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}
diff --git a/rtl/zxspectrum/system.pp b/rtl/zxspectrum/system.pp
index 7eb2ddb891..5279d44df6 100644
--- a/rtl/zxspectrum/system.pp
+++ b/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;