Routines |
Prev: 9691 | Up: Map | Next: 96C9 |
Used by the routine at 87CA. For each of the 99 bytes in the tune data table at 85FB, this routine produces two notes, each lasting approximately 0.15s; the second note is played at half the frequency of the first. Returns with the zero flag reset if ENTER, 0 or the fire button is pressed while the tune is being played.
|
||||||||
96A2 | LD A,(HL) | Pick up the next byte of tune data from the table at 85FB | ||||||
96A3 | CP $FF | Has the tune finished? | ||||||
96A5 | RET Z | Return (with the zero flag set) if so | ||||||
96A6 | LD BC,$0064 | B=0 (short note duration counter), C=100 (short note counter) | ||||||
96A9 | XOR A | A=0 (border colour and speaker state) | ||||||
96AA | LD E,(HL) | Save the byte of tune data in E for retrieval during the short note loop | ||||||
96AB | LD D,E | Initialise D (pitch delay counter) | ||||||
96AC | OUT ($FE),A | Produce a short note (approximately 0.003s) whose pitch is determined by the value in E | ||||||
96AE | DEC D | |||||||
96AF | JR NZ,$96B4 | |||||||
96B1 | LD D,E | |||||||
96B2 | XOR $18 | |||||||
96B4 | DJNZ $96AC | |||||||
96B6 | EX AF,AF' | Save A briefly | ||||||
96B7 | LD A,C | Is the short note counter in C (which starts off at 100) down to 50 yet? | ||||||
96B8 | CP $32 | |||||||
96BA | JR NZ,$96BE | Jump if not | ||||||
96BC | RL E | Otherwise double the value in E (which halves the note frequency) | ||||||
96BE | EX AF,AF' | Restore the value of A | ||||||
96BF | DEC C | Decrement the short note counter in C | ||||||
96C0 | JR NZ,$96AC | Jump back unless we've finished playing 50 short notes at the lower frequency | ||||||
96C2 | CALL $96C9 | Check whether ENTER, 0 or the fire button is being pressed | ||||||
96C5 | RET NZ | Return (with the zero flag reset) if it is | ||||||
96C6 | INC HL | Move HL along to the next byte of tune data | ||||||
96C7 | JR $96A2 | Jump back to play the next batch of 100 short notes |
Prev: 9691 | Up: Map | Next: 96C9 |