Forum
Scroll x 2 pixels, 4 pixels and 8 pixels (char level) - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Help & Support (https://www.boriel.com/forum/forumdisplay.php?fid=16)
+---- Thread: Scroll x 2 pixels, 4 pixels and 8 pixels (char level) (/showthread.php?tid=872)



Scroll x 2 pixels, 4 pixels and 8 pixels (char level) - Joflof - 03-28-2019

I am still learning and reading about most stuff, and I run across the scroll.bas library from Boriel that comes with ZXBasic. It was kinda impressive to see that kind of smooth scroll on a spectrum, and even if it is "attribute free", you can get nice results with clever programming of the colors.

As I am trying to scroll a big screen, even if the function is fast, I would like to do it by 2 pixels instead of one. Of course I can execute the function 2 times, but it shows the scroll when it moves every pixel so the result is the same. Is the code modificable in any way so the scroll is done by 2, 4 or even 8 pixels? That last option would be a great way to scroll screens, though I will have to deal with attributes of course.

If it is not possible, is there any "print" alternative fast enough to be able to simulate a scroll by char?

Thanks Smile


Re: Scroll x 2 pixels, 4 pixels and 8 pixels (char level) - britlion - 04-11-2019

It very much depends on what you want to scroll (whole screen? Part?) and in which direction. Up and down are probably faster than left and right - to move up and down you copy screen data from one row into another. Sideways, unless it's 8 pixels, you have to rotate bits around, which is a bit more fiddly.

For alogorithms and code, you might want to ask the wider audience on world of spectrum. Here we can help on getting it to work with the compiler, but fewer heads for writing snippets of code.

That said, there's a lot of good stuff in the library wiki on this site. I put a chunk in there Big Grin


Re: Scroll x 2 pixels, 4 pixels and 8 pixels (char level) - Joflof - 06-11-2019

Yes, in fact I am using the scroll function of the library. But as you suggested I will try worldofspectrum forums. Any subforum in particular recommended?

Sorry for answering so late, I just didn't had the time, but I will have more soon Smile


Re: Scroll x 2 pixels, 4 pixels and 8 pixels (char level) - boriel - 06-11-2019

A general purpose scroll routine has been planned for ages, but I also lack time Sad
In general, one like the current already provided, but allowing to specify the number of pixels to scroll in a single call.
However, this will require time to be tested, and I still need to work on other areas of the compiler (currently arrays, but later support for 128K models, etc).


Re: Scroll x 2 pixels, 4 pixels and 8 pixels (char level) - Joflof - 06-11-2019

No problem, I already built my function for 8p scroll screen (not difficult, just copying memory areas) and if I need to scroll 2 pixels instead of 1 I just apply the function 2 times and then I swap the screen (I am using virtual screen).

But yes, it would be nice!

I am also very interested in the loading stuff into different banks for 128K Smile