Prev: F4EC Up: Map Next: F54D
F51D: Advance Colour Cycle
Used by the routine at Attract_Mode_Loop.
Advances the colour cycling animation by one step. Scans all 768 screen attribute cells and replaces cells matching 47 with the next colour from the sequence at Colour_Cycle_Table, then immediately replaces all cells matching the following entry with 47 to prime the next cycle step.
Advance_Colour_Cycle F51D LD HL,($F554) Load the colour cycle table pointer.
F520 LD E,(HL) Read the replacement colour from the current table entry.
F521 LD A,$47 Set the attribute value to be replaced.
F523 LD D,A
F524 CALL Advance_Colour_Cycle_Scan Scan the attribute area and apply the colour replacement.
F527 LD HL,($F554) Re-read and advance the colour cycle pointer.
F52A INC HL
Advance_Colour_Cycle_Next F52B LD ($F554),HL Save the updated colour cycle pointer.
F52E LD A,(HL) Read the next table entry and check for the end sentinel.
F52F CP $FF
F531 LD D,A
F532 LD E,$47 Set up to restore the marker colour and scan again.
F534 JR NZ,Advance_Colour_Cycle_Scan
F536 LD HL,$F54D Reset the colour cycle pointer to the table start.
F539 JR Advance_Colour_Cycle_Next
This entry point is used by the routine at Advance_Intro_Colour_Cycle.
Scan all 768 screen attribute cells and replace any cell colour matching the target with the replacement colour.
Advance_Colour_Cycle_Scan F53B LD HL,$5800 Set up to scan all 768 screen attribute cells.
F53E LD BC,$0300
Advance_Colour_Cycle_Scan_Loop F541 CP (HL) Skip the cell if it does not match the target colour.
F542 JR NZ,Advance_Colour_Cycle_Loop_Next
F544 LD (HL),E Write the replacement colour to this attribute cell.
Advance_Colour_Cycle_Loop_Next F545 DEC BC Advance to the next cell and reload the target colour.
F546 LD A,B
F547 OR C
F548 INC HL
F549 LD A,D
F54A JR NZ,Advance_Colour_Cycle_Scan_Loop Loop back until all attribute cells are scanned.
F54C RET Return.
Prev: F4EC Up: Map Next: F54D