There were several issues left unresolved while programing the MIDI IN interface for the ATARI8 joystick ports. The first was to revert back to using the Cassette Motor Control pin on the SIO port for data flow control. This was accomplished with the AU2PORTA shield design.
The second consideration was the startup default joystick pin status. The joystick pins are set to high on startup and then grounded to zero by the joystick switches. There is some reverse logic in all of this that still gives me headaches. An Arduino pin set HIGH will turn on the optocoupler transistor and grounds the Atari Joystick pin resulting in a LOW logic level. The Arduino was programed to set all the joystick direction pins to HIGH at startup. PORTA contained 0. The Arduino inverted the MIDI data, thus the Atari was able to read the MIDI note number directly. This could be made to work but here is where the problem lies……..
I wanted to us an ATARIMAX cartridge to hold the programs to be used to produce the sounds. Read MIDI note number from PORTA (joystick port 1 and 2) and use it as index into the tone tables. The problem lay in the fact that the ATARIMAX menu expected to see the joystick working normally but the Arduino was setting all the pins to ground, thus confusing the ATARIMAX. The problem was temporarily solved by unplugging the Arduino before starting/or restarting the computer. A better solution was required.
The solution was to start with all Arduino data pins set LOW, when the Arduino was started or reset. The curser keys on the Atari could be used to select the menu program and space bar would run it. Then the Arduino would read the MIDI note number and set pins according to bits. The Atari would read PORTA as the inverted number. The Atari then used an EOR #255 command to invert it a second time and then use that number as an index into the frequency table.
This works as long as the MIDI instrument has not send data to the Arduino before turning on the Atari. A MIDI data byte to be sent to the Atari will set the data pins and the trigger, again confusing the AtariMax menu. Press the Arduino reset to clear the serial data buffer and reset the pin logic before restarting the Atari. At least nothing has to be unplugged.
Arduino UNO compatible - AU2PORTA shield - MIDI shield
These are the test programs for the Arduino and Atari used to troubleshoot the data transfer. The Arduino reads the MIDI data stream and picks out a channel 1 note on or note off command. It then sends a note number to the Atari; where it is used to turn on the note or turn it off.
.ATR contains the M65 source Code and related files.
.ZIP of the Arduino sketch.
I think I'm at a good place to decide on my next project. I don't think I will go beyond a mono instrument. Some day I may retry shaping the sound using ADSR envelopes and combine 2 - 16bit tones for some kind of harmonic distortion. Or…………..
There are no comments to display.