SP1 Scrolling: Tests 5 and 6

I have decided not to explore the mentioned Test 5 case (partial column scroll), since again we will have the degenerated case of having to scroll most of the column most of the time, and also the scrolling is not the most time-consuming operation which is being executed.

Test 6 can be found in the src/sp1-parallax directory. Based on Test 3, the assembler scrolling routine is modified to accept a parameter which is the number of pixels to scroll. Since the scroll routine is LDD based, the number of pixels scrolled does not affect the speed of the routine, it’s just a matter of adjusting the offset from the source to the destination address.

The scrolling area is now divided in 3 areas: AREA 1 is the center zone, where the action happens (columns 2 to 13); AREA 2 (columns 1 and 14) and AREA 3 (columns 0 and 15) are the parallax effect zones that scroll at different speed than the main one. AREA 1 scrolls at 1 pixel per cycle, AREA 2 at 2 pixels per cycle and AREA 3 at 4 pixels per cycle.

These new areas have to be explicitly managed when doing the whole scroll effect. This effect is achieved with 3 main functions: draw_top_row_of_tiles(), scroll_down_area(), and move_down_tile_positions(). All 3 functions have been modified so that they take into account the 3 different areas and their scrolling speeds.

Attributes have been changed on all areas for better observation of the effect, and also sprite movement has been constrained to AREA 1, so they don’t move over the parallax zones.

Admittedly I’m not a great artist and the tiles are not of great quality.

I was expecting that parallax would make the general scrolling substantially slower, but surprisingly it didn’t. I blame it to the draw_top_row_of_tiles() and scroll_down_area() functions not doing that much additional work (with respect to Test 3), because the parallax tiles are half the size of the regular ones and also they are printed ocassionally (as the others). The move_down_tile_positions() function has not changed at all, since the work to do is the same for all the columns, no matter in which parallax zone they are.

My next steps will be to optimize the code, add a trivial IM2 routine and deploy the “performance” monitor in all the previous tests, so that the perceived performance can be justified.

I’ll continue exploring other scrolling techniques with code in this repo, although it will probably not be SP1 based.

As with previous examples, you can download the TAP file, or read the code here.