groepaz wrote: ↑Mon Feb 05, 2024 1:11 pm
What doesn't work though? (That it sounds different is quite expected - there should be a thread somewhere around here about the new reverse engineered LFSR)
also the quoted code is missing some lines? it should be:
Code: Select all
int bit3 = (noise_LFSR >> 3) & 1;
int bit12 = (noise_LFSR >> 12) & 1;
int bit14 = (noise_LFSR >> 14) & 1;
int bit15 = (noise_LFSR >> 15) & 1;
int gate1 = bit3 ^ bit12;
int gate2 = bit14 ^ bit15;
int gate3 = (gate1 ^ gate2) ^ 1;
int gate4 = (gate3 & enabled) ^ 1;
noise_LFSR0_old = noise_LFSR & 1;
noise_LFSR = (noise_LFSR << 1) | gate4;
"What doesn't work" is that I get no sound at all (ie silence) from 38677 when it is set to 220 and 36878 is set to 15.
I only copy and pasted search results for noise_LFSR because I was looking for assignments to noise_LFSR.
I get no sound at all on channel 3 unless I set the initial value of noise_LFSR to
0x0202. VICE sets the initial value of noise_LFSR to
0x0000. Obviously the version of VICE that's downloadable works and has sound. There may be something in the above code that I'm not understanding.
If initial noise_LFSR = 0x0000, then after this:
Code: Select all
int bit3 = (noise_LFSR >> 3) & 1;
int bit12 = (noise_LFSR >> 12) & 1;
int bit14 = (noise_LFSR >> 14) & 1;
int bit15 = (noise_LFSR >> 15) & 1;
noise_LFSR is still zero. bit3, bit12, bit14 and bit15 are all 0 too.
Code: Select all
int gate1 = bit3 ^ bit12;
int gate2 = bit14 ^ bit15;
gate1 and gate 2 are still 0.
Code: Select all
int gate3 = (gate1 ^ gate2) ^ 1;
int gate4 = (gate3 & enabled) ^ 1;
gate3 would be 0 ^ 1 which is 1.
gate4 would be (1 & enabled) ^ 1 which is 0 if enabled is 1
Code: Select all
noise_LFSR0_old = noise_LFSR & 1;
noise_LFSR = (noise_LFSR << 1) | gate4;
Both noise_LFSR and noise_LFSR_old remain as 0, so subsequent iterations are the same - noise_LFSR is always zero and edge_trigger never gets set below:
Code: Select all
edge_trigger = (noise_LFSR & 1) & !noise_LFSR0_old;
I don't understand how this code is working in VICE. What am I missing?
I doesn't really bother me all that much because I have sound in my own program when I set the initial value to 0x0202 and I've moved on.