![]() |
Routines |
| Prev: 64683 | Up: Map | Next: 64780 |
|
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 254 (toggling bit 4 via 16) or takes the Continue_MenuMusicTick continue path. Called every pass of Wait_KeyWithMenuMusic_Loop.
|
||||
| Play_MenuMusicTick | 64691 | LD HL,64647 | Point HL at music cursor one (64647). | |
| 64694 | CALL Read_MusicStreamByte | Call Read_MusicStreamByte to read the next stream-one byte. | ||
| 64697 | LD (64644),A | Store it at MenuMusic_Workspace. | ||
| 64700 | LD HL,64651 | Point HL at music cursor two (64651). | ||
| 64703 | CALL Read_MusicStreamByte | Call Read_MusicStreamByte to read the next stream-two byte. | ||
| 64706 | LD (64645),A | Store it at 64645. | ||
| 64709 | LD HL,64644 | Point HL at stream-one's stored byte (MenuMusic_Workspace). | ||
| 64712 | CALL Decode_MusicDelay | Call Decode_MusicDelay to decode its delay pair. | ||
| 64715 | RL E | Rotate E left through carry to test the channel flag. | ||
| 64717 | JP C,Continue_MenuMusicTick | If carry is set, jump to Continue_MenuMusicTick for the continue path. | ||
| 64720 | PUSH HL | Stash the decoded delay on the stack. | ||
| 64721 | LD HL,64645 | Point HL at stream-two's stored byte (64645). | ||
| 64724 | CALL Decode_MusicDelay | Call Decode_MusicDelay to decode its delay pair. | ||
| 64727 | POP DE | Restore stream-one's delay into DE. | ||
| 64728 | LD A,H | If stream-one's duration is not 1, jump to Play_MenuMusic_PreparePulse. | ||
| 64729 | DEC A | |||
| 64730 | JR NZ,Play_MenuMusic_PreparePulse | |||
| 64732 | LD A,D | If stream-two's duration is 1, jump to Hold_MenuMusicSilence. | ||
| 64733 | DEC A | |||
| 64734 | JR Z,Hold_MenuMusicSilence | |||
|
Prepare the speaker output value and enter the tone pulse loop.
|
||||
| Play_MenuMusic_PreparePulse | 64736 | LD A,(64655) | Load the delay phase from 64655 into C and clear B. | |
| 64739 | LD C,A | |||
| 64740 | LD B,0 | |||
| 64742 | LD A,(64646) | Load the border and speaker bits from 64646. | ||
| 64745 | EX AF,AF' | Switch to the alternate accumulator. | ||
| 64746 | LD A,(64646) | Reload the border and speaker bits from 64646. | ||
| 64749 | LD IXh,D | Keep the inner delay count in IXh. | ||
| 64751 | LD D,16 | Load D with 16 (speaker bit mask). | ||
|
This entry point is used by the routine at Play_MenuMusic_PulseTail.
Inner tone loop: burn delay, write port 254, and toggle the speaker bit.
|
||||
| Play_MenuMusic_PulseLoop | 64753 | NOP | Timing pad before the port write. | |
| 64754 | 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 | 64755 | EX AF,AF' | Switch back to the primary accumulator. | |
| 64756 | DEC E | Decrease the fine delay in E. | ||
| 64757 | OUT (254),A | Write the border and speaker bits to port 254. | ||
| 64759 | JR NZ,Play_MenuMusic_PulseTail | If the fine delay remains, jump to Play_MenuMusic_PulseTail. | ||
| 64761 | LD E,IXh | Reload the fine delay from IXh. | ||
| 64763 | XOR D | Toggle the speaker bit (16) in A via D. | ||
| 64764 | EX AF,AF' | Switch to the alternate accumulator. | ||
| 64765 | DEC L | Decrease the coarse delay in L. | ||
| 64766 | 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 | 64769 | OUT (254),A | Write the speaker level to port 254. | |
| 64771 | LD L,H | Copy H into L to reload the coarse delay. | ||
| 64772 | XOR D | Toggle the speaker bit (16) in A via D. | ||
| 64773 | DJNZ Play_MenuMusic_PulseLoop | Decrease B and loop to Play_MenuMusic_PulseLoop while the outer count remains. | ||
| 64775 | INC C | Advance the phase counter in C. | ||
| 64776 | JP NZ,Play_MenuMusic_PulseWrite | If the phase remains, jump to Play_MenuMusic_PulseWrite. | ||
| 64779 | RET | Return. | ||
| Prev: 64683 | Up: Map | Next: 64780 |