NES Controllers Explained

Поділитися
Вставка
  • Опубліковано 8 чер 2024
  • In this episode I break down a NES-004 brick style controller and explain how it works.
    Support the channel on Patreon: / neshacker
    Controller Code GitHub Project - github.com/NesHacker/NesExpla...
    CD4021 Datasheet (Texas Instruments) - www.ti.com/lit/ds/symlink/cd4...
    Chapters:
    0:00 Introduction
    1:20 Opening a Controller
    2:28 NES-004 Electronics
    4:18 Button Circuitry
    7:10 Reading Controller Data
    9:37 Controller Code
    16:20 Conclusion
  • Наука та технологія

КОМЕНТАРІ • 159

  • @jluec
    @jluec 2 роки тому +122

    Man I can't tell you what amazing information this all is, and how professional your presentation is! The only reason this channel isn't huge is because its a pretty niche audience but know that to this crowd you're a godsend

    • @NesHacker
      @NesHacker  2 роки тому +39

      Yep, I didn’t make this channel to “get huge,” I made it to for people like yourself who appreciate the craft of 8-bit game creation :D

  • @igormoreno3464
    @igormoreno3464 2 роки тому +19

    Can't get enough of your videos! Found the channel recently and the mix between hardware explanation and assembly code is right up my alley.

    • @NesHacker
      @NesHacker  2 роки тому +4

      Thank you! Yeah, with these old 8-bit systems I think it makes good sense since there is such an interplay between the two. And also… who doesn’t like getting really close to the metal?

  • @majinnaibu
    @majinnaibu Рік тому +6

    I really like how you're going into how the digital electronics work instead of just giving us source code to read the buttons. I hope you do something cool like that when you get to sound. That could probably be a video series by itself though.

  • @schlangengrube157
    @schlangengrube157 2 роки тому +16

    Hi Ryan, thanks a lot for this phantastic video. Especially the combination of a look at the hardware and some actual code makes your video so helpful to fully understand the NES. I am interested in creating a homebrew game myself, so your channel is highly appreciated. One suggestion since you have now presented the normal controller. There are some games for up to four players, which require a special adapter. Perhaps you can talk about this special hardware in a future video.

    • @NesHacker
      @NesHacker  2 роки тому +4

      Yeah I’m interested in exploring different things in the future, and more on controllers is definitely one of the topics.

  • @pestydesperado8771
    @pestydesperado8771 2 роки тому +1

    until I saw the title I didn't know the controller needed explaining. You learn something new every day!

  • @mikesmith1290
    @mikesmith1290 2 роки тому +1

    I just found your channel randomly. I haven’t even though about nes in years, but now I think I have a new hobby!

  • @timmurray1033
    @timmurray1033 2 роки тому +40

    I'm so happy I found your videos I've been trying to understand NES programming for quite some time. To the point of getting NESMaker, buying a book by Steven Hugg, and even hiring a tutor, which is kind of frustrating given I am a programmer for my job. Your videos are starting to help everything click. If you have a patreon I'd love to subscribe to support the channel and if you ever want to develop a course consider me your first student.

    • @NesHacker
      @NesHacker  2 роки тому +11

      Wow, that's very high praise Tim, thank you so much! I'm exceedingly happy that you find my videos helpful as you're the kind of person that I had in mind when I decided to make the channel :)
      I don't have a Patreon at this time, but you're the second person to mention it today... so I should probably consider getting on that, lol. If / when I do set one up I'll announce it in a supplemental channel video. So just stay subscribed and setup with alerts and you'll see a video when I release it.
      Thanks so much for watching, and get pumped cause part 3 of the 6502 assembly crash course is scheduled to drop in two weeks ;)

    • @timmurray1033
      @timmurray1033 2 роки тому +4

      @@NesHacker I'm really excited to see it. I don't know if it's because my job is basically coming into departments assessing how reports are made and data is structures then making them more efficient but it seems like every NES resource out there is "do this to get that" and none of them explain why you're doing what you're doing or what the code is actually doing. NESMaker is really awesome but basically you're working within a giant set of code that was pre-written and trying to read through the variables is pretty difficult. The Steven Hugg book is written for a specific NES library in C which again is a "do this to get that". All of that isn't really helpful to me. I think when it comes to NES there are basically the structure:
      How to draw a background (how to switch background tiles)
      How to move from one background to another
      How to draw a sprite to the screen
      How to animate a sprite
      How to make the sprite collide with things
      How to use bank switching
      How to use ROM vs RAM for graphics
      Those are the things I'm struggling wrapping my head around. I'm really hoping since I code anyway all the time that something will just click with NES and I'll off and running. Thank you so much for this channel though, it's already so helpful.

  • @okeefech
    @okeefech 2 роки тому +4

    Awesome channel, brother; I just watched a bunch of your videos and subscribed. Thanks for the super informative and well-edited videos, can't wait to see what comes next!

    • @NesHacker
      @NesHacker  2 роки тому +1

      Right on! Yeah I am pumped about the videos I currently have planned, so I hope you enjoy them!

  • @valeriosanna5381
    @valeriosanna5381 2 роки тому +10

    Quality content here, good job.

    • @NesHacker
      @NesHacker  2 роки тому +1

      Yeah, this one felt pretty good. Thanks!

  • @BGDMusic
    @BGDMusic 11 місяців тому +1

    i already knew roughly how nes controllers worked but this is way more in depth

    • @NesHacker
      @NesHacker  11 місяців тому

      That’s kinda the idea haha 😂

    • @BGDMusic
      @BGDMusic 11 місяців тому

      @@NesHacker good video :)

  • @randy7894
    @randy7894 2 роки тому +1

    Awesome 'AHA!' moment with the animations about carry use. Great interesting content.
    I'm less intimidated by assembly now.

  • @taken_over3416
    @taken_over3416 2 роки тому

    Insanely good video. Don’t know that UA-cam has ever recommended me something I enjoy this much.

  • @Ghosthound_X
    @Ghosthound_X 2 роки тому

    Quality content. I can watch these all day.

  • @miltonlai4850
    @miltonlai4850 11 місяців тому +1

    You opened a new world -- big thanks!

  • @Hatchet2k4
    @Hatchet2k4 2 роки тому +5

    8 bits, 8 buttons. Balance in all things, as it should be!

    • @NesHacker
      @NesHacker  2 роки тому +6

      Yeah they really messed up with the SNES… 12 buttons and 16 bits?! That’s not mathematically pleasing! At least the controller works exactly the same way xD

    • @anguswilson1724
      @anguswilson1724 9 місяців тому

      ps4 controller has 16 binary value buttons which is interesting but likely coincidental

  • @AtomFry
    @AtomFry 2 роки тому +10

    Thanks for this, I’m enjoying the series. I’d love to see some discussion about how to call this and react to inputs. Do you do this at the start of the NMI to check for game inputs on each frame?

    • @NesHacker
      @NesHacker  2 роки тому +4

      Yeah reading inputs every NMI is definitely the easiest way to go. That said, you only have around 2200 cycles to play with during the VBLANK to update the PPU VRAM. So if your VRAM update code is very tight you might need to save the NMI cycles and use a flag in RAM somewhere so the non-interrupt code can break out of the infinite loop and perform the read while the screen is being rendered by the PPU.

  • @osfield
    @osfield Рік тому +1

    This video helped me build an interface for a NES controller using VHDL. Really great stuff!

  • @Vretrocomputing
    @Vretrocomputing 2 роки тому

    Brilliant explanations and video editing 👍

  • @MattBooth
    @MattBooth 2 роки тому +2

    "I'll get to that in a Bit"
    Don't think that went under the radar :D

    • @NesHacker
      @NesHacker  2 роки тому +1

      Haha, you caught me :)

  • @deltakid0
    @deltakid0 2 роки тому +1

    It's been well documented the way an NES controller works (being a shift register the most popular IC in UA-cam) but it's always nice and fun to have another perspective. Thank you.

    • @rebranded1248
      @rebranded1248 Рік тому

      Can you tell me where to go to research information on "micro PCB circuit boards" to make a micro controller for NES that works on NES original console/hardware. That has a ability to have direction on D-pad and/or buttons A/B to have auto-fire turbo capabilities? All the while working without the need for any external programs running on a PC like Joy2key, Rewasd etc....So basically all the turbo functionality is self-contained within the pad controller itself. Somone said something about altering the shift registers to produce turbo. How do I find info about that? Googling it does not really bring anything up but pre-made third party Turbo controllers and that is not what I am talking about.

    • @deltakid0
      @deltakid0 Рік тому

      @@rebranded1248 either I don't understand what you want or I haven't seen that type of gamepad, I saw a gamepad with extra 2 A and B buttons that fires rapidly, and I can't think of how to build one of those from scratch, but it shouldn't be terribly hard to build up.

    • @rebranded1248
      @rebranded1248 Рік тому

      @@deltakid0 I am talking about a micro controller where you switch out the original NES OEM circuit board and replace it with a ardruino micro controller board. That way you can have a NES controller with hidden auto fire and macros. I suspect there might be a couple speedrunners who do it professionally and they are indeed hiding the fact they are using micro controllers with auto fire. It would have to be a micro controller cause the NES controller needs to retain auto fire ability independant of wether or not it is plugged into a PC or not. Just needs to have that special function if it is plugged into OEM NES console.

    • @deltakid0
      @deltakid0 Рік тому

      @@rebranded1248 well, Arduino is the first option to come up when you need to prototype something, so, yeah, I think it's just an Arduino or even an ATTiny85 to solve your need, I would prefer the latter because of size so that you can fit it in the retail gamepad

  • @Hipocondriax
    @Hipocondriax 2 роки тому +3

    Best channel ever, top content, regards from Brazil

    • @NesHacker
      @NesHacker  2 роки тому +1

      I’m glad you’re liking it, and there’s a lot more in the works, obrigado!

  • @AT-zr9tv
    @AT-zr9tv 2 роки тому +2

    Wow what a great explanation.
    Your visuals make it so much easier to grasp.
    For future such videos, it might be of interest to give an idea of the number of clock cycles such a routine requires, and to compare that with the actual time it represents.
    One question: I've noticed in GameBoy ROM disassembles that joypad inputs are read multiple times in a row, and I assume it's to limit mistakes, but I don't understand how that helps. Is it also the case for NES controllers?
    Thanks so much for your excellent work. I look forward to supporting you on Patreon when your page is launched.

    • @NesHacker
      @NesHacker  2 роки тому +1

      From what I can see, the GameBoy requires this as the values in the joypad register may not be set immediately and require you to perform multiple reads. I am unsure as to why this is the case, as I’ve not done much tooling around with gameboy programming. NES controller reading doesn’t require this. As I showed in the video you simply need to “strobe” the controller, then proceed to read each of the bits one at a time.

  •  2 роки тому +5

    I really like the way you animated the workings of the BU4021B. What I/O chip is the NES using to decode the incoming serial data from the controller?

    • @NesHacker
      @NesHacker  2 роки тому +4

      Thanks! That was a super fun animation to make. So the exact chip most likely changes for each of the specific system models, but according to the schematic the original famicom used two 40H368 3-state logic drivers to do the trick (each port used one of the inverters on each of the chip). The mechanism of operation is a bit complicated since those chips are used for more than just inverting the incoming button data. Here’s a link to a modern equivalent: www.ti.com/lit/ds/symlink/cd74hc367.pdf

  • @MasterYota1
    @MasterYota1 Рік тому

    Thank you for sharing your brain. I admire your knowledge on this subject. I wish I would have taken the same path.

  • @insertmetalusernamehere
    @insertmetalusernamehere 2 роки тому

    This is really cool to see how the controller actually works. It makes me wonder how it was possible at all to get system to do what it does.

  • @mohsensoleymanee6620
    @mohsensoleymanee6620 Рік тому

    That was fantastic, well done

  • @harryguillermo
    @harryguillermo 2 роки тому

    Where can I find your 6502 assembler course? Amazing information! You are an incredible teacher and communicator. Thank you!

  • @CoolDudeClem
    @CoolDudeClem 2 роки тому +2

    For the longest time, I thought the NES used the same 9-pin connector as say, an Atari. Obviously I was wrong. Never owning a NES but owning one of the many Fami-clones out there that used the 9-pin connector, I thought the NES would be the same. It makes sense though why I would think that ... 9 pins, one pin being common, the other 8 pins for the 8 buttons.

  • @Mak10z
    @Mak10z 7 місяців тому

    that controller is the sturdiest bit of engineering I have ever used. I was a little bastard as a child, and I could break almost anything. but no that brick of a controller. until I retired my NES I still had and used my original controllers. none of my other consoles could make that distinction.

    • @NesHacker
      @NesHacker  7 місяців тому +1

      It’s a seriously good controller. Here’s to all of us who were tiny terrors back in the day 😂

  • @wfzyx
    @wfzyx Рік тому +1

    I know I'm super late to the party but, amazing video - thanks for sharing ! Out of curiosity, some FC controller models appear to have a 15 pin interface, would it possible/feasible to rewrite the controller input pooling routine so it could read a more "modern" controller, with at least L and R? I feel like this could open so many tools for romhacking and modders to add ergonomics into NES games such as zelda1 to swap weapons for example.

    • @NesHacker
      @NesHacker  Рік тому +3

      Yep totally feasible. The SNES controller is almost exactly the same except it has two shift registers which holds the value for all of its buttons. Basically you can use the controller ports as a general serial port as long as the game is programmed to use it that way.

  • @ioloavatar8430
    @ioloavatar8430 2 роки тому +1

    I remember back then for some reason I took apart my NES controller , stripped the wiring and I tried to attach to my Atari plug . I was young and did not know much about testing but I never got it to work . I wonder if you can actually use a NES controller on a original Atari system . Has anyone tried this before ? Great channel by the way . Thanks

    • @Veylon
      @Veylon 2 роки тому +1

      Atari controllers don't have a shift register. Each pin is used for a different input (Up, Down, Left, Right, Button). You'd have to completely rewire the controller's innards to make it work.
      You can, however, use a Sega Genesis controller on an Atari because they both use the same shaped plug with the same directions for the same pins. Several other systems work as well.

  • @michaelacosta3213
    @michaelacosta3213 2 роки тому

    14:56 The graphics helped a lot to understand

  • @jj74qformerlyjailbreak3
    @jj74qformerlyjailbreak3 8 місяців тому

    This video came in more handy then you could possibly know. I have maybe a tote full of NES systems with no controllers to test them. Now I don’t need one exactly. Thanks.

    • @NesHacker
      @NesHacker  8 місяців тому

      You are very welcome, I’m glad I could help

    • @jj74qformerlyjailbreak3
      @jj74qformerlyjailbreak3 8 місяців тому

      @@NesHacker I actually found NOS wireless NES controllers at a thrift store. For a dollar I picked up a few. I originally wanted to see if it worked for the system I have. Upon further review they went to some remake edition that didn’t use cartridges.

  • @commenter4799
    @commenter4799 8 місяців тому +1

    Of note: ground isn't always the lowest voltage on a board. It happens to be on many.

    • @NesHacker
      @NesHacker  8 місяців тому +1

      That’s true, I suppose you have negative voltages sometimes! I’m just so used to only working with digital logic so I always think of ground as “low” when perhaps I should think of it as “zero” 🤔

  • @NESADDICT
    @NESADDICT 2 роки тому

    Very very cool!

  • @michaelsegal3558
    @michaelsegal3558 2 роки тому

    That same controller shipped with the NES in Canada as well

  • @Rumplestiltzchen
    @Rumplestiltzchen Рік тому

    this is helpful thanks

  • @gamerzone5663
    @gamerzone5663 2 роки тому

    Really interesting video,
    But what about the snes, or n 64 controller ?
    Do they work the same ?

  • @nightbreed141
    @nightbreed141 2 роки тому

    So was writing code back in those days the same as writing code today ? Besides the new updated stuff that they have added for newer tech, is the basic code writing from today the same as back in those days ?

  • @Daniel-it1dp
    @Daniel-it1dp 2 роки тому

    Reminds me a lot of the microcontroller assignments I did in college.

  • @rebranded1248
    @rebranded1248 Рік тому

    Can you tell me where to go to research information on "micro PCB circuit boards" to make a micro controller for NES that works on NES original console/hardware. That has a ability to have direction on D-pad and/or buttons A/B to have auto-fire turbo capabilities? All the while working without the need for any external programs running on a PC like Joy2key, Rewasd etc....So basically all the turbo functionality is self-contained within the pad controller itself. Somone said something about altering the shift registers to produce turbo. How do I find info about that? Googling it does not really bring anything up but pre-made third party Turbo controllers and that is not what I am talking about.

  • @iyziejane
    @iyziejane Рік тому

    It's interesting that they used an integrated circuit on the controller itself to digitize the controller inputs before sending them to the NES. It seems it would have been cheaper to skip the IC within the controller and send the analog signals from the button presses to the NES to be digitized, but I guess this didn't work as well. I wonder if earlier game consoles did something like that.

    • @Brad-qw1te
      @Brad-qw1te 11 місяців тому

      If you didnt have the shift register you would have to have 8 wires returning instead of 1. The shift register makes it so that you can send a string of 8 bits back over one wire which tells you which buttons have been pressed rather than having one wire returning per button.
      Apparently wires were more expensive or something compared to the IC in the controller. Doesn't make a lot of sense to me either.

  • @atomicnoexcept
    @atomicnoexcept 2 роки тому +3

    IDK if the pads on the silicone are printed with a pattern or if the pattern is imprinted by repeated uses. I say this because I took apart these controllers as a kid and never noticed a pattern on the pads, and these controllers were new back in 1985. 😜

    • @NesHacker
      @NesHacker  2 роки тому +1

      Yeah I was having a hard time finding solid information on how those switches work. I’ve only ever seen them with the patterns, but like you say it could be due to use. Thanks for the info!

    • @atomicnoexcept
      @atomicnoexcept 2 роки тому

      @@NesHacker dude thank *you* for doing these videos. I’d gladly contribute to your patreon account.

  • @captainnintendo
    @captainnintendo 2 роки тому +1

    Something I found really strange is that some official NES controllers are not cross-compatible in different regions.
    I believe the 101E models will only work on PAL system while the normal 101 will work on either.
    I'm also curious about something.
    You say the controller can receive inputs from the NES. I was wondering to what extent this could be used.
    Like, let's say we had a theoretical NES controller with a little LCD display ala the Dreamcast.
    Would it then be possible to send picture information to this little display while you play if the controller had some ram onboard to handle it?

    • @NesHacker
      @NesHacker  2 роки тому +2

      Yeah, so there are apparently PAL consoles included diodes on the controller ports, which require the controller itself to pull the clock and latch signals high in order to operate correctly. The PAL version of the NES-004 has a 3.6K Ohm resistor pulling both lines up to high voltage. As for using the ports for external communication, I’m pretty sure this is possible (from what I’ve read) but I haven’t tried it myself. Might make for an interesting experiment to document in a video :)

  • @michaelsegal3558
    @michaelsegal3558 2 роки тому

    I there are only 5 buttons on an NES controller “A” button 1 “B” button 2 Start button 3 Select button 4 and the D-pad 5 where does he get 8 from does each direction on the D-pad count as a separate button? If so then it would be “A” button 1 “B” button 2 Start button 3 Select button 4 up direction 5 down direction 6 right direction 7 and left direction 8 so if you count each direction on the D-pad separately as opposed to the D-pad as one button then yeah there are 8 buttons

  • @SyphistPrime
    @SyphistPrime 2 роки тому +1

    I thought the NES automatically did this and loaded it into memory, that's interesting to know it doesn't. The explanation is really good as well and I understood it without prior assembly knowledge. It's really cool to learn the ins and outs of hardware like this, as a single person can actually understand the entire system as it's relatively simple.

    • @NesHacker
      @NesHacker  2 роки тому +1

      It’s kinda cool too, cause you can use the controller ports as a general I/O interface that way. There’s no reason why you’d have to only transmit exactly eight bits.

    • @SyphistPrime
      @SyphistPrime 2 роки тому

      @@NesHacker If I recall some of the TASbot submissions for GDQ have actually used the control ports for general I/O for things like audio playback through the console.

  • @sorry11303
    @sorry11303 2 роки тому

    Correct me if I'm wrong didn't the famicon have built-in turbo? 🤔

  • @dysonsphere6738
    @dysonsphere6738 2 роки тому +3

    So if I have an SNES controller hooked up to an NES, and I want to read the controllers extra 8 bits, I just need to have 2 loops and read the other 8 bits into another memory location, correct?

    • @NesHacker
      @NesHacker  2 роки тому +1

      Conceivably, though I’ve never tried it… I believe the SNES controller just has two shift registers in series to register all 12 bits of button data. Would definitely make for a fun experiment!

  • @michaelsegal3558
    @michaelsegal3558 2 роки тому

    I once had this one NES controller that was a little messed up I was playing SMB1 with it and the “A” and “B” buttons made the game pause instead of the Start button for pausing I don’t have that controller anymore for obvious reasons (it didn’t work properly)

  • @LukeAvedon
    @LukeAvedon 2 роки тому +1

    NES Hacker, what is your view on starting a ROM Hack by finding the subroutine that reads controller input,
    then stepping through the code from the controller read, then trying to understand that code step-by-step from there. i.e. using the controller read as an organic starting point for code investigation.
    1.) Finding whatever subroutine loads from $4016 (via searching function list in MESEN)
    2.) Set a break point on LDA, $4016
    3.) Understand confusing mess of assembly??
    Thank you so much for all your great content and amazing videos.

    • @NesHacker
      @NesHacker  2 роки тому +3

      I think that’s okay, but honestly the controller reading code for *most* games probably doesn’t have much to do with the actual game logic. For instance, a game like MegaMan 2 has at least 6 distinct controller contexts: Main menu, Boss Select, Password Select, Main Gameplay, Start Menu, & Game Over. So the controller code is most likely abstracted out away from the logic that handles those different game states as part of a set of general routines that runs every frame.
      That said, you can still piggyback off the *result* of the controller code, by this I mean if you can find the memory location where the controller buttons are stored, you can use it to find code that reads and reacts to that code. By combining this with other memory locations you can setup breakpoints that can pinpoint the exact location for code that handles various things (e.g. handling of the D-PAD buttons on the boss select or the code that initiates a jump for MegaMan himself, etc.).

    • @LukeAvedon
      @LukeAvedon 2 роки тому +1

      @@NesHacker Thanks so much for the detailed reply!!

  • @RetroArcadeGuy
    @RetroArcadeGuy 2 роки тому

    It sounds like the longer route on how Modems work. Encode data into signals and have them converted back into readable data on the other side in the console.
    This kinda explained me how they could send all eight buttons through mere 3 data + 2 electricity cables, unlike other contemporary consoles with cables that weighted more than the controller itself!
    And the blacked out graphite pads above the main buttons pads on the PCB are just resistors??

    • @NesHacker
      @NesHacker  2 роки тому +1

      Yeah pretty sure they are, I was reading around 50k Ohm with my multimeter when I tested across them (though that’s probably a bit high since there is probably some amount of corrosion on the test points and pins I was using as contact points). Also one side is connected to high voltage and the other connects to the button switch / pin trace, so the only thing they could really be is the pull-up resistors for the button switch circuits.

    • @RetroArcadeGuy
      @RetroArcadeGuy 2 роки тому +1

      @@NesHacker And me thinking they were left overs from the 2nd player or japanese FamiCom controller PCB designs and that I should scratch and tap to see what they do, haha! Now I see it's a terrible idea...
      Will you point out the differences and mechanics on the FamiCom controllers in a future video? They seem a bit smarter than American ones.

  • @mysteryneophyte
    @mysteryneophyte 2 роки тому

    I never even considered that there might be people who did not just intuitively understanding precisely how they were put together and function both from a hardware and software perspective.
    common Sense really

  • @poorman-trending
    @poorman-trending 11 місяців тому +2

    What about button bounce? Is that something that the programmer needs to worry about / test for?

    • @NesHacker
      @NesHacker  11 місяців тому

      It depends on situation. For things like menus and the like button bounce might be handled by waiting some amount of time to ensure the player is pressing the confirmation button. For most gameplay, however, responsiveness is more important so generally you don’t try to denounce the inputs (remember the NES runs pretty darn slow even compared to modern hobbies microcontrollers).

  • @pauldelmonico4933
    @pauldelmonico4933 2 роки тому

    The communication sounds exactly like an SPI protocol. Assuming the limiting factor is the chip on the controller, It should be easy to replace it with a modern microcontroller with a higher clock frequency to decrease latency and improve response times.

    • @NesHacker
      @NesHacker  2 роки тому +1

      It is similar, but you gotta remember: games execute specific instructions at a particular clock speed, so even if you increased how fast the chip on the controller worked it would take the same amount of time due to game code. Also you can easily handle the reading of all buttons in a fraction of a frame, so even if it were faster there would be no noticeable increase in responsiveness.

    • @danieljimenez1989
      @danieljimenez1989 2 роки тому

      The 4021 already works at 1 MHz and more. The whole latch-clockout procedure can be done within 10 uS. There isn't much headroom with this protocol.

  • @michaelsegal3558
    @michaelsegal3558 2 роки тому

    I’m sure most people know this but opposite directions on the D-pad can’t be pressed at the same time for example the up and down directions can’t be pressed at the same time or the right and left directions can’t be pressed at the same time but up and right or down and right or up and left or down and left can be pressed at the same time

    • @sa3270
      @sa3270 2 роки тому

      I used to do programming on the Commodore 64 which used 4 position joysticks which like the NES controllers should not be able to press opposite directions at the same time, but I can tell you if you move it around vigorously you may get some from time to time. So best to design the code to handle it cleanly.

    • @michaelsegal3558
      @michaelsegal3558 2 роки тому

      @@sa3270 I see

  • @shadimurwi7170
    @shadimurwi7170 2 роки тому

    Neshacker

  • @michaelsegal3558
    @michaelsegal3558 2 роки тому

    Is there a 001 NES controller or a 002 NES controller or a 003 NES controller or did they just start at 004?

  • @YadraVoat
    @YadraVoat Рік тому

    But how does the NES handle multiple controllers? Are there actually four bytes (32 bits) of controller data to handle four controllers?

    • @NesHacker
      @NesHacker  Рік тому +1

      For two controllers you can read the 2nd player joypad from $4017 instead of $4016. In the case of the "Four Score" (4 player adapter for the NES) controllers 1 & 3 are read back-to-back from the the first port, and controllers 2 & 4 are read back to back from the second port. So yes, there are 32 bits of button data: 16 bits from port 1, and 16 from port 2. Good deduction :)

    • @YadraVoat
      @YadraVoat Рік тому

      @@NesHacker @NesHacker Thanks. Back-to-back, eh? Meaning every even and odd clock cycle, respectively? That is an intriguing strategy and has me wondering if the only limit on the number of controllers would be the clock speed of the 4021 chip? 🤔

  • @michaelsegal3558
    @michaelsegal3558 2 роки тому

    0:36 he showed the original grey gun as opposed to the second edition orange gun

  • @TheJaguar1983
    @TheJaguar1983 2 роки тому

    I can't believe that the controller's "brain" is just a shift register. I was expecting something more complicated like the PSX controller. I guess I shouldn't be that surprised.

    • @sa3270
      @sa3270 2 роки тому +1

      Guess how many ICs were in an Atari 2600 joystick.

    • @TheJaguar1983
      @TheJaguar1983 2 роки тому +1

      @@sa3270 Zero, I'd guess. 4 Pins for direction, 1 for the button and just simple switches on all of them.

  • @johneymute
    @johneymute 2 роки тому +2

    You for get to mention that the nes cannot read and process a controller input signal along with a dpcm sound signal atonce,that’s because they share and use both the same pin,most early nes games had no dpcm audio,trough,nes games that did supported dpcm audio, solved that problem by comparing button presses with it’s own interprationss(because the nes always assumes that a button was pressed),and if they match the button presses will be considered as legit,if it finds no match,it rejects it,another option would be to disable dpcm playback during button presses,or it could ignoire button presses during during dpcm playback during button presses(wich could be ideal during cut scenes when theres no game play)
    Supermario 3 for instance uses an comparision algorithm and surprisingly enough theres no input delay at all,or atleast it’s unoticible for us(alltrough i do hear story’s about speedrunners complaining that the duck jump doesn’t alway’s get’s registred), well i would be not surprised if supermariobros 1 plays just slightly smoother because of not using the dpcm channel at all,
    Not this issue has been solved on pal nes systems,but i don’t think that pal games were adjusted with this fix in mind,maybe some pal games?? (Wich may explain why they could behave strange on a ntsc nes because of this aside from timing issues??? ) but not sure, but it’s interesting to examin that.

  • @spaces1990
    @spaces1990 2 роки тому +1

    Quality

  • @MrCleardark
    @MrCleardark 2 роки тому

    Why only 13000 views? quality! maybe too detailed? I guess that from your knowledge you get good money for somewhere else so it's all good :D

  • @AgeofReason
    @AgeofReason Рік тому

    The most rage proof controller known to man

  • @nickgivent3157
    @nickgivent3157 2 роки тому

    wow

  • @michaelsegal3558
    @michaelsegal3558 2 роки тому

    11:03 the number 4016 was another fleet number in our old streetcar fleet in Toronto where I live

  • @ericyeahbaby3875
    @ericyeahbaby3875 Рік тому

    🥰

  • @michaelsegal3558
    @michaelsegal3558 2 роки тому

    7:15 that number 4021 in Toronto Canada where I live in our old streetcar fleet (which is now retired we have new streetcars now) but one of the streetcars in our old now retired fleet one of those old streetcars had the fleet number 4021

  • @Lohoris
    @Lohoris Рік тому

    I'm still super confused about WHY they chose such a complicated serial design, instead of just having 1 pin = 1 button 🤔

  • @kregadeth5562
    @kregadeth5562 9 місяців тому

    Commenting to boost. I haven’t even watched the video yet

  • @Time-yo5mw
    @Time-yo5mw 2 роки тому +2

    I love the content, just watch your cadence, it sounds (tonally) like you are repeating the same sentence over and over again and makes you sound like a bit of a robot lol

    • @NesHacker
      @NesHacker  2 роки тому

      Yeah my cadence can get somewhat repetitive, I think it gets better over time, though.

    • @Time-yo5mw
      @Time-yo5mw 2 роки тому

      @@NesHacker I am really interested in what you have to say, this breakdown of electronics and circuits could keep me watching forever :D

  • @michaelsegal3558
    @michaelsegal3558 2 роки тому

    16:11 like why is there a dollar sign next to the “20” I’m pretty sure we are not talking about twenty dollars here so why the dollar sign?

    • @ricoh9379
      @ricoh9379 2 роки тому

      If I'm not wrong, the dollar sign just means a memory address

    • @michaelsegal3558
      @michaelsegal3558 2 роки тому

      @@ricoh9379 I see

    • @sa3270
      @sa3270 2 роки тому

      The dollar sign is the conventional notation for hexadecimal in 6502 programming. It could have been written as rol $20 or rol 32 and it would mean the same thing.

    • @michaelsegal3558
      @michaelsegal3558 2 роки тому

      @@sa3270 I see

  • @patrickhawthorneLS
    @patrickhawthorneLS 2 роки тому

    Open and explore a sega Saturn mission stick

  • @nand3kudasai
    @nand3kudasai 5 місяців тому

    i love the channel and production quality.
    but the accentuation and pauses on random words makes it hard to follow and sometimes annoying coupled with the abstract words means i loose track of what hes actually saying.
    the animations are beautiful and very professional but sometimes they dont really show what hes explaining so end up being more distracting than helpful.
    anyway great videos and great series i love to learn more about all these details.

  • @aSameplayer
    @aSameplayer 2 роки тому +1

    are the buttons debounced?

  • @mikefisher4834
    @mikefisher4834 Рік тому +1

    The zapper gun isn’t weird but the Power Glove sure is but the Power Glove is more just garbage than it is weird💯💀

    • @NesHacker
      @NesHacker  Рік тому

      Haha, super true, I could never get it to do anything when I was a kid

  • @michaelsegal3558
    @michaelsegal3558 2 роки тому

    11:16 I never understood why when talking about numbers like these they have dollar signs we’re not talking about money here like next to where it says “4016” it has a dollar sign and I’m pretty sure we are not talking about four thousand and sixteen dollars here so why the dollar sign?

    • @NesHacker
      @NesHacker  2 роки тому

      The ‘$’ denotes that the number is in hexadecimal.

    • @michaelsegal3558
      @michaelsegal3558 2 роки тому

      @@NesHacker I see that sign looks a lot like a dollar sign

    • @gf2e
      @gf2e 8 місяців тому

      @@michaelsegal3558That’s because it is a dollar sign.

  • @joshdavidian
    @joshdavidian 2 роки тому

    Am I listening to the good version of Agent Smith from the Matrix?

  • @JarppaGuru
    @JarppaGuru 4 місяці тому

    13:11 there it is LSR not shift and INVERT. it wont invert value its allready 1 if button was pressed. your graph show it invert, bcoz u thing controlled do what you say, but looking 4021 chip its doing opposite with those pullup resistors and input are inverted button press is 1. code not invert
    why cant we just read $4016 when data is there or there is circuit when read it clock and new serial bit come
    and LSR shift right bit 0 move to carry and in not INVERTED
    and i was nice i tested it button is 1 i know circuits you not know 6502 LOL
    LSR not invert bit its allready 1 when button is pressed. now you know

  • @codycast
    @codycast 2 роки тому

    Why do games have to go and ask the controller what buttons are being pressed? Why doesn’t the NES do it itself and tell the game?

    • @NesHacker
      @NesHacker  2 роки тому

      I think it is to allow for more complex controllers or specific ones for games. The controller ports are basically just serial ports so it wouldn’t even have to be a controller plugged in.

    • @codycast
      @codycast 2 роки тому

      @@NesHacker cool thanks for the comment

  • @chad55009
    @chad55009 2 роки тому

    Loved the video, but hate when people ask me to like it before I even watch it...

    • @NesHacker
      @NesHacker  2 роки тому

      Yeah a lot of people get *really* angry for call-outs like that. It’s a method that is often espoused by “insiders” and the like when you google stuff like “increase subscribers”, etc. I tried it out, but honestly, I can take it or leave it. Decided to simply ask at the end of the next video. The biggest problem is this, though: people who would indeed have liked or subscribed often forget to do so without call outs. So I’m kinda stuck, right? More subs and likes are good, but pissing people off is bad.

  • @allwaizeright9705
    @allwaizeright9705 Рік тому

    You push a BUTTON and it RESPONDS - There I saved some time for a lot of PEOPLE.... Actually - It is quite interesting how early and then later controllers worked...

  • @DaveRG
    @DaveRG 2 роки тому

    Ñpñ

  • @xfallofmanx
    @xfallofmanx Рік тому

    Why do people do that “up-down-up-down” talking thing when they read stuff in front of a camera? Just say the things 😂 no need to bash us over the head with weird inflections. I swear that social media has changed the way people present information for the worse lol

    • @NesHacker
      @NesHacker  Рік тому +1

      Reading something “normally” is much harder than you’d expect. If you watch across multiple videos you can see my voice pattern changes quite a bit, and more recently I’ve tried my best to get away from that particular pattern. That said, it’s still rough… especially when everything is completely scripted.

  • @RobeonMew
    @RobeonMew 2 роки тому

    don't remind me to sub amd like, otherwise I don't.

    • @sa3270
      @sa3270 2 роки тому +1

      Don't forget to ring the bell.

  • @feralshad0w
    @feralshad0w 3 місяці тому +1

    Blah blah blah... Why are the a and b buttons not in alphabetical order?