![]() |
Routines |
| Prev: FCAB | Up: Map | Next: FD0C |
|
Used by the routine at Wait_KeyWithMenuMusic.
One tick of the two-channel menu tune while the key-scan waits. Reads both stream cursors, looks each byte up in Table_MenuMusicDelay, then either bit-bangs the speaker on port FE (toggling bit 04 via 10) or takes the Continue_MenuMusicTick continue path. Called every pass of Wait_KeyWithMenuMusic_Loop.
|
||||
| Play_MenuMusicTick | FCB3 | LD HL,$FC87 | Point HL at music cursor one (FC87). | |
| FCB6 | CALL Read_MusicStreamByte | Call Read_MusicStreamByte to read the next stream-one byte. | ||
| FCB9 | LD ($FC84),A | Store it at MenuMusic_Workspace. | ||
| FCBC | LD HL,$FC8B | Point HL at music cursor two (FC8B). | ||
| FCBF | CALL Read_MusicStreamByte | Call Read_MusicStreamByte to read the next stream-two byte. | ||
| FCC2 | LD ($FC85),A | Store it at FC85. | ||
| FCC5 | LD HL,$FC84 | Point HL at stream-one's stored byte (MenuMusic_Workspace). | ||
| FCC8 | CALL Decode_MusicDelay | Call Decode_MusicDelay to decode its delay pair. | ||
| FCCB | RL E | Rotate E left through carry to test the channel flag. | ||
| FCCD | JP C,Continue_MenuMusicTick | If carry is set, jump to Continue_MenuMusicTick for the continue path. | ||
| FCD0 | PUSH HL | Stash the decoded delay on the stack. | ||
| FCD1 | LD HL,$FC85 | Point HL at stream-two's stored byte (FC85). | ||
| FCD4 | CALL Decode_MusicDelay | Call Decode_MusicDelay to decode its delay pair. | ||
| FCD7 | POP DE | Restore stream-one's delay into DE. | ||
| FCD8 | LD A,H | If stream-one's duration is not 01, jump to Play_MenuMusic_PreparePulse. | ||
| FCD9 | DEC A | |||
| FCDA | JR NZ,Play_MenuMusic_PreparePulse | |||
| FCDC | LD A,D | If stream-two's duration is 01, jump to Hold_MenuMusicSilence. | ||
| FCDD | DEC A | |||
| FCDE | JR Z,Hold_MenuMusicSilence | |||
|
Prepare the speaker output value and enter the tone pulse loop.
|
||||
| Play_MenuMusic_PreparePulse | FCE0 | LD A,($FC8F) | Load the delay phase from FC8F into C and clear B. | |
| FCE3 | LD C,A | |||
| FCE4 | LD B,$00 | |||
| FCE6 | LD A,($FC86) | Load the border and speaker bits from FC86. | ||
| FCE9 | EX AF,AF' | Switch to the alternate accumulator. | ||
| FCEA | LD A,($FC86) | Reload the border and speaker bits from FC86. | ||
| FCED | LD IXh,D | Keep the inner delay count in IXh. | ||
| FCEF | LD D,$10 | Load D with 10 (speaker bit mask). | ||
|
This entry point is used by the routine at Play_MenuMusic_PulseTail.
Inner tone loop: burn delay, write port FE, and toggle the speaker bit.
|
||||
| Play_MenuMusic_PulseLoop | FCF1 | NOP | Timing pad before the port write. | |
| FCF2 | NOP | |||
|
This entry point is used by the routine at Play_MenuMusic_PulseTail.
Write the speaker level and advance the dual delay counters.
|
||||
| Play_MenuMusic_PulseWrite | FCF3 | EX AF,AF' | Switch back to the primary accumulator. | |
| FCF4 | DEC E | Decrease the fine delay in E. | ||
| FCF5 | OUT ($FE),A | Write the border and speaker bits to port FE. | ||
| FCF7 | JR NZ,Play_MenuMusic_PulseTail | If the fine delay remains, jump to Play_MenuMusic_PulseTail. | ||
| FCF9 | LD E,IXh | Reload the fine delay from IXh. | ||
| FCFB | XOR D | Toggle the speaker bit (10) in A via D. | ||
| FCFC | EX AF,AF' | Switch to the alternate accumulator. | ||
| FCFD | DEC L | Decrease the coarse delay in L. | ||
| FCFE | JP NZ,Play_MenuMusic_PulseTailWrite | If the coarse delay remains, jump to Play_MenuMusic_PulseTailWrite. | ||
|
This entry point is used by the routine at Play_MenuMusic_PulseTail.
Reload the coarse delay from H and keep pulsing.
|
||||
| Play_MenuMusic_ReloadCoarse | FD01 | OUT ($FE),A | Write the speaker level to port FE. | |
| FD03 | LD L,H | Copy H into L to reload the coarse delay. | ||
| FD04 | XOR D | Toggle the speaker bit (10) in A via D. | ||
| FD05 | DJNZ Play_MenuMusic_PulseLoop | Decrease B and loop to Play_MenuMusic_PulseLoop while the outer count remains. | ||
| FD07 | INC C | Advance the phase counter in C. | ||
| FD08 | JP NZ,Play_MenuMusic_PulseWrite | If the phase remains, jump to Play_MenuMusic_PulseWrite. | ||
| FD0B | RET | Return. | ||
| Prev: FCAB | Up: Map | Next: FD0C |