# Extra tracks: HookJoystick (Part 3 of 3)

```       Name: HookJoystick (Part 3 of 3)                              [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

.joys12

\ By this point, Y contains the scale factor to apply to
\ the steering, which is one of the following values:
\
\   * 181 for a scale factor of 1.00
\
\   * 188 for a scale factor of 1.08
\
\   * 205 for a scale factor of 1.28
\
\   * 215 for a scale factor of 1.41

TYA                    \ Set A = Y
\
\ So A is 181, 188, 205 or 215

JSR Multiply8x8        \ Set (A T) = A * U
\           = A * x-axis

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 = 215 we have:
\
\   (A T) = 2 * (215/256 * x-axis) ^ 2
\         = 2 * (0.840 * x-axis) ^ 2
\         = 1.41 * x-axis ^ 2
\
\ and for A = 205 we have:
\
\   (A T) = 2 * (205/256 * x-axis) ^ 2
\         = 2 * (0.8012 * x-axis) ^ 2
\         = 1.28 * x-axis ^ 2
\
\ and for A = 188 we have:
\
\   (A T) = 2 * (188/256 * x-axis) ^ 2
\         = 2 * (0.734 * x-axis) ^ 2
\         = 1.08 * 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
```