Shop OBEX P1 Docs P2 Docs Learn Events
Propeller-based NES Gamepad — Parallax Forums

Propeller-based NES Gamepad

ClemensClemens Posts: 236
edited 2008-06-23 23:41 in Propeller 1
Hi,

I just turned my $80 Propstick USB into a ($5?) NES Controller smile.gif
- 8 Buttons to inputs 0 to 7 as described in the Education Labs
- 5V and Ground from my almost-a-demoboard-protoboard
- 3 Datlines with pulldown resistors connected between the props on both boards
- some lines of spin:

CON
  _CLKMODE = xtal1 + pll16x
  _XINFREQ = 5_000_000 + 0000
PUB start |i
      DIRA[noparse][[/noparse]0..7]:=0
      DIRA[noparse][[/noparse]18]:=0
      DIRA[noparse][[/noparse]17]:=0
      DIRA[noparse][[/noparse]16]:=1
   repeat 
      repeat
      while INA[noparse][[/noparse]17]==0
        OUTA[noparse][[/noparse]16]:=!INA[noparse][[/noparse]7]  
      repeat
      while INA[noparse][[/noparse]17]==1
      repeat i from 7 to 0
        repeat
        while INA[noparse][[/noparse]18]==1
        OUTA[noparse][[/noparse]16]:=!INA[noparse][[/noparse]i] 
        repeat
        while INA[noparse][[/noparse]18]==0
      OUTA[noparse][[/noparse]16]:=1
   

·This is what it looks like, chaotic wiring, I know...

nes.jpg

I tested it with Dodgy Kong and it works!
However·I had·to uncomment the "Delay(1)" lines in the NES_Read_Gamepad section of the sw_dkong_020.spin and add a delay function:

PUB Delay(length) 
repeat length

I know, this is bad coding, but I just need a tiny delay and hope I'll manage to write an asm driver, so the delay will not be necessary at all.

I realize that this is another one of my foolish projects, and a prop is total overkill for this task, but think of the possibilities:
- One could replace the buttons with sensors and play hydra-games with acceleration or ir sensors
- One could build a wii-controller-to-NES-converter and play NES games with wii-controllers

Cheers,

Clemens


Oh and thank you Steve and Eric for Dodgy Kong!!!

Comments

  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2008-06-23 23:41
    Nice project. All projects are good as long as learning is facilitated.

    I think there was an article in Nuts & Volts a few months ago about using an accelerometer as an input to the Hyrdra, my mind is fuzzy though.

    A WII to NES converter would be cool!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter

    www.brilldea.com·- uOLED-IOC, RGB LEDs, TLC5940 driver PCB
    www.tdswieter.com
    One little spark of imagination is all it takes for an idea to explode
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-06-23 23:41
    I'm not sure the motivation for this, but awesome anyway..

    BTW, Nice demoboard.. [noparse]:)[/noparse]

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with the Protoboard? - Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card? - PropDOS
    Need a part? Got spare electronics? - The Electronics Exchange
Sign In or Register to comment.