| Routines

29836: Make a sound effect

Used by the routines at 28952, 29716, 29896, 30804 and 32433.
Input
A | Initial border colour
B | Pitch
C | 16 + next border colour
DE | Duration
29836 | PUSH HL |
29837 | LD L,B | Save the pitch parameter in L
29838 | OUT (254),A | Flip the border colour and the state of the speaker
29840 | XOR C
29841 | LD B,L | This is the pitch timing delay
29842 | DJNZ 29842
29844 | DEC E | Jump back unless the sound effect is finished
29845 | JR NZ,29838
29847 | DEC D
29848 | JR NZ,29838
29850 | LD A,1 | BORDER 1 (blue) before returning
29852 | OUT (254),A
29854 | POP HL |
29855 | RET |