From 40 Raster Lines to 1: C64 Optimisation
Performance optimization in Parallaxian successfully reduced distant mountain parallax interrupt code from roughly 40 raster lines to just 9 lines through double-buffering, a well-established C64 programming technique. This dramatic improvement freed significant CPU time for gameplay logic and additional visual effects.
Technical Approach
- Double-buffer implementation — Distributes processor-intensive software character scrolling across multiple hardware scroll cycles. Rather than updating an entire character row during a single frame, the work spreads across frames, with buffer swaps synchronized to scroll position changes
- Workload redistribution — The primary game loop assumes responsibility for demanding calculations during interrupt downtime, removing character-shifting from slower layer interrupts entirely. This leverages the fact that the main loop has more flexible timing requirements than raster-synchronized code
- Predictive scrolling — The system anticipates scroll direction based on player input, preparing character data before it becomes visible. This lookahead prevents visible pop-in at buffer boundaries
Compromises
This method suits some parallax layers better than others depending on their scroll speed and required update frequency. Slower-moving background layers benefit most, while fast-moving foreground elements may still require per-frame updates. However, adequate idle time accumulates between scroll updates to make the technique practical for the mountain layer specifically.
Memory usage increases due to maintaining two buffer copies, but the cycle savings justify this trade-off in the context of the full game’s memory budget.
Upcoming Developments
An NTSC version remains under consideration, possibly implemented as a native Commodore 128 release supporting both PAL and NTSC standards. The NTSC timing differences (fewer cycles per line, more lines per frame) require rebalancing the interrupt structure rather than simple constant adjustments.
See also: Bank-Switched Smooth Scrolling
See also: sprite timing techniques · multiplexing in Deep Winter · interrupt timing fundamentals