Prev: D325 Up: Map Next: D368
D331: Flash the 'MAGIC' text in the bottom left (if Maroc has picked up a spell) and trigger sound effect
Used by the routine at C7EA.
Input
HL Address pointer (EABC/EABE) to first byte of one of the data sets at 7C00 (the one after the last set copied in the previous routine)
Jump here from C7D0 after copying graphics data to banks at 7C00
If Maroc picks up a spell, the 'Magic' text in the bottom left changes colour for a short time, and a sound is played
flashing indicator when Maroc picks up a spell
D331 LD HL,($EABE) Address pointer to start of next data set (at 7C00)
D334 LD (HL),$FF Add end-of-data marker to the first byte of the set
D336 LD ($EB72),HL Copy address pointer into store
Check if the post-scroll-pickup effect (colour/sound) needs to be actioned:
D339 LD A,($ECA0) This is the counter byte for flashing the 'MAGIC' text in the bottom left of the screen.
D33C CP $00
D33E JR Z,$D368 If it's zero, no need for flashing & playing sound - skip to the next routine
Change the colour of the 'Magic' text in the bottom left of the screen and play a sound.
D340 DEC A Decrement the 'flashing' counter, and re-store
D341 LD ($ECA0),A
D344 JR NZ,$D348 Check if now zero
D346 LD A,$30 If so, reset the final colour change to yellow (INK 0, PAPER 6), otherwise the counter would make it INK 0, PAPER 0 (invisible).
At the start of the game the lower part of 'MAGIC' is white, but will subsequently be yellow once the first spell is collected (see the animated image on this page).
Change the colour of the word 'MAGIC':
D348 LD DE,$001C Prepare an offset of 28 character spaces ready to move down to the next line of the screen
D34B LD C,$02 2 character rows to colour
D34D LD HL,$5AC2 Screen display address for the top left of the word 'MAGIC'
D350 LD B,$04 4 characters wide
D352 LD (HL),A Colour the character square (colour = counter byte value)
D353 INC HL Move right one character square
D354 DJNZ $D352 Repeat x 4
D356 ADD HL,DE Jump down to the next character row, over to the left again
D357 DEC C Decrement the row counter
D358 JR NZ,$D350 ...And repeat for 2 rows
Play sound effect:
D35A LD C,$80 Outer loop - duration counter
D35C LD A,$10 Speaker bit 4 (16)
Speaker toggle loop:
D35E XOR $10 Toggle speaker bit
D360 OUT ($FE),A Output sound
D362 LD B,C Get duration counter
D363 DJNZ $D363 ...short pause for duration value of counter
D365 DEC C Decrement duration counter
D366 JR NZ,$D35E Repeat loop until sound duration counter = 0
Prev: D325 Up: Map Next: D368