Prev: 50956 Up: Map Next: 51069
50963: Update Attribute Bar
Paints the HUD attribute border with *Border_Colour and writes the cycling colour from HelpBarAttributeSequence to 7 attribute cells at *Colour_Bar_Column. Checks the H key (help) and F key (restart). UpdateAttributeBar_FillBorder is also called directly by 50621.
UpdateAttributeBar 50963 LD HL,(50405) HL=*Colour_Cycle_Table_Pointer (colour cycle table pointer).
UpdateAttributeBar_FetchColour 50966 LD A,(HL) Read the next colour byte; jump to UpdateAttributeBar_ResetTable if zero (table end).
50967 AND A
50968 JP Z,UpdateAttributeBar_ResetTable
50971 INC HL Advance the table pointer and save it back to *Colour_Cycle_Table_Pointer.
50972 LD (50405),HL
This entry point is used by the routine at PrintPlayerScore.
Fill the attribute area border with *Border_Colour (current border colour).
UpdateAttributeBar_FillBorder 50975 LD HL,22528 HL=22528 (attribute area start).
50978 LD A,(50222) A=*Border_Colour (border colour).
50981 LD B,64 Top rows loop count 64 (B=64).
UpdateAttributeBar_TopFillLoop 50983 LD (HL),A Write the border colour to 64 attribute cells (top two rows).
50984 INC HL
50985 DJNZ UpdateAttributeBar_TopFillLoop
50987 LD B,21 Side-column loop count 21 (B=21).
50989 LD DE,31 DE=31 (stride between left and right edge columns).
UpdateAttributeBar_SideFillLoop 50992 LD (HL),A Write the border colour to the left (col 0) and right (col 31) edge cells of 21 consecutive rows.
50993 ADD HL,DE
50994 LD (HL),A
50995 INC HL
50996 DJNZ UpdateAttributeBar_SideFillLoop
50998 LD B,32 Bottom row loop count 32 (B=32).
UpdateAttributeBar_BottomFillLoop 51000 LD (HL),A Write the border colour to 32 attribute cells (bottom row).
51001 INC HL
51002 DJNZ UpdateAttributeBar_BottomFillLoop
Load the current colour byte from the table into C.
51004 LD HL,(50405) Back up one step in the table and load the colour byte into C.
51007 DEC HL
51008 LD C,(HL)
51009 LD H,88 H=88 (high byte of the colour bar attribute row pointer).
51011 LD A,(50208) L=*Colour_Bar_Column (colour bar column offset).
51014 LD L,A
51015 LD B,7 Colour bar loop count 7 (B=7).
UpdateAttributeBar_ColourBarLoop 51017 LD (HL),C Write the cycling colour (C) to 7 consecutive attribute cells.
51018 INC HL
51019 DJNZ UpdateAttributeBar_ColourBarLoop
Check H (help) and F (restart) keys.
51021 LD A,191 Read from the keyboard;
Port Number Bit
0 1 2 3 4
191 ENTER L K J H
51023 IN A,(254)
51025 AND %00010000 Test the H key (bit 4).
51027 JP Z,UpdateAttributeBar_HKeyWait_D Jump to UpdateAttributeBar_HKeyWait_D if H is pressed.
51030 LD A,253 Read from the keyboard;
Port Number Bit
0 1 2 3 4
253 A S D F G
51032 IN A,(254)
51034 AND %00001000 Test the F key (bit 3).
51036 JP Z,GameEntryPoint Jump to GameEntryPoint if F is pressed (restart the game).
51039 RET Return.
H key pressed: poll via PollHKey, counting down D then E then D again.
UpdateAttributeBar_HKeyWait_D 51040 CALL PollHKey Call PollHKey.
51043 DEC D Decrease D and loop back to UpdateAttributeBar_HKeyWait_D while non-zero.
51044 JP NZ,UpdateAttributeBar_HKeyWait_D
UpdateAttributeBar_HKeyWait_E 51047 CALL PollHKey Call PollHKey.
51050 DEC E Decrease E and loop back to UpdateAttributeBar_HKeyWait_E while non-zero.
51051 JP NZ,UpdateAttributeBar_HKeyWait_E
UpdateAttributeBar_HKeyWait_D2 51054 CALL PollHKey Call PollHKey.
51057 DEC D Decrease D and loop back to UpdateAttributeBar_HKeyWait_D2 while non-zero.
51058 JP NZ,UpdateAttributeBar_HKeyWait_D2
51061 RET Return.
51062 RET Return.
Table exhausted: reset the pointer to the start of HelpBarAttributeSequence and continue.
UpdateAttributeBar_ResetTable 51063 LD HL,50956 HL=HelpBarAttributeSequence (start of the colour cycle table).
51066 JP UpdateAttributeBar_FetchColour Jump to UpdateAttributeBar_FetchColour (fetch the first colour byte).
Prev: 50956 Up: Map Next: 51069