Mercurial > repos > blastem
comparison ym2612.c @ 851:b10cf2c921ad
Fix mapping of key on/off reg bits to operators
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 01 Nov 2015 20:44:12 -0800 |
parents | 7068a9db6dd0 |
children | 5de8759b87af |
comparison
equal
deleted
inserted
replaced
850:215b5dabbc20 | 851:b10cf2c921ad |
---|---|
689 uint8_t channel = value & 0x7; | 689 uint8_t channel = value & 0x7; |
690 if (channel != 3 && channel != 7) { | 690 if (channel != 3 && channel != 7) { |
691 if (channel > 2) { | 691 if (channel > 2) { |
692 channel--; | 692 channel--; |
693 } | 693 } |
694 for (uint8_t op = channel * 4, bit = 0x10; op < (channel + 1) * 4; op++, bit <<= 1) { | 694 uint8_t bits[] = {0x10, 0x40, 0x20, 0x80}; |
695 if (value & bit) { | 695 for (uint8_t op = channel * 4, bit = 0; op < (channel + 1) * 4; op++, bit++) { |
696 if (value & bits[bit]) { | |
696 if (context->operators[op].env_phase == PHASE_RELEASE) | 697 if (context->operators[op].env_phase == PHASE_RELEASE) |
697 { | 698 { |
698 first_key_on = 1; | 699 first_key_on = 1; |
699 //printf("Key On for operator %d in channel %d\n", op, channel); | 700 //printf("Key On for operator %d in channel %d\n", op, channel); |
700 context->operators[op].phase_counter = 0; | 701 context->operators[op].phase_counter = 0; |