# HG changeset patch # User Michael Pavone # Date 1446439452 28800 # Node ID b10cf2c921ad4796429b41fab765fae4ec6c874f # Parent 215b5dabbc20659872e6514a4fe9d6a37f9d08b2 Fix mapping of key on/off reg bits to operators diff -r 215b5dabbc20 -r b10cf2c921ad ym2612.c --- a/ym2612.c Sun Nov 01 20:40:30 2015 -0800 +++ b/ym2612.c Sun Nov 01 20:44:12 2015 -0800 @@ -691,8 +691,9 @@ if (channel > 2) { channel--; } - for (uint8_t op = channel * 4, bit = 0x10; op < (channel + 1) * 4; op++, bit <<= 1) { - if (value & bit) { + uint8_t bits[] = {0x10, 0x40, 0x20, 0x80}; + for (uint8_t op = channel * 4, bit = 0; op < (channel + 1) * 4; op++, bit++) { + if (value & bits[bit]) { if (context->operators[op].env_phase == PHASE_RELEASE) { first_key_on = 1;