Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 13:41 29 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PicoMite: PicoGAME VGA development

     Page 27 of 31    
Author Message
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6814
Posted: 02:50pm 25 Jul 2022
Copy link to clipboard 
Print this post

Yes, On 2.0 you can put Atari joysticks on both ports. There is a link that can be used that connects pins 1 and 9 of the port, allowing GP28 to be used as the UP input. LB1 has to be set for UP for GP28, of course. You could dangle such a link in the wiring, I suppose. :)

2.0 also has a 2-position link on GP28, allowing it to go to either SET on the JDY-40 or over to pin 9 of port B. You needn't put that in, of course.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 03:09pm 25 Jul 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  Yes, On 2.0 you can put Atari joysticks on both ports. There is a link that can be used that connects pins 1 and 9 of the port, allowing GP28 to be used as the UP input. LB1 has to be set for UP for GP28, of course. You could dangle such a link in the wiring, I suppose. :)

2.0 also has a 2-position link on GP28, allowing it to go to either SET on the JDY-40 or over to pin 9 of port B. You needn't put that in, of course.


So to be clear if I put a bodge wire from pin 1 to pin 9 of K7 I can test two Atari joysticks on the 1.4 PCB ?

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6814
Posted: 03:15pm 25 Jul 2022
Copy link to clipboard 
Print this post

Correct. All you need to do is write a routine to read the pins:
GP28 - UP
GP4 - Down
GP5 - Left
GP22 - Right
GP15 - Fire

I know the pins are in a daft order, but that's how they worked out. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 03:42pm 25 Jul 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  Correct. All you need to do is write a routine to read the pins:
GP28 - UP
GP4 - Down
GP5 - Left
GP22 - Right
GP15 - Fire

I know the pins are in a daft order, but that's how they worked out. :)


Nps.

I'm putting finishing touches to (pure MMBasic) code to read Atari, NES or SNES controllers on Ports A & B and return a bitmap indicating the current state - and conveniently provided you are only interested in reading the directions and the state of a single fire button (A on the NES = B on the SNES) all 3 controller options will return the same bitmap.

Secondly this code is then being used in the program that creates the "/PicoGAME.ini" file that we discussed earlier in the thread.

Onward and upward, at least until the Challenge 2022 results come in ,

Tom
Edited 2022-07-26 08:37 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Sasquatch

Guru

Joined: 08/05/2020
Location: United States
Posts: 362
Posted: 03:06am 26 Jul 2022
Copy link to clipboard 
Print this post

Below is a photo of my growing NES/SNES game controller collection.

I finally got around to making some temporary adapter cables from parts I had at hand to do some testing.

The two on the left are the Famiclone controllers with the 9 pin D connectors.  These have the epoxy-blob chip and exhibit the Right = 129 issue if they don't receive the "extra clock" pulse.  They work fine reading 16bits (16 clocks) with or without the extra clock pulse reporting only the first 8 bits of data.

The two in the center are old Chinese clone NES controllers with the odd shaped 7 pin NES plug.  They also have their chips obscured under an epoxy blob.  They do NOT exhibit the Right = 129 issue.  These work fine at 8 or 16 bits read with or without the extra clock pulse.

The two on the right are newer clone SNES controllers from AliExpress with the flat 7 pin SNES plugs.  They also have an epoxy blob chip.  They do NOT exhibit the Right = 129 issue.  These work fine at 8 or 16 bits read with or without the extra clock pulse.  These ARE true SNES controllers and report all 12 bits of data correctly.  Note that the buttons are mapped slightly differently than the NES controllers as shown in the post by @thwill above.  The most annoying change in button mapping is that the bits for the "Start" and "Select" buttons are reversed.

I also noted that about half of these cheap clone controllers have a wonky D-Pad where it is difficult NOT to press multiple directions at once.




Edited 2022-07-26 13:09 by Sasquatch
-Carl
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 05:26am 26 Jul 2022
Copy link to clipboard 
Print this post

  Tom said  I'm putting finishing touches to (pure MMBasic) code to read Atari, NES or SNES controllers on Ports A & B

Hi Tom, while playing with the challenge entries I had the idea to produce as series of functions, say PA() and PB().

There would be a version of PA() to read the joystick, one for NES, one for keyboard etcetera on Port A and a similar set of functions for Port B.

The idea was to just tack the appropriate function onto the end of the game program rather than include a whole suite of routines to read all of the types of input and having more logic to select the appropriate one.

ie:
ACTION = PA()

Similar functions could be used for the CMM2 only the pin numbers changed to protect the innocent.  

I cannot recall seeing any mention of the NUNCHUK in reference to the Pico. It should not be too hard to interface one into either Port A and/or B.

Bill
Keep safe. Live long and prosper.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6814
Posted: 08:01am 26 Jul 2022
Copy link to clipboard 
Print this post

Those functions are a neat idea. Almost a pseudocode. Just plug in the one you want. The only argument I can see against it is that it produces a version of the game for a particular controller/joystick/keyboard setup. This is one of those cases where #INCLUDE would be so useful, where the needed routines could be called from storage as needed.

Oddly enough, the very first design for the PicoGAME was roughed out to use the Nunchuck. The problem is that connections to it are on PCB fingers, which will eventually wear, and getting the connector the right way up means that you *have* to provide some sort of cut front panel or other moulding. There appear to be no proper PCB sockets available for them at all now. They are I2C devices, but they all have the same address, so they need individual ports. That's get-roundable, even if it means bit banging them. The port pin arrangements don't work easily for hardware I2C now.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 09:25am 26 Jul 2022
Copy link to clipboard 
Print this post

  Sasquatch said  Below is a photo of my growing NES/SNES game controller collection.


Lighweight!



   - at the far left are the AliExpress 9-pin "NES" gamepads. These all have the Right=129 issue and 25+% of them have the wonky D-Pad issue. I have so many because they were very cheap and I can afford to just give them away.

   - top middle are the AliExpress 9-pin "SNES" gamepads that turned out to have "NES" internals. They don't have the Right=129 issue and have "so far" good D-Pads.

   - front middle is a "New Old Stock" 9-pin Famicom gamepad that I got with my Gigatron kit several years ago. It's a bit unresponsive, possibly because I've had it in pieces so many times.

   - top-right are AliExpress Atari joysticks. They seem to work fine.

   - middle-right is my solderless breadboard "NES" gamepad with a discrete 4021. It works great, though the ergonomics are poor .

   - bottom-right is my perfboard "NES" gamepad with a discrete 4021. It works great, though again the ergonomics are poor .

  Sasquatch said  The two on the right are newer clone SNES controllers from AliExpress with the flat 7 pin SNES plugs.  They also have an epoxy blob chip.  They do NOT exhibit the Right = 129 issue.  These work fine at 8 or 16 bits read with or without the extra clock pulse.  These ARE true SNES controllers and report all 12 bits of data correctly.  Note that the buttons are mapped slightly differently than the NES controllers as shown in the post by @thwill above.  The most annoying change in button mapping is that the bits for the "Start" and "Select" buttons are reversed.


I have a pair of what I suspect are these in the post ... that's annoying about the Start/Select buttons, I've checked my previous post and I'm reasonably certain it is correct.

  Sasquatch said  I also noted that about half of these cheap clone controllers have a wonky D-Pad where it is difficult NOT to press multiple directions at once.


This is as far as I am concerned the biggest problem with this project, it is simply not clear what reliable "new" gamepad can be recommended. There are some "new" gamepads on AliExpress that look like the maroon Famicom controller in the above picture, I might order a couple of those at some point.

Best wishes,

Tom
Edited 2022-07-26 19:45 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6814
Posted: 09:48am 26 Jul 2022
Copy link to clipboard 
Print this post

Perhaps we need some 3D printing.
A pcb with the bits on, for the pad there would be 4 tactile switches (decent make so we get a predictable height and operating force). Then we need a 3D printed disc with a stem on the bottom. The stem would have a rounded end and a hole to accept a self tapping screw. The screw goes up through a hole in the pcb into the stem, but not fully tightened so that the disc rocks to press the tactile switches. The thickness of the disc and length of the stem would have to add up to about 12mm, I think, as we need a usefully long screw so that it doesn't work loose. Four indents in the bottom of the disc could locate over the switches if we don't want the disc to rotate.

The overall size/shape of the PCB can be more or less what we want (but it would be nice if it would fit within 100x100mm). The components can be SMD on the back, if necessary. Even the tactile switches can be SMD parts. I'd prefer not to go too tiny on anything though.

Of course, we can also do whatever we want with buttons. We could have just two or three additional ones. There's no compatibility issue.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 10:06am 26 Jul 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  Perhaps we need some 3D printing.


It could be a "fun" project for someone but I suspect you end up with a controller of comparable cost to the PicoGAME itself.

Hopefully somewhere out there we will find a reliable 3rd party controller ... or buy 2 and throw 1 away.

Best wishes,

Tom
Edited 2022-07-26 20:07 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 10:45am 26 Jul 2022
Copy link to clipboard 
Print this post

  Turbo46 said  Hi Tom, while playing with the challenge entries I had the idea to produce as series of functions, say PA() and PB().


It's an idea Bill, but there are downsides that @Mixtel90 raised, and the actual suite of functions required to support NES, SNES and Atari controllers is pretty small (note how much of the below is actually just comments and strictly speaking you don't need the NES version as the SNES version will handle both).

Extracted from WIP - https://github.com/thwill1000/pico-game-vga/blob/main/software/pg-config.bas

' Reads a port connected to a NES gamepad.
'
' @param idx%   controller port: A = 0 or B = 1.
' @return       bitmap corresponding to current controller state:
'                 7 6 5 4 3 2 1 0
'                 ^ ^ ^ ^ ^ ^ ^ ^
'                 | | | | | | | +-- Button A
'                 | | | | | | +---- Button B
'                 | | | | | +------ Select
'                 | | | | +-------- Start
'                 | | | +---------- Up
'                 | | +------------ Down
'                 | +-------------- Left
'                 +---------------- Right
'
' Note that in theory it should not be necessary to pulse the clock pin after
' reading bit 7 (Right), but in practice there are some clone NES controllers
' which return the wrong value on subsequent reads of bit 7 if it not pulsed.
Function ctrl_read_nes%(idx%)
 Local i%
 Pulse NES_LATCH_PIN%(idx%), NES_PULSE_DURATION!
 For i% = 0 To 7
   Inc ctrl_read_nes%, Not Pin(NES_DATA_PIN%(idx%)) * 2^i%
   Pulse NES_CLOCK_PIN%(idx%), NES_PULSE_DURATION!
 Next
End Function

' Reads a port connected to a SNES gamepad.
'
' @param idx%   controller port: A = 0 or B = 1.
' @return       bitmap corresponding to current controller state:
'                 11 10 9 8 7 6 5 4 3 2 1 0
'                 ^  ^  ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
'                 |  |  | | | | | | | | | +-- Button B
'                 |  |  | | | | | | | | +---- Button Y
'                 |  |  | | | | | | | +------ Select
'                 |  |  | | | | | | +-------- Start
'                 |  |  | | | | | +---------- Up
'                 |  |  | | | | +------------ Down
'                 |  |  | | | +-------------- Left
'                 |  |  | | +---------------- Right
'                 |  |  | +------------------ Button A
'                 |  |  +-------------------- Button X
'                 |  +----------------------- Left Bumper
'                 +-------------------------- Right Bumper
Function ctrl_read_snes%(idx%)
 Local i%
 Pulse NES_LATCH_PIN%(idx%), NES_PULSE_DURATION!
 For i% = 0 To 11
   Inc ctrl_read_snes%, Not Pin(NES_DATA_PIN%(idx%)) * 2^i%
   Pulse NES_CLOCK_PIN%(idx%), NES_PULSE_DURATION!
 Next
End Function

' Reads a port connected to an ATARI 1-button joystick.
'
' @param idx%   controller port: only port A = 0 is supported.
' @return       bitmap corresponding to current controller state:
'                 7 6 5 4 3 2 1 0
'                 ^ ^ ^ ^ ^ ^ ^ ^
'                 | | | | | | | +-- Fire Button
'                 | | | | | | +---- unused
'                 | | | | | +------ unused
'                 | | | | +-------- unused
'                 | | | +---------- Up
'                 | | +------------ Down
'                 | +-------------- Left
'                 +---------------- Right
Function ctrl_read_atari%(idx%)
 Inc ctrl_read_atari%, Not Pin(ATARI_FIRE_PIN%(idx%))
 Inc ctrl_read_atari%, Not Pin(ATARI_UP_PIN%(idx%)) * 16
 Inc ctrl_read_atari%, Not Pin(ATARI_DOWN_PIN%(idx%)) * 32
 Inc ctrl_read_atari%, Not Pin(ATARI_LEFT_PIN%(idx%)) * 64
 Inc ctrl_read_atari%, Not Pin(ATARI_RIGHT_PIN%(idx%)) * 128
End Function


  Turbo46 said  Similar functions could be used for the CMM2 ...


I'm not climbing into that sack of wasps . Note how the CMM2 hardware includes Nuchuck support and the firmware has easy Nunchuck (and compatible classic controller) support, and still how few programs make use of it.

  Turbo46 said  I cannot recall seeing any mention of the NUNCHUK in reference to the Pico. It should not be too hard to interface one into either Port A and/or B.


I think @Mixtel90 said everything there is to say here, you'd have to build an adapter from DB9 to Nunchuck and then bitbang the I2C protocol because the ports don't bring out the correct pins for the hardware I2C ... another sack of wasps . For better or worse we have NES and Atari controllers to work with and I accept any blame for the former, if only I could identify reliable ones.

Best wishes,

Tom
Edited 2022-07-26 21:36 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6814
Posted: 01:42pm 26 Jul 2022
Copy link to clipboard 
Print this post

I'll have a bit of a think about the DIY controllers. Might be fun. :)
The 3D printed bit is the only real problem, everything else is pretty cheap. You may even get two PCBs out of 100x100mm. The 90x70x28 boxes are cheap if you wanted something suitably housed.

Hmmmmm.....
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 02:11pm 26 Jul 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  I'll have a bit of a think about the DIY controllers. Might be fun. :)
The 3D printed bit is the only real problem, everything else is pretty cheap. You may even get two PCBs out of 100x100mm. The 90x70x28 boxes are cheap if you wanted something suitably housed.


My perfboard controller with the big chunky (Chinese) tac switches rather than a D-pad feels very satisfyingly clicky, but the trimmed component leads on the underside make it is a bit uncomfortable to use for very long. I'm sure it would be very acceptable sandwiched between two rounded rectangles of acrylic though ...

Hmmm ... can you get (cheaply) PCBs with the corners rounded off, if you could then a controller could be made from a sandwich of three PCBs, the bottom would be a blank, the middle would be the actual PCB and the top would be another blank with holes cut out for the tac switches to poke through, the problem might be getting the correct spacers for between the middle and top PCBs.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6814
Posted: 02:58pm 26 Jul 2022
Copy link to clipboard 
Print this post

I shall think.....  :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 06:15pm 26 Jul 2022
Copy link to clipboard 
Print this post

Me again.

I obviously hadn't been paying much attention before, but I was sorting out a couple of gamepads for @Volhout and actually there are significant cosmetic differences between the "NES" gamepads with the "sloppy" D-Pad and those that are actually useful - both sorts display the Right=129 issue though:



The top one is "bad" and the bottom one is "good", differences are:

1. Good ones have grey start/select, bad ones have black.
2. Good ones are a slighly lighter grey colour.
3. Good ones label the red buttons in their bottom-right corners as A, AA, B, BB whereas bad ones label them either top or bottom centre as A, TA, B, TB
4. Good ones have a "model number" GGL/-003 embossed on the back, bad ones just have an empty space where some text is meant to go. Note that I added the white sticker, it will get a black X in it later.
5. Good ones provide more resistance to button pushes - I suspect this is the key difference; I haven't dismantled them but I bet they have better quality rubber/conductive domes under the buttons.
6. Good ones are very marginally thicker.
7. Good ones have a marginally more matt finish on both body and buttons.

The good ones also just feel slightly better made, but that may be psychosomatic because I know they work.

Alas I can find no items on eBay or AliExpress advertised with pictures of the "good" ones, even the listing I bought them from has a picture of the "bad" ones ... and to make matters worse I bought both batches good and bad from the same listing !

So interesting, but basically of no bloody use.

@Mixtel90 - I'm afraid I think you got "bad" ones.
@Volhout - You've won the $5 jackpot as I will send you some of my "good" ones.

Best wishes,

Tom
Edited 2022-07-27 04:20 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1115
Posted: 06:36pm 26 Jul 2022
Copy link to clipboard 
Print this post

  thwill said  
  Mixtel90 said  I'll have a bit of a think about the DIY controllers. Might be fun. :)
The 3D printed bit is the only real problem, everything else is pretty cheap. You may even get two PCBs out of 100x100mm. The 90x70x28 boxes are cheap if you wanted something suitably housed.


My perfboard controller with the big chunky (Chinese) tac switches rather than a D-pad feels very satisfyingly clicky, but the trimmed component leads on the underside make it is a bit uncomfortable to use for very long. I'm sure it would be very acceptable sandwiched between two rounded rectangles of acrylic though ...

Hmmm ... can you get (cheaply) PCBs with the corners rounded off, if you could then a controller could be made from a sandwich of three PCBs, the bottom would be a blank, the middle would be the actual PCB and the top would be another blank with holes cut out for the tac switches to poke through, the problem might be getting the correct spacers for between the middle and top PCBs.

Best wishes,

Tom

The Printing is timeconsuming but not the Problem, the harder thing is the construction part to build the 3d Model ..
I use https://www.tinkercad.com/ for this ..
'no comment
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6814
Posted: 06:36pm 26 Jul 2022
Copy link to clipboard 
Print this post

These are "bad" but they did what they were intended to do.  :)

I'm having fun with a controller design. Did away with the disc-with-stem idea and simply glued a 25mmx5mm thick disc onto a 30mmx3mm thick acrylic disc (both available from ebay). The hole in the box is 25mm clear (could be 26 dia). With 0.8mm tactile switches I would need to pad the pcb with a 0.3mm washer to get it to line up on the pcb pillars in the box. O.5mm washers might actually be realistic. The tactile switches are through-hole 2-pin Alps Alpine at £7.10 for 10 incl. VAT, but I've just grabbed some that looked right. There are cheaper ones. This design of pad leaves an area of open PCB under it, which may come in useful when I get to the electronics.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 06:42pm 26 Jul 2022
Copy link to clipboard 
Print this post

  Martin H. said  The Printing is timeconsuming but not the Problem, the harder thing is the construction part to build the 3d Model ..


You can find multiple "Printable" NES controllers on the net, e.g. https://www.thingiverse.com/thing:22549

Best wishes,

Tom
Edited 2022-07-27 04:43 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6814
Posted: 06:57pm 26 Jul 2022
Copy link to clipboard 
Print this post

The main thing I have at the moment is the ordinary buttons. A 3D model for those would be simple - two cylinders stuck end to end, just solids. At the moment anyway. Still playing. :) You can get switches with built-in caps. If the price is right and the depth is right then it's solved.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Sasquatch

Guru

Joined: 08/05/2020
Location: United States
Posts: 362
Posted: 08:26pm 26 Jul 2022
Copy link to clipboard 
Print this post

  thwil said  Alas I can find no items on eBay or AliExpress advertised with pictures of the "good" ones, even the listing I bought them from has a picture of the "bad" ones ... and to make matters worse I bought both batches good and bad from the same listing !

I received one of each in the same batch with a single order!  On closer inspection they are exactly as you describe.

  thwil said  I have a pair of what I suspect are these in the post ... that's annoying about the Start/Select buttons, I've checked my previous post and I'm reasonably certain it is correct.


Yes, your button mapping is correct.  I was thinking the select and start buttons were different between the NES and SNES controllers, but after checking again, I was mistaken.

After further review, the AliExpress SNES controllers with the flat 7 pin SNES plug are slightly larger, have rounded ends, the D-Pads aren't wonky and they don't have the Right=129 issue.  Overall I like the feel of them.  They are slightly more expensive but the quality seems much better.  I think my current solution will be to transplant some 9pin cables from the wonkier NES controllers to the SNES controllers that came with the 7 pin SNES plugs.  This might not be the ideal solution for everyone.

I'll be interested to hear your impression of them when yours arrive.
-Carl
 
     Page 27 of 31    
Print this page
© JAQ Software 2024