| View previous topic :: View next topic |
| Author |
Message |
Turd HG Ruler

Joined: 18 Aug 2007 Posts: 260 Location: Saskatchewan, Canada
|
Posted: Mon Jan 07, 2008 5:52 am Post subject: NES controller to parallel port |
|
|
I got bored so I connected a NES controller to my pc's parallel port and made a test program in FreeBASIC:
| Code: | dim i as integer
dim x as integer
dim btna as integer
dim btnb as integer
dim btnse as integer
dim btnst as integer
dim btnup as integer
dim btndn as integer
dim btnl as integer
dim btnr as integer
screen 7
color 10, 0
out 890, 0
out 888, 0
do while inkey$ = ""
out 888, 2: out 888, 0
btna = 0: btnb = 0: btnse = 0: btnst = 0: btnup = 0: btndn = 0: btnl = 0: btnr = 0
if inp(889) = 127 then btna = 1
out 888, 1: out 888, 0
if inp(889) = 127 then btnb = 1
out 888, 1: out 888, 0
if inp(889) = 127 then btnse = 1
out 888, 1: out 888, 0
if inp(889) = 127 then btnst = 1
out 888, 1: out 888, 0
if inp(889) = 127 then btnup = 1
out 888, 1: out 888, 0
if inp(889) = 127 then btndn = 1
out 888, 1: out 888, 0
if inp(889) = 127 then btnl = 1
out 888, 1: out 888, 0
if inp(889) = 127 then btnr = 1
out 888, 1: out 888, 0
locate 1, 1
print "A button ="; btna
print "B button ="; btnb
print "Select button ="; btnse
print "Start button ="; btnst
print "Up button ="; btnup
print "Down button ="; btndn
print "left button ="; btnl
print "Right button ="; btnr
loop
end | Sorry for the badly written program
eric |
|
| Back to top |
|
 |
|
 |
Turd HG Ruler

Joined: 18 Aug 2007 Posts: 260 Location: Saskatchewan, Canada
|
Posted: Fri Jan 18, 2008 11:19 am Post subject: |
|
|
Here is a program that I made that lets me play a NES emulator (or anything else) and use a NES controller.
| Code: | #Define KEYEVENTF_KEYDOWN 0
#Include "windows.bi"
Dim As Integer btna, btnb, btnc, btnd, btne, btnf, btng, btnh
Cls
Color 12, 0
Print "Nintendo Entertainment System Controller To Keyboard"
Print
Print
Color 15, 0
Print "White Wire From The Controller To Pin 1 On The Parallel Port (Power)"
Print "Red Wire From The Controller To Pin 2 On The Parallel Port (Clock)"
Print "Orange Wire From The Controller To Pin 3 On The Parallel Port (Latch)"
Print "Brown Wire From The Controller To Pins 18-25 On The Parallel Port (Ground)"
Print "Yellow Wire From The Controller To A 2.2K Resistor (Data)"
Print "The Other End Of The Resistor To The Base Of A NPN Transistor"
Print "The Emitter Of The Transistor To Pins 18-25 On The Parallel Port (Ground)"
Print "The Collector Of The Transistor To Pin 11 On The Parallel Port (Data)"
Print
Print
Print "Set Your Game's Keyboard Settings For The A Button To Be The Letter A"
Print "B Button To The Letter B"
Print "Start Button To The Enter Key"
Print "Select Button To The Space Bar"
Print "The Direction Pad To The Arrow Keys"
Print
Print
Print "Minimize This Window And Play Your Game"
Print
Print "To Close This Window Have It In focus And Hit The Esc Key"
Out 890, 0
Out 888, 0
Do Until Inkey$ = Chr(27)
Out 888, 2:Sleep 1: Out 888, 0:Sleep 1
btna = Inp(889)
Out 888, 1:Sleep 1: Out 888, 0:Sleep 1
btnb = Inp(889)
Out 888, 1:Sleep 1: Out 888, 0:Sleep 1
btnc = Inp(889)
Out 888, 1:Sleep 1: Out 888, 0:Sleep 1
btnd = Inp(889)
Out 888, 1:Sleep 1: Out 888, 0:Sleep 1
btne = Inp(889)
Out 888, 1:Sleep 1: Out 888, 0:Sleep 1
btnf = Inp(889)
Out 888, 1:Sleep 1: Out 888, 0:Sleep 1
btng = Inp(889)
Out 888, 1:Sleep 1: Out 888, 0:Sleep 1
btnh = Inp(889)
Out 888, 1:Sleep 1: Out 888, 0:Sleep 1
If btna = 127 Then
Keybd_event &h41, &h1E, KEYEVENTF_KEYDOWN, 0
Else
Keybd_event &h41, &h1E, KEYEVENTF_KEYUP, 0
End If 'A
If btnb = 127 Then
Keybd_event &h42, &h30, KEYEVENTF_KEYDOWN, 0
Else
Keybd_event &h42, &h30, KEYEVENTF_KEYUP, 0
End If 'B
If btne = 127 Then
Keybd_event &h26, &h48, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYDOWN, 0
Else
Keybd_event &h26, &h48, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0
End If 'UP
If btnf = 127 Then
Keybd_event &h28, &h50, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYDOWN, 0
Else
Keybd_event &h28, &h50, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0
End If 'DOWN
If btng = 127 Then
Keybd_event &h25, &h4B, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYDOWN, 0
Else
Keybd_event &h25, &h4B, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0
End If 'LEFT
If btnh = 127 Then
Keybd_event &h27, &h4D, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYDOWN, 0
Else
Keybd_event &h27, &h4D, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0
End If 'RIGHT
If btnd = 127 Then
Keybd_event &h0D, &h1C, KEYEVENTF_KEYDOWN, 0
Else
Keybd_event &h0D, &h1C, KEYEVENTF_KEYUP, 0
End If 'START (ENTER)
If btnc = 127 Then
Keybd_event &h20, &h39, KEYEVENTF_KEYDOWN, 0
Else
Keybd_event &h20, &h39, KEYEVENTF_KEYUP, 0
End If 'SELECT (SPACE BAR)
Sleep 20
Loop
Cls
End |
ps. the program seems to lock up if there is no controller attached.
eric
Last edited by Turd on Tue Oct 21, 2008 6:50 pm; edited 3 times in total |
|
| Back to top |
|
 |
Project_Nightmare HG Master

Joined: 12 Oct 2007 Posts: 119 Location: Gig Harbor, WA
|
Posted: Fri Jan 18, 2008 10:48 pm Post subject: |
|
|
| Lol, I know a lot of places that show conversions of controllers to computer ports. I myself got some for my emulators. PM me if you want them, though I need to retrace my steps to find them since I lost interest in them. |
|
| Back to top |
|
 |
Turd HG Ruler

Joined: 18 Aug 2007 Posts: 260 Location: Saskatchewan, Canada
|
Posted: Sat Jan 19, 2008 2:42 pm Post subject: |
|
|
Sure I'd like to see those, if it's no problem
eric |
|
| Back to top |
|
 |
Project_Nightmare HG Master

Joined: 12 Oct 2007 Posts: 119 Location: Gig Harbor, WA
|
Posted: Sat Jan 19, 2008 3:28 pm Post subject: |
|
|
I have used the Xbox controllel hack from redcl0ud and it worked great for me, especially when I connected the live headset to it and used it as my mic/heaset.
To mod an (original) XBox controller to usb (and you can download the drivers to have all the devices that can be connected it also work):
http://www.redcl0ud.com/
N64 to parallel:
http://arcadecontrols.com/Mirrors/emulatronia/n64pad/
PSX to parallel:
http://www.emulatronia.com/reportajes/directpad/psxeng/print.htm
SNES to parallel:
http://www.tolaris.com/snes-to-parallel/
If you want to buy some controller adaptors you can buy it from here:
http://www.ztnetstore.com/
It's a pitty that znet resold the (n64) adaptoid for a limited time a few years after it was discontinued (I luckly got one and it works great). I also got the "N64/PSX USB Adapter" too for my n64 controller but it is crap (it goes wacky when i connect the controller to it and it doesn't work well with the PSX controller also).
Last edited by Project_Nightmare on Thu Apr 10, 2008 6:34 pm; edited 2 times in total |
|
| Back to top |
|
 |
Turd HG Ruler

Joined: 18 Aug 2007 Posts: 260 Location: Saskatchewan, Canada
|
Posted: Sat Jan 19, 2008 6:30 pm Post subject: |
|
|
Great links, thanks
eric |
|
| Back to top |
|
 |
Project_Nightmare HG Master

Joined: 12 Oct 2007 Posts: 119 Location: Gig Harbor, WA
|
Posted: Sat Jan 19, 2008 8:44 pm Post subject: |
|
|
NP I was glad I could find them again and none were dead links  |
|
| Back to top |
|
 |
Project_Nightmare HG Master

Joined: 12 Oct 2007 Posts: 119 Location: Gig Harbor, WA
|
|
| Back to top |
|
 |
Logic Kills HG Writer

Joined: 17 Nov 2007 Posts: 17
|
Posted: Wed Apr 09, 2008 4:27 pm Post subject: |
|
|
| Nice, can't believe I didn't see this earlier. |
|
| Back to top |
|
 |
Project_Nightmare HG Master

Joined: 12 Oct 2007 Posts: 119 Location: Gig Harbor, WA
|
|
| Back to top |
|
 |
crusch Newbie
Joined: 19 May 2008 Posts: 3
|
|
| Back to top |
|
 |
Project_Nightmare HG Master

Joined: 12 Oct 2007 Posts: 119 Location: Gig Harbor, WA
|
Posted: Fri May 23, 2008 11:58 pm Post subject: |
|
|
| crusch wrote: | | great post and links, I've been wondering looking for this. thanks a lot! |
Glad I could be of assistance  |
|
| Back to top |
|
 |
lmczitz Newbie
Joined: 27 Jul 2008 Posts: 1
|
Posted: Sun Jul 27, 2008 11:47 am Post subject: I will thank you guys very much if you could help. |
|
|
I created a SNES to Parallel Port adapter. My problem is that unfortunately the thing simply won't work with WINDOWS XP PRO SP2 with drivers I am utilizing. These drivers are the fallowing:
PPjoy http://www.simtel.net/pub/pd/75176.htmland
Direct Pad Pro http://arcadecontrols.com/Mirrors/www.ziplabel.com/dpadpro/
I will thank you guys greatly if you can find information on how to make this thing work properly with XP SP2.
NOTE: I heard that there are some issues with the drivers for this mod and directX9c....
Thanks again in advance guy. God bless you all. |
|
| Back to top |
|
 |
Turd HG Ruler

Joined: 18 Aug 2007 Posts: 260 Location: Saskatchewan, Canada
|
Posted: Sun Jul 27, 2008 2:25 pm Post subject: |
|
|
The source code is listed on the site but I don't know anything about C, C++ or whatever it is. Sorry I wish I could help you. Maybe someone else knows how to get it working.
On another note, my program won't compile anymore
eric |
|
| Back to top |
|
 |
meetu Newbie
Joined: 01 Oct 2008 Posts: 4
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|