Prev: 26747 Up: Map Next: 26880
26784: Create Game Window
Used by the routines at GameInitialisation, GameOver, NewGame and HandlerCup.
Builds the game screen from scratch. The screen and attribute buffers are cleared, then the sidebar, the map, the cup count, the lives, the score headings and the border of the play area are drawn.
Before After
create-window-before create-window-after
CreateWindow 26784 LD HL,24168 Point HL at the radar blip records (RadarBlips).
26787 LD BC,3072 BC=3072 (B is the counter for the 12 bytes and C is 0).
CreateWindow_ClearBlips 26790 LD (HL),C Clear a byte of the radar blip records.
26791 INC HL Increment HL by one.
26792 DJNZ CreateWindow_ClearBlips Decrease the byte counter by one and loop back to CreateWindow_ClearBlips until all 12 bytes have been cleared.
26794 LD HL,65535 Write 65535 to PlayerWorldPosition (so the terrain dots are drawn afresh).
26797 LD (24116),HL
26800 LD HL,26109 Point HL at the first terrain dot (TerrainDots).
26803 LD B,16 Set the dot counter to 16.
CreateWindow_Terrain 26805 RES 0,(HL) Reset bit 0 of the byte HL is pointing to (the dot is not drawn).
26807 INC HL Move on to the next terrain dot.
26808 INC HL
26809 DJNZ CreateWindow_Terrain Decrease the dot counter by one and loop back to CreateWindow_Terrain until all 16 dots are marked as not drawn.
26811 CALL ResetAttributes Call ResetAttributes to reset the attribute buffer.
26814 CALL DrawHUDPanel Call DrawHUDPanel to draw the sidebar.
26817 CALL PlotMapPoints Call PlotMapPoints to plot the map points.
26820 CALL DisplayCupsCollected Call DisplayCupsCollected to display the cups collected.
26823 CALL DisplayPlayerLives Call DisplayPlayerLives to display the lives.
26826 CALL DisplayMiles Call DisplayMiles to display the miles and time.
Draw the border of the play area, by setting a row of attributes along the top and bottom and a column along each side.
26829 LD HL,22536 HL=22536 (the attribute address of the top left).
26832 LD BC,6145 BC=6145 (24 across and 1 down).
26835 PUSH BC Stash BC on the stack.
26836 CALL AttributesPlayArea Set the attributes of the top row using AttributesPlayArea.
26839 LD HL,23272 HL=23272 (the attribute address of the bottom left).
26842 POP BC Restore BC from the stack.
26843 CALL AttributesPlayArea Set the attributes of the bottom row using AttributesPlayArea.
26846 LD HL,22568 HL=22568 (the attribute address of the left side).
26849 LD BC,278 BC=0278 (1 across and 22 down).
26852 PUSH BC Stash BC on the stack.
26853 CALL AttributesPlayArea Stash the size of the side on the stack.
26856 POP BC Restore BC from the stack.
26857 LD HL,22591 HL=22591 (the attribute address of the right side).
26860 CALL AttributesPlayArea Set the attributes of the right side using AttributesPlayArea.
Print the "SCORE" and "HI-SCORE" headings and the scores.
26863 LD HL,80 HL=0080 (pixel co-ordinates: H is the Y position and L is the X position).
26866 LD DE,24625 Point DE at the "SCORE" and "HI-SCORE" headings (Text_ScoreHi).
26869 CALL PrintStringColour Print the headings using PrintStringColour.
26872 CALL Score_1UP Call Score_1UP to print the score.
26875 CALL Score_HI Call Score_HI to print the high score.
26878 JR DisplayNightDriver Jump to DisplayNightDriver.
View the equivalent code in;
Prev: 26747 Up: Map Next: 26880