![]() |
Routines |
| Prev: 25514 | Up: Map | Next: 25613 |
|
Used by the routine at LevelComplete.
|
||||||||
| PlayMusic | 25569 | LD A,(DE) | Fetch the next note of the tune. | |||||
| 25570 | CP 255 | Return if the terminator (255) has been reached. | ||||||
| 25572 | RET Z | |||||||
| 25573 | AND %00011111 | Keep only bits 0-4 (the note number). | ||||||
| 25575 | DEC A | Decrease the note number by one (the notes are numbered from one). | ||||||
| 25576 | SLA A | Double it, as there are two bytes for each note in the table. | ||||||
| 25578 | LD C,A | Make this the offset into the note table in BC. | ||||||
| 25579 | LD B,0 | |||||||
| 25581 | LD HL,25613 | HL=NoteTable (the note table). | ||||||
| 25584 | ADD HL,BC | Add the offset to find the note. | ||||||
| 25585 | PUSH DE | Stash the tune pointer on the stack. | ||||||
| 25586 | LD A,(HL) | Fetch the pitch of the note. | ||||||
| 25587 | INC HL | Move onto the duration of the note. | ||||||
| 25588 | LD E,(HL) | E=the duration of the note. | ||||||
| 25589 | LD D,0 | Set the high byte of the duration (D) to 0. | ||||||
| 25591 | LD L,A | HL=the pitch of the note. | ||||||
| 25592 | LD H,0 | |||||||
| 25594 | SLA L | Multiply HL by four to make the pitch for the beeper. | ||||||
| 25596 | RL H | |||||||
| 25598 | SLA L | |||||||
| 25600 | RL H | |||||||
| 25602 | PUSH IX | Stash IX on the stack, as the beeper routine overwrites it. | ||||||
| 25604 | CALL 949 | Call BEEPER. | ||||||
| 25607 | POP IX | Restore IX and the tune pointer from the stack. | ||||||
| 25609 | POP DE | |||||||
| 25610 | INC DE | Move onto the next note of the tune. | ||||||
| 25611 | JR PlayMusic | Loop back round to PlayMusic to play the next note (the tune only ends when the terminator is reached). | ||||||
| Prev: 25514 | Up: Map | Next: 25613 |