Prev: 44801 Up: Map Next: 44927
44860: Initialise New Game
Used by the routine at GameStart.
Start a new game: reset display buffers, tick counter, menu glyphs and room state for Learner or Super Berk.
Initialise_New_Game 44860 CALL Backup_Entity_And_Game_State Call Backup_Entity_And_Game_State to backup Entity And Game State.
44863 LD HL,25504 Point HL at Primary Display Buffer (PrimaryDisplayBuffer).
44866 LD (29429),HL Store HL in Pointer: Current Display Buffer (Pointer_CurrentDisplayBuffer).
44869 XOR A Clear the display-buffer select flag.
44870 LD (29418),A Set Display Buffer Select Flag (DisplayBufferSelectFlag).
44873 LD A,100 Load A with 100 as the initial game tick counter.
This entry point is used by the routine at Initialise_Room_Display.
Set the game tick counter, clear both display buffers, and set the border/speaker state.
Initialise_New_Game_SetTickCounter 44875 LD (29426),A Set the game tick counter (GameTickCounter).
44878 CALL Clear_BothDisplayBuffers Call Clear_BothDisplayBuffers to clear both display buffers.
44881 LD A,2 Load A with 2.
44883 CALL Set_BorderSpeakerState Call Set_BorderSpeakerState to set Border And Speaker State.
This entry point is used by the routine at Initialise_Room_Display.
Point the glyph printer at Data_MenuGlyphBitmaps and choose the Learner (122) vs Super Berk (104) room byte.
Initialise_New_Game_SetGlyphPointer 44886 LD HL,44311 Point HL at the menu/glyph bitmap data (Data_MenuGlyphBitmaps).
44889 LD (29433),HL Write the pointer in HL to the temporary screen pointer (Pointer_CurrentCharacterSet).
44892 LD E,4 Load E with 4 as a small loop/position count.
44894 LD A,(29353) Load A with the Learner Berk mode flag (Flag_LearnerBerkMode).
44897 OR A Is Learner Berk mode flag zero? If so, jump to Initialise_New_Game_SuperBerkRoomByte.
44898 JR Z,Initialise_New_Game_SuperBerkRoomByte
44900 LD A,122 Load A with 122.
44902 JR Initialise_New_Game_WriteRoomByte Jump to Initialise_New_Game_WriteRoomByte to set the temporary room/state byte.
This entry point is used by the routine at Initialise_Room_Display.
Super Berk path: use room/state byte 104.
Initialise_New_Game_SuperBerkRoomByte 44904 LD A,104 Load A with 104.
This entry point is used by the routine at Initialise_Room_Display.
Advance the small position count before writing the room/state byte.
Initialise_New_Game_Branch 44906 INC E Advance the low byte of the pointer/offset in DE.
Write the room/state byte and prepare to fill the attribute-file base row.
Initialise_New_Game_WriteRoomByte 44907 LD (29447),A Set the temporary room/state byte (CurrentTextAttribute).
44910 LD B,128 Load B with 128 as a loop counter.
44912 LD D,0 Clear D (high byte of a pointer/offset).
44914 LD HL,23168 Point HL at the attribute-file base (23168 (attribute buffer)).
Print a full attribute-file row of glyphs, then initialise the room display.
Initialise_New_Game_PrintAttrRow 44917 CALL Print_Character Call Print_Character to print Character.
44920 INC HL Advance 23168 (attribute buffer) by one byte.
44921 DJNZ Initialise_New_Game_PrintAttrRow Decrease the loop counter in B and jump to Initialise_New_Game_PrintAttrRow if more iterations remain.
44923 CALL Initialise_Room_Display Call Initialise_Room_Display to initialise the room display.
44926 RET Return.
Prev: 44801 Up: Map Next: 44927