Prev: E5B2 Up: Map Next: E5D0
E5B3: Sound: Cursor Movement
Used by the routines at Controls_CheckRight and Controls_CheckLeft.
Sound_Cursor E5B3 LD A,($D82F) Load *CurrentCursor_X_Position into A.
The value in C is used as a delay value.
E5B6 RLCA Multiply A by 20 and store the result in C.
E5B7 RLCA
E5B8 RLCA
E5B9 RLCA
E5BA LD C,A
E5BB LD B,$64 Set the number of sound loops in B.
E5BD LD HL,$03E8 In HL set a pointer to an arbitrary area in ZX Spectrum ROM.
Sound_Cursor_Loop E5C0 LD A,(HL) Fetch the byte from ZX Spectrum ROM and store it in A.
E5C1 AND %00011000 Keep only bits 3-4.
E5C3 OR %00000101 Set bits 0, 2.
E5C5 OUT ($FE),A Send to the speaker.
E5C7 INC HL Increment the ZX Spectrum memory byte pointer by one.
E5C8 PUSH BC Stash the sound loop counter on the stack.
E5C9 LD B,C Write the delay value from C into B.
Sound_Cursor_DelayLoop E5CA DJNZ Sound_Cursor_DelayLoop Decrease the delay counter by one and loop back to Sound_Cursor_DelayLoop until the delay counter is zero.
E5CC POP BC Restore the sound loop counter from the stack.
E5CD DJNZ Sound_Cursor_Loop Decrease the sound loop counter by one and loop back to Sound_Cursor_Loop until the sound loop counter is zero.
E5CF RET Return.
Prev: E5B2 Up: Map Next: E5D0