scrollingControl Driver

Last updated: · Active Development — Hardware-Tested Prototype
A scrolling engine and a home for its map
B4C4A remains the performance reference. On the physical KS3, the 100 × 100 world scrolls quickly and smoothly one pixel at a time in all eight directions at 50 Hz and 60 Hz. The camera stays inside the world at each edge and all four corners. The engine also accepts 80 × 64 and 64 × 48 maps.
Two independent R3 diagnostics passed on a physical KS3 ZX Spectrum Next. The first allocated a 16 KB RAM bank, wrote and read back a byte, then released the bank. The second loaded a full map image into a newly allocated bank, checked its contents and the 8 KB boundary, then released it.
A larger world through a rolling view
The engine uses the Spectrum Next’s Layer 3 hardware tilemap with a 40×32 hardware map and 16×16 logical world tiles. These are different levels of the representation: the hardware map is a rolling display buffer, not the complete world. Pixel-level hardware scrolling moves the view while newly exposed rows and columns are streamed into the buffer. Reusing that buffer avoids rebuilding the entire scene for every small movement, allowing worlds considerably larger than the visible screen.
Cameras that suit the game
Four camera modes have been tested: Manual, Follow, Auto-scroll and Scripted. Manual gives direct control of the view; Follow tracks a world-coordinate target; Auto-scroll moves the camera automatically; Scripted moves it between destinations. Configurable boundaries, speeds and optional diagonal normalisation make this foundation useful for platformers, RPGs, shoot-em-ups and other genres.
One engine, different worlds
The approved Platformer Cavern V2.1 has moved beyond a single fixed demonstration. Externally prepared map data supplies the world dimensions; the same scrolling engine successfully runs all three tested sizes without recompilation.
| World | Dimensions | Result |
|---|---|---|
| Full Platformer Cavern V2.1 | 100×100 tiles | Hardware-tested |
| Cavern section | 80×64 tiles | Hardware-tested |
| Central cavern section | 64×48 tiles | Hardware-tested |
Tested capabilities
- Fast, smooth, pixel-level scrolling in all eight directions using hardware Layer 3 tilemap rendering and efficient rolling-buffer tile streaming.
- A 40×32 hardware tilemap serving worlds built from 16×16 logical tiles.
- External map dimensions: 100×100, 80×64 and 64×48 worlds successfully tested with the same engine, without recompiling it for each map.
- Configurable camera boundaries and scrolling speeds, with optional diagonal speed normalisation.
- Manual, Follow, Auto-scroll and Scripted camera modes.
- 50 Hz and 60 Hz support, with raster-synchronised updates that eliminated the visible scrolling artefacts encountered in testing.
- Responsive keyboard input, including simultaneous directional movement.
- Normal shutdown returning successfully to NextBASIC.
- Compatibility testing on the latest Spectrum Next core used for these tests, with the approved Platformer Cavern V2.1 environment.
CPU speed and frame timing
Demanding scrolling workloads are tested at 28 MHz. NextBASIC controls CPU-speed selection; drivers should not silently modify global CPU settings. Frame-based and raster-synchronised updates tie scrolling to video timing, so gameplay speed does not simply depend on how quickly the CPU executes instructions. The CPU still needs enough processing headroom to complete each update. This is an architectural principle, not a claim that ecosystem-wide CPU detection and performance reporting are already implemented in every driver.
For the broader principle, see Why CPU Speed Matters: A New Standard for Dystopian Pixel Drivers ↗.
Shared information, clear responsibilities
NextBASIC continues to organise the game and select global settings. The intended integration has scrollingControl supply world, camera, terrain and environmental information while playerControl and shipControl resolve their own movement. Terrain, forces and cross-driver event integration remain planned rather than proven by the scrolling tests.
B4C4B · Memory management and driver coexistence
B4C4A keeps its map at a fixed address. Its largest world uses one byte for each of 100 × 100 logical tiles, or 10,000 bytes. That fits in a 16 KB bank allocated by the system. Asking for a free bank gives scrollingControl a defined owner and lifetime for the map when audioControl, playerControl or a future shipControl also needs memory.
Stage 4 will connect the banked map reader to the scrolling driver. For a tile lookup the machine-code reader must save the current MMU mapping, map the required part of its allocated bank, read the tile and restore the caller’s mapping. The driver must keep ownership for as long as the map is live and release it on exit or error.