Prev: 58878 Up: Map Next: 58945
58896: Intro sequence - toggle sky colour between blue/yellow
Used by the routine at 49274.
This routine alternates the INK and PAPER colours of the sky above the landscape to flash between yellow and blue.
lightning flashes during intro sequence
It checks the INK and PAPER colours of the byte (1 or 6) and toggles between them.
The effect doesn't filter out squares in the left/right border - because a section on the left has yellow in it, it gets affected - see Bugs - Intro sequence - lightning effect colour bleeds into border.
58896 LD B,255 255 bytes covers a couple of rows more than the first third of the screen.
58898 LD HL,22592 Screen attribute address - top left of the screen, then two rows down below the top border
Determine INK colour in screen attribute byte:
58901 LD A,(HL) Get screen attribute byte
58902 LD D,A Store in D register
58903 AND 7 Get the INK value from the screen attribute byte (0-7)
58905 CP 1 Is it blue (INK 1)?
58907 JR NZ,58913
58909 LD A,6 If so, set the INK colour to yellow (6) and skip next check
58911 JR 58919
58913 CP 6 Is the INK colour yellow (6)?
58915 JR NZ,58919
58917 LD A,1 If so, Set the INK colour to blue
Determine PAPER colour to paint sky - alternating between yellow and blue:
58919 LD E,A Copy INK colour into E register - blue (1) or yellow (6)
58920 LD A,D Get screen attribute byte
58921 AND 56 Filter out everything but the PAPER colour (bits 3-5)
58923 CP 8 Is it blue (PAPER 1)?
58925 JR NZ,58931
58927 LD A,48 If so, set to yellow (PAPER 6) and skip next check
58929 JR 58937
58931 CP 48 Is it yellow (PAPER 6)?
58933 JR NZ,58937
58935 LD A,8 If so, set to blue (PAPER 1)
Combine calculated INK and PAPER parts of attribute byte:
58937 OR E Combine PAPER value with INK value calculated earlier
58938 LD (HL),A ...and print onto screen
58939 INC HL Move right one square
58940 AND 16 This instruction has no effect, as the A register is assigned a new value within the next couple of instructions
58942 DJNZ 58901 Repeat x 255, covering the top third of the screen (and a bit more).
58944 RET Return to the routine at 49274
Prev: 58878 Up: Map Next: 58945