I'm trying to write code on an Arduino to emulate a Sega Saturn controller (as part of an adapter project).
The Saturn controller protocol is fairly simple (the pads are actually just the equivalent of 2 TC74HC153A multiplexers).
Basically there's two select lines the console sets high/low and you set 4 data lines high/low as appropriate.
My biggest question is an Arduino NG board actually fast enough to respond? The Sega hardware docs say the console should wait 2 usec after setting the select lines and then read the data lines. My test code is essentially this in the main loop:
do { PINB = datalookup[(PIND & SMASK) >> 2];} while (1)
I read somewhere that & promotes operands to 16 bit integers (which could possibly be slower); but casting to unsigned char didn't help things either.
datalookup is just a 4 element array that contains static bitstrings that represent the state of the data lines. They're setup according to the docs so they set things properly so the pad will be identified+the 'X' button will always register as pushed.
My tests so far haven't met with much success. I think the next step is taking a scope (when I get one!) to the thing so I can verify what is and isn't working. With the timing involved I really can't send any debugging info out the Serial port...
Is my problem likely response time or am I crawling up the wrong tree here?