Prev: 49370 Up: Map Next: 49458
49436: Play Rest
Used by the routine at PlayNote.
Waits for the length of a rest, which is one to four times as long as the shortest. It is used by PlayNote.
Input
DE The address of the rest
Output
DE The address after the rest
Work out the length of the rest in beats.
PlayRest 49436 LD A,(DE) Fetch the rest.
49437 INC DE Move on to the next note.
49438 RLCA Rotate the length bits into the bottom of the byte.
49439 RLCA
49440 AND %00000011 Keep them.
49442 INC A Add one to get the length in beats.
49443 LD L,A Copy the length into L.
49444 LD BC,17163 Set the length of a beat.
Wait for each beat.
PlayRest_Loop 49447 PUSH BC Stash the length of a beat on the stack.
PlayRest_Wait 49448 DEC BC Count down.
49449 LD A,B Jump to PlayRest_Wait if the count is not zero.
49450 OR C
49451 JR NZ,PlayRest_Wait
49453 POP BC Retrieve the length of a beat.
Loop back until the length has been counted down.
49454 DEC L Count down the beats.
49455 JR NZ,PlayRest_Loop Loop back until the rest is over.
49457 RET Return.
View the equivalent code in;
Prev: 49370 Up: Map Next: 49458