[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: apple II 8bit sound programmers



BLuRry wrote:
((A+B)/2) + 128

If you want to avoid 16-bit math then you could do...

A/2 + B/2 + 128 right?
LDA A
LSR
STA zp1
LDA B
LSR
CLC
ADC zp1
ADC #128

Or is that less efficient?  (damn I wish there were ways to add
registers together like you could in an '040)

This overlooks that A and B already have 128 added into them.

All that's needed to average excess-128 samples is:

loop clc
     lda a,y
     adc b,y
     ror
     sta avg,y
<loop and conditional page update code>

-michael

Music synthesis for 8-bit Apple II's!
Home page:  http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it is seriously underused."