This algorithm and the one of Scroller_XYUnlimited2 are identical. The only difference is that the demo program was compiled with:

#define EXTRAWIDTH 64

That way the bitmap width is a multiple of 64 and becomes suitable for 4x FETCH Mode.