summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-04-26 13:38:15 +0000
committernickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-04-26 13:38:15 +0000
commit77c15d53c43a0014cd92d1f091fcaca98b903b4a (patch)
tree1cf20577a213dabcad2af4588f4993e2d088c272
parentcd0f7baada80341a130561c95942534753bee055 (diff)
downloadfpc-77c15d53c43a0014cd92d1f091fcaca98b903b4a.tar.gz
+ initialize more stuff in the system unit. Stdio doesn't work yet... :(
git-svn-id: https://svn.freepascal.org/svn/fpc/branches/z80@45097 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--rtl/zxspectrum/system.pp57
1 files changed, 53 insertions, 4 deletions
diff --git a/rtl/zxspectrum/system.pp b/rtl/zxspectrum/system.pp
index 9169dce66e..2900ca85b1 100644
--- a/rtl/zxspectrum/system.pp
+++ b/rtl/zxspectrum/system.pp
@@ -10,6 +10,10 @@ interface
{$define HAS_MEMORYMANAGER}
+{ Use Ansi Char for files }
+{$define FPC_ANSI_TEXTFILEREC}
+{$define FPC_STDOUT_TRUE_ALIAS}
+
{$I systemh.inc}
{$I tnyheaph.inc}
@@ -97,10 +101,6 @@ procedure randomize;
begin
end;
-procedure SysInitStdIO;
-begin
-end;
-
function GetProcessID: SizeUInt;
begin
GetProcessID:=0;
@@ -237,4 +237,53 @@ begin
PrintChar(Char(Y-1));
end;
+{*****************************************************************************
+ SystemUnit Initialization
+*****************************************************************************}
+
+var
+ ZXHeap: array [0..{1023}255] of Byte;
+
+procedure InitZXHeap;
+begin
+ RegisterTinyHeapBlock_Simple_Prealigned(@ZXHeap[0],SizeOf(ZXHeap));
+end;
+
+procedure SysInitStdIO;
+begin
+(* TODO: doesn't work yet...
+ OpenStdIO(Input,fmInput,StdInputHandle);
+ OpenStdIO(Output,fmOutput,StdOutputHandle);
+ OpenStdIO(ErrOutput,fmOutput,StdErrorHandle);
+{$ifndef FPC_STDOUT_TRUE_ALIAS}
+ OpenStdIO(StdOut,fmOutput,StdOutputHandle);
+ OpenStdIO(StdErr,fmOutput,StdErrorHandle);
+{$endif FPC_STDOUT_TRUE_ALIAS}
+*)
+end;
+
+begin
+{ StackBottom := __stkbottom;
+ StackLength := __stktop - __stkbottom;}
+ { To be set if this is a GUI or console application }
+ IsConsole := TRUE;
+{$ifdef FPC_HAS_FEATURE_DYNLIBS}
+ { If dynlibs feature is disabled,
+ IsLibrary is a constant, which can thus not be set to a value }
+ { To be set if this is a library and not a program }
+ IsLibrary := FALSE;
+{$endif def FPC_HAS_FEATURE_DYNLIBS}
+{ Setup heap }
+ InitZXHeap;
+ SysInitExceptions;
+{$ifdef FPC_HAS_FEATURE_UNICODESTRINGS}
+ initunicodestringmanager;
+{$endif def FPC_HAS_FEATURE_UNICODESTRINGS}
+{ Setup stdin, stdout and stderr }
+ SysInitStdIO;
+{ Reset IO Error }
+ InOutRes:=0;
+{$ifdef FPC_HAS_FEATURE_THREADING}
+ InitSystemThreads;
+{$endif}
end.