|
@@ -16,11 +16,16 @@
|
|
|
|
|
|
unit ports;
|
|
|
|
|
|
+{$ifdef VER3_0}
|
|
|
{$Calling StdCall}
|
|
|
+{$endif VER3_0}
|
|
|
+
|
|
|
+{$inline ON}
|
|
|
|
|
|
interface
|
|
|
|
|
|
type
|
|
|
+{$ifdef VER3_0}
|
|
|
tport = object
|
|
|
procedure writeport(p : word;data : byte);
|
|
|
function readport(p : word) : byte;
|
|
@@ -38,6 +43,25 @@ type
|
|
|
function readport(p : word) : longint;
|
|
|
property pp[w : word] : longint read readport write writeport;default;
|
|
|
end;
|
|
|
+{$else VER3_0}
|
|
|
+ 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);inline;
|
|
|
+ function readport(p : word) : longint;inline;
|
|
|
+ property pp[w : word] : longint read readport write writeport;default;
|
|
|
+ end;
|
|
|
+{$endif VER3_0}
|
|
|
var
|
|
|
{ we don't need to initialize port, because neither member
|
|
|
variables nor virtual methods are accessed }
|
|
@@ -52,6 +76,7 @@ var
|
|
|
|
|
|
{ to give easy port access like tp with port[] }
|
|
|
|
|
|
+{$ifdef VER3_0}
|
|
|
procedure tport.writeport(p : word;data : byte);assembler;
|
|
|
asm
|
|
|
movw p,%dx
|
|
@@ -95,5 +120,41 @@ asm
|
|
|
movw p,%dx
|
|
|
inl %dx,%eax
|
|
|
end;
|
|
|
+{$else VER3_0}
|
|
|
+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;
|
|
|
+
|
|
|
+
|
|
|
+procedure tportl.writeport(p : word;data : longint);inline;
|
|
|
+begin
|
|
|
+ fpc_x86_outportl(p,data);
|
|
|
+end;
|
|
|
+
|
|
|
+
|
|
|
+function tportl.readport(p : word) : longint;inline;
|
|
|
+begin
|
|
|
+ readport:=fpc_x86_inportl(p);
|
|
|
+end;
|
|
|
+{$endif VER3_0}
|
|
|
|
|
|
end.
|