The Cursor Moves Diagonally Down and Right DX DY
If you push the joystick diagonally down toward the right to move the cursor diagonally down toward the right of the screen, A = 5
The number 5 is present in the first statement of line 30, so DX = 1 (DX = 1 - 0). Movement occurs in the X direction (toward the right of the screen).
The number 5 is present in the first statement of line 40, so DY = 1 (DY = 1 - 0). Movement occurs in the Y direction (towards the bottom of the screen).
Use this piece of scratch paper to take care of a persistent itch, or to work through the other six joystick/cursor movement combinations.
Lines 70 and 80: These two lines are used to ensure that the cursor doesn't go past the boundaries of the screen. These expressions are set for graphics mode 3, which has a screen size of 40X24. If you use a different graphics mode, change these numbers to equal 1 less than the new screen size.
Post a comment