home *** CD-ROM | disk | FTP | other *** search
-
- PORT
-
- The Port Twiddling Tool
-
- By John De Armond (jgd@dixie.com)
- Rapid Deployment Systems, Inc.
-
- Introduction
-
- PORT is a tool written to facilitate working with I/O ports on the PC or
- Intel processor-based hardware. It has many uses. Among them:
-
- * Debugging new hardware.
- * Reverse engineering old hardware.
- * Finding out where an adaptor card decodes its ports.
- * Otherwise manipulating I/O ports.
-
- Among the capabilities:
-
- * Read or write to a specified port.
- * Read or write and then wait for a specified byte or word pattern
- * Read or write in byte or word modes.
- * Enter or display data in either decimal or hex.
- * Repeatedly read or write a port - generate nice scoping patterns.
- * Repeatedly read or write and alternate between a specified bit
- pattern and all zeros - generates even nicer scope patterns.
- * Increment or decrement port addresses while reading or writing
- a specified bit pattern.
- * Submit commands from files.
-
-
- Starting PORT
-
- Starting PORT is easy - just type "port" on the command line. There are
- 2 optional arguments that you may specify if desired. The first argument
- is interpreted as the port and the second is interpreted as the bit
- pattern. These must be specified in hex with no leading modifiers, eg,
-
- port 3b4 0111 DON'T use 0x3b4 or any other c-like notation
-
- You can redirect a configuration file into PORT:
-
- port <config
-
- This file should contain PORT commands just as if you had typed them
- from the command line. PORT will execute the commands and then
- wait for keyboard input.
-
-
- The Command Line
-
- When you invoke PORT, you will see something like this:
-
-
- PORT v1.0 03/04/91 by John De Armond. (jgd@dixie.com)
-
- Usage: port <port_address data> Arguments are in hex
-
- Commands:
-
- r read the port
- w write the port
- e<xd> Enter a byte (word in designated mode, hex or decimal)
- m<xdbw> Mode (x=hex, d=dec, b=byte, w=word)
- t n Toggle bit <n>
- c Clear all bits
- s Set all bits
- p Set port address
- g<io> Go In or Go Out - perform action continuously
- i Increment port address one count
- d Decrement port address one count
- q Quit
- < Redirect commands from a file
- ? Help
-
- While in "go out" mode, keys 0-f will toggle bits, <t> will cause the output
- to alternate between the byte pattern and all zeros.
-
- Command (help-?):
-
- As you enter commands, you will see a display as follows:
-
- Bits
- 5432 1098 7654 3210
- Port: 0000 Byte: 0100, 0000 0001 0000 0000 Mode= HEX Data= BYTE
-
- This display shows you the currently addressed port, the current bit
- pattern, the mode and the data size. The "mode" refers to the display
- mode and can be either decimal or hex. The mode is changed with the
- "mode" command or by the use of the modifiers "x" or "d" with the
- (E)nter command. See below.
-
-
- Commands:
-
- r - read the port
-
- This command executes a read on the specified port. If the data
- width is set to WORD, then the LSB is written to the specified port
- and the MSB is written to port+1. If the data width is set to BYTE,
- the LSB is written to the specified port and the MSB is ignored.
-
- If the command is followed by a hex number, the command outputs the
- byte specified with the "enter" command and then reads on the
- port looking for the byte pattern specified in the command. This is
- useful when testing latching ports or when testing devices that
- return a result code on the same port.
-
-
- w - write the port
-
- Same as the above except that a write is executed.
-
-
- e<xd> - Enter a byte or word
-
- This command allows you to enter a word or byte to be written to a port.
- If the command is entered with no modifier, the default entry mode
- is used. A specific mode can be specified with the options "x" for HEX
- mode or "d" for DECimal mode. Examples:
-
- e 0100 (assumes the default mode is HEX)
- ex 0100
- ed 256
-
- If a mode "override" is specified as above, the override sticks; ie,
- it becomes the new default mode.
-
-
- m<xdbw> - Set the mode.
-
- This command allows you to specify new modes with no other effects.
- This command is somewhat overloaded in that it applies to the word
- size in addition to the HEX or DECimal modes. This overloading
- seems logical to this humble programmer and can be learned by those
- for which it is not.
-
-
- t n - Toggle bit <n>
-
- This command allows you to toggle the setting of any bit in a word.
- "n" is the bit position starting at zero. Thus, the MSB is 15 and
- the LSB is 0. Example:
-
- t 3 sets the 4th bit (3rd bit numbering from 0) in the word.
-
-
- c - Clear all bits
-
- This one does what it says. It clears all bits in the I/O word.
- A shortcut for "ex 0".
-
-
- s - Set all bits
-
- Same as above except that it sets all bits. A shortcut for "ex ffff".
-
-
- p - Set port address
-
- This command enters the port address to be manipulated. It does not
- have a hex or decimal override because it is not anticipated that
- this command is a high usage one and and because people think of ports
- in hex and because your humble programmer got lazy :-) The entry mode is
- automatically the default mode. Example:
-
- e 3e4
-
-
- g<io> - Go In or Go Out
-
- This command makes PORT continuously input or output the specified word to
- the specified port until the <enter> key is pressed. There are several
- options while the "go" mode that are explained below.
-
-
- i - Increment port address one count
-
- Just what it says, increase the port number by one.
-
-
- d - Decrement port address one count
-
- Again, just what it says.
-
-
- < - Redirect commands from a file
-
- This command directs PORT to read the specified file and interpret the
- file's contents as typed commands. These files are useful for storing
- repeated data such as port addresses and for test patterns. One can
- output to a port and then read another, for example. When interpreting
- commands from a file, PORT goes into an abbreviated message mode so that
- the screen is not cluttered and so that it will run faster.
-
-
- q - Quit
-
- Yep, exit the program. No twiddling is done; the program simply exits.
- If you want to restore a value to a port before exiting, be sure to
- explicitly do it.
-
- ? - Help
-
- Displays the help screen.
-
-
- The GO mode:
-
- The GO mode is primarily designed to generate repetitive patterns on the
- I/O lines so you can observe them with an oscilloscope. When
- you enter the GO mode with a "gi" or "go" command, the specified byte
- is repeatedly output or input to the specified port as fast as the
- computer can do it. About 200 microseconds per cycle on a 16 mhz 386
- and a standard printer port.
-
- There are several options available while in the GO mode. They are:
-
- < Decrement the port address one count.
-
- > Increment the port address one count.
-
- digits 0-f
- Toggle the state of the specified bit.
-
- t Enter "toggle" mode. Only valid for OUT mode. In this mode, on
- alternate cycles, the specified byte is output and on the other cycle,
- the value 0 is output. This mode generates rapid scope patterns on
- the data lines.
-
- <enter>
- Leave GO mode.
-
- Note that there is a loop counter displayed on the screen. For speed
- considerations, this display is not updated unless there is a display
- event. If you want to monitor the progress of the looping, simply press
- the space bar which makes the screen update but with no other effect.
-
-
- Rights
-
- This program is copyright 1991 by John De Armond. Minimal rights reserved.
-
- You may not sell this program and if you redistribute it, you must
- redistribute the self-extracting ZIP file which includes the
- source. Source must always be available. Other than this, you
- may do with this program what you like including modifying it
- and/or incorporating portions of the code in other programs.
-
- If you modify the program and redistribute it, please change the name
- so as to avoid confusion with the real thing.
-
- I would appreciate your sending any modifications back to me for
- inclusion in future releases. Before you fire off with major mods,
- please read the "future directions" section below and touch base with
- me at the email address specified below. As I use this program
- daily, it is likely that I've already implemented some form of your
- changes or at least given them some thought. Let's swap ideas and
- avoid the duplicate work.
-
-
- Future Directions:
-
- Here are some ideas I'm going to implement in the next releases:
-
- * Trapping interrupts - PORT will trap and display any hardware interrupts
- it detects on specified lines.
-
- * Programming constructs for the command language. To allow one to
- program a test sequence with basic decision constructs.
-
- * A data register stack. Allows one to store away port or byte data
- for later use.
-
- * Command stack with recall. Probably something similar to the Korn
- shell.
-
- * Full screen mode. Probably implemented on top of PC Curses to keep
- the program fully freely distributable.
-
-
- Building PORT:
-
- PORT was written under Boreland C++ 2.0. It uses no C++ constructs
- and so should be portable to Turbo C or other DOS C compilers.
- It uses the project feature of Boreland C in lieu of a makefile.
- There are no special compile or link options so a makefile is not
- really needed.
-
- The binary in the distribution is compressed with Phil Katz's
- pklite program. Highly recommended.
-
- Addresses:
-
- The easiest way to get in touch with me is via Email on the Usenet. My
- address is as follows:
-
- Domain: jgd@dixie.com
- Bang: emory!rsiatl!jgd or
- emory!dixie.com!jgd or (costs $$$)
- uunet!rsiatl!jgd
- Slow boat: John De Armond
- C/O Rapid Deployment Systems, Inc.
- PO Box 670386,
- Marietta, Ga 30066
- Shout: (404) 578 9547
-
- If you are on Compu$erv, find out how to mail through the Compu$erve <->
- Internet gateway.
-
- I will NOT provide support via phone, though you may call to chat about
- new features or to discover ways to spend money with us. You may also call
- or write to find out about our products such as the Printer Nidget (TM),
- a device that lets you hang ordinary printers from Ethernets.
-
-
- About Rapid Deployment Systems, Inc.
-
- RDS is a company that specializes in fast solutions to tough problems involving
- embedded processors, TCP/IP networking and custom systems. We have the
- facilities to rapidly take an idea from concept to implementation in hardware
- and/or software. We specialize in Intel and Zilog processors.
-
- In addition to custom services, we have the following products under
- development that will be ready for introduction in early summer 1991:
-
- The Printer Nidget (tm)
-
- The Printer Nidget is the first in a series of Network Widgets. It
- is a small modem-like box that speaks TCP/IP and allows you to attach
- ordinary printers to an Ethernet network and address them from multiple
- hosts. It is designed to sit under LP (SysV) or LPR (Berkely) and
- speaks FTP and RSH. Up to 2 printers, either parallel or serial,
- may be attached to the Printer Nidget. Pseudo-commands passed to
- rsh on the host specify the port to direct the print job and other
- operating parameters. Price is expected to be under $500.
-
- The Midget (tm)
-
- The Midget (Modem Widget) is a multi-purpose modem controller that
- sits between hosts and modems and does the following:
-
- * Controls power to the modem based on DTR.
- * Initializes the modem on each powerup.
- * Drops idle lines after programmed intervals.
- * Breaks up getty-modem chats.
- * Provides absolute dial-out security.
-
- This very inexpensive device is designed to address the chronic
- problems faced by administrators when integrating so-called "smart"
- modems with Unix and BBS systems. It will also be of interest to
- those who have dial-out only systems that need absolute security
- against hacking when the modem is unused. It will be available in 2, 4
- and 8 port versions. Estimated price - $75 per port.
-
- - END -
-
-