aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/lib/zlportio/Example
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-05 12:02:06 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-05 12:02:06 +0000
commit30343a531999b5e50673ee1731f1c54cbc008dfd (patch)
treeac7bd5051ad29aa13fe5a854d553b49ececcd4a8 /Game/Code/lib/zlportio/Example
parentfee5e834a23f11ea42365b9c5f7336b9c5c58bc0 (diff)
downloadusdx-30343a531999b5e50673ee1731f1c54cbc008dfd.tar.gz
usdx-30343a531999b5e50673ee1731f1c54cbc008dfd.tar.xz
usdx-30343a531999b5e50673ee1731f1c54cbc008dfd.zip
added 3rd party dependencies ( except Jedi-SDL )
modified DPR to statically include all files needed (using relative paths) this means 3rd party components should not need installation in the IDE, or adding to search paths. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@368 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/lib/zlportio/Example/README.TXT27
-rw-r--r--Game/Code/lib/zlportio/Example/install.txt6
-rw-r--r--Game/Code/lib/zlportio/Example/mainform.dfmbin0 -> 2935 bytes
-rw-r--r--Game/Code/lib/zlportio/Example/mainform.pas205
-rw-r--r--Game/Code/lib/zlportio/Example/portio.dof85
-rw-r--r--Game/Code/lib/zlportio/Example/portio.dpr14
-rw-r--r--Game/Code/lib/zlportio/Example/portio.resbin0 -> 876 bytes
-rw-r--r--Game/Code/lib/zlportio/Example/zlportio.sysbin0 -> 3664 bytes
8 files changed, 337 insertions, 0 deletions
diff --git a/Game/Code/lib/zlportio/Example/README.TXT b/Game/Code/lib/zlportio/Example/README.TXT
new file mode 100644
index 00000000..dd71c689
--- /dev/null
+++ b/Game/Code/lib/zlportio/Example/README.TXT
@@ -0,0 +1,27 @@
+
+PortIO example
+Copyright (C) 2001 Zloba Alexander
+http://www.specosoft.com
+Description
+-----------
+ This example show how tow to get direct access port input and output under
+ all versions of Microsoft Windows using ZlPortio library,
+
+Terms of Use
+------------
+
+This software is provided "as is", without any guarantee made
+as to its suitability or fitness for any particular use. It may
+contain bugs, so use of this tool is at your own risk. We take
+no responsilbity for any damage that may unintentionally be caused
+through its use.
+
+Reporting Problems
+------------------
+
+If you encounter problems, please visit http://www.specosoft.com
+and download the latest version to see if the issue has been resolved.
+If not, please send a bug report to:
+
+ zal@specosoft.com
+
diff --git a/Game/Code/lib/zlportio/Example/install.txt b/Game/Code/lib/zlportio/Example/install.txt
new file mode 100644
index 00000000..8d4f45a6
--- /dev/null
+++ b/Game/Code/lib/zlportio/Example/install.txt
@@ -0,0 +1,6 @@
+
+Installation:
+
+Copy files: zlportio.pas, ddkint.pas to your project directory
+or common unit directory.
+
diff --git a/Game/Code/lib/zlportio/Example/mainform.dfm b/Game/Code/lib/zlportio/Example/mainform.dfm
new file mode 100644
index 00000000..42608286
--- /dev/null
+++ b/Game/Code/lib/zlportio/Example/mainform.dfm
Binary files differ
diff --git a/Game/Code/lib/zlportio/Example/mainform.pas b/Game/Code/lib/zlportio/Example/mainform.pas
new file mode 100644
index 00000000..295958c2
--- /dev/null
+++ b/Game/Code/lib/zlportio/Example/mainform.pas
@@ -0,0 +1,205 @@
+{$A-,H+}
+unit mainform;
+
+interface
+
+uses
+ Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
+ StdCtrls,zlportio, ComCtrls, shellapi,rdtsc;
+
+type
+ TMain = class(TForm)
+ lb1: TLabel;
+ ePort: TEdit;
+ lb2: TLabel;
+ eData: TEdit;
+ eRData: TEdit;
+ btnExit: TButton;
+ lb3: TLabel;
+ coDataType: TComboBox;
+ Lb4: TLabel;
+ gb1: TGroupBox;
+ sbBar: TStatusBar;
+ lb5: TLabel;
+ btnWrite: TButton;
+ btnRead: TButton;
+ cbDirect: TCheckBox;
+ llbWWW: TLabel;
+ procedure btnExitClick(Sender: TObject);
+ procedure ePortKeyUp(Sender: TObject; var Key: Word;
+ Shift: TShiftState);
+ procedure ePortKeyPress(Sender: TObject; var Key: Char);
+ procedure FormCreate(Sender: TObject);
+ procedure coDataTypeChange(Sender: TObject);
+ procedure ePortKeyDown(Sender: TObject; var Key: Word;
+ Shift: TShiftState);
+ procedure btnWriteClick(Sender: TObject);
+ procedure eDataKeyDown(Sender: TObject; var Key: Word;
+ Shift: TShiftState);
+ procedure btnReadClick(Sender: TObject);
+ procedure cbDirectClick(Sender: TObject);
+ procedure llbWWWClick(Sender: TObject);
+ private
+ { Private declarations }
+ public
+ { Public declarations }
+ procedure setrdata(const Data:dword);
+ function str2int(const value:string;const HEX:boolean):integer;
+ end;
+
+var
+ Main: TMain;
+implementation
+
+{$R *.DFM}
+{$R-}
+
+function TMain.str2int(const value:string;const HEX:boolean):integer;
+begin
+ if HEX then
+ result := strtoint('$' + value)
+ else
+ result := strtoint(value);
+end;
+
+
+procedure TMain.btnExitClick(Sender: TObject);
+begin
+ close;
+end;
+
+procedure TMain.ePortKeyUp(Sender: TObject; var Key: Word;
+ Shift: TShiftState);
+begin
+try
+ Case key of
+ 38: begin
+ key := 0;
+ end;
+ 40: begin
+ key := 0;
+ end
+ end;
+except
+end;
+end;
+
+procedure TMain.ePortKeyPress(Sender: TObject; var Key: Char);
+begin
+ // filter on hex
+ if pos(key,#13#8'0123456789abcdefABCDEF')=0 then
+ key := #0;
+end;
+
+procedure TMain.FormCreate(Sender: TObject);
+begin
+ coDataType.itemindex :=0;
+ coDataType.Tag := 2;
+ if ZLIOStarted then
+ sbBar.SimpleText := 'Driver successfully started !'
+ else
+ sbBar.SimpleText := 'Couldnt start driver. Something wrong !';
+end;
+
+procedure TMain.coDataTypeChange(Sender: TObject);
+var s:string;
+begin
+ coDataType.Tag := 2 shl (coDataType.itemindex);
+ erdata.MaxLength := coDataType.Tag;
+ edata.MaxLength := coDataType.Tag;
+ s := edata.Text;
+ delete(s,1,length(s)-coDataType.Tag);
+ edata.text := s;
+end;
+
+procedure TMain.ePortKeyDown(Sender: TObject; var Key: Word;
+ Shift: TShiftState);
+var Port,data:dword;
+begin
+try
+ try
+ Port := str2int(ePort.Text,true);
+ except
+ Port := 0;
+ end;
+ Case key of
+ 13: begin
+ zlioportwrite(port,coDataType.itemindex,str2int(eData.Text, true));
+ end;
+ 38: begin
+ inc(Port);
+ ePort.Text := inttohex(Port,3);
+ key := 0;
+ end;
+ 40: begin
+ if port > 0 then
+ dec(Port);
+ ePort.Text := inttohex(Port,3);
+ key := 0;
+ end
+ end;
+ setthreadpriority(GetCurrentThread,THREAD_PRIORITY_TIME_CRITICAL);
+ data := zlioportread(Port,coDataType.itemindex);
+ setrdata(data);
+except
+end;
+
+end;
+
+procedure TMain.setrdata(const Data:dword);
+begin
+ erData.Text := inttohex(Data,coDataType.Tag);
+end;
+
+procedure TMain.btnWriteClick(Sender: TObject);
+var i:word;
+begin
+ i := 13;
+ ePortKeyDown( self,i,[])
+end;
+
+
+
+procedure TMain.eDataKeyDown(Sender: TObject; var Key: Word;
+ Shift: TShiftState);
+var data:dword;
+begin
+ try
+ Data := str2int(eData.Text,true);
+ except Data := 0; end;
+ Case key of
+ 13: begin
+ ePortKeyDown( self,key,[])
+ end;
+ 38: begin
+ inc(Data);
+ eData.Text := inttohex(Data,coDataType.Tag);
+ key := 0;
+ end;
+ 40: begin
+ dec(Data);
+ eData.Text := inttohex(Data,coDataType.Tag);
+ key := 0;
+ end
+ end;
+
+end;
+
+procedure TMain.btnReadClick(Sender: TObject);
+var k:word;
+begin
+ k := 0;
+ ePortKeyDown(self, k,[]);
+end;
+
+procedure TMain.cbDirectClick(Sender: TObject);
+begin
+zliosetiopm(cbDirect.Checked);
+end;
+
+procedure TMain.llbWWWClick(Sender: TObject);
+begin
+ shellexecute( 0,'open','http://www.specosoft.com/update/portio_15.htm',nil,nil,SW_SHOW);
+end;
+
+end.
diff --git a/Game/Code/lib/zlportio/Example/portio.dof b/Game/Code/lib/zlportio/Example/portio.dof
new file mode 100644
index 00000000..3f5c0f5c
--- /dev/null
+++ b/Game/Code/lib/zlportio/Example/portio.dof
@@ -0,0 +1,85 @@
+[Compiler]
+A=0
+B=0
+C=0
+D=1
+E=0
+F=0
+G=1
+H=1
+I=0
+J=1
+K=0
+L=1
+M=0
+N=1
+O=1
+P=1
+Q=0
+R=0
+S=0
+T=0
+U=0
+V=1
+W=0
+X=1
+Y=2
+Z=1
+ShowHints=1
+ShowWarnings=1
+UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[Linker]
+MapFile=0
+OutputObjs=9
+ConsoleApp=1
+DebugInfo=0
+RemoteSymbols=0
+MinStackSize=16384
+MaxStackSize=1048576
+ImageBase=4194304
+ExeDescription=
+[Directories]
+OutputDir=
+UnitOutputDir=
+PackageDLLOutputDir=
+PackageDCPOutputDir=
+SearchPath=
+Packages=Vcl50;Vclx50;VclSmp50;dclocx50;Vcldb50;dclaxserver50;zal
+Conditionals=
+DebugSourceDirs=
+UsePackages=0
+[Parameters]
+RunParams=
+HostApplication=
+[Language]
+ActiveLang=
+ProjectLang=$00000419
+RootDir=
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1049
+CodePage=1251
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
diff --git a/Game/Code/lib/zlportio/Example/portio.dpr b/Game/Code/lib/zlportio/Example/portio.dpr
new file mode 100644
index 00000000..5d86ae5d
--- /dev/null
+++ b/Game/Code/lib/zlportio/Example/portio.dpr
@@ -0,0 +1,14 @@
+{$A-,H+}
+program portio;
+
+uses
+ Forms,
+ mainform in 'mainform.pas' {Main};
+
+{$R *.RES}
+
+begin
+ Application.Initialize;
+ Application.CreateForm(TMain, Main);
+ Application.Run;
+end.
diff --git a/Game/Code/lib/zlportio/Example/portio.res b/Game/Code/lib/zlportio/Example/portio.res
new file mode 100644
index 00000000..08ba56e9
--- /dev/null
+++ b/Game/Code/lib/zlportio/Example/portio.res
Binary files differ
diff --git a/Game/Code/lib/zlportio/Example/zlportio.sys b/Game/Code/lib/zlportio/Example/zlportio.sys
new file mode 100644
index 00000000..19e42319
--- /dev/null
+++ b/Game/Code/lib/zlportio/Example/zlportio.sys
Binary files differ