![]() |
Routines |
| Prev: 64921 | Up: Map | Next: 65003 |
|
Used by the routine at Continue_MenuMusicTick.
Pulse the speaker bit on port 254 for the delay count built by Build_MusicDelayCount. Walks the step mask in D, writing high or low levels or burning timing for clear bits.
|
||||
| Pulse_MenuMusicSpeaker | 64942 | PUSH AF | Stash AF, HL and BC on the stack. | |
| 64943 | PUSH HL | |||
| 64944 | PUSH BC | |||
| 64945 | LD A,(64646) | Load the border and speaker bits from 64646 and clear B. | ||
| 64948 | LD B,0 | |||
| 64950 | LD HL,1000 | Point HL at the pulse period base (1000). | ||
|
Walk the step mask in D and either pulse or burn timing.
|
||||
| Pulse_MenuMusicSpeaker_Step | 64953 | RRC D | Rotate D right through carry. | |
| 64955 | JP NC,Pulse_MenuMusicSpeaker_Burn | If carry is clear, jump to Pulse_MenuMusicSpeaker_Burn for a timing burn. | ||
| 64958 | INC HL | Advance the period pointer. | ||
| 64959 | BIT 0,(HL) | If the selected step bit is clear, jump to Pulse_MenuMusicSpeaker_Low to force the speaker low. | ||
| 64961 | JP Z,Pulse_MenuMusicSpeaker_Low | |||
| 64964 | SET 4,A | Force the speaker bit high in A. | ||
| 64966 | XOR %10000011 | Toggle spare tone bits with 131. | ||
| 64968 | XOR %10000011 | Toggle spare tone bits with 131 again. | ||
|
Write the speaker level and count down the pulse delay.
|
||||
| Pulse_MenuMusicSpeaker_Write | 64970 | OUT (254),A | Write the border and speaker bits to port 254. | |
|
Inner delay between speaker writes.
|
||||
| Pulse_MenuMusicSpeaker_Delay | 64972 | NOP | Timing pad. | |
| 64973 | DEC B | Decrease B and loop to Pulse_MenuMusicSpeaker_Step while the fine count remains. | ||
| 64974 | JP NZ,Pulse_MenuMusicSpeaker_Step | |||
| 64977 | DEC C | Decrease C and loop to Pulse_MenuMusicSpeaker_Step while the coarse count remains. | ||
| 64978 | JP NZ,Pulse_MenuMusicSpeaker_Step | |||
| 64981 | POP BC | Restore BC, HL and AF from the stack. | ||
| 64982 | POP HL | |||
| 64983 | POP AF | |||
| 64984 | RET | Return. | ||
|
Force the speaker bit low, then write it.
|
||||
| Pulse_MenuMusicSpeaker_Low | 64985 | RES 4,A | Clear the speaker bit in A. | |
| 64987 | JR Pulse_MenuMusicSpeaker_Write | Jump to Pulse_MenuMusicSpeaker_Write to write it. | ||
|
Timing burn for a clear step-mask bit.
|
||||
| Pulse_MenuMusicSpeaker_Burn | 64989 | SCF | Set the carry flag. | |
| 64990 | JP NC,0 | Timing pad (JP NC). |
||
| 64993 | JP NC,0 | Timing pad (JP NC). |
||
| 64996 | JP NC,0 | No operations. | ||
| 64999 | NOP | |||
| 65000 | NOP | |||
| 65001 | JR Pulse_MenuMusicSpeaker_Delay | Jump to Pulse_MenuMusicSpeaker_Delay to resume the delay count. | ||
| Prev: 64921 | Up: Map | Next: 65003 |