How Super Nintendo (SNES) controller interfaces with my 8-bit homebrew computer

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 พ.ย. 2024

ความคิดเห็น • 60

  • @Curt_Sampson
    @Curt_Sampson 2 ปีที่แล้ว +10

    Why do you bother reading the last four bits from the shift register? If you read just twelve bits, that should be fine, too, since the next time you make latch active all the bits in the register will be replaced with the parallel input (the current button values) regardless of any shifting that's been done before that, right?

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว +9

      Good point! In theory yes, that's how a shift register works, here I really wanted to mimic the SNES, which performs all the clock cycles.
      That's definitely something I am going to try though!

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว +10

      I confirm that it works, only 11 clock cycles (as after the latch, we have already the first bit on the DATA line) are necessary to get all the buttons!
      Thanks for the remark, I am going to pin your comment so that everyone can see it!
      Reagarding the SNES itself and why it perform 16 clock cycles, my guess is that it's not only due to the controller 16-bit shift register but also due to the console itself which has a 16-bit I/O register used to store the joypad status (CNTRL1L, CNTRL2L, ...). Moreover, in the hardware, it's much simpler to detect when a counter is equal to 16 than dectecting when it's equal to 12, as it's not a power of two.

    • @Curt_Sampson
      @Curt_Sampson 2 ปีที่แล้ว +4

      @@Zeal8bit Good to know that not reading all the bits actually works! It's always nice to have one's theories tested.
      As for why Nintendo reads 17 bits, I read in a forum that it's used for controller detection: the SI (shift input) pin from the shift register at the end of the chain is what you'll read after the 16th shift, and this pin is held low in the controller, causing you to read a zero if the controller is connected. I'll link to this post in another reply since TH-cam tends to swallow any post of mine that has a URL in it.

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว +3

      @@Curt_Sampson The 17th is a very ingenious trick, I didn't know about it!
      So the games could detect when a controller has been disconnected or reconnected

    • @jkobain
      @jkobain 2 ปีที่แล้ว +1

      04:04 note brought me to the comments section with the very same argument.

  • @philtoa334
    @philtoa334 2 ปีที่แล้ว +3

    Nice.

  • @bridiro
    @bridiro 2 ปีที่แล้ว +3

    AMAZING!!!! That's exactly why I am here! I just hope your channel could reach more people in future!

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว +1

      Thank you very much, I hope so!

  • @foxwwweb
    @foxwwweb 2 ปีที่แล้ว +3

    Great work! I feel the Sinclair vibe :)

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว +1

      Thank you for the compliment! 😄

  • @ezrakornfeld8436
    @ezrakornfeld8436 ปีที่แล้ว +1

    You inspired me to make my own 8 bit computer. I went with the 8080 because I didn’t want to completely copy yours. It’s called the 808E because it sounds the same when you say it.

    • @Zeal8bit
      @Zeal8bit  ปีที่แล้ว

      I like the name of your project!
      You can "copy", it's not a problem, the Z80 is very popular, I didn't innovate on that😄
      Keep in mind that powering on an 8080 is more tricky because it requires more voltages than the Z80, which only requires 5V

  • @bulldog8080
    @bulldog8080 2 ปีที่แล้ว +3

    finally a new video! 🤟😎👍

  • @zetaconvex1987
    @zetaconvex1987 2 ปีที่แล้ว +3

    I love how professional-looking your board is. You could probably build your own little button controller using some buttons and an off-the-shelf IC. Hardware back in the day was so SIMPLE. I have been mucking around with USB as an experiment. Jeez, could anything get more complicated? For your system, how to you read the controller? Do you bit-bang, use interrupts, or mapped memory?

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว +1

      Thank you very much, I did put a lot of effort in the board 😄
      Making a controller is totally possible! Few buttons, one parallel to serial shift register and that's it. In fact, I was thinking about making this as part of the video at first, but I didn't want it to be too long.
      The hardware was indeed simple and effective. What bothers me in USB is not the protocol itself but more the software stack on top of it that is really complex.
      I do use bit-bang for the controller because we are not tied to timing and because I have a PIO that makes this easy. In comparison, for the PS/2 keyboard I prefered to add hardware shift registers and generate an interrupt everytime a key is received.

  • @sanhua8337
    @sanhua8337 2 ปีที่แล้ว +5

    I like that you left a user port on Zeal 8-bit computer, leaving lots of space for extensions like adding joysticks, or even Wi-Fi module etc. BTW when can I get some kit, really wanna try it😄

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว +1

      Haha exactly, that was the purpose, let anyone extend the capabilities! The limit is the imagination (and the cost?)

  • @rfgrooteman
    @rfgrooteman 2 ปีที่แล้ว +4

    Great stuff!

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว +1

      Thank you very much 😄

  • @paulspark7287
    @paulspark7287 2 ปีที่แล้ว +4

    Awesome video! I love the sound effect you use when presenting the pins too! Very entertaining.. and I might just have to use one of these types of controller myself since I have one. I would have been lazy and stuck with the Atari/C64 joystick scheme myself.. but I like the idea of something a bit more complex.
    Of course I still have to integrate a CPU to my FPGA yet as you know..

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว

      Thanks for the feedback!
      I would totally advise you to try if you have one already. It's easy and the controller is really good. If you want to interface it with an FPGA, be careful about the DATA line (and other pins too maybe) the controller needs 5V, all recent FPGA I/Os are 3.3V
      The controller won't have any problem recognizing 3.3V signals, but don't plug the DATA line directly to your FPGA without a level-shifter or you'll fry your FPGA I/O. In practice I would even advise you to shift all DATA, LATCH and CLOCK pins with level-shifters.

  • @GregCoonrod
    @GregCoonrod 2 ปีที่แล้ว +3

    This is such a cool project! I hope to be able to do something like it in the future. Keep up the great work :)

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว +1

      Thank you very much!
      With time and patience, it's always possible

  • @nuthenry2
    @nuthenry2 2 ปีที่แล้ว +3

    I wonder if it would be possible to put the rom on the controller interface card and have it auto run the needed drivers, allowing you to use it with any software/games without having to edit the games to have the drivers. you may have to add a config options to the driver so it can work with games that uses different key bindings and maybe a key shift option (press start and the A button is now Z)

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว

      Putting a ROM on the controller interface is completely possible, mainly since the "User port" has an I2C bus. So adding an I2C EEPROM is simple (and cheap).
      I wanted to show in the video how this controller could be interpreted as a keyboard thanks a proper driver and also thanks to the "open device" interface/layer Zeal 8-bit OS offers, but I didn't want to make the video too long.
      I may also need to add support for dynamic driver loading in that case though. That's doable, but needs a bit of work.

  • @retrogamestudios6688
    @retrogamestudios6688 2 ปีที่แล้ว +3

    New viewer here, do u upload often

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว +2

      Welcome to you! I try to upload once a month

    • @retrogamestudios6688
      @retrogamestudios6688 2 ปีที่แล้ว +3

      Hey hey, I'll be there can't wait to see what's next. You on Patreon

  • @DiggOlive
    @DiggOlive 2 ปีที่แล้ว +2

    Is vertical scrolling implemented?

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว

      I implemented vertical scrolling for text mode in the FPGA. So it's hardware scrolling.

  • @ratatus5645
    @ratatus5645 2 ปีที่แล้ว +2

    It will be posible to use the user port for 9-pin style connectors like the sega mega drive or some joysticks?

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว

      Yes! Almost any joystick can be interfaced. However you will need to use the appropriate driver too (or write one) as the protocol is different from the SNES'

  • @ratatus5645
    @ratatus5645 2 ปีที่แล้ว +1

    Are you gonna use fpga for the sound? 'cause there's an fpga emulator for the Yamaha ymf262(opl3)

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว

      Indeed, I am using the FPGA as a sound card too. It's still in development as there are higher priority tasks to do but the goal is to have an easy interface to generate sound (PSG). What I've done so far is a module that receives a duration, a frequency, a waveform and generates the sound out of this. Usually, sound chips are more complex to set up.

  • @kirill_bykov
    @kirill_bykov 2 ปีที่แล้ว +1

    4:04 why do you think you need 16 clocks? Did you try 12?

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว +1

      Check the pinned comment 😉

  • @analebanane508
    @analebanane508 2 ปีที่แล้ว +1

    Hello - I have the following question:
    for what are the 2 "not used" Pins good for?
    I mean are they debugging pins f.e.?

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว

      On the controller side, these pins are not connected to the shift register. On the console side, they are connected are can be controlled by the processor. I guess Nintendo intended to have special peripherals, just like the NES had the Zapper. I don't know if there was such device using these pins on the SNES.

    • @catgirlQueer
      @catgirlQueer ปีที่แล้ว

      @@Zeal8bit there is, the super scope!
      I'd recommend checking out Retro Game Mechanics Explained's video about SNES controllers for more info on what those lines are used for on other controllers

    • @Zeal8bit
      @Zeal8bit  ปีที่แล้ว

      @@catgirlQueer Thanks for the pointer! I am going to check this

  • @octacore4F
    @octacore4F ปีที่แล้ว +1

    Does the Controller even work in games? Or do you have to write drivers or something for that?

    • @Zeal8bit
      @Zeal8bit  ปีที่แล้ว

      If the games use the standard input and the joystick is somehow simulating the standard input, it is possible, without modifying the games!

  • @Defianthuman
    @Defianthuman 11 หลายเดือนก่อน

    One question is the intro music able to be played on the system?

  • @catgirlQueer
    @catgirlQueer ปีที่แล้ว +1

    where did you get the SNES ports from?

    • @Zeal8bit
      @Zeal8bit  ปีที่แล้ว +1

      I bought it on Taobao but I am convinced you can also find it on AliExpress

    • @catgirlQueer
      @catgirlQueer ปีที่แล้ว

      @@Zeal8bit I see, thanks!

  • @vidi0816
    @vidi0816 ปีที่แล้ว

    Awesome.... but my old game is nitendo. May convert to wireless joystick ?

    • @Zeal8bit
      @Zeal8bit  ปีที่แล้ว

      I am not sure to understand. You want to convert your SNES controller to a wireless controller?

  • @bulldog8080
    @bulldog8080 2 ปีที่แล้ว +1

    I forgot to ask but do you recognize me from the discord?

    • @Zeal8bit
      @Zeal8bit  2 ปีที่แล้ว +1

      Haha, yes I recognize you

    • @bulldog8080
      @bulldog8080 2 ปีที่แล้ว

      @@Zeal8bit oh ok maybe do a shoutout?
      ...... Nah just kiding XD