English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 02 August 2017, 23:32   #41
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,160
Toni, in a previous message you answered to

Quote:
what could explain that some games work OK with the joystick, but when you plug in a CD32 joypad, red button is not recognized? (ex: Moktar, and another one I don't remember)
by

Quote:
I guess they have 3rd button line active forcing pad in CD32 pad mode.
I can't imagine they're doing that on purpose (this isn't even a 2-button compatible game). And how to reset that? (I have another issue in another slave, I figured that I could reuse Asman/others ReadJoyPad code bits to do:

Code:
	moveq	#CIAB_GAMEPORT1,d3	; red button ( port 1 )
	bset	d3,ciaddra(a1)	;set bit to out at ciapra
	bclr	d3,ciapra(a1)	;clr bit to in at ciapra
before reading the button and

Code:
	bclr	d3,ciaddra(a1)		;set bit to in at ciapra		
	or.b	#$C0,ciapra(a1)	;reset port direction
afterwards. Would that be OK? and the bugs reported by many users about this damn red/fire button not registering on CD32 don't happen in WinUAE. Is that normal? I'd very much like this "feature" implemented so I could debug a lot of those issues...
jotd is offline  
Old 03 August 2017, 01:55   #42
robinsonb5
Registered User
 
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,153
Quote:
Originally Posted by jotd View Post
I can't imagine they're doing that on purpose (this isn't even a 2-button compatible game). And how to reset that?
Look for writes to POTGO ($dff034).
Normally to have the middle and right mouse buttons (or two extra joystick buttons on pins 5 and 9) readable on each port, you'd write $ff00 to POTGO - if bits 8, 9 (port 1), or 12 or 13 (port 2) are low, then pin 5 won't be pulled up to 5v so the CD32 pad will be in shift-register rather than direct mode. (Most games probably won't write anything to POTGO, assuming that the system's left it in a sane state. The troublesome ones are probably writing an ill-considered value.)

Incidentally, in your CD32 pad reading code, after reading the buttons I'd restore POTGO by writing $ff00 to it, not $ffff - the latter is asking the chipset to put the ports in digital i/o mode, set pins 5 and 9 high, and then dump the capacitors and start the analogue counters - which makes no sense with the pins in digital mode.
robinsonb5 is offline  
Old 03 August 2017, 19:13   #43
Amiga1992
Registered User
 
Join Date: May 2001
Location: ?
Posts: 19,644
Sorry to butt in, don't have much to he;p with :/ but I remember someone here mentioning that if you would rewrite the pad reading routines, you could natively support a 3 button Megadrive pad without modifications. Is that true?

If so, while you guys are looking at joypad reading code, it would be a great addition to have. 3+1 buttons would be excellent, and those are much cheaper and easier to find than CD32 pads
Amiga1992 is offline  
Old 04 August 2017, 10:39   #44
robinsonb5
Registered User
 
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,153
Quote:
Originally Posted by Akira View Post
Sorry to butt in, don't have much to he;p with :/ but I remember someone here mentioning that if you would rewrite the pad reading routines, you could natively support a 3 button Megadrive pad without modifications. Is that true?

If so, while you guys are looking at joypad reading code, it would be a great addition to have. 3+1 buttons would be excellent, and those are much cheaper and easier to find than CD32 pads
You can read two buttons of a megadrive pad without modifications. Technically it will be drawing a small amount of power from a signal pin rather than the power pin to run its multiplexing electronics, but in practice that's harmless. You do need to swap pins 5 and 7 in order to have control over the button multiplexing.
robinsonb5 is offline  
Old 04 August 2017, 12:01   #45
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
I remember someone (possibly Toni) saying before that different versions of kickstart have different default settings for the POTGO registers, so if a game is written for one and assumes the POTGO contents are set the way it needs them, it may not work with other kickstart versions where this is not true. Such a difference won't show up when using a single button controller, so you might only see it if you try to use a CD32 pad (or Megadrive pad for that matter) with such game/kickstart combinations.

Edit: Yep, here it is: http://eab.abime.net/showpost.php?p=989662&postcount=26
So if games for a 1.3 machine don't explicitly write to POTGO, they might work with multi-button controllers under 1.3 but not 2.0+.

Last edited by Daedalus; 04 August 2017 at 12:07.
Daedalus is offline  
Old 04 August 2017, 12:51   #46
robinsonb5
Registered User
 
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,153
Quote:
Originally Posted by Daedalus View Post
I remember someone (possibly Toni) saying before that different versions of kickstart have different default settings for the POTGO registers, so if a game is written for one and assumes the POTGO contents are set the way it needs them, it may not work with other kickstart versions where this is not true.
Good point - so the troublesome games may in fact be those that aren't writing to POTGO at all.
robinsonb5 is offline  
Old 04 August 2017, 16:34   #47
Amiga1992
Registered User
 
Join Date: May 2001
Location: ?
Posts: 19,644
Quote:
Originally Posted by robinsonb5 View Post
You can read two buttons of a megadrive pad without modifications. Technically it will be drawing a small amount of power from a signal pin rather than the power pin to run its multiplexing electronics, but in practice that's harmless. You do need to swap pins 5 and 7 in order to have control over the button multiplexing.
So you still need to swap pins 5 and 7. If you do, can you access all buttons on a 3 button Sega pad?
You would need to write support for them, though, right?

A "dongle" swapping those pins should be easy to build.
Amiga1992 is offline  
Old 04 August 2017, 16:46   #48
robinsonb5
Registered User
 
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,153
Quote:
Originally Posted by Akira View Post
So you still need to swap pins 5 and 7. If you do, can you access all buttons on a 3 button Sega pad?
You would need to write support for them, though, right?

A "dongle" swapping those pins should be easy to build.
Yup, the 3-button pads are really easy to support: pin 7 high = buttons B & C on pins 6 and 9. Pin 7 low = buttons A and Start on pins 6 & 9. So yeah, it still needs software support. (The six buttons pads can also be read by pulsing pin 7 with the correct timing - they multiplex the direction lines as well as the fire button lines.)
robinsonb5 is offline  
Old 04 August 2017, 16:52   #49
Amiga1992
Registered User
 
Join Date: May 2001
Location: ?
Posts: 19,644
Quote:
Originally Posted by robinsonb5 View Post
Yup, the 3-button pads are really easy to support: pin 7 high = buttons B & C on pins 6 and 9. Pin 7 low = buttons A and Start on pins 6 & 9. So yeah, it still needs software support. (The six buttons pads can also be read by pulsing pin 7 with the correct timing - they multiplex the direction lines as well as the fire button lines.)
Interesting, was just gonna ask about 6 button pads too.
This would be great to have. I just don't understand why this has not been requested more and realized years ago. Making adapters would be really stupid easy.
Anyway sorry for derailing! But I hope this could be added to CD32Load/WHDLoad too, as I said, CD32 pads are expensive, harder to find, and to be honest, not really good layout-wise.
Amiga1992 is offline  
Old 04 March 2018, 08:13   #50
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,160
Still issues with this damn pad, and it appears that the revision of the A1200 mobo could be the culprit. Check this mantis whdload bug: http://mantis.whdload.de/view.php?id=3141

And that explains a lot: my A1200 is a rev B (probably 2B, don't have it here), and I always had issues with the joypads. However, lowlevel library seemed okay. Is this confirmed, and is there a workaround/fix once and for all? This button thing has been driving me crazy for 20 years now.

Note: it seems that there's a problem reading the buttons on my TF232 (CD32 expansion). Any other ppl with this issue?
jotd is offline  
Old 04 March 2018, 08:38   #51
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
Does it only happen with official CD32 pad or also clones? IMHO They are not 100% identical. Also does the mantis bug happen without Blizzard installed? (This needs to be narrowed down more) Check/ask also CIA revision, is it 391078-01 or -02?
Toni Wilen is online now  
Old 04 March 2018, 08:47   #52
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,160
Toni I only have official CD32 pads (yes, there are even more issues with Honeybee and such). I haven't tested CIA revision on my A1200. I could use your CIAtest tool, I know.

I don't know about the mantis bug, but at the time I seem to remember that I thought that CD32 pad routine was failing because of a CPU dependent issue (because of TST.B $BFE001) but I was told this wasn't the case.
So I tried turning the expansion off and was puzzled to see that even A1200/020 no fast the issue was the same.
(I'm talking about custom CD32 pad read, I never had any issue with lowlevel.library, though)
jotd is offline  
Old 04 March 2018, 09:26   #53
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
I have 2B A1200 (and -01 CIAs) but I don't have official CD32 pad (I really need to find one..)

Could you include source of button reading code that is confirmed not working with 2B+CD32 combination?

EDIT: -01 would explain the problem if CIA is in output mode because -01 bug makes CIA to always return output mode state, not pin's actual state.

EDIT: Does same happen if you tick recent WinUAE's -01 CIA option in advanced chipset panel?
Toni Wilen is online now  
Old 12 March 2018, 23:51   #54
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,160
ok Toni here are the results of my tests (sorry for the delay):

- motherboard revision: it's 1A (oooooold!!)

- ciabuttontest displays :

--*- --*-

when I press fire:

***- ***-
***- --*- (sometimes)

Joyporttest by Psygore (handly tool!):

- CD32 joypad: only red & directions are recognized, lowlevel lib or not!!
- wico joystick #1: same thing
- wico joystick #2: blue button is recognized as well.

Quote:
Could you include source of button reading code that is confirmed not working with 2B+CD32 combination?
I can't include Joyporttest source because Psygore almost never releases his source code. But with lowlevel or without it, it doesn't work.

I tested with one of my latest releases, confirmed working by several EAB members here: http://www.whdload.de/games/Beast3.lha (SOTB 3, source of joypad read is in the install archive: ReadJoyPad.s).

I have added a joypad/joystick automatic detection and it works fine.

Guess what: the game doesn't recognize joypad buttons, not even the blue one, but when I plug my good Wico joystick, the second button works...

Is there a chance to be able to read joypads with a rev 1A A1200 mobo? I have a spare mobo (rev 1D). Maybe I could install that one instead.

Last Q: how can I check CIA revision?
jotd is offline  
Old 13 March 2018, 09:10   #55
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
Quote:
Originally Posted by jotd View Post
I tested with one of my latest releases, confirmed working by several EAB members here: http://www.whdload.de/games/Beast3.lha (SOTB 3, source of joypad read is in the install archive: ReadJoyPad.s).
Do you mean this routine also does not work with your A1200? If yes, could you make it quick and dirty tester program? (Just add interrupt and dma disable, wait for vblank, check buttons, for example flash red background when red is pressed and blue when blue is pressed, preferably also check buttons 3 and 4 because blue is also shared with normal second button, repeat loop forever.)

(I don't want to do it because I want program that is 100% guaranteed "not working". Even vertical position of read may affect results)

EDIT: Does it work if you double or triple number of dummy CIA waits?

Quote:
Last Q: how can I check CIA revision?
Test program result matches -01 model behavior but only 100% sure is to open the cover and check chip labels, 391078-01 or 391078-02. (Check both CIA's, I guess it is also possible other CIA is -01 and another is -02...)

Last edited by Toni Wilen; 13 March 2018 at 10:29.
Toni Wilen is online now  
Old 13 March 2018, 19:38   #56
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,160
Toni I wanted to create a whdload joystick button tester program for a while. I'll do that. With variable delay on the CIA waits, all right.

The color stuff is the debug mode I added in JST because it just drove me CRAZY! (now I know why).

Rev 1A is probably model 01. This is the one where you can create software autofire right? I'll open the machine again tonight.
jotd is offline  
Old 15 March 2018, 13:17   #57
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
Quote:
Originally Posted by jotd View Post
Toni I wanted to create a whdload joystick button tester program for a while. I'll do that. With variable delay on the CIA waits, all right.
That would be good idea. "Standard" test that everyone can run easily and quickly.

I suggested changed CIA waits because this is most likely "analog problem", second and third buttons are connected to Paula POT lines which also have capacitors for analog/paddle position detection.

Capacitors will delay "digital" state changes and if something has drifted too much (old capacitors, increased internal resistance, possibly low +5v line, weak Paula output drivers etc..), it may make state change delays too long.

It may not have anything to do CIAs.

Quote:
Rev 1A is probably model 01. This is the one where you can create software autofire right? I'll open the machine again tonight.
Yes, if software can change button state to released, even when physical button is pressed, it has "broken" (-01) CIA.
Toni Wilen is online now  
Old 15 March 2018, 23:46   #58
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,160
If I can create the ultimate joypad read routine that works with all joypads on all amigas I'll die a happy man.

(not that I'm planning that to happen anytime soon).

Do you think the timings would have an effect with WinUAE?
jotd is offline  
Old 16 March 2018, 00:38   #59
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,856
Quote:
Originally Posted by jotd View Post
If I can create the ultimate joypad read routine that works with all joypads on all amigas I'll die a happy man.

(not that I'm planning that to happen anytime soon)[...]
So do I .
We are waiting updates of JST & CD32Load .
malko is offline  
Old 16 March 2018, 14:46   #60
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
Quote:
Originally Posted by jotd View Post
If I can create the ultimate joypad read routine that works with all joypads on all amigas I'll die a happy man.

(not that I'm planning that to happen anytime soon).
I'd prefer to get non-working one first that works some hardware but not all. I want to find out the real reason. Don't fix it

Quote:
Do you think the timings would have an effect with WinUAE?
No. It would be similar to keyboard hanshake pulse. Different keyboards have different requirements and no one really knows exact (or even close enough) values.
Toni Wilen is online now  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Lincs Amiga User Group aka "LAG" Meeting Confirmed for Sat 2nd of March" rockape News 2 21 February 2013 22:46
"Reminder "Lincs Amiga User Group aka "LAG" Meet Sat 5th of January 2013" rockape News 4 30 January 2013 00:06
CD32 Image-Name-Bug: "...(bla)[!].zip" -> "...(bla)[" / "...[test].zip" -> "...[tes" cfTrio support.WinUAE 8 18 December 2012 16:31
Shadowlands ("Mystery Tour" problem) Bolch support.Games 1 14 December 2007 15:48
Problems with "Thespywholovedme", "Flood", "Shinobi" sareks support.Games 12 03 May 2006 14:52

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:16.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.21752 seconds with 16 queries