home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Virtual Reality Zone
/
VRZONE.ISO
/
mac
/
PC
/
PCGLOVE
/
POWER386
/
README.TXT
< prev
next >
Wrap
Text File
|
1994-12-20
|
4KB
|
102 lines
Hello-
This shar contains my Nintendo Entertainment System joystick driver.
It's a Streams driver for UNIX V.3/386. It includes the support driver
files for the original release of Thomas Roell's 386/X11R4 software.
This has only been tested on an Orchid 386/20 motherboard running
AT&T UNIX V.3.2. You shouldn't have much trouble with normal
variants like ISC or Everex. With terminally weird junk like SCO,
good luck. Edit the Master file to have the driver's major
device number in the indicated place. Add Master as one line
in the file /etc/conf/cf.d/mdevice. If you need to use a different
parallel port number, change the port in System and nes.c.
This project requires a little soldering, I'm afraid. It was inspired
by an article in Byte magazine (July 1990, pp. 288-289) on attaching
a Mattel Power Glove to an IBM PC. In fact, the article was not about
the PG, but instead about attaching a Nintendo Joystick to a PC.
If you want to make the PG send raw data so you can do Virtual Reality
with it, this won't do it at all. You need schematics which I can send
you, and real electronic skills, which I can't.
The driver includes constants for the parallel port # and the pins
attached. The pinouts for the cable are:
Nintendo Printer
1 - GND
2 - 2 (Clock)
3 - 3 (Reset)
4 - 13 (Data)
5 - NC
6 - NC
7 - 5V
You need to have a spare disk power connector in your PC.
You need to get the 5V and GND lines from this connector.
I got empty shells for the big 4-pin Molexes and built a plug.
Don't even think about doing this without an ohmmeter.
The algorithm is simple: wiggle the Reset line, wait a bit.
Read the status from the Data line. This is the A button.
For 7 times wiggle the clock line, wait a bit, and read a bit.
This gives the other 3 buttons and the four direction buttons.
The strobe program demonstrates the use of the cable, and
allows you to test your cable without messing around with the kernel.
You will need to calibrate the waiting constant for your computer.
You will then need to transfer that constant to the variables
nes_c[1-5] in nes.c. They seem to want to be the same. The
constant 20 came from a 20 mhz 386. Mr. Joystick is fairly picky
about the range of times he's happy with, so you may have to mess
around a bit with strobe.c. When you're done, the program output
should reliably reflect the buttons.
To add it you Thomas Roell's X386 system, cd to server/ddx/at386
in your X source tree. The enclosed mouse.c dates from his original
256-color release, Nov 8, 1990. You may have to do something for
his later versions. The enclosed nintendo.h is included by mouse.c
You also need to add the following three lines to config.c:
< #define NINTENDO 11
< { NINTENDO, "nintendo" },
< case NINTENDO: X386LinkDevice(NesMouseConfig()); break;
Just hunt for MICROSOFT, and you'll see where they go.
Now, comment out the mouse config line in
/usr/lib/X11/X386/config/Xconfig and add this line:
Nintendo "/dev/nes0" "A" "Select" "B" 10
This is to use /dev/nes0 (you might add more later, you never know)
and to configure NES "A" as the left button, NES "Select" as the
middle button, NES "B" as the right button, and an accelerator
value (see below) of 10. The accelerator value is optional,
and defaults to 0, but you must give all three button descriptors!
The button descriptors available are: "A", "B", "Select", "Start,
and "AB". The latter refers to simultaneously pressing A and B.
The Power Glove does this in some modes; there is no timer-based
heuristic for deciding that "A-50 milliseconds-B" counts as an AB.
The accelerator value makes the cursor speed up when you hold down
the joystick button in one direction. I find 3 to 5 pleasantly useable,
and nicer than a mouse.
You jaded Streams hackers may be in for a surprise. Hint: search for
"bucket" in nes.c. Especially serial port Streams driver hackers.
Homework: 1) add some dead time before starting acceleration. 2) add
time smarts for the AB combination. 3) Bring up ZapGun (light pen)
support on a VGA card based on the Cirrus chip set, the only chipset
that support light pens. Pins 5 & 6 on the Nintendo plug are lightpen
input and trigger input. It's handy for games, and you can get a
helmet with the ZapGun lightpen lens built in as a monocle. Head
tracking doesn't have to cost $50,000.
Enjoy!
Lance Norskog
thinman@netcom.com