mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 03:30:30 +02:00
* 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 -
This commit is contained in:
parent
513f2251ee
commit
5318a04a5b
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -9333,6 +9333,8 @@ rtl/i8086/int64p.inc svneol=native#text/plain
|
|||||||
rtl/i8086/makefile.cpu svneol=native#text/plain
|
rtl/i8086/makefile.cpu svneol=native#text/plain
|
||||||
rtl/i8086/math.inc svneol=native#text/plain
|
rtl/i8086/math.inc svneol=native#text/plain
|
||||||
rtl/i8086/mathu.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/set.inc svneol=native#text/plain
|
||||||
rtl/i8086/setjump.inc svneol=native#text/plain
|
rtl/i8086/setjump.inc svneol=native#text/plain
|
||||||
rtl/i8086/setjumph.inc svneol=native#text/plain
|
rtl/i8086/setjumph.inc svneol=native#text/plain
|
||||||
|
58
rtl/i8086/ports.inc
Normal file
58
rtl/i8086/ports.inc
Normal file
@ -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
rtl/i8086/portsh.inc
Normal file
41
rtl/i8086/portsh.inc
Normal file
@ -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;
|
@ -20,76 +20,10 @@ unit ports;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
type
|
{$I portsh.inc}
|
||||||
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
|
implementation
|
||||||
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
|
{$I ports.inc}
|
||||||
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;
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user