![]() |
Routines |
| Prev: FD99 | Up: Map | Next: FDEB |
|
Used by the routine at Continue_MenuMusicTick.
Pulse the speaker bit on port FE 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 | FDAE | PUSH AF | Stash AF, HL and BC on the stack. | |
| FDAF | PUSH HL | |||
| FDB0 | PUSH BC | |||
| FDB1 | LD A,($FC86) | Load the border and speaker bits from FC86 and clear B. | ||
| FDB4 | LD B,$00 | |||
| FDB6 | LD HL,$03E8 | Point HL at the pulse period base (03E8). | ||
|
Walk the step mask in D and either pulse or burn timing.
|
||||
| Pulse_MenuMusicSpeaker_Step | FDB9 | RRC D | Rotate D right through carry. | |
| FDBB | JP NC,Pulse_MenuMusicSpeaker_Burn | If carry is clear, jump to Pulse_MenuMusicSpeaker_Burn for a timing burn. | ||
| FDBE | INC HL | Advance the period pointer. | ||
| FDBF | BIT 0,(HL) | If the selected step bit is clear, jump to Pulse_MenuMusicSpeaker_Low to force the speaker low. | ||
| FDC1 | JP Z,Pulse_MenuMusicSpeaker_Low | |||
| FDC4 | SET 4,A | Force the speaker bit high in A. | ||
| FDC6 | XOR %10000011 | Toggle spare tone bits with 83. | ||
| FDC8 | XOR %10000011 | Toggle spare tone bits with 83 again. | ||
|
Write the speaker level and count down the pulse delay.
|
||||
| Pulse_MenuMusicSpeaker_Write | FDCA | OUT ($FE),A | Write the border and speaker bits to port FE. | |
|
Inner delay between speaker writes.
|
||||
| Pulse_MenuMusicSpeaker_Delay | FDCC | NOP | Timing pad. | |
| FDCD | DEC B | Decrease B and loop to Pulse_MenuMusicSpeaker_Step while the fine count remains. | ||
| FDCE | JP NZ,Pulse_MenuMusicSpeaker_Step | |||
| FDD1 | DEC C | Decrease C and loop to Pulse_MenuMusicSpeaker_Step while the coarse count remains. | ||
| FDD2 | JP NZ,Pulse_MenuMusicSpeaker_Step | |||
| FDD5 | POP BC | Restore BC, HL and AF from the stack. | ||
| FDD6 | POP HL | |||
| FDD7 | POP AF | |||
| FDD8 | RET | Return. | ||
|
Force the speaker bit low, then write it.
|
||||
| Pulse_MenuMusicSpeaker_Low | FDD9 | RES 4,A | Clear the speaker bit in A. | |
| FDDB | JR Pulse_MenuMusicSpeaker_Write | Jump to Pulse_MenuMusicSpeaker_Write to write it. | ||
|
Timing burn for a clear step-mask bit.
|
||||
| Pulse_MenuMusicSpeaker_Burn | FDDD | SCF | Set the carry flag. | |
| FDDE | JP NC,$0000 | Timing pad (JP NC). |
||
| FDE1 | JP NC,$0000 | Timing pad (JP NC). |
||
| FDE4 | JP NC,$0000 | No operations. | ||
| FDE7 | NOP | |||
| FDE8 | NOP | |||
| FDE9 | JR Pulse_MenuMusicSpeaker_Delay | Jump to Pulse_MenuMusicSpeaker_Delay to resume the delay count. | ||
| Prev: FD99 | Up: Map | Next: FDEB |