Prev: 37633 Up: Map Next: 38194
38000: Game entry point
GameEntry 38000 LD HL,64244 Write 64244 to CHARS.
38003 LD (23606),HL
38006 LD A,1 Write 1 to DF_SZ.
38008 LD (23659),A
38011 LD A,1 Write 1 to ControlMethod.
38013 LD (23464),A
This entry point is used by the routines at InstructionsPrint, BestScoresPrint and StartGame.
GameEntry_0 38016 LD HL,16384 Writes 0 to all 6144 screen buffer address locations (clears the screen).
38019 LD DE,16385
38022 LD (HL),0
38024 LD BC,6143
38027 LDIR
38029 LD A,7 Write 7 to BORDCR.
38031 LD (23624),A
38034 XOR A Set the border colour to BLACK.
38035 OUT (254),A
38037 LD A,3 Write 3 to TemporaryCounter.
38039 LD (23482),A
38042 CALL 38234 Call 38234.
38045 CALL TitleScreenPrint Call TitleScreenPrint.
38048 LD A,(23464) If ControlMethod is 1 jump to TitleScreenInit.
38051 CP 1
38053 JP Z,TitleScreenInit
38056 LD A,(23464) If ControlMethod is 2 jump to Input_KempstonJoystick.
38059 CP 2
38061 JP Z,Input_KempstonJoystick
38064 LD A,(23464) If ControlMethod is 3 jump to Input_ProtekJoystick.
38067 CP 3
38069 JP Z,Input_ProtekJoystick
38072 LD A,(23464) If ControlMethod is 5 jump to Input_Interface2.
38075 CP 5
38077 JP Z,Input_Interface2
Handles selecting "1. KEYBOARD".
TitleSelectInput 38080 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
38082 IN A,(254)
38084 AND %00000001 Keep only bit 0.
38086 JP Z,InputTest_Keyboard If "1" was pressed then jump to InputTest_Keyboard.
Handles selecting "2. KEMPSTON JOYSTICK".
38089 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
38091 IN A,(254)
38093 AND %00000010 Keep only bit 1.
38095 JP Z,InputTest_KempstonJoystick If "2" was pressed then jump to InputTest_KempstonJoystick.
Handles selecting "3. PROTEK JOYSTICK".
38098 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
38100 IN A,(254)
38102 AND %00000100 Keep only bit 2.
38104 JP Z,InputTest_ProtekJoystick If "3" was pressed then jump to InputTest_ProtekJoystick.
Handles selecting "4. INTERFACE 2".
38107 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
38109 IN A,(254)
38111 AND %00001000 Keep only bit 3.
38113 JP Z,InputTest_Interface2 If "4" was pressed then jump to InputTest_Interface2.
Handles ... cheat codes?
CHEATCODES 38116 LD A,253 Read from the keyboard;
Port Number Bit
0 1 2 3 4
253 A S D F G
38118 IN A,(254)
38120 AND %00000011 Keep only bits 0-1.
38122 JP Z,39210 If "A" and "S" was pressed then jump to 39210.
38125 LD A,253 Read from the keyboard;
Port Number Bit
0 1 2 3 4
253 A S D F G
38127 IN A,(254)
38129 AND %00000001 Keep only bit 0.
38131 JP Z,39236 If "A" was pressed then jump to 39236.
Handles selecting "5. INSTRUCTIONS".
38134 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
38136 IN A,(254)
38138 AND %00010000 Keep only bit 4.
38140 JP Z,InstructionsPrint If "5" was pressed then jump to InstructionsPrint.
Handles selecting "6. PLAY".
38143 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
38145 IN A,(254)
38147 AND %00010000 Keep only bit 4.
38149 JP Z,StartGame If "6" was pressed then jump to StartGame.
38152 LD HL,(23449) Increment the value at RandomNumberSeed by one.
38155 INC HL
38156 LD (23449),HL
38159 LD A,31 A=31.
38161 CP H
38162 CALL Z,ResetRandomSeed
38165 LD HL,(23480) Increment the value at TemporaryAddress by one.
38168 INC HL
38169 LD (23480),HL
38172 XOR A A=0.
38173 CP H
38174 JP NZ,TitleSelectInput
38177 CP L
38178 JP NZ,TitleSelectInput
38181 LD A,(23482) Increment the value at TemporaryCounter by one.
38184 DEC A
38185 LD (23482),A
38188 JP NZ,TitleSelectInput
38191 JP BestScoresPrint Jump to BestScoresPrint.
Prev: 37633 Up: Map Next: 38194