Prev: AF9A Up: Map Next: AFF2
AFDC: Play Rest
Used by the routine at PlayNote.
Waits for the length of a rest, which is one to four beats.
Input
DE The address of the rest
Output
DE The address after the rest
Work out the length of the rest in beats.
PlayRest AFDC LD A,(DE) Fetch the rest.
AFDD INC DE Move on to the next note.
AFDE RLCA Rotate the length bits into the bottom of the byte.
AFDF RLCA
AFE0 AND %00000011 Keep them.
AFE2 INC A Add one to get the length in beats.
AFE3 LD L,A Copy the length into L.
AFE4 LD BC,$430B Set the length of a beat.
Wait for each beat.
PlayRest_Beat AFE7 PUSH BC Stash the length of a beat on the stack.
PlayRest_Wait AFE8 DEC BC Count down.
AFE9 LD A,B Jump to PlayRest_Wait if the count is not zero.
AFEA OR C
AFEB JR NZ,PlayRest_Wait
AFED POP BC Retrieve the length of a beat.
AFEE DEC L Count down the beats.
AFEF JR NZ,PlayRest_Beat Loop back until the rest is over.
AFF1 RET Return.
View the equivalent code in;
Prev: AF9A Up: Map Next: AFF2