Different kinds of input (Contollers, Zapper, paddle, etc)

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Different kinds of input (Contollers, Zapper, paddle, etc)

Post by Disch »

I'm trying to reorganize how I handle my emus input so that it'll be easier to add support for more types of controllers down the line. Initially I set it up so that 4 normal controllers would work easily... and later I worked in the Arkanoid paddle... but rather than having to rip my joypad setup apart and rebuild it every time I want to add another input device -- I figure I should plan ahead a bit and see what all needs to be handled.

So..... what I'm thinking now...

Normal Controllers (FC and NES): Up to 4 can be hooked up (controller ports 1+2 with four-score). Each read through $4016.0 (controller 1,3) or $4017.0 (controller 2,4)

NES Arkanoid Paddle: plugs in a controller port, button state read through $401x.3, paddle position read through $401x.4 (x=6 or 7 depending on which port it's plugged into)

Famicom Arkanoid Paddle: plugs into FC expansion port, button state read through $4016.1, paddle position read through $4017.1

NES Zapper: plugs into a controller port, trigger state read through $401x.4, light-sight read through $401x.3

Famicom Zapper: plugs into expansion port, trigger read through $4017.4, light read through $4017.3

Famicom Keyboard: plugs into expansion port. Writing to ?$4016.1? cycles through keyboard rows (and high/low bits of row data)... 9 real rows + 1 dummy/garbage row. Key data read through $4017.1-4

NES Power Pad: plugs into controller port. Data read through $401x.3-4

Famicom Power Pad: plugs into expansion port, data read through $4017.3-4


That's about all the info I currently have. I've tested and used above behavior for standard controllers... and both FC and NES types of paddles (in the (J) and (U) versions of Arkanoid, respectively)... but everything else is based solely on what I've read in docs -- so if you see anything that should be corrected, please speak up.

Also... there still seems to be some input devices which are scarcely documented (or not documented at all?) and I only know of their existence because of minor blips I've seen in docs. Any/all information anyone has on the following (or any other input devices I'm missing) please fill me in:


Robot Operated Buddy (R.O.B.) --- I'd assume famicom only and uses expansion port? don't know anything about this at all

Microphone --- on very old Famicom controllers... don't do anything that would affect any game, only carry the recorded sound and output it to TV speakers ???

Barcode Scanner --- FC only? Expansion port? Barcode World and mapper 96 games seem to want something like this.
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Post by Quietust »

The ROB has no actual connection to the NES. All it does is watch for rapid green flashes on the screen and move around, usually causing objects to land on the buttons of a 2nd NES controller.

One simple way to handle this is to designate 2 "controller ports" and one "expansion port" in your emulator, and connect various devices to them. The Four-Score would be a semi-special case (since it always connects to both standard ports and then only works with normal controllers), though the others would work just fine. Give each port a "read" and "write" function (two "read" functions for the expansion port) and other stuff (like "load" and "unload", "config", and "frame" to update button states from keyboard/joypads/etc.) and you'll be all set.

Incidentally, this is the exact method I use in Nintendulator, and it works quite nicely.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

That seems like a simple and effective setup. Heh, it seems like I'm using function pointers everywhere in this emu.

ROB sounds pretty strange... what games were designed to work with it?

Thanks for the input, Q ^^. I'm still really wondering about that barcode scanner... maybe I'll take a peek at Barcode World and see what it's doing..... tomorrow.


edit:

What about the Power glove? I never actually had one... was it the same thing as a normal controller? just in glove form?
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Power Glove had a mode that emulated a normal controller. It also had a positional mode that measured the flex of each finger and the position of the hand, much like a mouse; apparently only Super Glove Ball used this.
Great Hierophant
Posts: 780
Joined: Tue Nov 23, 2004 9:35 pm

Post by Great Hierophant »

I heard there was some difference between the NES Arkanoid paddle and the Japanese Arkanoid or Arkanoid 2 paddle? An extra button perhaps?
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Post by koitsu »

Disch wrote:ROB sounds pretty strange... what games were designed to work with it?
Gyromite and Stack Em.
Post Reply