m00dawg wrote:Yeah I'm trying to compile all this somewhat disparate data together. It looks like most solutions are just sending pulses? So all I would need is to add in the NES output section to the routine that handles LSDJ slave output to the GameBoy, maybe plus start/stop - I think
Well I was thinking that by watching the bytes sent out (if midi Thru is part of Arduinoboy code) a sync function would work with both the Arduinoboy in Master or Slave mode. Otherwise you will only output sync when the GB is slave, which may be fine also (?).
The basics of the timing:
Most NSFs are played within the NMI at a refresh of 60Hz. which works out to 3600 calls to the play frame address per Min.
This is the same as a Midi clock running at 150 BPM. The midi Clock messages occur at 24 ppqn, so at 150 BPM: 150 x 24 (ppqn) = 3600 tick bytes per Min. What I'm driving at is with a Clock running at 150 BPM your NSF should sound 'normal'. So there is no heavy math in the firmware, just detect the Midi Tick byte and pulse the trigger button.
The other issue is the connection to the CD4021 in the GamePad. The Buttons are active low logic; I.E. when 'Open' a 10K R pulls the pin high, Closed to GND. So to drive the 4021 pin we need to setup our uC for Open Drain: a 1 = Pin as Input, 0 = active GND. To press a button we Output a 0 and to release, idle the Pin as a Input (neither sourcing or sinking);
1. During Init, set output Pin latch data to 0 for each GamePad button we want.
2. Then switch Pin between Input and Output for triggering a button (output to trigger, input for release). Beware: with the PIC, there are issues with the Read-Modify-Write structure of the ports, but I don't think the AVRs suffer from this.
For Start/Continue/Stop just need to switch the 2nd Pin direction according to the received message; Start/Continue = button pressed, Stop = Button released. FamiSync handles this manually but its a easy change.
The Tick pulse width is still up in the air, but I am starting with 2-3mS. It really depends on the NES code; how responsive the code is reading the controller. Once I get all the hardware running together I'll have a better idea.
m00dawg wrote: While I've made some updates to the ArduinoBoy code to better fit my needs for my custom one, I haven't dug super deep. But it looks like there is room to spare as far as RAM and processing power to add in the NES functions.
The ASM for my 'F628 is like 400 words and uses about 5 ram bytes ATM. So I would guess the Arduino code would be similar.
Yogi