2
$Id: ports.pas,v 1.3 2003/12/26 22:20:44 hajny Exp $
3
This file is part of the Free Pascal run time library.
4
Copyright (c) 1999-2000 by the Free Pascal development team.
6
These files adds support for TP styled port accesses (port[],
7
portw[] and portl[] constructs) using Delphi classes.
9
See the file COPYING.FPC, included in this distribution,
10
for details about the copyright.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
**********************************************************************}
20
1) You have to enable port access in your CONFIG.SYS (IOPL directive),
21
either globally (IOPL=YES), or just for particular application/-s with
22
a need for port access (IOPL=app_name1, appname2, ...).
23
2) Once you access some port, access to this port is enabled all the time
24
for all EMX applications until EMX.DLL is unloaded from memory (i.e.
25
all applications using this library finish).
30
{ This unit uses classes so ObjFpc mode is required. }
38
procedure WritePort (P: word; Data: byte);
39
function ReadPort (P: word): byte;
41
property PP [W: word]: byte read readport write writeport; default;
46
procedure WritePort (P: word; Data: word);
47
function ReadPort (P: word): word;
49
property PP [W: word]: word read readport write writeport; default;
54
procedure WritePort (P: word; Data: longint);
55
function ReadPort (P: word): longint;
57
property PP [W: word]: longint read readport write writeport; default;
60
{ Non-instantiated vars. As yet, they don't have to be instantiated,
61
because neither member variables nor virtual methods are accessed }
70
{Import syscall to call it nicely from assembler procedures.}
72
procedure syscall; external name '___SYSCALL';
76
procedure TPort.WritePort (P: word; Data: byte); assembler;
97
end {['eax', 'ecx', 'edx']};
99
function TPort.ReadPort (P: word): byte; assembler;
117
end {['eax', 'ecx', 'edx']};
119
procedure TPortW.WritePort (P: word; Data : word); assembler;
140
end {['eax', 'ecx', 'edx']};
142
function TPortW.ReadPort (P: word): word; assembler;
160
end {['eax', 'ecx', 'edx']};
162
procedure TPortL.WritePort (P: word; Data: longint); assembler;
183
end {['eax', 'ecx', 'edx']};
185
function TPortL.ReadPort (P: word): longint; assembler;
203
end {['eax', 'ecx', 'edx']};
209
Revision 1.3 2003/12/26 22:20:44 hajny
212
Revision 1.2 2003/10/07 21:33:24 hajny
213
* stdcall fixes and asm routines cleanup
215
Revision 1.1 2002/11/17 16:22:54 hajny
218
Revision 1.2 2002/09/07 16:01:25 peter
219
* old logs removed and tabs fixed