mirror of
https://github.com/bobbimanners/Applecorn.git
synced 2024-12-29 05:29:28 +00:00
ADSR envelope overflow bugfix.
This commit is contained in:
parent
37fce59283
commit
943cce4f70
@ -1,7 +1,10 @@
|
||||
* MAINMEM.AUDIO.S
|
||||
* (c) Bobbi 2022 GPLv3
|
||||
*
|
||||
* Applecorn audio code
|
||||
* Applecorn audio code.
|
||||
* This is the implementation of the audio-engine. The code is
|
||||
* device-independent, using the Ensoniq driver in MAINMEM.ENSQ.S
|
||||
* or the Mockingboard driver in MAINMEM.MOCK.S.
|
||||
*
|
||||
|
||||
SYSCLOCK DB $00 ; Centisecond counter (5 bytes)
|
||||
@ -729,6 +732,7 @@ ADSRPHASE STX OSCNUM
|
||||
:S1 TYA ; Change/step -> A
|
||||
CLC
|
||||
ADC CURRAMP,X ; Add change to current amp
|
||||
BCS :CLAMP ; If overflow, clamp to target
|
||||
CMP :TARGET ; Compare with target
|
||||
BCS :CLAMP ; If target < sum, clamp to target
|
||||
BRA :UPDATE
|
||||
@ -739,6 +743,7 @@ ADSRPHASE STX OSCNUM
|
||||
:S2 TYA ; Change/step -> A
|
||||
CLC
|
||||
ADC CURRAMP,X ; Add change to current amp
|
||||
BCS :CLAMP ; If overflow, clamp to target
|
||||
CMP :TARGET ; Compare with target
|
||||
BCC :CLAMP ; If target >= sum, clamp to target
|
||||
BRA :UPDATE
|
||||
|
Loading…
Reference in New Issue
Block a user