![]() |
Routines |
| Prev: 63AA | Up: Map | Next: 640D |
|
Used by the routine at LevelComplete.
|
||||||||
| PlayMusic | 63E1 | LD A,(DE) | Fetch the next note of the tune. | |||||
| 63E2 | CP $FF | Return if the terminator (FF) has been reached. | ||||||
| 63E4 | RET Z | |||||||
| 63E5 | AND %00011111 | Keep only bits 0-4 (the note number). | ||||||
| 63E7 | DEC A | Decrease the note number by one (the notes are numbered from one). | ||||||
| 63E8 | SLA A | Double it, as there are two bytes for each note in the table. | ||||||
| 63EA | LD C,A | Make this the offset into the note table in BC. | ||||||
| 63EB | LD B,$00 | |||||||
| 63ED | LD HL,$640D | HL=NoteTable (the note table). | ||||||
| 63F0 | ADD HL,BC | Add the offset to find the note. | ||||||
| 63F1 | PUSH DE | Stash the tune pointer on the stack. | ||||||
| 63F2 | LD A,(HL) | Fetch the pitch of the note. | ||||||
| 63F3 | INC HL | Move onto the duration of the note. | ||||||
| 63F4 | LD E,(HL) | E=the duration of the note. | ||||||
| 63F5 | LD D,$00 | Set the high byte of the duration (D) to 00. | ||||||
| 63F7 | LD L,A | HL=the pitch of the note. | ||||||
| 63F8 | LD H,$00 | |||||||
| 63FA | SLA L | Multiply HL by four to make the pitch for the beeper. | ||||||
| 63FC | RL H | |||||||
| 63FE | SLA L | |||||||
| 6400 | RL H | |||||||
| 6402 | PUSH IX | Stash IX on the stack, as the beeper routine overwrites it. | ||||||
| 6404 | CALL $03B5 | Call BEEPER. | ||||||
| 6407 | POP IX | Restore IX and the tune pointer from the stack. | ||||||
| 6409 | POP DE | |||||||
| 640A | INC DE | Move onto the next note of the tune. | ||||||
| 640B | JR PlayMusic | Loop back round to PlayMusic to play the next note (the tune only ends when the terminator is reached). | ||||||
| Prev: 63AA | Up: Map | Next: 640D |