Level 28: Moving Dot
Task
Write a program that moves a dot on the screen using the gamepad.
For a moving dot:
Solution
1. Store X and Y coordinates in RAM (e.g. RAM[0]=X, RAM[1]=Y). 2. Each step, read gamepad: LDA 254 (port 0xFE). Buttons: bit 0=Up, 1=Down, 2=Left, 3=Right. 3. Update X/Y in RAM based on pressed buttons (compare via SUB+JN/JZ). 4. Clear old pixel: STA 255 with Acc=0. 5. Write new X/Y via ports 252/253. 6. Light pixel: STA 255 with Acc=1. 7. Loop via JMP.
Tip: start with a simple program that draws a dot at a fixed position. The checkpoint will verify writing to (3,5).