Prev: CA1B Up: Map Next: CA55
CA2B: Display Menu
Used by the routine at GameMenu.
Prints the eight lines of the game selection menu. The first time that it is called it also draws the frame around the screen.
Point at the menu colours, positions and text.
DisplayMenu CA2B LD DE,$C962 Point DE at MenuLineAttributes.
CA2E EXX Switch to the shadow registers.
CA2F LD HL,$C96A Point HL at MenuLinePositions.
CA32 LD DE,$C97A Point DE at MenuText.
CA35 LD B,$08 Set the number of lines to 08.
Print one line from the three lists.
DisplayMenu_Loop CA37 LD A,(HL) Fetch the x position.
CA38 INC HL Move on to the next pair of positions.
CA39 INC HL
CA3A PUSH HL Stash the address of the next pair on the stack.
CA3B DEC HL Point HL at the y position.
CA3C LD H,(HL) Fetch the y position.
CA3D LD L,A Set the x position.
CA3E EXX Switch to the shadow registers.
CA3F LD A,(DE) Fetch the attribute of the line.
CA40 INC DE Move on to the next attribute.
CA41 EX AF,AF' Keep the attribute in AF'.
CA42 EXX Switch back to the main registers.
CA43 CALL PrintString Call PrintString.
CA46 POP HL Restore the address of the next pair from the stack.
CA47 DJNZ DisplayMenu_Loop Jump to DisplayMenu_Loop until all of the lines have been printed.
Draw the frame the first time.
CA49 LD A,($BBBF) Return if MenuFrameDrawnFlag is set.
CA4C AND A
CA4D RET NZ
CA4E INC A Write 01 to *MenuFrameDrawnFlag.
CA4F LD ($BBBF),A
CA52 JP DrawFrame Jump to DrawFrame.
View the equivalent code in;
Before After DisplayMenu
print-menu-lines-before print-menu-lines-after
Prev: CA1B Up: Map Next: CA55