The ball has four registers: X position, Y position, X velocity (1 or 255 for right/left), and Y velocity (1 or 255 for down/up). Each clock, the next position is computed by adding velocity to position.
But the ball would be impossibly fast if it moved every clock. A clock divider, a counter that counts 0, 1, 2, 3, then resets, generates an enable signal that fires once every 4 clocks. The ball’s position registers only update when this enable signal is high. The paddle runs off its own divider at twice the rate, giving the player a speed advantage.
Clock dividers are fundamental hardware. Every digital system uses them: your CPU’s peripheral bus runs slower than the core, USB runs at 12MHz from a 48MHz source, VGA timing derives from a pixel clock. Here, it’s just a counter and a comparator: when the counter equals the max value, the enable goes high and the counter resets.
Wall bouncing is handled before computing the next position. If the ball is at X=0 moving left, the velocity flips to +1 first, then the new position is computed. This prevents the ball from wrapping around to the other side of the screen.