Please take a look at source on github - the compiled result is 190 bytes - any size optimizations are welcome!
Not much to optimize, except maybe:
- in "; receive content", increment Y instead of the low byte of zdst to make the 16 bit increment faster
- have "setup_slave" in the main code to avoid the cost of the jsr/rts
- modify " ; receive 6 bytes header" to load it reversed to avoid the cpy #6
- modify "receive_byte" to return the value in X instead of A, so you can get rid of the PHA/PLA in the routine
Only ONE thing remains unclear for me - the audio mixer...
I've to admit that hardware wise I've no idea how these things are done, obviously we want to avoid volume variance, but we also want to avoid truncation, and as I said earlier, I'd like the Exos to be able to run normal Oric software identical as normal, which means at the very least the master machine should play standard mono YM sound.
I've no idea what the cost and feasibilities of things, but Ibisum mentioned he'd like to have volume control, as well as stereo, the Atari STe had an additional chip, called a Microwire, that allowed this kind of thing, including tweak bass and treble, maybe something similar would work?
I was wondering about something like that:
but my gf said it would not work because of volume change and output voltage when things are perfectly in phase and told me to look at this instead
https://electronics.stackexchange.com/q ... io-signals
EDIT: Somebody actually posted something exactly on this topic on the Commander X 16 Facebook page:
Ellen Larsson
2 hrs
Made a simplified schematic for a combined pan control and headphone output buffer/mixer.
Multiply the pink block by number of AY3 channels.
All values are noncritical beans.
Note that those cross-pots are digitally tapped (so called DPP:s). Commonly available and cheap packages come in duos, triads, and quads. Triads are nice since the AY-3 has three channels. On the other hand, a quad could be used to add a digitally controlled master volume fader to the output if you so wish.
Pan resolution:
It'd be more convenient from a programmers' point of view to limit the resolution to like 32 taps or even less, but it is actually cheaper to have a 7bit or even 8bit DPP chip so why not. That provides midi-like smoothness to the pan control. With a bit of search you can probably get a suitable chip up to the task for about a dollar. Another practical tradeoff is that logarithmic DPP:s (which would be ideal for audio) are a bit more expensive and usually only comes in dual chips (which adds more to the total in itself), but linear is fine. With a resolution this smooth, you can devise a response curve in software if you so wish.
Relative volume between AY3 and gameduino:
Some hard-wired R mix adjustments between the Gameduino outs and the AY-3 outs are in order. I just assumed a give or take 1:1 mix ratio, which is probably naive now that i think of it. The more ay-3 channels, the weaker they should be in comparison to the stereo out of gameduino. Also, i don't think we know the relative difference in amplitude between gameduino and ay3 at this point.
tl;dr:
Anyway, so this gives the programmer full control to customize how AY3 channels are panned: All-mono (zx spectrum / sunsoft 5b style), hard panned "turbo" style, more modern/subtle, or even on the fly programmable for spatial effects.
See: facebook.com/groups/CommanderX16/permalink/422154388535661/ [Closed Group]