Prev: 49803 Up: Map Next: 49868
49829: 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 49829 LD D,16 Set the number of times to cycle to 16.
CycleColoursWithSound_Cycle 49831 LD HL,22528 Point HL at the attribute file.
49834 LD BC,768 Set the number of attributes to 768.
CycleColoursWithSound_Attribute 49837 LD A,(HL) Fetch the attribute.
49838 AND %11111000 Keep the paper, brightness and flash.
49840 LD E,A Stash them in E.
49841 LD A,(HL) Fetch the attribute again.
49842 INC A Add one to the ink colour.
49843 AND %00000111 Keep the ink colour.
49845 OR E Combine it with the rest of the attribute.
49846 LD (HL),A Set the attribute.
49847 INC HL Move on to the next attribute.
49848 DEC BC Decrease the number of attributes left.
49849 LD A,B Check whether any attributes are left to change.
49850 OR C
49851 JR NZ,CycleColoursWithSound_Attribute Jump to CycleColoursWithSound_Attribute until all of the attributes have been changed.
49853 CALL PlaySparkleSound Play the sound of sparkles.
49856 LD BC,8192 Set the delay counter to 8192.
CycleColoursWithSound_Delay 49859 DEC BC Decrease the delay counter.
49860 LD A,B Check whether the delay counter has reached zero.
49861 OR C
49862 JR NZ,CycleColoursWithSound_Delay Jump to CycleColoursWithSound_Delay until the delay is over.
49864 DEC D Decrease the number of times left.
49865 JR NZ,CycleColoursWithSound_Cycle Jump to CycleColoursWithSound_Cycle until all of the cycles are done.
DoNothing 49867 RET Return.
Prev: 49803 Up: Map Next: 49868