Prev: 687B Up: Map Next: 6900
68A0: 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 68A0 LD HL,$5E68 Point HL at the radar blip records (RadarBlips).
68A3 LD BC,$0C00 BC=0C00 (B is the counter for the 0C bytes and C is 00).
CreateWindow_ClearBlips 68A6 LD (HL),C Clear a byte of the radar blip records.
68A7 INC HL Increment HL by one.
68A8 DJNZ CreateWindow_ClearBlips Decrease the byte counter by one and loop back to CreateWindow_ClearBlips until all 0C bytes have been cleared.
68AA LD HL,$FFFF Write FFFF to PlayerWorldPosition (so the terrain dots are drawn afresh).
68AD LD ($5E34),HL
68B0 LD HL,$65FD Point HL at the first terrain dot (TerrainDots).
68B3 LD B,$10 Set the dot counter to 10.
CreateWindow_Terrain 68B5 RES 0,(HL) Reset bit 0 of the byte HL is pointing to (the dot is not drawn).
68B7 INC HL Move on to the next terrain dot.
68B8 INC HL
68B9 DJNZ CreateWindow_Terrain Decrease the dot counter by one and loop back to CreateWindow_Terrain until all 10 dots are marked as not drawn.
68BB CALL ResetAttributes Call ResetAttributes to reset the attribute buffer.
68BE CALL DrawHUDPanel Call DrawHUDPanel to draw the sidebar.
68C1 CALL PlotMapPoints Call PlotMapPoints to plot the map points.
68C4 CALL DisplayCupsCollected Call DisplayCupsCollected to display the cups collected.
68C7 CALL DisplayPlayerLives Call DisplayPlayerLives to display the lives.
68CA 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.
68CD LD HL,$5808 HL=5808 (the attribute address of the top left).
68D0 LD BC,$1801 BC=1801 (18 across and 01 down).
68D3 PUSH BC Stash BC on the stack.
68D4 CALL AttributesPlayArea Set the attributes of the top row using AttributesPlayArea.
68D7 LD HL,$5AE8 HL=5AE8 (the attribute address of the bottom left).
68DA POP BC Restore BC from the stack.
68DB CALL AttributesPlayArea Set the attributes of the bottom row using AttributesPlayArea.
68DE LD HL,$5828 HL=5828 (the attribute address of the left side).
68E1 LD BC,$0116 BC=0116 (01 across and 16 down).
68E4 PUSH BC Stash BC on the stack.
68E5 CALL AttributesPlayArea Stash the size of the side on the stack.
68E8 POP BC Restore BC from the stack.
68E9 LD HL,$583F HL=583F (the attribute address of the right side).
68EC CALL AttributesPlayArea Set the attributes of the right side using AttributesPlayArea.
Print the "SCORE" and "HI-SCORE" headings and the scores.
68EF LD HL,$0050 HL=0050 (pixel co-ordinates: H is the Y position and L is the X position).
68F2 LD DE,$6031 Point DE at the "SCORE" and "HI-SCORE" headings (Text_ScoreHi).
68F5 CALL PrintStringColour Print the headings using PrintStringColour.
68F8 CALL Score_1UP Call Score_1UP to print the score.
68FB CALL Score_HI Call Score_HI to print the high score.
68FE JR DisplayNightDriver Jump to DisplayNightDriver.
View the equivalent code in;
Prev: 687B Up: Map Next: 6900