Jump to content
IGNORED

Joy2b+ Discussion


Recommended Posts

Splitting this off into its own thread …

 

It seems that perhaps Grizzards is the first 2600 game to use Joy2b+ controllers. I thought I'd open up a thread to discuss them a little.

 

I'm just gonna mention that RetroGameBoyz makes lovely NES-style Joy2b+ game pads, which is what I use, although I believe there are a few other sources out there as well.

 

 

 

Getting Joy2b+ support into your game

 

As we all probably know, the basic CX-40 joystick's FIRE button is mapped to INPT4 on the 2600. This same control is also the B button on the Genesis (MegaDrive) controller, and the I button on Joy2b+

bit INPT4
bpl ButtonIPressed

The Genesis controller's A and Start buttons are effectively unavailable on the 2600, but its C button is mapped to INPT1, and can be read in much the same way. However, you need to confirm that a Genesis pad exists first with a short sequence. First, you'll want to dump INPT[0123] to ground by setting bit 7 of VBLANK, eg

lda #$80
sta VBLANK

Then, wait about a frame and check whether both pins are clear, eg, in Grizzards I set a flag during startup like so:

          lda INPT0
          bpl NotGenesis

          lda INPT1
          bpl NotGenesis

          lda SystemFlags
          ora #SystemFlagP0Gamepad
          bne DoneGenesis            ; always taken (gne)

NotGenesis:
          lda SystemFlags
          and #~SystemFlagP0Gamepad
DoneGenesis:
          sta SystemFlags

The Joy2b+ works essentially the same as a Genesis controller, in that Button I = B and Button II = C. The only new wrinkle is that Button III is also available, on INPT0.

 

My reading routines are in my common VBlank code, but it's fraught with debouncing logic and not the cleanest example.

 

 

 

Getting Joy2b+ support into Stella

 

This leads to a second wrinkle … support in Stella. You can set the controller type to Genesis and access Button I & II (as B & C) just fine, but you can't test Button III without hardware.

I certainly don't want to rush anyone — I understand the motivations for the current break — but perhaps we all can help out the Stella team, as well.

 

I've taken a whack at the easy part of Stella support, over here: https://github.com/brpocock/stella/tree/joy2b%2B … that is, mapping the keyboard events, and adding the Joy2b+ controller type, and a debugger widget for it.

 

That fork mostly seems to work, but has a double-free-memory crash-on-exit that I haven't tried to track down in any detail, but I'm sure is some foolish mistake on my part — my C++ chops are easily 10 years out-of-date.

 

The harder part will be to auto-detect a Joy2b+ controller, without breaking auto-detection for the keyboard controller. In the ControllerDetector class, the heuristic used to detect the keyboard is to identify reads from both INPT0 and INPT1. My thought in that direction is that perhaps the keyboard controller auto-detect might be enhanced to also look for a write to the digital pins that the keyboard uses for row selection, as it would be unusual (and not useful) to write to the gamepad's directional controls. I have not done any coding in that direction, yet, however.

  • Like 3
Link to comment
Share on other sites

11 minutes ago, Bruce-Robert Pocock said:

The harder part will be to auto-detect a Joy2b+ controller, without breaking auto-detection for the keyboard controller.

I have experimented a bit and it seems sufficient to exclude games accessing SWCHA from keyboard controller detection (except for MagiCard, which needs a workaround or properties set). This seems to work for all existing keyboard ROMs.

  • Thanks 1
Link to comment
Share on other sites

1 minute ago, Thomas Jentzsch said:

I have experimented a bit and it seems sufficient to exclude games accessing SWCHA from keyboard controller detection (except for MagiCard, which needs a workaround or properties set). This seems to work for all existing keyboard ROMs.

That is awesome :D Perhaps I'll get a chance tonight to improve my fork with that logic as well. At that rate, I may have a PR waiting for y'all in a week.

Link to comment
Share on other sites

Note; the Joy2b+ protocol is different from, and incompatible with, the 7800's two-button mechanism. You can use Joy2b+ on the 7800 — if a game supports it — but you can't use a 7800 ProLine type controller on the 2600.

 

(So if you're looking at buying one, anything that says “2600/7800” will not work with Joy2b+/Genesis mode … the Joy2b+ stuff is usually marked for Atari 8-bits machines.)

Edited by Bruce-Robert Pocock
edit
Link to comment
Share on other sites

6 hours ago, Thomas Jentzsch said:

@Bruce-Robert Pocock Do you know if any of the 2600-daptors supports Joy 2B+?

 

And the Joy 2B+ works like a Booster Grip, just with reversed bits, right? Nevermind :)

I do not know … my Stelladaptor I reflashed to test AtariVox in Stella. I imagine I could reflash it back and find out at some point in near future, however.

 

If they work with paddles, then I imagine they would do fine with it, however …

Edited by Bruce-Robert Pocock
PS
Link to comment
Share on other sites

For completeness, let me point out that https://github.com/ascrnet/Joy2Bplus is the (canonical?) description of the protocol and has descriptions of altering various devices to work with it, and a number of 8-bit Atari games that work with it. Note the last section shows that it is fairly simple to alter a Genesis/MegaDrive controller if you'd like. (tiny amount of soldering involved)

Link to comment
Share on other sites

  • 10 months later...

As of 3/11/2023, the 2600-daptor II has support for Joy2B+ controllers (Thanks Hafner Enterprises!)

http://www.2600-daptor.com/2600-daptor.htm

 

The Joy2B+ extra buttons are mapped as Buttons 3 and 4 (where the main Atari fire button is Button 1).

 

I have actual 2600-daptor II hardware and Joy2B controllers - please let me know if you need me to test anything in Stella.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...