Thread: Damn Interrupts
View Single Post
Old 24 March 2019, 16:50   #11
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Quote:
Originally Posted by mcgeezer View Post
Nope, a5 and a6 are never changed... ever.
Don't do it. Sooner or later you make some optimized routine that temporarily uses all address registers which in worst case works just fine until (much) later something else changes timing just enough to break it randomly without any clue..

Quote:
Originally Posted by ross View Post
It depends.
CD32 pad have two working mode: "CD32 mode" and "normal mode".
If you want basic CD32 pad support (only the red/blue buttons as 1st and 2nd joy buttons) aka "normal mode" this init should suffice.

/Tech mode on
Pin 5 (MMB) = 1 = output, I/O data = 0 (gnd) -> pad to "CD32 mode", shift register enabled*.
Pin 5 = 0 = input or data = 1 (5v) -> "normal mode", red and blue buttons -> 2 buttons joystick.
This is what I've understood from the mess laying around
But I've never owned a joypad...
*you need a proper routine to read all the buttons state

All the delay / capacitors stuff is for when you use POT in analog mode (bit 0 = 1)
/off

jotd has a ready auto-recognition routine that uses different code depending on what is connected.
And a full "CD32 mode" support.

Toni to confirm/correct me and/or give you more details
It looks correct enough

Capacitors are always connected but they only cause max few tens of microsecond delays when reading buttons using POTGOR bits. No problems as long as you don't do something weird like toggling POTGO data out/in bits and then immediately attempt to read button state

Pot line caps is also the reason why CD32 pad routines have delays (usually by reading CIA register which always takes at least 1 E-clock cycle = ~710KHz)

btw, it is much simpler to read POTGOR first, then set it to $ff00. This way you guarantee there is always more than enough time before next read. This is how KS ROM does it too. (But remember to ignore results of first read..)
Toni Wilen is offline  
 
Page generated in 0.12717 seconds with 11 queries