Prev: 44954 Up: Map Next: 45042
45020: 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 45020 LD A,(DE) Fetch the rest.
45021 INC DE Move on to the next note.
45022 RLCA Rotate the length bits into the bottom of the byte.
45023 RLCA
45024 AND %00000011 Keep them.
45026 INC A Add one to get the length in beats.
45027 LD L,A Copy the length into L.
45028 LD BC,17163 Set the length of a beat.
Wait for each beat.
PlayRest_Beat 45031 PUSH BC Stash the length of a beat on the stack.
PlayRest_Wait 45032 DEC BC Count down.
45033 LD A,B Jump to PlayRest_Wait if the count is not zero.
45034 OR C
45035 JR NZ,PlayRest_Wait
45037 POP BC Retrieve the length of a beat.
45038 DEC L Count down the beats.
45039 JR NZ,PlayRest_Beat Loop back until the rest is over.
45041 RET Return.
View the equivalent code in;
Prev: 44954 Up: Map Next: 45042