Prev: C0DA Up: Map Next: C132
C11C: 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 C11C LD A,(DE) Fetch the rest.
C11D INC DE Move on to the next note.
C11E RLCA Rotate the length bits into the bottom of the byte.
C11F RLCA
C120 AND %00000011 Keep them.
C122 INC A Add one to get the length in beats.
C123 LD L,A Copy the length into L.
C124 LD BC,$430B Set the length of a beat.
Wait for each beat.
PlayRest_Loop C127 PUSH BC Stash the length of a beat on the stack.
PlayRest_Wait C128 DEC BC Count down.
C129 LD A,B Jump to PlayRest_Wait if the count is not zero.
C12A OR C
C12B JR NZ,PlayRest_Wait
C12D POP BC Retrieve the length of a beat.
Loop back until the length has been counted down.
C12E DEC L Count down the beats.
C12F JR NZ,PlayRest_Loop Loop back until the rest is over.
C131 RET Return.
View the equivalent code in;
Prev: C0DA Up: Map Next: C132