comparison psg.c @ 2212:71b0cb7c34a6

Fix PSG white noise LSFR tap
author Michael Pavone <pavone@retrodev.com>
date Sun, 28 Aug 2022 22:49:26 -0700
parents 2648081f3100
children 0d1d5dccdd28
comparison
equal deleted inserted replaced
2211:5e6e589efbad 2212:71b0cb7c34a6
101 if (i == 3 && context->output_state[i]) { 101 if (i == 3 && context->output_state[i]) {
102 context->noise_out = context->lsfr & 1; 102 context->noise_out = context->lsfr & 1;
103 context->lsfr = (context->lsfr >> 1) | (context->lsfr << 15); 103 context->lsfr = (context->lsfr >> 1) | (context->lsfr << 15);
104 if (context->noise_type) { 104 if (context->noise_type) {
105 //white noise 105 //white noise
106 if (context->lsfr & 0x40) { 106 if (context->lsfr & 0x4) {
107 context->lsfr ^= 0x8000; 107 context->lsfr ^= 0x8000;
108 } 108 }
109 } 109 }
110 } 110 }
111 } 111 }