Prev: FD76 Up: Map Next: FDAE
FD99: Build Music Delay Count
Used by the routine at Continue_MenuMusicTick.
Build a delay count from the shared phase at FC8F.
Build_MusicDelayCount FD99 PUSH AF Stash AF on the stack.
FD9A LD A,($FC8F) Load FC8F, complement it, and copy the result into B and C.
FD9D CPL
FD9E LD B,A
FD9F LD C,A
FDA0 ADD A,$01 Add 01 so a zero phase still yields a positive count.
FDA2 SRA A Divide A by 04 with two arithmetic shifts right.
FDA4 SRA A
FDA6 LD E,A Copy the scaled count into E.
FDA7 CP $00 If the scaled count is zero, force E to 01.
FDA9 JR NZ,Build_MusicDelayCount_Return
FDAB INC E
Restore AF and return the delay count.
Build_MusicDelayCount_Return FDAC POP AF Restore AF from the stack and return.
FDAD RET
Prev: FD76 Up: Map Next: FDAE