Prev: 25026 Up: Map Next: 25086
25056: Input: Accelerate
Used by the routine at UpdatePlayerCar.
Reads the accelerator control. From the keyboard any key in the rows Q to T, or P to Y, accelerates the car.
Output
A 247 if accelerate is pressed, else 255
Check if this should be read from the Kempston joystick instead?
ReadInputAccelerate 25056 LD A,(24126) If GameOptions indicates the control method is via the Kempston joystick then jump to ReadKempstonJoystick.
25059 BIT 1,A
25061 JR NZ,ReadKempstonJoystick
Check for "Accelerator" button input.
25063 LD B,2 Set the keyboard row counter to 2.
25065 LD A,251 A=251 (the first keyboard row).
ReadInputAccelerate_Loop 25067 OUT (253),A Read from the keyboard;
Port Number Bit
0 1 2 3 4
251 Q W E R T
223 P O I U Y
25069 IN A,(254)
25071 AND %00011111 Keep only bits 0-4.
25073 CP 31 If any buttons were pressed jump to Input_Accelerate.
25075 JR NZ,Input_Accelerate
25077 LD A,223 A=223 (the second keyboard row).
25079 DJNZ ReadInputAccelerate_Loop Decrease the keyboard row counter by one and loop back to ReadInputAccelerate_Loop until both rows have been checked.
25081 JR Input_None Jump to Input_None.
Return "Accelerator" button pressed.
Input_Accelerate 25083 LD A,247 A=11110111.
25085 RET Return.
View the equivalent code in;
Prev: 25026 Up: Map Next: 25086