+Ripdubski #1 Posted July 17, 2016 Can the CX50 keyboard controllers be used on the computers? If so, are they read the same way as a joystick, or would they be more like a paddle? 12 buttons on the controllers which exceeds the number of joystick values, unless "invalid" joystick values are returned for some buttons. Just curious how it would be read? I found this in a Stella programming guide (image since the text wouldn't paste the table correctly): Thanks Quote Share this post Link to post Share on other sites
Rybags #2 Posted July 17, 2016 They can be used and in similar fashion. The details to read them are in the OS manual and Altirra hw manual. Note that reading these is different to the CX-85 numerical keypad though both attach via a joystick port. The keys are arranged in column/row layout: 1 2 3 4 5 6 7 8 9 * 0 # To select a row to read the 4 PORTA/B bits relevant to the joystick port used should be set to outputs. Then set all outputs to 1 except the one to be scanned. e.g. to read the second row with keys 4, 5, 6 set the relevant bits to 1011 binary. To read which keys are pressed in a row, the columns correspond to PADDLEB, PADDLEA, STRIG in order. So for joystick port 2, you'd be using the top 4 bits of PORTA for row selection then POT3, POT2, STRIG1 to read the rows. Note of course that POT reads take time, but you can use fast POT scan mode (3 scanlines). The OS VBlank Stage 2 initiates Pot Scan each time but doesn't alter the Pot scan mode so you can set it to fast. To read the controllers it'd probably be best to use a DLI, preferably the first available. By that time the fast Pot scan by the OS VB would have finished. Just select each row in order and start a POT scan. You can test the ALLPOT register which will signify when the Pot scan has finished. The CPU cost would be about 12 scanlines but if time's critical you could spread it out, ie use multiple DLIs where each subsequent one reads the keys then sets up the next scan. Quote Share this post Link to post Share on other sites
phaeron #3 Posted July 17, 2016 Just switching to fast pot scan mode and using the OS poll won't work because the POTn registers can fail to update at all. The POTn registers are updated from the master counter whenever the signal is below threshold, and if it's already above that threshold at the start of the scan the POTn register isn't updated at all. You have to temporarily switch to slow pot scan mode to allow the dumping transistors to activate. 1 Quote Share this post Link to post Share on other sites
UNIXcoffee928 #4 Posted July 17, 2016 If 48 switches were laid out, in a row, you could make a four octave synth keyboard for the Atari, using this method. How would the performance be with four of these keyboard controllers plugged into an Atari 800? Could you poll & read the key switches & have the computer generate sound, while still keeping the display on? Quote Share this post Link to post Share on other sites
Rybags #5 Posted July 17, 2016 It wouldn't be a great deal more effort to read 4 controllers vs doing just 1. Do each row scan in parallel. Of course you potentially have a whole buttload of simultaneous button presses to contend with but that'd equally be the case if you could just read the entire matrix as a sequence of registers. With some thought the process could be optimised a bit - given that it's a mix of STrig and Pot inputs that in the end you'd probably just want packed into 10 bits worth per controller. Quote Share this post Link to post Share on other sites
+Ripdubski #6 Posted July 17, 2016 Thanks for all the responses! Quote Share this post Link to post Share on other sites