Prev: 26760 Up: Map Next: 26801
26778: Handle Notes
The handler for sound effect actors with the ID 22. Each time it is called it plays the next note from a table of periods. The table address is held in the actor (IX+2 and IX+3), 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+4. The actor is removed after the first entry of the table.
Input
IX Sound actor
Handler_Notes 26778 DEC (IX+1) Decrease the note counter by one.
26781 JR Z,RemoveActor Jump to RemoveActor if there are no more notes to play.
26783 LD C,(IX+1) Fetch the note counter.
26786 LD B,0 Set the high byte of the offset to 0.
26788 LD L,(IX+2) Fetch the low byte of the address of the table of periods.
26791 LD H,(IX+3) Fetch the high byte of the address of the table of periods.
26794 ADD HL,BC Find the note in the table using the note counter.
26795 LD D,(HL) Fetch the period of the note.
26796 LD C,(IX+4) Fetch the number of cycles in each note.
26799 JR Handler_PlayCycles Jump to Handler_PlayCycles.
Prev: 26760 Up: Map Next: 26801