summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2015-11-01 20:44:12 -0800
committerMichael Pavone <pavone@retrodev.com>2015-11-01 20:44:12 -0800
commita7220a5647adc1a59d172df7391314a9c58e61d5 (patch)
tree3b20dea10c08eb93e211cd26bc384ba3b7a5f6f9
parentf20323f1b81d0dd575868705946f6a5e449ddf67 (diff)
Fix mapping of key on/off reg bits to operators
-rw-r--r--ym2612.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ym2612.c b/ym2612.c
index 864081c..7fb5b91 100644
--- a/ym2612.c
+++ b/ym2612.c
@@ -691,8 +691,9 @@ void ym_data_write(ym2612_context * context, uint8_t value)
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;