Browse Source

* moved the interface and implementation parts of the i8086-msdos ports unit to
include files portsh.inc and ports.inc in the i8086 rtl directory

git-svn-id: trunk@39396 -

nickysn 7 years ago
parent
commit
5318a04a5b
4 changed files with 104 additions and 69 deletions
  1. 2 0
      .gitattributes
  2. 58 0
      rtl/i8086/ports.inc
  3. 41 0
      rtl/i8086/portsh.inc
  4. 3 69
      rtl/msdos/ports.pp

+ 2 - 0
.gitattributes

@@ -9333,6 +9333,8 @@ rtl/i8086/int64p.inc svneol=native#text/plain
 rtl/i8086/makefile.cpu svneol=native#text/plain
 rtl/i8086/math.inc svneol=native#text/plain
 rtl/i8086/mathu.inc svneol=native#text/plain
+rtl/i8086/ports.inc svneol=native#text/plain
+rtl/i8086/portsh.inc svneol=native#text/plain
 rtl/i8086/set.inc svneol=native#text/plain
 rtl/i8086/setjump.inc svneol=native#text/plain
 rtl/i8086/setjumph.inc svneol=native#text/plain

+ 58 - 0
rtl/i8086/ports.inc

@@ -0,0 +1,58 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by the Free Pascal development team.
+
+    These files adds support for TP styled port accesses
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{ to give easy port access like tp with port[] }
+
+procedure tport.writeport(p : word;data : byte);inline;
+begin
+  fpc_x86_outportb(p,data);
+end;
+
+
+function tport.readport(p : word) : byte;inline;
+begin
+  readport:=fpc_x86_inportb(p);
+end;
+
+
+procedure tportw.writeport(p : word;data : word);inline;
+begin
+  fpc_x86_outportw(p,data);
+end;
+
+
+function tportw.readport(p : word) : word;inline;
+begin
+  readport:=fpc_x86_inportw(p);
+end;
+
+
+{$asmcpu 80386}
+procedure tportl.writeport(p : word;data : longint);assembler;
+asm
+  mov dx, p
+  mov eax, data
+  out dx, eax
+end;
+
+
+function tportl.readport(p : word) : longint;assembler;
+asm
+  mov dx, p
+  in eax, dx
+  mov edx, eax
+  shr edx, 16
+end;
+{$asmcpu 8086}

+ 41 - 0
rtl/i8086/portsh.inc

@@ -0,0 +1,41 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by the Free Pascal development team.
+
+    These files adds support for TP styled port accesses
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+type
+   tport = object
+      procedure writeport(p : word;data : byte);inline;
+      function  readport(p : word) : byte;inline;
+      property pp[w : word] : byte read readport write writeport;default;
+   end;
+
+   tportw = object
+      procedure writeport(p : word;data : word);inline;
+      function  readport(p : word) : word;inline;
+      property pp[w : word] : word read readport write writeport;default;
+   end;
+
+   tportl = object
+      procedure writeport(p : word;data : longint);
+      function  readport(p : word) : longint;
+      property pp[w : word] : longint read readport write writeport;default;
+   end;
+
+var
+{ we don't need to initialize port, because neither member
+  variables nor virtual methods are accessed }
+   port,
+   portb : tport;
+   portw : tportw;
+   portl : tportl;

+ 3 - 69
rtl/msdos/ports.pp

@@ -20,76 +20,10 @@ unit ports;
 
 interface
 
-type
-   tport = object
-      procedure writeport(p : word;data : byte);inline;
-      function  readport(p : word) : byte;inline;
-      property pp[w : word] : byte read readport write writeport;default;
-   end;
+{$I portsh.inc}
 
-   tportw = object
-      procedure writeport(p : word;data : word);inline;
-      function  readport(p : word) : word;inline;
-      property pp[w : word] : word read readport write writeport;default;
-   end;
+implementation
 
-   tportl = object
-      procedure writeport(p : word;data : longint);
-      function  readport(p : word) : longint;
-      property pp[w : word] : longint read readport write writeport;default;
-   end;
-
-var
-{ we don't need to initialize port, because neither member
-  variables nor virtual methods are accessed }
-   port,
-   portb : tport;
-   portw : tportw;
-   portl : tportl;
-
-  implementation
-
-{ to give easy port access like tp with port[] }
-
-procedure tport.writeport(p : word;data : byte);inline;
-begin
-  fpc_x86_outportb(p,data);
-end;
-
-
-function tport.readport(p : word) : byte;inline;
-begin
-  readport:=fpc_x86_inportb(p);
-end;
-
-
-procedure tportw.writeport(p : word;data : word);inline;
-begin
-  fpc_x86_outportw(p,data);
-end;
-
-
-function tportw.readport(p : word) : word;inline;
-begin
-  readport:=fpc_x86_inportw(p);
-end;
-
-
-{$asmcpu 80386}
-procedure tportl.writeport(p : word;data : longint);assembler;
-asm
-  mov dx, p
-  mov eax, data
-  out dx, eax
-end;
-
-
-function tportl.readport(p : word) : longint;assembler;
-asm
-  mov dx, p
-  in eax, dx
-  mov edx, eax
-  shr edx, 16
-end;
+{$I ports.inc}
 
 end.