public void set_lenctr_en(bool en) { if (!en) { //If the DMC bit is clear, the DMC bytes remaining will be set to 0 sample_length = 0; //and the DMC will silence when it empties. // (what does this mean? does out_deltacounter get reset to 0? maybe just that the out_silence flag gets set, but this is natural) } else { //only start playback if playback is stopped if (sample_length == 0) { sample_address = user_address; sample_length = user_length; if (out_silence) { timer = 0; out_bits_remaining = 0; } } } //irq is acknowledged or sure to be clear, in either case apu.dmc_irq = false; apu.SyncIRQ(); }
public void set_lenctr_en(bool en) { if (!en) { // If the DMC bit is clear, the DMC bytes remaining will be set to 0 // and the DMC will silence when it empties. sample_length = 0; } else { // only start playback if playback is stopped // Console.Write(sample_length); Console.Write(" "); Console.Write(sample_buffer_filled); Console.Write(" "); Console.Write(apu.dmc_irq); Console.Write("\n"); if (sample_length == 0) { sample_address = user_address; sample_length = user_length; } if (!sample_buffer_filled) { // apparently the dmc is different if called from a cpu write, let's try apu.call_from_write = true; } } // irq is acknowledged or sure to be clear, in either case apu.dmc_irq = false; apu.SyncIRQ(); }