Prev: 6888 Up: Map Next: 68B1
689A: Handle Notes
The handler for sound effect actors with the ID 16. Each time it is called it plays the next note from a table of periods. The table address is held in the actor (IX+02 and IX+03), and the notes are played from the end of the table towards the start. The number of cycles in each note is held in IX+04. The actor is removed after the first entry of the table.
Input
IX Sound actor
Handler_Notes 689A DEC (IX+$01) Decrease the note counter by one.
689D JR Z,RemoveActor Jump to RemoveActor if there are no more notes to play.
689F LD C,(IX+$01) Fetch the note counter.
68A2 LD B,$00 Set the high byte of the offset to 00.
68A4 LD L,(IX+$02) Fetch the low byte of the address of the table of periods.
68A7 LD H,(IX+$03) Fetch the high byte of the address of the table of periods.
68AA ADD HL,BC Find the note in the table using the note counter.
68AB LD D,(HL) Fetch the period of the note.
68AC LD C,(IX+$04) Fetch the number of cycles in each note.
68AF JR Handler_PlayCycles Jump to Handler_PlayCycles.
Prev: 6888 Up: Map Next: 68B1