Prev: 41420 Up: Map Next: 41510
41487: Play Rest
Used by the routine at PlayNote.
Plays a rest, which is a fixed length of silence, in a piece of music.
Input
DE The address of the byte of the music
Output
DE The address of the next byte of the music
PlayRest 41487 LD A,(DE) Fetch the byte of the music again.
41488 INC DE Move onto the next byte of the music.
41489 RLCA Rotate bits 6 and 7 of the note down...
41490 RLCA ...to bits 0 and 1.
41491 AND %00000011 Keep them, but the result is not used.
41493 XOR A Set the multiplier to zero...
41494 INC A ...and then to one.
41495 LD L,A Store it in L.
41496 LD BC,17163 Set the length of the delay.
PlayRest_Loop 41499 PUSH BC Save the length of the delay.
PlayRest_Delay 41500 DEC BC Count the delay down.
41501 LD A,B Combine the two bytes...
41502 OR C ...to test whether it is zero.
41503 JR NZ,PlayRest_Delay Jump back until the delay has finished.
41505 POP BC Restore the length of the delay.
41506 DEC L Decrease the multiplier by one.
41507 JR NZ,PlayRest_Loop Jump back until none remain.
41509 RET Return.
View the equivalent code in;
Prev: 41420 Up: Map Next: 41510