Skip to navigation

Sound: DefineEnvelope

Name: DefineEnvelope [Show more] Type: Subroutine Category: Sound Summary: Define a sound envelope
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * MakeSound calls DefineEnvelope

Arguments: A The number of the sound envelope data block to define in the envelopeData table (0 to 5)
.DefineEnvelope STA aStoreEnvelope \ Set (Y X) = envelopeData + (A * 8 - A) * 2 ASL A \ = envelopeData + A * 7 * 2 ASL A \ = envelopeData + A * 14 ASL A \ SEC \ starting with the low byte (we set the high byte in SBC aStoreEnvelope \ MakeSoundEnvelope) ASL A \ ADC #LO(envelopeData) \ Each envelope definition in envelopeData contains 14 TAX \ bytes of data, so this sets A to the address within \ the envelopeData table of the data for the envelope \ number in A LDA #8 \ Set A = 8 for the OSWORD command to define an envelope \ Fall through into MakeSoundEnvelope to set up Y and \ apply the OSWORD command to the (Y X) block, which \ defines the relevant sound envelope