Subversion Repositories svnkaklik

Compare Revisions

No changes between revisions

Regard whitespace Rev 5 → Rev 6

/programy/VB/work/joystick/INPOUT32.DLL
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programy/VB/work/joystick/INPOUT32.DPR
0,0 → 1,38
{Source code for inpout32.dll.
Enables 32-bit Visual Basic programs to do direct port I/O
(Inp and Out) under Windows 95.
To be compiled with Borland's Delphi 2.0.}
library inpout32;
uses SysUtils;
procedure Out32(PortAddress:smallint;Value:smallint);stdcall;export;
var
ByteValue:Byte;
begin
ByteValue:=Byte(Value);
asm
push dx
mov dx,PortAddress
mov al, ByteValue
out dx,al
pop dx
end;
end;
 
function Inp32(PortAddress:smallint):smallint;stdcall;export;
var
ByteValue:byte;
begin
asm
push dx
mov dx, PortAddress
in al,dx
mov ByteValue,al
pop dx
end;
Inp32:=smallint(ByteValue) and $00FF;
end;
Exports
Inp32,
Out32;
begin
end.
/programy/VB/work/joystick/INPOUT32.TXT
0,0 → 1,72
Documentation for inpout32.zip
Inpout32.zip contains a DLL that enables direct reading and writing to I/O ports in 32-bit Visual-Basic programs running under Windows 95.
 
by Jan Axelson
Lakeview Research
Email: jaxelson@lvr.com
WWW: http://www.lvr.com
 
Important information and cautions:
 
1. Use this DLL at your own risk. Writing directly to hardware ports can result in system crashes, loss of data, and even permanent damage. Inpout32 was developed to allow access to parallel ports and other ports on custom hardware, but you can use it to attempt to access any hardware that is mapped as an I/O port. You've been warned!
2. Use this DLL only with 32-bit programs. 16-bit programs require a 16-bit DLL (inpout16.dll).
3. Windows 95 allows direct port reads and writes unless a VxD has control of the port and blocks access. Under Windows NT, direct port access is not allowed, and you must use a kernel-mode device driver.
4. For the latest parallel-port programming and interfacing information and tools, visit Parallel Port Central at:
http://www.lvr.com
 
***
Inpout32.zip contains the following files:
 
inpout32.txt
This file
 
inpout32.dll
A DLL that enables the use of Inp and Out routines in 32-bit Visual Basic 4 and Visual Basic 5 programs.
inpout32.bas
Visual-Basic declarations for Inp and Out
 
inpout32.vbp
Visual Basic 4 test project for inpout32. The project will also load into and run under Visual Basic 5.
 
inpout32.frm
Startup form for the test project
inpout32.dpr
Source code for inpout32.dll. The DLL was compiled with Borland's Delphi 2.0 Object Pascal compiler.
 
***
 
How to run the test program (inpout32.vbp):
1. Copy inpout32.dll to one of these locations: your default Windows directory (usually \Windows), your Windows system directory (usually \Windows\system), or your application's working directory. In the VB programming environment, the working directory is the default VB directory.
2. Open the project inpout32.vbp.
3. In the Form_Load subroutine, set PortAddress equal to the port address you want to test.
3. Clicking the command button causes the program to do the following: write a value to the port, read the port, and display the result. The value increments with each click, resetting to 0 at 255.
 
***
 
How to use inpout32 in your programs:
 
1. Copy inpout32.dll to your default Windows directory (or other directory as described above).
 
2. Add inpout32.bas to your Visual-Basic project (File menu, Add File).
 
3. Use this syntax to write to a port:
Out PortAddress, ValueToWrite
 
Example:
Out &h378, &h55
 
Use this syntax to read a port:
ValueRead = Inp(PortAddress)
 
Example:
ValueRead = Inp(&h378)
(The syntax is identical to QuickBasic's Inp and Out).
/programy/VB/work/joystick/INPOUT32.VBP
0,0 → 1,31
Type=Exe
Form=inpout32.frm
Module=inpout; Inpout32.bas
IconForm="inpout32"
Startup="inpout32"
HelpFile=""
Command32=""
Name="Project1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="doma"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
/programy/VB/work/joystick/INPOUT32.vbw
0,0 → 1,2
inpout32 = 25, -2, 354, 453, Z, -2, -9, 554, 447, C
inpout = 66, 66, 317, 328,
/programy/VB/work/joystick/Inpout32.bas
0,0 → 1,29
Attribute VB_Name = "inpout"
 
'Inp and Out declarations for direct port I/O
'in 32-bit Visual Basic 4 programs.
 
Public Declare Function Input32 Lib "inpout32.dll" _
Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Public Declare Sub Output Lib "inpout32.dll" _
Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
Sub out(ByVal Value As Integer)
Output &H3BC, Value
End Sub
Function inp() As Integer
inp = Input32(&H3BD)
End Function
 
Function inp11() As Boolean
inp11 = ((inp And &H80) = 0)
End Function
Function inp10() As Boolean
inp10 = Not ((inp And &H40) = 0)
End Function
Function inp12() As Boolean
inp12 = Not ((inp And &H20) = 0)
End Function
Function inp13() As Boolean
inp13 = Not ((inp And &H10) = 0)
End Function
 
/programy/VB/work/joystick/inpout32.frm
0,0 → 1,78
VERSION 5.00
Begin VB.Form inpout32
Caption = "Form1"
ClientHeight = 4710
ClientLeft = 915
ClientTop = 1410
ClientWidth = 4770
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 4710
ScaleWidth = 4770
Begin VB.Timer TimerY
Left = 1680
Top = 600
End
Begin VB.TextBox TextY
Height = 375
Left = 960
TabIndex = 1
Text = "Y"
Top = 600
Width = 615
End
Begin VB.Timer TimerX
Left = 1680
Top = 120
End
Begin VB.TextBox TextX
Height = 372
Left = 960
TabIndex = 0
Text = "X"
Top = 120
Width = 615
End
End
Attribute VB_Name = "inpout32"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim pocitadlo
 
Private Sub Form_Load()
TimerX.Interval = 500
TimerX.Enabled = True
TimerY.Interval = 500
TimerY.Enabled = True
End Sub
 
Private Sub TimerX_Timer()
Dim vstup
Output &H201, &HFF
For n = 1 To 1000
pocitadlo = n
vstup = Input32(&H201) And 1
If vstup = 0 Then
GoTo ven
End If
Next n
ven:
TextX.Text = pocitadlo
End Sub
 
 
Private Sub TimerY_Timer()
Dim vstup
Output &H201, &HFF
For n = 1 To 1000
pocitadlo = n
vstup = Input32(&H201) And 2
If vstup = 0 Then
GoTo ven
End If
Next n
ven:
TextY.Text = pocitadlo
End Sub
/programy/VB/work/joystick/mssccprj.scc
0,0 → 1,5
SCC = This is a Source Code Control file
 
[INPOUT32.VBP]
SCC_Aux_Path = "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\COMMON\VSS"
SCC_Project_Name = "$/programy/VB/work/joystick", RDBAAAAA
/programy/VB/work/joystick/vssver.scc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property