Jet Set Willy: Routine at 96DE

| Routines

96DE: Play an intro message sound effect

Used by the routine at 87CA.
Input
A | Value between 0x32 and 0x51
96DE | LD E,A | Save the value of A in E for later retrieval
96DF | LD C,$FE | We will output to port 0xFE
96E1 | LD D,A | Copy A into D; bits 0-2 of D determine the initial border colour
96E2 | RES 4,D | Reset bit 4 of D (initial speaker state)
96E4 | RES 3,D | Reset bit 3 of D (initial MIC state)
96E6 | LD B,E | Initialise B (delay counter for the inner loop)
96E7 | CP B | Is it time to flip the MIC and speaker and make the border black?
96E8 | JR NZ,$96EC | Jump if not
96EA | LD D,$18 | Set bits 3 (MIC) and 4 (speaker) of D, and reset bits 0-2 (black border)
96EC | OUT (C),D | Set the MIC state, speaker state and border colour
96EE | DJNZ $96E7 | Jump back until the inner loop is finished
96F0 | DEC A | Is the outer loop finished too?
96F1 | JR NZ,$96E1 | Jump back if not
96F3 | RET |