mirror of
https://github.com/bobbimanners/Applecorn.git
synced 2025-01-16 16:30:54 +00:00
ADSR envelope overflow bugfix.
This commit is contained in:
parent
37fce59283
commit
943cce4f70
@ -1,7 +1,10 @@
|
|||||||
* MAINMEM.AUDIO.S
|
* MAINMEM.AUDIO.S
|
||||||
* (c) Bobbi 2022 GPLv3
|
* (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)
|
SYSCLOCK DB $00 ; Centisecond counter (5 bytes)
|
||||||
@ -729,6 +732,7 @@ ADSRPHASE STX OSCNUM
|
|||||||
:S1 TYA ; Change/step -> A
|
:S1 TYA ; Change/step -> A
|
||||||
CLC
|
CLC
|
||||||
ADC CURRAMP,X ; Add change to current amp
|
ADC CURRAMP,X ; Add change to current amp
|
||||||
|
BCS :CLAMP ; If overflow, clamp to target
|
||||||
CMP :TARGET ; Compare with target
|
CMP :TARGET ; Compare with target
|
||||||
BCS :CLAMP ; If target < sum, clamp to target
|
BCS :CLAMP ; If target < sum, clamp to target
|
||||||
BRA :UPDATE
|
BRA :UPDATE
|
||||||
@ -739,6 +743,7 @@ ADSRPHASE STX OSCNUM
|
|||||||
:S2 TYA ; Change/step -> A
|
:S2 TYA ; Change/step -> A
|
||||||
CLC
|
CLC
|
||||||
ADC CURRAMP,X ; Add change to current amp
|
ADC CURRAMP,X ; Add change to current amp
|
||||||
|
BCS :CLAMP ; If overflow, clamp to target
|
||||||
CMP :TARGET ; Compare with target
|
CMP :TARGET ; Compare with target
|
||||||
BCC :CLAMP ; If target >= sum, clamp to target
|
BCC :CLAMP ; If target >= sum, clamp to target
|
||||||
BRA :UPDATE
|
BRA :UPDATE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user