Saturday, February 14, 2009

More AY-3-8910 and YM2149F hacking

One of the last oscillator code bits I need to do is to replicate the Envelope buzzer (and Sync Buzzer) techniques used on those chips.

So again, like with all facets of this project, i just HAD to get my hands dirty!
I used a bread board to experiment (left), and then made a protoboard(right) that proves a bit less flaky than the original. (and well i needed my breadboards for some other stuff)

All my boards now follow a simple setup where I can talk to any 8 bit chips using a serial line (74hc595) and a few chip select lines. I can use either the an Atmel/Arduino/MIDIBoxCore as an interface between the 8bit chip and the PC running Bidule.

It goes without saying that also made a special MIDI encoding for every chip I have on external boards, so that microcontroller code modifications to drive each new chip was minimal (there are limits to my masochistic tendencies)

In short: I can - direct in Bidule- just "type in" the register changes that i need for the chip and then feed the audio back in bidule for analysis and recording... many GB worth of that in fact.

I can also, directly in C++, code MIDI to "Chip register language" transforms to actually get some live musical results out of them.

More boards and pictures soon... Maybe my 1U RACK'ed NES is next :)


  1. I was wondering if you could share your code for interfacing the Arduino with the AY-3-8910. I'm just looking for a place to start because everything I can find in the AY-3-8910 isn't too clear on how to differentiate between picking registers and data input.


  2. Hi sorry i JUST noticed that reply

    The code bit im using is this:

    void AY_SR_Write(unsigned char address, unsigned char value)
    H3 = 0; // CLEAR BDIR (AY Chip)
    H2 = 0; // CLEAR BC1 (AY Chip)
    H3 = 1; // Set BDIR (AY Chip)
    H2 = 1; // Set BC1 (AY Chip)

    SR_WriteBit(address, 0);
    SR_WriteBit(address, 1);
    SR_WriteBit(address, 2);
    SR_WriteBit(address, 3);
    SR_WriteBit(address, 4);
    SR_WriteBit(address, 5);
    SR_WriteBit(address, 6);
    SR_WriteBit(address, 7);

    SR_RCLK = 1; // latch AY values
    SR_DATA = 0; // clear out pin (standby)
    SR_RCLK = 0; // release latch

    H3 = 0; // CLEAR BDIR (AY Chip)
    H2 = 0; // CLEAR BC1 (AY Chip)

    H3 = 1; // R // SET BDIR (AY Chip)
    H2 = 0; // // SET BC1 (AY Chip)

    SR_WriteBit(value, 0);
    SR_WriteBit(value, 1);
    SR_WriteBit(value, 2);
    SR_WriteBit(value, 3);
    SR_WriteBit(value, 4);
    SR_WriteBit(value, 5);
    SR_WriteBit(value, 6);
    SR_WriteBit(value, 7);

    SR_RCLK = 1; // latch AY values
    SR_DATA = 0; // clear out pin (standby)
    SR_RCLK = 0; // release latch

    H3 = 0; // CLEAR BDIR (AY Chip)
    H2 = 0; // CLEAR BC1 (AY Chip)

  3. So. Push register, then push value. (yes i know the registers are 4 bit and not 8, but i do that so that the bit shifting pipeline is always synched)

  4. //more efficient macro-ized version
    #define SR_WriteBit(reg, bit) SR_DATA=0;if((reg>>bit)&1)SR_DATA=1;SR_SCLK=1;SR_SCLK=0;

  5. Hello

    I've hooked up an YM-2149F to an Arduino. I have problems with the audio-output. I got it working with an LM386 amp and a piezo-speaker, but the quality were very bad by some reason..

    Anyhow, I want to be able to connect it to either line-in on a computer sound card or to an external amplifier and speakers, i.e. computer speakers.

    What do I need for that? The things between the 3 channel outputs on the YM-2149F and the 3.5mm jack.

  6. you need to put a charge on the output, else it will not sound right.

    look at the "No OP MIXER Option" of this page for a typical hookup:


    Some signal needs to go to ground.