Prev: C70C Up: Map Next: C77D
C713: Update Attribute Bar
Paints the HUD attribute border with *Border_Colour and writes the cycling colour from HelpBarAttributeSequence to 07 attribute cells at *Colour_Bar_Column. Checks the H key (help) and F key (restart). UpdateAttributeBar_FillBorder is also called directly by C5BD.
UpdateAttributeBar C713 LD HL,($C4E5) HL=*Colour_Cycle_Table_Pointer (colour cycle table pointer).
UpdateAttributeBar_FetchColour C716 LD A,(HL) Read the next colour byte; jump to UpdateAttributeBar_ResetTable if zero (table end).
C717 AND A
C718 JP Z,UpdateAttributeBar_ResetTable
C71B INC HL Advance the table pointer and save it back to *Colour_Cycle_Table_Pointer.
C71C LD ($C4E5),HL
This entry point is used by the routine at PrintPlayerScore.
Fill the attribute area border with *Border_Colour (current border colour).
UpdateAttributeBar_FillBorder C71F LD HL,$5800 HL=5800 (attribute area start).
C722 LD A,($C42E) A=*Border_Colour (border colour).
C725 LD B,$40 Top rows loop count 40 (B=40).
UpdateAttributeBar_TopFillLoop C727 LD (HL),A Write the border colour to 40 attribute cells (top two rows).
C728 INC HL
C729 DJNZ UpdateAttributeBar_TopFillLoop
C72B LD B,$15 Side-column loop count 15 (B=15).
C72D LD DE,$001F DE=1F (stride between left and right edge columns).
UpdateAttributeBar_SideFillLoop C730 LD (HL),A Write the border colour to the left (col 00) and right (col 1F) edge cells of 15 consecutive rows.
C731 ADD HL,DE
C732 LD (HL),A
C733 INC HL
C734 DJNZ UpdateAttributeBar_SideFillLoop
C736 LD B,$20 Bottom row loop count 20 (B=20).
UpdateAttributeBar_BottomFillLoop C738 LD (HL),A Write the border colour to 20 attribute cells (bottom row).
C739 INC HL
C73A DJNZ UpdateAttributeBar_BottomFillLoop
Load the current colour byte from the table into C.
C73C LD HL,($C4E5) Back up one step in the table and load the colour byte into C.
C73F DEC HL
C740 LD C,(HL)
C741 LD H,$58 H=58 (high byte of the colour bar attribute row pointer).
C743 LD A,($C420) L=*Colour_Bar_Column (colour bar column offset).
C746 LD L,A
C747 LD B,$07 Colour bar loop count 07 (B=07).
UpdateAttributeBar_ColourBarLoop C749 LD (HL),C Write the cycling colour (C) to 07 consecutive attribute cells.
C74A INC HL
C74B DJNZ UpdateAttributeBar_ColourBarLoop
Check H (help) and F (restart) keys.
C74D LD A,$BF Read from the keyboard;
Port Number Bit
0 1 2 3 4
BF ENTER L K J H
C74F IN A,($FE)
C751 AND %00010000 Test the H key (bit 4).
C753 JP Z,UpdateAttributeBar_HKeyWait_D Jump to UpdateAttributeBar_HKeyWait_D if H is pressed.
C756 LD A,$FD Read from the keyboard;
Port Number Bit
0 1 2 3 4
FD A S D F G
C758 IN A,($FE)
C75A AND %00001000 Test the F key (bit 3).
C75C JP Z,GameEntryPoint Jump to GameEntryPoint if F is pressed (restart the game).
C75F RET Return.
H key pressed: poll via PollHKey, counting down D then E then D again.
UpdateAttributeBar_HKeyWait_D C760 CALL PollHKey Call PollHKey.
C763 DEC D Decrease D and loop back to UpdateAttributeBar_HKeyWait_D while non-zero.
C764 JP NZ,UpdateAttributeBar_HKeyWait_D
UpdateAttributeBar_HKeyWait_E C767 CALL PollHKey Call PollHKey.
C76A DEC E Decrease E and loop back to UpdateAttributeBar_HKeyWait_E while non-zero.
C76B JP NZ,UpdateAttributeBar_HKeyWait_E
UpdateAttributeBar_HKeyWait_D2 C76E CALL PollHKey Call PollHKey.
C771 DEC D Decrease D and loop back to UpdateAttributeBar_HKeyWait_D2 while non-zero.
C772 JP NZ,UpdateAttributeBar_HKeyWait_D2
C775 RET Return.
C776 RET Return.
Table exhausted: reset the pointer to the start of HelpBarAttributeSequence and continue.
UpdateAttributeBar_ResetTable C777 LD HL,$C70C HL=HelpBarAttributeSequence (start of the colour cycle table).
C77A JP UpdateAttributeBar_FetchColour Jump to UpdateAttributeBar_FetchColour (fetch the first colour byte).
Prev: C70C Up: Map Next: C77D