Skip to navigation

Revs on the BBC Micro

Sound: MakeSoundEnvelope

Name: MakeSoundEnvelope [Show more] Type: Subroutine Category: Sound Summary: Either make a sound or set up an envelope
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * MakeSound calls MakeSoundEnvelope

Arguments: A The action: * A = 7 make a sound * A = 8 to define a sound envelope X The low byte of the address of the OSWORD block xStoreSound The value of X to restore at the end of the routine
.MakeSoundEnvelope LDY #HI(soundData) \ Set y to the high byte of the soundData block \ address, so (Y X) now points to the relevant envelope \ or sound data block JSR OSWORD \ Call OSWORD with action A, as follows: \ \ * A = 7 to make the sound at (Y X) \ \ * A = 8 to set up the sound envelope at (Y X) LDX xStoreSound \ Restore the value of X we stored before calling the \ routine, so it doesn't change RTS \ Return from the subroutine