浏览代码

sinclairql: initial heap allocation code, and minor system unit bits

git-svn-id: trunk@47351 -
Károly Balogh 4 年之前
父节点
当前提交
d5596ef21d
共有 3 个文件被更改,包括 23 次插入1 次删除
  1. 3 0
      rtl/sinclairql/sysheap.inc
  2. 2 0
      rtl/sinclairql/sysos.inc
  3. 18 1
      rtl/sinclairql/system.pp

+ 3 - 0
rtl/sinclairql/sysheap.inc

@@ -18,12 +18,15 @@
  ****************************************************************************}
  ****************************************************************************}
 
 
 
 
+
 function SysOSAlloc(size: ptruint): pointer;
 function SysOSAlloc(size: ptruint): pointer;
 begin
 begin
+  Result:=mt_alchp(size, nil, -1);
 end;
 end;
 
 
 {$define HAS_SYSOSFREE}
 {$define HAS_SYSOSFREE}
 
 
 procedure SysOSFree(p: pointer; size: ptruint);
 procedure SysOSFree(p: pointer; size: ptruint);
 begin
 begin
+  mt_rechp(p);
 end;
 end;

+ 2 - 0
rtl/sinclairql/sysos.inc

@@ -15,6 +15,8 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
+{$i qdos.inc}
+
 procedure Error2InOutRes(errno: longint);
 procedure Error2InOutRes(errno: longint);
 begin
 begin
 end;
 end;

+ 18 - 1
rtl/sinclairql/system.pp

@@ -122,8 +122,12 @@ var
 {*****************************************************************************
 {*****************************************************************************
                          System Dependent Exit code
                          System Dependent Exit code
 *****************************************************************************}
 *****************************************************************************}
+
+procedure haltproc(e:longint); external name '_haltproc';
+
 procedure system_exit;
 procedure system_exit;
 begin
 begin
+  haltproc(exitcode);
 end;
 end;
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -146,6 +150,19 @@ begin
   CheckInitialStkLen := StkLen;
   CheckInitialStkLen := StkLen;
 end;
 end;
 
 
+procedure PrintStr(const s: shortstring);
+begin
+  io_sstrg($00010001,-1,@s[1],ord(s[0]));
+end;
+
+procedure PrintStr2(const s: shortstring);
+var
+  i: smallint;
+begin
+  for i:=1 to ord(s[0]) do
+    io_sbyte($00010001,-1,s[i]);
+end;
+
 
 
 begin
 begin
   StackLength := CheckInitialStkLen (InitialStkLen);
   StackLength := CheckInitialStkLen (InitialStkLen);
@@ -160,7 +177,7 @@ begin
   InitUnicodeStringManager;
   InitUnicodeStringManager;
 {$endif FPC_HAS_FEATURE_UNICODESTRINGS}
 {$endif FPC_HAS_FEATURE_UNICODESTRINGS}
 { Setup stdin, stdout and stderr }
 { Setup stdin, stdout and stderr }
-  SysInitStdIO;
+(*  SysInitStdIO;*)
 { Reset IO Error }
 { Reset IO Error }
   InOutRes:=0;
   InOutRes:=0;
 { Setup command line arguments }
 { Setup command line arguments }