Prev: C28B Up: Map Next: C2CC
C2A5: Cycle Colours With Sound
Used by the routine at HandleObjectAtCentreOfRoom.
Changes the ink colour of every attribute on the screen to the next colour, sixteen times, with a sound and a short delay each time.
Cycle every attribute, then play a sound and wait.
CycleColoursWithSound C2A5 LD D,$10 Set the number of times to cycle to 10.
CycleColoursWithSound_Cycle C2A7 LD HL,$5800 Point HL at the attribute file.
C2AA LD BC,$0300 Set the number of attributes to 0300.
CycleColoursWithSound_Attribute C2AD LD A,(HL) Fetch the attribute.
C2AE AND %11111000 Keep the paper, brightness and flash.
C2B0 LD E,A Stash them in E.
C2B1 LD A,(HL) Fetch the attribute again.
C2B2 INC A Add one to the ink colour.
C2B3 AND %00000111 Keep the ink colour.
C2B5 OR E Combine it with the rest of the attribute.
C2B6 LD (HL),A Set the attribute.
C2B7 INC HL Move on to the next attribute.
C2B8 DEC BC Decrease the number of attributes left.
C2B9 LD A,B Check whether any attributes are left to change.
C2BA OR C
C2BB JR NZ,CycleColoursWithSound_Attribute Jump to CycleColoursWithSound_Attribute until all of the attributes have been changed.
C2BD CALL PlaySparkleSound Play the sound of sparkles.
C2C0 LD BC,$2000 Set the delay counter to 2000.
CycleColoursWithSound_Delay C2C3 DEC BC Decrease the delay counter.
C2C4 LD A,B Check whether the delay counter has reached zero.
C2C5 OR C
C2C6 JR NZ,CycleColoursWithSound_Delay Jump to CycleColoursWithSound_Delay until the delay is over.
C2C8 DEC D Decrease the number of times left.
C2C9 JR NZ,CycleColoursWithSound_Cycle Jump to CycleColoursWithSound_Cycle until all of the cycles are done.
DoNothing C2CB RET Return.
Prev: C28B Up: Map Next: C2CC