Browse Source

+ added error checking to the dos file operations

git-svn-id: branches/i8086@24044 -
nickysn 12 years ago
parent
commit
1077093b08
3 changed files with 29 additions and 3 deletions
  1. 8 3
      rtl/msdos/sysfile.inc
  2. 18 0
      rtl/msdos/sysos.inc
  3. 3 0
      rtl/msdos/system.pp

+ 8 - 3
rtl/msdos/sysfile.inc

@@ -42,8 +42,12 @@ begin
   regs.DS := DSeg;
   regs.DX := Word(addr);
   MsDos(regs);
-  { TODO: add error checking }
-  do_write := len;
+  if (regs.Flags and fCarry) <> 0 then
+  begin
+    GetInOutRes(regs.AX);
+    exit(0);
+  end;
+  do_write := regs.AX;
 end;
 
 
@@ -90,6 +94,7 @@ begin
   regs.AX := $4400;
   regs.BX := handle;
   MsDos(regs);
-  { TODO: add error checking }
   do_isdevice := (regs.DL and $80) <> 0;
+  if (regs.Flags and fCarry) <> 0 then
+   GetInOutRes(regs.AX);
 end;

+ 18 - 0
rtl/msdos/sysos.inc

@@ -14,3 +14,21 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
+
+procedure GetInOutRes(def: Word);
+var
+  regs : Registers;
+begin
+  regs.AX:=$5900;
+  regs.BX:=$0;
+  MsDos(regs);
+  InOutRes:=regs.AX;
+  case InOutRes of
+   19 : InOutRes:=150;
+   21 : InOutRes:=152;
+   32 : InOutRes:=5;
+  end;
+  if InOutRes=0 then
+    InOutRes:=Def;
+end;
+

+ 3 - 0
rtl/msdos/system.pp

@@ -63,6 +63,9 @@ procedure DebugWriteLn(const S: string);
 
 implementation
 
+const
+  fCarry = 1;
+
 {$I registers.inc}
 
 procedure Intr(IntNo: Byte; var Regs: Registers); external name 'FPC_INTR';