23 October 2012, 09:01 | #101 | ||||
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 828
|
Quote:
Quote:
Quote:
Quote:
|
||||
23 October 2012, 15:01 | #102 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,521
|
Quote:
When will you need output mode? To clock a CD32 game controller perhaps? Quote:
Quote:
Now I'm doing this at the beginning of each frame: Code:
POTGO = $7700 (pin 5 and pin 9 to input) Read POTGOR (bit 14 is button 2 of the second controller) POTGO = $ff01 (all pins output again, recharge capacitors?) |
|||
23 October 2012, 15:32 | #103 | ||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,542
|
Quote:
Check HRM, "Digital I/O on the controller port", second to last chapter that begins with "These lines can also be used for button inputs". Quote:
Not surprising that older UAE versions get confused, emulation was originally made to emulate "standard" usage, it didn't emulate hardware behavior. |
||
23 October 2012, 16:22 | #104 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,521
|
Quote:
But wait, I wrote $ffff, not $ff00. Should that make a difference? |
|
23 October 2012, 16:37 | #105 | ||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,542
|
Quote:
Quote:
|
||
23 October 2012, 20:21 | #106 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 828
|
You are 100% sure that tester has 100% working controller/pad ? In other games ( like The Lost Vikings CD32 version - but not WHDLoad ) controller works ok ?
|
24 October 2012, 09:41 | #107 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,521
|
Of course I'm not 100% sure about that tester. But I have seen the problems myself, last evening, while testing on my A3000.
In my case it works for several seconds and then fails for several seconds again. The state often flips between working (2nd button is recognized) and non-working (2nd button is ignored) after I used a different direction. Although, in the absence of a joypad, I used a mouse for testing the 2nd button. This is hopeless. |
24 October 2012, 11:00 | #108 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,542
|
Just confirming: you do have OS completely disabled? OS vblank routine may write to POTGO.
What kind of mouse? Commodore original or some 3rd party (with possible Amiga/Atari switch). 3rd party mice generally have pullup resistors in button lines, Commodore mice don't. |
24 October 2012, 11:33 | #109 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 828
|
@phx
Can you sent source or program to test it on my machine ( I should have cd32 pad ). Then I will test it this evening. Information: potgo.resource. As I understand correctly WritePotgo function disable ints before write POTGO. but I think that disabling/enabling ints is not necessary if you disabled OS. |
24 October 2012, 13:02 | #110 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,521
|
Quote:
Quote:
http://www.the-liberator.net/site-fi...-044-Mouse.JPG I wonder why the 2nd mouse button is always working fine on the first port... |
||
24 October 2012, 13:15 | #111 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,521
|
Quote:
My joystick routine, current state. Does work on UAE. Does not work on a tester's A1200. Does work on a tester's A2000. Does work sometimes on my A3000. Called every frame: Code:
* * Input devices * * initControllers() * d0=status = readController(d0=port) * include "custom.i" CIAA_PRA equ $bfe001 near a4 code ;--------------------------------------------------------------------------- xdef initControllers initControllers: ; Initialize joystick/joypad controllers. ; Set all POTGO lines to output and pull them up to logical 1. This makes ; sure the 2nd button signal is stable, even when no joypad is connected. move.w #$ff00,POTGO(a6) rts ;--------------------------------------------------------------------------- xdef readController readController: ; Read joystick button and directions for port d0. ; Left is -1, right is 1. Up is -1, down is 1. ; d0 = port (0 or 1) ; -> d0.l = button.b << 24 | updown.b << 16 | leftright.b ; move.w #$7700,POTGO(a6) move.w #$ff00,POTGO(a6) move.l d2,a0 tst.b d0 bne .2 ; port 0, check button moveq #0,d0 btst #2,POTGOR(a6) seq d0 ; 2nd button is 'up' in Sqrxz btst #6,CIAA_PRA bne .1 or.w #$ff00,d0 .1: move.w JOY0DAT(a6),d1 bra .4 ; port 1, check button .2: moveq #0,d0 btst #6,POTGOR(a6) seq d0 ; 2nd button is 'up' in Sqrxz btst #7,CIAA_PRA bne .3 or.w #$ff00,d0 .3: move.w JOY1DAT(a6),d1 .4: move.w d1,d2 lsr.w #1,d2 eor.w d1,d2 ; tst.b d0 ; bne .6 ; do not check up/down, when 2nd button pressed and.b #$01,d2 beq .5 addq.b #1,d0 ; down bra .6 .5: and.w #$0100,d2 beq .6 subq.b #1,d0 ; up .6: swap d0 and.b #$02,d1 beq .7 addq.b #1,d0 ; right bra .8 .7: and.w #$0200,d1 beq .8 subq.b #1,d0 ; left .8: move.l a0,d2 ; move.w #$ff01,POTGO(a6) rts http://www.hasenbraten.de/~frank/sqrxz_2ndbutton.lha Quote:
|
||
24 October 2012, 16:46 | #112 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 828
|
@phx
Thank you for source I will do tests today evening on my A1200. For sure I will change move.w #$ff00,POTGO(a6) in begin of readController into move.w #$6600,POTGO(a6) and on end of this routine I will uncomment move.w #$ff01,POTGO(a6). |
24 October 2012, 16:53 | #113 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,542
|
Note that CD32 pad does have pullups. Make also sure it works with mouse right button (if you have original Commodore mouse), only this test guarantees it works with every pad type!
|
24 October 2012, 16:57 | #114 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,521
|
|
25 October 2012, 14:58 | #115 | |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 828
|
Quote:
I checked my source code with A1200 mouse ( mouse looks like phx mouse ). And I don't have good news. Left mouse button is ok. By when I pressed right mouse button then my code detect also left mouse (same behaviour on my A1200 and on WinUAE 2.4) - I do not check if other bits were set, I just check if bit for LMB (bit $17 in d0 as result of my routine ) is set and check if bit for RMB ($16) is set. When I commented block of code with reading CD32 buttons then mouse works nice on A1200 and on WinUAE 2.4. So I checked how worsk lowlevel.library and .... ReadJoyPort works fine for mouse. I spent some time to figure out ( after some debugging without success I read lowlevel.library autodocs ) that ReadJoyPort routine sense what kind of controller is attached ( but I still don't know where is recognization of controller type). And then it (ReadJoyPort) works like my routine with commented block of code of cd32 pad. But when I call SetJoyPortAttrsA with SJA_Type == SJA_TYPE_GAMECTLR then lowlevel.library (ReadJoyPort call) behave like my original routine (uncommented block of code of cd32 buttons), mean when RMB is pressed then LMB is also pressed. I checked phx code and it works fine on WinUAE 2.4, today I will check with cd32 pad on my A1200. I still don't understand why both mouse button were detected, because my routine checks pins: 5 and 9. Why pin 6 was detected ??? Perhaps my code has some error. Regards Last edited by Asman; 25 October 2012 at 15:06. Reason: added some explanation |
|
25 October 2012, 22:47 | #116 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 828
|
@phx
I checked your routine (with commented section about joystick direction ) with cd32 pad and mouse and works fine ( with or without writting to the potgo) on my A1200. I must recheck my routine, because I'm not sure if works as I expect. |
26 October 2012, 10:35 | #117 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
What I do is write $FF00 to POTGO and %11 to CIAADDRA once for the remainder of the program. I can then read the primary buttons on both ports of course, and the secondary buttons on both ports on a 1D4 A1200, a very early A500, and a late A500 from 1992 (in case the motherboard revision has an effect on these things).
I've only tried this with a 2-button mouse, a regular 1-button joystick and the CD32 joypad though, and I have no controller that connects middle mouse-button or third fire-button on pin 5 to test with. |
26 October 2012, 11:06 | #118 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,542
|
Quote:
|
|
26 October 2012, 11:08 | #119 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,521
|
Even if it works for you, both variants (also Asman's test) already failed on some Amigas, so I cannot rely on them. Maybe this POTGO pullup effect depends on good capacitors, and some Amigas have aged ones...?
Setting CIAADDRA to $03 is the default, so I don't think it is required to write that explicitely? |
26 October 2012, 11:13 | #120 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,542
|
Quote:
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sqrxz 2 for AmigaOCS | vitux | Amiga scene | 11 | 25 November 2013 02:21 |
WTB: Plastic Dust Cover for Amiga 500 & Amiga 600 | S0nic | MarketPlace | 0 | 14 February 2013 16:41 |
Compatibility with Amiga 500 and 500+ games | ErickDF | Amiga scene | 2 | 23 May 2008 20:16 |
WTB: Amiga 600, 500, 500 +, 1200 (NTSC) | JeremyDay | MarketPlace | 2 | 30 November 2006 03:27 |
Will the Amiga 500 or Amiga 1000 run workbench 2? | anim8 | support.Hardware | 12 | 18 August 2001 05:02 |
|
|