Mercurial > repos > blastem
comparison ym2612.c @ 744:fc68992cf18d
Merge windows branch with latest changes
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 28 May 2015 21:19:55 -0700 |
parents | 8972378e314f |
children | 2317bdca03b4 |
comparison
equal
deleted
inserted
replaced
743:cf78cb045fa4 | 744:fc68992cf18d |
---|---|
519 //printf("address_write_part1: %X\n", address); | 519 //printf("address_write_part1: %X\n", address); |
520 context->selected_reg = address; | 520 context->selected_reg = address; |
521 context->selected_part = 0; | 521 context->selected_part = 0; |
522 context->write_cycle = context->current_cycle; | 522 context->write_cycle = context->current_cycle; |
523 context->busy_cycles = BUSY_CYCLES_ADDRESS; | 523 context->busy_cycles = BUSY_CYCLES_ADDRESS; |
524 context->status |= 0x80; | |
524 } | 525 } |
525 | 526 |
526 void ym_address_write_part2(ym2612_context * context, uint8_t address) | 527 void ym_address_write_part2(ym2612_context * context, uint8_t address) |
527 { | 528 { |
528 //printf("address_write_part2: %X\n", address); | 529 //printf("address_write_part2: %X\n", address); |
529 context->selected_reg = address; | 530 context->selected_reg = address; |
530 context->selected_part = 1; | 531 context->selected_part = 1; |
531 context->write_cycle = context->current_cycle; | 532 context->write_cycle = context->current_cycle; |
532 context->busy_cycles = BUSY_CYCLES_ADDRESS; | 533 context->busy_cycles = BUSY_CYCLES_ADDRESS; |
534 context->status |= 0x80; | |
533 } | 535 } |
534 | 536 |
535 uint8_t fnum_to_keycode[] = { | 537 uint8_t fnum_to_keycode[] = { |
536 //F11 = 0 | 538 //F11 = 0 |
537 0,0,0,0,0,0,0,1, | 539 0,0,0,0,0,0,0,1, |
581 //printf("ym_update_phase_inc | channel: %d, op: %d\n", chan_num, op); | 583 //printf("ym_update_phase_inc | channel: %d, op: %d\n", chan_num, op); |
582 //base frequency | 584 //base frequency |
583 ym_channel * channel = context->channels + chan_num; | 585 ym_channel * channel = context->channels + chan_num; |
584 uint32_t inc, detune; | 586 uint32_t inc, detune; |
585 if (chan_num == 2 && context->ch3_mode && (op < (2*4 + 3))) { | 587 if (chan_num == 2 && context->ch3_mode && (op < (2*4 + 3))) { |
586 inc = context->ch3_supp[op-2*4].fnum; | 588 //supplemental fnum registers are in a different order than normal slot paramters |
587 if (!context->ch3_supp[op-2*4].block) { | 589 int index = (op-2*4) ^ 2; |
590 inc = context->ch3_supp[index].fnum; | |
591 if (!context->ch3_supp[index].block) { | |
588 inc >>= 1; | 592 inc >>= 1; |
589 } else { | 593 } else { |
590 inc <<= (context->ch3_supp[op-2*4].block-1); | 594 inc <<= (context->ch3_supp[index].block-1); |
591 } | 595 } |
592 //detune | 596 //detune |
593 detune = detune_table[context->ch3_supp[op-2*4].keycode][operator->detune & 0x3]; | 597 detune = detune_table[context->ch3_supp[index].keycode][operator->detune & 0x3]; |
594 } else { | 598 } else { |
595 inc = channel->fnum; | 599 inc = channel->fnum; |
596 if (!channel->block) { | 600 if (!channel->block) { |
597 inc >>= 1; | 601 inc >>= 1; |
598 } else { | 602 } else { |