Documentation for inpout16.zip

Inpout16 is a DLL that enables direct reading and writing to I/O ports in 16-bit Visual-Basic programs.

by Jan Axelson
Lakeview Research
Email: jaxelson@lvr.com
WWW: http://www.lvr.com

Important information and cautions:

1. Use this DLL entirely at your own risk. Writing directly to hardware ports can result in system crashes, loss of data, and even permanent damage. Inpout16 was developed to allow access to parallel ports and 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 16-bit programs. 32-bit programs require a 32-bit DLL (inpout32).
 
3. Windows 3.1 and Windows 95 allow direct port access with Inpout16 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 in parallel-port programming and interfacing information and tools, visit Parallel Port Central at: 
 
http://www.lvr.com 

*** 

Inpout16.zip contains the following: 

inpout16.txt
This file
 
inpout16.dll 
A DLL that enables the use of Inp and Out routines in Visual Basic 3 and 16-bit Visual Basic 4 programs. 
 
inpout16.bas 
Declarations for Inp and Out
 
inpout16.mak 
Visual Basic 3 test project for inpout16. (The project will also load into and run under 16-bit Visual Basic 4.)
 
inpout16.frm 
Startup form for inpout16.mak 
 
inpout16.pb 
Source code for inpout16 (compiled with PowerBasic DLL compiler v1.1)

*** 

How to run the test program (inpout.mak): 
1.  Copy inpout16.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 inpout16.mak.
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 inpout16.dll to your default Windows directory (or other directory as described above).
2. Add inpout16.bas to your Visual Basic project (File menu, Add File). 
3. Use this syntax to write to a port: 
   Out PortAddress, ByteToWrite 

   Example: 
   Out &h378, &h55 

   Use this syntax to read a port: 
   ByteRead = Inp(PortAddress) 

   Example: 
   ByteRead = Inp(&h378) 
 
(The syntax is identical to QuickBasic's Inp and Out). 

