Skip to navigation


Extra tracks: HookJoystick (Part 2 of 2)

Name: HookJoystick (Part 2 of 2) [Show more] Type: Subroutine Category: Extra tracks Summary: Apply enhanced joystick steering to specific track sections Deep dive: Secrets of the extra tracks Code hooks in the extra tracks
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
.joys4 STA U \ Set U = A \ = high byte of A * x-axis JSR Multiply8x8 \ Set (A T) = A * U \ = A * A \ = (A * x-axis) ^ 2 ASL T \ Set (A T) = (A T) * 2 ROL A \ = 2 * (A * x-axis) ^ 2 \ So for A = 248 we have: \ \ (A T) = 2 * (248/256 * x-axis) ^ 2 \ = 2 * (0.969 * x-axis) ^ 2 \ = 1.88 * x-axis ^ 2 \ \ and for A = 190 we have: \ \ (A T) = 2 * (190/256 * x-axis) ^ 2 \ = 2 * (0.742 * x-axis) ^ 2 \ = 1.10 * x-axis ^ 2 \ \ and for A = 181 we have: \ \ (A T) = 2 * (181/256 * x-axis) ^ 2 \ = 2 * (0.707 * x-axis) ^ 2 \ = 1.00 * x-axis ^ 2 RTS \ Return from the subroutine