Prev: 25400 Up: Map Next: 25577
25531: Print HUD Header
Used by the routine at Draw_Room_Rows_Loop.
Prints the heads-up display header showing Energy, Lives and Score, then applies random colours to the bottom two rows of the screen attributes to create a colourful ground strip.
Print_HUD_Header 25531 LD A,1 Write 1 to *Screen_Initialised_Flag.
25533 LD (24481),A
Print the HUD string to the upper screen.
25536 CALL 5633 Call CHAN_OPEN to open channel 2 (upper screen).
25539 LD HL,25577 Point HL at Messaging_Header.
25542 LD B,79 Set a counter in B for the length of the string (79 characters).
25544 CALL PrintString Call PrintString.
This entry point is used by the routine at Draw_Room_Rows_Loop.
Apply pseudo-random colours to the bottom two rows of screen attributes to create a colourful ground strip. Uses the Memory Refresh Register as a seed to pick unpredictable colour values.
Colour_Ground_Strip 25547 LD A,R Load the Memory Refresh Register into E as a pointer offset.
25549 LD E,A
25550 LD D,0 Set D to 0 so DE is an offset into low memory.
25552 LD B,32 Set a counter in B for 32 attribute cells.
25554 LD HL,23232 Point HL at 23232 (start of the bottom two attribute rows).
Colour_Ground_Loop 25557 LD A,(DE) Fetch a pseudo-random byte from *DE.
25558 AND %00000111 Keep only bits 0-2 (INK colour).
25560 INC DE Advance the source pointer.
25561 CP 3 Jump back to Colour_Ground_Loop if the colour is less than 3 (reject dark colours to keep the ground strip bright).
25563 JR C,Colour_Ground_Loop
25565 PUSH DE Stash the source pointer on the stack.
25566 LD E,A Copy the chosen colour into E.
25567 LD A,(HL) Fetch the current attribute byte from *HL.
25568 AND %11110111 Mask off the existing INK bits (keep PAPER, BRIGHT, FLASH).
25570 OR E OR in the new INK colour from E.
25571 LD (HL),E Write the updated attribute byte to *HL.
25572 POP DE Restore the source pointer from the stack.
25573 INC HL Advance to the next attribute cell.
25574 DJNZ Colour_Ground_Loop Decrease the counter and loop back to Colour_Ground_Loop until all 32 cells are coloured.
25576 RET Return.
Prev: 25400 Up: Map Next: 25577