daver2
10k Member
After a bit more thinking I believe I may have inadvertently reversed the bytes of my frequency table.
I think I am supposed to ADD the fractional parts together first and then ADC the integer parts together.
I will fix this shortly.
I am still confused about the four off RLA instructions that are present though. They make no sense to me (well, today at least)...
The integer part of the sum is stored in register L at the end of the 16-bit addition (I think). This is then used to index the wave table. The value from the wave table (after loading into register A) should be in the range 00 through 3F. This is summed into C - so cannot exceed FF for four voices (i.e. the carry flag should be clear).
After this loop, registers C (and A) should hold the summed amplitude to output to the DAC. However, the overall sum in register A is RLA'd four times. This propagates the (cleared) carry into A? A is then output to the DAC.
Confusing...
Has the OP got any insights?
Dave
I think I am supposed to ADD the fractional parts together first and then ADC the integer parts together.
I will fix this shortly.
I am still confused about the four off RLA instructions that are present though. They make no sense to me (well, today at least)...
The integer part of the sum is stored in register L at the end of the 16-bit addition (I think). This is then used to index the wave table. The value from the wave table (after loading into register A) should be in the range 00 through 3F. This is summed into C - so cannot exceed FF for four voices (i.e. the carry flag should be clear).
After this loop, registers C (and A) should hold the summed amplitude to output to the DAC. However, the overall sum in register A is RLA'd four times. This propagates the (cleared) carry into A? A is then output to the DAC.
Confusing...
Has the OP got any insights?
Dave
Last edited: